Chip firmware management method and device, computer program product and storage medium
By setting firmware status priorities in the chip's storage device and managing it, the problem of inability to start after power outage during the chip's firmware upgrade process is solved, achieving higher chip reliability and user experience.
Patent Information
- Application Number
- CN202510221606.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-27
AI Technical Summary
There is a lack of a mature chip firmware management method in the prior art, which leads to the chip being unable to start the target system after power is cut off during the upgrade process of the target system firmware in the chip, which reduces the chip reliability and user experience.
By setting the priority of the firmware status in the first storage area and the second storage area of the storage device, the firmware with the highest priority is selected as the target firmware for startup. During firmware upgrade, the firmware in the storage area with the lowest priority is updated, and the firmware status of the updated storage area is replaced with a special firmware status, while the firmware status of the unupdated storage area is replaced with the lowest priority status.
Even if the power is cut off during the upgrade process, reliable firmware can be selected and started by comparing firmware status priorities, improving the reliability and user experience of the chip.
Smart Images

Figure CN119718472A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip management, and in particular to a chip firmware management method, device, computer program product and storage medium. Background Art
[0002] During the startup process, the chip needs to guide the target system in the chip (such as the kernel system) to start up. The firmware of the target system is usually located in a storage device, and there is a need to upgrade the firmware of the target system. However, the relevant technology lacks a mature chip firmware management method. If the power is cut off during the firmware upgrade of the target system in the chip, the chip will not be able to start the target system after it is powered on again, which reduces the chip reliability and user experience.
[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention
[0004] The purpose of the present invention is to provide a chip firmware management method, device, computer program product and storage medium. When the chip is started, the firmware with the highest priority of the firmware status in the first storage area and the second storage area of the storage device can be used as the target firmware, and the target system can be started according to the target firmware. When the firmware needs to be updated, the firmware in the storage area with the lowest priority of the firmware status can be updated, and the firmware status in the storage area where the firmware updated this time is located can be replaced with a special firmware status corresponding to the storage area where the firmware is updated, and the firmware status in the storage area where the firmware not updated this time is located can be replaced with the firmware status with the lowest priority, so that the firmware with the highest priority of the firmware status can be selected for startup next time. Even if the power is cut off during the upgrade process, the reliable firmware can be successfully selected for startup by comparing the firmware status priorities, thereby improving the chip reliability and user experience.
[0005] In order to solve the above technical problems, the present invention provides a chip firmware management method, which is applied to a chip processor, comprising:
[0006] At startup, the firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device is used as the target firmware, and the target system is started according to the target firmware, wherein the firmware state is the state of the firmware of the target system stored in the storage area, and the storage area includes the first storage area and the second storage area;
[0007] In response to the firmware modification instruction, the firmware in the storage area with the lowest priority of the firmware state is replaced with the latest firmware;
[0008] Replace the firmware state in the storage area where the firmware being updated is located with a special firmware state corresponding to the storage area where the firmware is updated, wherein the priority of the special firmware state is higher than the lowest priority;
[0009] The firmware state in the storage area where the firmware that is not updated this time is located is replaced with the firmware state with the lowest priority.
[0010] On the other hand, at startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes:
[0011] At startup, respectively obtaining firmware states in a first storage area and a second storage area of a storage device;
[0012] Determining whether the firmware states in the first storage area and the second storage area are the same;
[0013] If they are different, the firmware with the highest priority in the firmware state in the first storage area and the second storage area is used as the target firmware, and the target system is started according to the target firmware;
[0014] If they are the same, the firmware in the storage area with the highest priority among the storage areas is used as the target firmware, and the target system is started according to the target firmware.
[0015] On the other hand, the special firmware state corresponding to the first storage area is different from the special firmware state corresponding to the second storage area.
[0016] On the other hand, before determining whether the firmware states in the first storage area and the second storage area are the same, the chip firmware management method further includes:
[0017] Determining whether a current combination of firmware states in the first storage area and the second storage area belongs to a preset correct combination set;
[0018] If yes, determining whether the firmware states in the first storage area and the second storage area are the same;
[0019] If it does not belong to the above, the control prompter will prompt that the firmware status is wrong.
[0020] On the other hand, after determining whether the current combination of the firmware states in the first storage area and the second storage area belongs to a preset correct combination set, the chip firmware management method further includes:
[0021] If not, determining whether the firmware states in the two storage areas both belong to the special firmware states corresponding to the storage areas;
[0022] If they all belong to the special firmware state corresponding to the storage area, the firmware in the storage area with the highest priority of the storage area is used as the target firmware, and the target system is started according to the target firmware;
[0023] If they are not all in the special firmware state corresponding to the storage area, the firmware belonging to the special firmware state corresponding to the storage area is used as the target firmware, and the target system is started according to the target firmware.
[0024] On the other hand, booting the target system according to the target firmware includes:
[0025] Loading the boot program from a memory segment of the boot program stored in the target memory area;
[0026] Executing the boot program to load the target firmware from the target storage segment stored in the target storage area, wherein the target storage area is the storage area where the target firmware is located, and the target storage segment is the storage segment of the target firmware;
[0027] The target firmware is executed to boot the target system.
[0028] On the other hand, the target firmware includes a secondary program loader sub-firmware, a universal boot loader, and a kernel system firmware;
[0029] Executing the boot program to load the target firmware from the target storage segment stored in the target storage area includes:
[0030] Executing the boot program to load the secondary program loader sub-firmware in the target firmware from the first storage sub-segment stored in the target storage area;
[0031] Executing the target firmware includes:
[0032] executing the secondary program loader sub-firmware to load the universal boot loader in the target firmware from the second storage sub-segment stored in the target storage area;
[0033] Executing the universal boot loader to load the kernel system firmware in the target firmware from the third storage subsection stored in the target storage area;
[0034] The kernel system firmware is executed to boot the target system.
[0035] On the other hand, at startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes:
[0036] At startup, obtain the storage device combination currently connected to the chip;
[0037] According to a preset storage area selection rule, a first storage area and a second storage area are selected from each storage device in the storage device combination currently connected to the chip;
[0038] The firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device is used as the target firmware, and the target system is started according to the target firmware.
[0039] On the other hand, at startup, obtaining the combination of storage devices currently connected to the chip includes:
[0040] At startup, the combination of storage devices currently connected to the chip is determined according to the switch value of the multi-bit DIP switch;
[0041] The switch value of any bit of the DIP switch indicates the in-place status of a corresponding storage device.
[0042] On the other hand, the storage area selection rules include:
[0043] The priority of the dual storage device single image selection method is higher than the single storage device dual image selection method;
[0044] Among them, dual storage device single mirroring refers to selecting one storage area from each of the two storage devices, and single storage device dual mirroring refers to selecting two storage areas from a single storage device.
[0045] On the other hand, at startup, after respectively acquiring the firmware states in the first storage area and the second storage area of the storage device, the chip firmware management method further includes:
[0046] The control prompter prompts the firmware status in the first storage area and the second storage area.
[0047] On the other hand, the firmware state of any storage area includes a two-bit array;
[0048] The first numerical combination of the two-bit array represents a special firmware state of the firmware in the first storage area, the second numerical combination of the two-bit array represents a special firmware state of the firmware in the second storage area, and the third numerical combination of the two-bit array represents the lowest priority firmware state.
[0049] In order to solve the above technical problems, the present invention further provides a chip firmware management device, comprising:
[0050] Memory for storing computer programs;
[0051] The processor is used to implement the steps of the chip firmware management method as described above when executing the computer program.
[0052] In order to solve the above technical problem, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the chip firmware management method as described above when executed by a processor.
[0053] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the chip firmware management method as described above are implemented.
[0054] Beneficial effect: The present invention provides a chip firmware management method. Considering that in the case of having two storage areas for storing firmware, reliable firmware can be efficiently and clearly selected for use by setting the firmware status and dividing the firmware status priority. Therefore, in the present invention, when the chip is started, the firmware with the highest priority of the firmware status in the first storage area and the second storage area of the storage device can be used as the target firmware, and the target system can be started according to the target firmware. When the firmware needs to be updated, the firmware in the storage area with the lowest priority of the firmware status can be updated, and the firmware status in the storage area where the firmware updated this time is located can be replaced with the special firmware status corresponding to the storage area where the firmware is updated, and the firmware status in the storage area where the firmware not updated this time is located can be replaced with the firmware status with the lowest priority, so that the firmware with the highest priority of the firmware status can be selected for startup next time. Even if the power is cut off during the upgrade process, the reliable firmware can be successfully selected for startup by comparing the firmware status priorities, thereby improving the chip reliability and user experience.
[0055] The present invention also provides a chip firmware management device, a computer program product and a computer-readable storage medium, which have the same beneficial effects as the above chip firmware management method. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the relevant technologies and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 A schematic diagram of a chip firmware management method provided by the present invention;
[0058] Figure 2 A schematic flow chart of another chip firmware management method provided by the present invention;
[0059] Figure 3 A schematic diagram of the structure of a storage device provided by the present invention;
[0060] Figure 4 A schematic diagram of a flow chart of another chip firmware management method provided by the present invention;
[0061] Figure 5 A schematic diagram of the structure of a chip firmware management device provided by the present invention;
[0062] Figure 6 A schematic diagram of the structure of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0063] The core of the present invention is to provide a chip firmware management method, device, computer program product and storage medium. When the chip is started, the firmware with the highest priority of the firmware status in the first storage area and the second storage area of the storage device can be used as the target firmware, and the target system can be started according to the target firmware. When the firmware needs to be updated, the firmware in the storage area with the lowest priority of the firmware status can be updated, and the firmware status in the storage area where the firmware updated this time is located can be replaced with a special firmware status corresponding to the storage area where the firmware is updated, and the firmware status in the storage area where the firmware not updated this time is located can be replaced with the firmware status with the lowest priority, so that the firmware with the highest priority of the firmware status can be selected for startup next time. Even if the power is cut off during the upgrade process, the reliable firmware can be successfully selected for startup by comparing the firmware status priorities, thereby improving the chip reliability and user experience.
[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] Please refer to Figure 1 , Figure 1 A schematic flow chart of a chip firmware management method provided by the present invention, wherein the chip firmware management method is applied to a processor of a chip, and comprises:
[0066] S101: At startup, taking the firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware, wherein the firmware state is the state of the firmware of the target system stored in the storage area, and the storage area includes the first storage area and the second storage area;
[0067] Specifically, taking into account the technical problems in the above background technology, and considering that in the case of having two storage areas for storing firmware, by setting the firmware status and dividing the firmware status priority, a reliable firmware can be efficiently and clearly selected for use. Therefore, in the embodiment of the present invention, the firmware status (the firmware status has a priority) is set for the "two storage areas for storing the target system firmware", and the firmware status of the two storage areas is adjusted during the firmware upgrade process, so that even if the power is cut off during the firmware upgrade process, the firmware can still be correctly loaded to start the target system after powering on again. Therefore, in this step, at startup, the firmware with the highest priority of the firmware status in the first storage area and the second storage area of the storage device can be used as the target firmware, and the target system can be started according to the target firmware.
[0068] Among them, in the initial case, the target system firmware can be placed in the first storage area, and the priority of the initial firmware state of the first storage area can be higher than the priority of the initial firmware state of the second storage area, so that in the initial case, the processor starts the target system according to the target firmware in the first storage area.
[0069] Specifically, the first storage area and the second storage area store a firmware of the target system respectively, so the firmware with the highest firmware status priority in the first storage area and the second storage area refers to the one with a higher firmware status priority in the two firmwares.
[0070] S102: In response to the firmware modification instruction, the firmware in the storage area with the lowest priority of the firmware state is replaced with the latest firmware;
[0071] Specifically, since the firmware with the highest priority in the firmware state is started as the target firmware during startup, in order not to affect the target firmware during update, the firmware in the storage area with the lowest priority in the firmware state can be replaced with the latest firmware in response to the firmware modification instruction.
[0072] S103: replacing the firmware state in the storage area where the firmware being updated is located with a special firmware state corresponding to the storage area where the firmware is updated, wherein the priority of the special firmware state is higher than the lowest priority;
[0073] Specifically, after the firmware is updated, the firmware status of the storage area where the firmware is updated needs to be set to one with a higher "firmware status priority", so in order to more conveniently identify the firmware status of the upgraded firmware, in this step, the firmware status in the storage area where the firmware being updated is located can be replaced with a special firmware status corresponding to the storage area where the firmware is updated, that is, through the special firmware status, it can be identified that the firmware corresponding to the firmware status belongs to the updated firmware.
[0074] S104: Replace the firmware state in the storage area where the firmware that has not been updated this time is located with the firmware state with the lowest priority.
[0075] Specifically, in order to set the firmware state of the storage area where the firmware is updated to one with a higher "firmware state priority" after the firmware is updated, the firmware state in the storage area where the firmware that has not been updated this time is located can also be replaced with the firmware state with the lowest priority in the embodiment of the present invention, thereby achieving the effect of "the firmware state of one storage area is a special firmware state, and the firmware state of the other storage area is a firmware state with the lowest priority". Then, when the chip is started, the firmware in the special firmware state will be used as the target firmware to start the target system.
[0076] In addition, assuming that the power is cut off between S103 and S104, the firmware states of the two storage areas are both special firmware states corresponding to the storage areas where they are located. Since the firmware that has not been updated this time can still support the startup of the target system, in this case, when the chip is powered on again, no matter which storage area's firmware is used as the target firmware, it can support the startup of the target system. In this case, the target firmware can be selected from the firmware in the two special firmware states.
[0077] The present invention provides a chip firmware management method. Considering that in the case of having two storage areas for storing firmware, reliable firmware can be efficiently and clearly selected for use by setting firmware status and dividing firmware status priorities. Therefore, in the present invention, when the chip is started, the firmware with the highest priority of firmware status in the first storage area and the second storage area of the storage device can be used as the target firmware, and the target system can be started according to the target firmware. When the firmware needs to be updated, the firmware in the storage area with the lowest priority of firmware status can be updated, and the firmware status in the storage area where the firmware updated this time is located can be replaced with a special firmware status corresponding to the storage area where the firmware is updated, and the firmware status in the storage area where the firmware not updated this time is located can be replaced with the firmware status with the lowest priority, so that the firmware with the highest priority of firmware status can be selected for startup next time. Even if the power is cut off during the upgrade process, the reliable firmware can be successfully selected for startup by comparing the firmware status priorities, thereby improving the chip reliability and user experience.
[0078] Based on the above embodiments:
[0079] As an optional embodiment, at startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes:
[0080] At startup, respectively obtaining firmware states in a first storage area and a second storage area of a storage device;
[0081] Determining whether the firmware states in the first storage area and the second storage area are the same;
[0082] If they are different, the firmware with the highest priority in the firmware state in the first storage area and the second storage area is used as the target firmware, and the target system is started according to the target firmware;
[0083] If they are the same, the firmware in the storage area with the highest priority among the storage areas is used as the target firmware, and the target system is started according to the target firmware.
[0084] Specifically, considering that in some cases (for example, the special firmware states corresponding to the first and second storage areas are the same, or an error occurs in the firmware state of a storage area), the firmware states in the two storage areas may be the same. In this case, in order to successfully select the target firmware, the priority of the storage area is set in the embodiment of the present invention, that is, the first storage area and the second storage area have different priorities. In this case, at startup, the firmware states in the first storage area and the second storage area of the storage device can be obtained respectively, and it can be determined whether the firmware states in the first storage area and the second storage area are the same. If they are the same, the firmware in the storage area with the highest priority of the storage area can be used as the target firmware, and the target system can be started according to the target firmware.
[0085] The priorities of the first storage area and the second storage area may be set independently, for example, the priority of the first storage area is set to be higher than that of the second storage area by default, and the embodiment of the present invention does not limit this.
[0086] As an optional embodiment, the special firmware state corresponding to the first storage area is different from the special firmware state corresponding to the second storage area.
[0087] Specifically, in order to clearly distinguish the two storage areas through their firmware states, the special firmware state corresponding to the first storage area in the embodiment of the present invention is different from the special firmware state corresponding to the second storage area.
[0088] Of course, the special firmware state corresponding to the first storage area and the special firmware state corresponding to the second storage area may also be set to the same firmware state, which is not limited in the embodiment of the present invention.
[0089] As an optional embodiment, before determining whether the firmware states in the first storage area and the second storage area are the same, the chip firmware management method further includes:
[0090] Determine whether a current combination of firmware states in the first storage area and the second storage area belongs to a preset correct combination set;
[0091] If yes, determining whether the firmware states in the first storage area and the second storage area are the same;
[0092] If it does not belong to the above, the control prompter will prompt that the firmware status is wrong.
[0093] Specifically, considering that under normal circumstances, the combination of firmware states in the first storage area and the second storage area has a limited number of combinations, in order to quickly verify whether the firmware states in the first storage area and the second storage area are incorrect, a preset correct combination set is set in an embodiment of the present invention, and the preset correct combination set includes various theoretically possible correct combinations of "the combination of firmware states in the first storage area and the second storage area", and determines whether the current combination of the firmware states in the first storage area and the second storage area belongs to the preset correct combination set. If it does, it means that there are most likely no errors in the firmware states in the first storage area and the second storage area. If it does not, it means that there is most likely a problem with the firmware state of at least one of the storage areas. In this case, the prompter can be controlled to prompt that the firmware state is wrong.
[0094] The prompter may be of various types, such as a display or a voice announcer, etc., which is not limited in the embodiment of the present invention.
[0095] As an optional embodiment, after determining whether the current combination of the firmware states in the first storage area and the second storage area belongs to a preset correct combination set, the chip firmware management method further includes:
[0096] If not, determining whether the firmware states in the two storage areas both belong to the special firmware states corresponding to the storage areas;
[0097] If they all belong to the special firmware state corresponding to the storage area, the firmware in the storage area with the highest priority of the storage area is used as the target firmware, and the target system is started according to the target firmware;
[0098] If they are not all in the special firmware state corresponding to the storage area, the firmware belonging to the special firmware state corresponding to the storage area is used as the target firmware, and the target system is started according to the target firmware.
[0099] Specifically, in order to be able to smoothly select the target firmware and start the target system when there is an error in the firmware state, first of all, it is considered that there may be an abnormal situation that "the firmware states in the two storage areas both belong to the special firmware state corresponding to the storage area". Therefore, in the embodiment of the present invention, it can be determined whether the firmware states in the two storage areas both belong to the special firmware state corresponding to the storage area. If both belong to the special firmware state corresponding to the storage area, the firmware in the storage area with the highest priority of the storage area can be used as the target firmware, and the target system can be started according to the target firmware; considering that the firmware in the special firmware state has higher reliability than the firmware states in other position forms, therefore, when not all are the special firmware states corresponding to the storage area, the firmware belonging to the special firmware state corresponding to the storage area can be used as the target firmware, and the target system can be started according to the target firmware.
[0100] As an optional embodiment, starting the target system according to the target firmware includes:
[0101] Loading the boot program from the memory segment of the boot program stored in the target memory area;
[0102] Executing a boot program to load a target firmware from a target storage segment stored in a target storage area, wherein the target storage area is a storage area where the target firmware is located, and the target storage segment is a storage segment of the target firmware;
[0103] Execute the target firmware to boot the target system.
[0104] Specifically, in order to smoothly load and execute the target firmware, a boot program is set in any storage area in the embodiment of the present invention. When the boot program is executed, the target firmware can be loaded from the target storage segment stored in the target storage area and then executed.
[0105] The target firmware may be loaded into the chip for execution, and may be loaded into various locations inside the chip, such as SRAM (Static Random Access Memory), etc., which is not limited in the embodiment of the present invention.
[0106] As an optional embodiment, the target firmware includes a secondary program loader sub-firmware, a universal boot loader, and a kernel system firmware;
[0107] Executing a boot program to load a target firmware from a target memory segment stored in a target memory area includes:
[0108] executing the boot program so as to load the secondary program loader sub-firmware in the target firmware from the first storage sub-segment stored in the target storage area;
[0109] The target firmware includes:
[0110] executing the secondary program loader sub-firmware to load the universal boot loader in the target firmware from the second storage sub-segment stored in the target storage area;
[0111] Executing a universal boot loader to load the kernel system firmware in the target firmware from the third storage subsegment stored in the target storage area;
[0112] Execute the kernel system firmware to boot the target system.
[0113] Specifically, considering that the startup of the kernel system firmware requires multi-level booting, when the target system is a kernel system, the target firmware may include a secondary program loader sub-firmware (SPL, Secondary ProgramLoader), a universal boot loader (U-Boot, Universal Boot Loader) and the kernel system firmware. In this way, the boot program may first load the secondary program loader sub-firmware in the target firmware, and when executing the secondary program loader sub-firmware, it may load the universal boot loader, and when executing the universal boot loader, it may load the kernel system program and execute the kernel system program, thereby completing the startup of the kernel system.
[0114] The process of booting the target system may also include a BootRom (Boot Read-Only Memory, a first-level boot program) stage that is first executed inside the chip.
[0115] To better illustrate the embodiments of the present invention, please refer to Figure 2 , Figure 2 A flow chart of another chip firmware management method provided by the present invention. After the chip is powered on, it can first read and execute the first-level startup program from the ROM, then determine the first and second storage areas, and then read the firmware status of the two storage areas. Finally, the target firmware can be selected according to the firmware status to boot the target system.
[0116] To better illustrate the embodiments of the present invention, please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a storage device provided by the present invention. Each storage device connected to the chip can have the following Figure 3 The two storage areas shown, Figure 3The upper and lower areas in the data storage device represent a storage area respectively. In the same storage device, the first information group in the upper area can be represented by Paramter_ROM_P0, the first information group in the lower area can be represented by Paramter_ROM_P1, the second information group in the upper area can be represented by Parameter_P0, the second information group in the lower area can be represented by Parameter_P1, the boot program in the upper area can be represented by PRE_P0, and the boot program in the lower area can be represented by PRE_P1.
[0117] The first information group may include the firmware status of the storage area and the storage segment of the boot program, and the second information group may include the storage segment of the firmware of the target system. This structure can support the booting of the target system concisely and accurately.
[0118] Of course, in addition to this specific storage structure, the storage structure of the storage area in the storage device may also be in other forms, which is not limited in the embodiment of the present invention.
[0119] As an optional embodiment, at startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes:
[0120] At startup, obtain the storage device combination currently connected to the chip;
[0121] According to a preset storage area selection rule, a first storage area and a second storage area are selected from each storage device in the storage device combination currently connected to the chip;
[0122] The firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device is used as the target firmware, and the target system is started according to the target firmware.
[0123] Specifically, considering that there may be multiple situations of storage devices connected to the chip, and there may also be multiple situations for the layout of the first and second storage areas, in order to support higher flexibility in storage device connection and storage area layout, the processor in the embodiment of the present invention can select the first storage area and the second storage area from each storage device in the storage device combination currently connected to the chip according to a preset storage area selection rule at startup. In this way, no matter what the storage device combination currently connected to the chip is, two storage areas can be selected, and the storage area selection rules can be flexibly configured.
[0124] As an optional embodiment, at startup, obtaining the storage device combination currently connected to the chip includes:
[0125] At startup, the combination of storage devices currently connected to the chip is determined according to the switch value of the multi-bit DIP switch;
[0126] The switch value of any bit of the DIP switch indicates the in-place status of a corresponding storage device.
[0127] Specifically, considering that a multi-bit dip switch can be used to accurately and at low cost represent the combination of storage devices currently connected to the chip, in an embodiment of the present invention, at startup, the combination of storage devices currently connected to the chip can be determined based on the switch value of the multi-bit dip switch, and the switch value of any bit of the dip switch can be used to represent the in-place status of a corresponding storage device, which can further reduce the cost of the dip switch.
[0128] In order to better illustrate the embodiment of the present invention, please refer to the following Table 1, which is a comparison table of DIP switch values provided by the present invention.
[0129] Table 1
[0130]
[0131] In Table 1, it is assumed that there are four storage devices connected to the chip, which are numbered 0-3. According to the different numbers, they are referred to as medium 0, medium 1, medium 2 and medium 3. Bit0 corresponds to medium 0, Bit1 corresponds to medium 1, Bit2 corresponds to medium 2, and Bit3 corresponds to medium 3. For any bit, a value of 1 indicates that the corresponding storage device is in place, and a value of 0 indicates that the corresponding storage device is not in place.
[0132] As an optional embodiment, the storage area selection rule includes:
[0133] The priority of the dual storage device single image selection method is higher than the single storage device dual image selection method;
[0134] Among them, dual storage device single mirroring refers to selecting one storage area from each of the two storage devices, and single storage device dual mirroring refers to selecting two storage areas from a single storage device.
[0135] Specifically, considering that the two storage areas are located in different storage devices, the disaster recovery capability of the firmware can be improved. Therefore, in an embodiment of the present invention, the storage area selection rule can be set to: the priority of the selection method of dual storage devices with a single mirror is higher than the selection method of a single storage device with dual mirrors.
[0136] Of course, in addition to this specific form, the storage area selection rule can also be set to other forms, which are not limited in the embodiment of the present invention.
[0137] Specifically, based on the situation in Table 1 above, since the priority of the dual storage device single mirror selection method is higher than the single storage device dual mirror selection method, when there are more than one storage devices in place, the storage areas in two of the storage devices can be selected as the first storage area and the second storage area; when there is one storage device in place, the first storage area and the second storage area can be selected from the only storage device in place; when the number of storage devices in place is greater than 2, any two of the storage devices in place can be selected and the storage area can be selected.
[0138] The storage device may be of various types, such as a flash memory or an eMMC (Embedded MultiMedia Card), etc., which is not limited in the embodiment of the present invention.
[0139] As an optional embodiment, at startup, after respectively acquiring the firmware states in the first storage area and the second storage area of the storage device, the chip firmware management method further includes:
[0140] The control prompter prompts the firmware status in the first storage area and the second storage area.
[0141] Specifically, considering that the staff can obtain a lot of information through the firmware status in the first storage area and the second storage area, such as whether the firmware status is wrong, which storage area is the most recently updated storage area, and whether the firmware needs to be updated again, the embodiment of the present invention can control the prompter to prompt the firmware status in the first storage area and the second storage area so that the staff can perform corresponding processing.
[0142] As an optional embodiment, the chip is a baseboard management controller.
[0143] Specifically, considering that there is a booting requirement of the target system in a BMC (Baseboard management controller), the chip in the embodiment of the present invention may be a baseboard management controller.
[0144] Of course, in addition to the BMC, the chip may also be of other types, which is not limited in the embodiment of the present invention.
[0145] As an optional embodiment, the firmware state of any storage area includes a two-bit array;
[0146] The first numerical combination of the two-bit array represents a special firmware state of the firmware in the first storage area, the second numerical combination of the two-bit array represents a special firmware state of the firmware in the second storage area, and the third numerical combination of the two-bit array represents the lowest priority firmware state.
[0147] Specifically, considering that a two-bit array can support the setting of a special firmware state for a storage area and a firmware state with the lowest priority, the chip in the embodiment of the present invention is a baseboard management controller, thereby reducing costs.
[0148] Of course, in addition to this specific form, the firmware state of the storage area may also be represented in other forms, which are not limited in the embodiment of the present invention.
[0149] Specifically, in order to better illustrate the embodiments of the present invention, please refer to the following Table 2 and Figure 4 , Table 2 is a firmware status comparison table provided by the present invention, Figure 4 A schematic flow chart of another chip firmware management method provided by the present invention.
[0150] Table 2
[0151]
[0152] Specifically, in Table 2 above, the special firmware state of the first storage area is 00, and the initial firmware state is 00; the special firmware state of the second storage area is 01, and the initial firmware state is 11, and the firmware state with the lowest priority is 11. The priority order of the firmware states is: 00>01>11, and the firmware state 10 belongs to an error state, and the priority of the first storage area is greater than the priority of the second storage area. When an error state occurs, it can be specified not to start, or the target firmware can be selected for startup according to the firmware state priority and the storage area priority. When both firmware states are 11, startup is prohibited, and the firmware with the lowest priority state is prohibited from being used as the target firmware at any time. Among them, the first bit of the two-bit array can also represent the firmware update state of the corresponding storage area. When the first bit is 1, it indicates that the firmware of the corresponding storage area has not been updated, and when it is 0, it indicates that the firmware of the corresponding storage area has been updated. The second bit of the two-bit array can also represent the firmware validity state of the corresponding storage area. When the second bit is 1, it indicates that the firmware of the corresponding storage area is invalid, and when the second bit is 0, it indicates that the firmware of the corresponding storage area is valid.
[0153] For details, see Figure 4 , Image 0 represents the firmware of the target system in the first storage area, and Image 1 represents the firmware of the target system in the second storage area. In the initial state, the firmware status of Image 0 is 00, and the firmware status of Image 1 is 11. At this time, Image 0 is used as the target firmware. Figure 4The second line represents the "update process of image 1". First, since the priority of 01 is lower than 00, image 1 can be updated. After the update, the firmware state of image 1 can be set to the special firmware state 01 of the second storage area. Then, in the third line, the firmware state of the first storage area can be set to the lowest priority firmware state 11. Suppose that the power is cut off in the firmware state of the second line. When it is restarted, since the priority of firmware state 00 is higher than the priority of firmware state 01, image 0 can be used as the target firmware. The fourth line represents the "update process of image 0". First, since the priority of 01 is higher than 11, image 0 can be updated. After the update, the firmware state of image 0 can be set to the special firmware state 00 of the first storage area. Then, in the sixth line, the firmware state of the second storage area can be set to the lowest priority firmware state 11. Suppose that the power is cut off in the firmware state of the fifth line. When it is restarted, since the priority of firmware state 00 is higher than the priority of firmware state 01, image 0 can be used as the target firmware.
[0154] Please refer to Figure 5 , Figure 5 A schematic diagram of the structure of a chip firmware management device provided by the present invention, the chip firmware management device comprises:
[0155] A memory 51, used for storing computer programs;
[0156] The processor 52 is used to implement the steps of the chip firmware management method in the above-mentioned embodiment when executing the computer program.
[0157] For an introduction to the chip firmware management device provided in the embodiment of the present invention, please refer to the aforementioned embodiment of the chip firmware management method, and the embodiment of the present invention will not be described in detail here.
[0158] The present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the chip firmware management method in the above-mentioned embodiment when executed by a processor.
[0159] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the aforementioned embodiment of the chip firmware management method, and the embodiment of the present invention will not be described in detail here.
[0160] Please refer to Figure 6 , Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium provided by the present invention. A computer program 62 is stored on the computer-readable storage medium 61. When the computer program 62 is executed by the processor, the steps of the chip firmware management method in the aforementioned embodiment are implemented.
[0161] For an introduction to the computer-readable storage medium provided in the embodiment of the present invention, please refer to the aforementioned embodiment of the chip firmware management method, and the embodiment of the present invention will not be described in detail here.
[0162] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other. It should also be noted that in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the element.
[0163] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A chip firmware management method, characterized in that: Processors used in chips include: At startup, the firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device is used as the target firmware, and the target system is started according to the target firmware, wherein the firmware state is the state of the firmware of the target system stored in the storage area, and the storage area includes the first storage area and the second storage area; In response to the firmware modification instruction, the firmware in the storage area with the lowest priority of the firmware state is replaced with the latest firmware; Replace the firmware state in the storage area where the firmware being updated is located with a special firmware state corresponding to the storage area where the firmware is updated, wherein the priority of the special firmware state is higher than the lowest priority; The firmware state in the storage area where the firmware that is not updated this time is located is replaced with the firmware state with the lowest priority.
2. The chip firmware management method according to claim 1, characterized in that: At startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes: At startup, respectively obtaining firmware states in a first storage area and a second storage area of a storage device; Determining whether the firmware states in the first storage area and the second storage area are the same; If they are different, the firmware with the highest priority in the firmware state in the first storage area and the second storage area is used as the target firmware, and the target system is started according to the target firmware; If they are the same, the firmware in the storage area with the highest priority among the storage areas is used as the target firmware, and the target system is started according to the target firmware.
3. The chip firmware management method according to claim 2, characterized in that: The special firmware state corresponding to the first storage area is different from the special firmware state corresponding to the second storage area.
4. The chip firmware management method according to claim 3, characterized in that: Before determining whether the firmware states in the first storage area and the second storage area are the same, the chip firmware management method further includes: Determining whether a current combination of firmware states in the first storage area and the second storage area belongs to a preset correct combination set; If yes, determining whether the firmware states in the first storage area and the second storage area are the same; If it does not belong to the above, the control prompter will prompt that the firmware status is wrong.
5. The chip firmware management method according to claim 4, characterized in that: After determining whether the current combination of the firmware states in the first storage area and the second storage area belongs to a preset correct combination set, the chip firmware management method further includes: If not, determining whether the firmware states in the two storage areas both belong to the special firmware states corresponding to the storage areas; If they all belong to the special firmware state corresponding to the storage area, the firmware in the storage area with the highest priority of the storage area is used as the target firmware, and the target system is started according to the target firmware; If they are not all in the special firmware state corresponding to the storage area, the firmware belonging to the special firmware state corresponding to the storage area is used as the target firmware, and the target system is started according to the target firmware.
6. The chip firmware management method according to claim 1, characterized in that: Booting the target system according to the target firmware includes: Loading the boot program from the memory segment of the boot program stored in the target memory area; Executing the boot program to load the target firmware from the target storage segment stored in the target storage area, wherein the target storage area is the storage area where the target firmware is located, and the target storage segment is the storage segment of the target firmware; The target firmware is executed to boot the target system.
7. The chip firmware management method according to claim 6, characterized in that: The target firmware includes a secondary program loader sub-firmware, a universal boot loader and a kernel system firmware; Executing the boot program to load the target firmware from the target storage segment stored in the target storage area includes: Executing the boot program to load the secondary program loader sub-firmware in the target firmware from the first storage sub-segment stored in the target storage area; Executing the target firmware includes: executing the secondary program loader sub-firmware to load the universal boot loader in the target firmware from the second storage sub-segment stored in the target storage area; Executing the universal boot loader to load the kernel system firmware in the target firmware from the third storage subsection stored in the target storage area; The kernel system firmware is executed to boot the target system.
8. The chip firmware management method according to claim 1, characterized in that: At startup, taking the firmware with the highest priority of the firmware state in the first storage area and the second storage area of the storage device as the target firmware, and starting the target system according to the target firmware includes: At startup, obtain the storage device combination currently connected to the chip; According to a preset storage area selection rule, a first storage area and a second storage area are selected from each storage device in the storage device combination currently connected to the chip; The firmware with the highest priority in the firmware state in the first storage area and the second storage area of the storage device is used as the target firmware, and the target system is started according to the target firmware.
9. The chip firmware management method according to claim 8, characterized in that: At startup, the combination of storage devices currently connected to the chip is obtained, including: At startup, the combination of storage devices currently connected to the chip is determined according to the switch value of the multi-bit DIP switch; The switch value of any bit of the DIP switch indicates the in-place status of a corresponding storage device.
10. The chip firmware management method according to claim 9, characterized in that: The storage area selection rules include: The priority of the selection method of dual storage devices and single mirror is higher than the selection method of single storage device and dual mirror; Among them, dual storage device single mirroring refers to selecting one storage area from each of the two storage devices, and single storage device dual mirroring refers to selecting two storage areas from a single storage device.
11. The chip firmware management method according to claim 2, characterized in that: At startup, after respectively acquiring the firmware states in the first storage area and the second storage area of the storage device, the chip firmware management method further includes: The control prompter prompts the firmware status in the first storage area and the second storage area.
12. The chip firmware management method according to any one of claims 1 to 11, characterized in that: The firmware state of any storage area includes a two-bit array; The first numerical combination of the two-bit array represents a special firmware state of the firmware in the first storage area, the second numerical combination of the two-bit array represents a special firmware state of the firmware in the second storage area, and the third numerical combination of the two-bit array represents the lowest priority firmware state.
13. A chip firmware management device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the chip firmware management method according to any one of claims 1 to 12 when executing the computer program.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the chip firmware management method as claimed in any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the chip firmware management method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Starting method of embedded LINUX operating system based on multiple backup bootstrap programs
CN110737481A
System starting method, electronic equipment, and machine readable storage medium
CN111316235A
Program upgrading method and device, computer equipment and storage medium
CN112650513A
PCIE (Peripheral Component Interface Express) link signal test method and system, computer equipment and medium
CN115904849A
Start loading management method, device and equipment of embedded system and storage medium
CN116541081A