Baseboard management controller firmware upgrading method and device, equipment and medium

By using three flash memory roles and preset tag bits in the baseboard management controller, directly writing the upgrade image and recycling the flash memory roles, the problem of slow upgrade speed in the existing technology is solved, and faster firmware upgrades are achieved. and higher stability.

CN118656101APending Publication Date: 2024-09-17SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410683901.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

During the existing baseboard management controller firmware upgrade process, the Flash image needs to be erased and rewritten, which results in a slow upgrade speed and increases the overall time.

Method used

Three flash memory roles are adopted: running flash memory, backup flash memory and upgrade flash memory. After receiving and confirming the legality of the new upgrade image through the preset flash memory mark bits, the upgrade image data fragments are directly written into the original upgrade flash memory to avoid multiple Search and erase processes between storage blocks, speed up image storage, and cycle flash roles after upgrades so that new upgrade flash is immediately available for the next upgrade.

Benefits of technology

It significantly speeds up the baseboard management controller firmware upgrade, reduces unnecessary erasing processes, simplifies the upgrade steps, and improves the overall upgrade efficiency and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656101A
    Figure CN118656101A
Patent Text Reader

Abstract

The invention relates to the technical field of substrate management control, and discloses a substrate management controller firmware upgrading method, device and equipment and a medium. After a server is started, an upgrading mirror image is received, and the legality of the upgrading mirror image is verified; when the verification is successful, reading a first flag value corresponding to the original upgrading flash memory flag bit, a second flag value corresponding to the original running flash memory flag bit and a third flag value corresponding to the original backup flash memory flag bit from the electrified erasable programmable read-only memory; when the original upgrading flash memory is determined according to the first mark value, writing the upgrading mirror into the original upgrading flash memory; and taking the original upgrading flash memory after mirror image upgrading as a new running flash memory, taking the original backup flash memory as a new upgrading flash memory, and taking the original running flash memory as a new backup flash memory. And the flash memory role is recycled, so that a new upgrading flash memory can be used immediately during next upgrading, and the firmware upgrading speed of the substrate management controller is increased without waiting for an erasing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of baseboard management control, and in particular to a baseboard management controller firmware upgrade method, device, equipment and medium. Background Art

[0002] Related technology In the process of upgrading the firmware of BMC (baseboard management controller), a dual-image redundancy scheme is basically adopted, namely, the main Flash image and the backup Flash image. Under normal circumstances, when the BMC system is started, it is first started from the main Flash image. If the main Flash image fails to start, it will automatically switch to the backup Flash image to start. The upgrade process is that if the main Flash image is currently running, the backup Flash image will be selected for upgrading. First, the upgrade image is loaded, and then the legitimacy of the upgrade image is verified. After the upgrade image is verified, the image in the Flash to be upgraded is read according to the Block of Flash and compared with the loaded upgrade image. If the compared contents are not the same, first erase the corresponding Block of the Flash to be upgraded (i.e., the main Flash image), and then write the corresponding upgraded image content to the corresponding Block of the upgrade Flash. If the compared contents are the same, there is no need to upgrade the Block of the Flash until all the Blocks in the upgrade Flash are traversed. That is to say, any data block that needs to be updated must be erased and rewritten first, which increases the overall upgrade time, which also leads to a slower upgrade speed of the baseboard management controller firmware. Summary of the invention

[0003] In view of this, the present invention provides a baseboard management controller firmware upgrade method, device, equipment and medium to solve the problem of how to improve the firmware upgrade speed of the baseboard management controller.

[0004] In a first aspect, the present invention provides a method for upgrading firmware of a baseboard management controller, the method being applied to a baseboard management controller, the baseboard management controller reading a value mapped by a flash memory flag bit from a powered erasable programmable read-only memory, wherein the powered erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types, and stores values ​​mapped by flash memory flag bits of different types, the flash memory flag bits including a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit; the method comprising:

[0005] After the server is started, the upgrade image and the data address of each data fragment of the upgrade image are received, and the legitimacy of the upgrade image is verified;

[0006] When the upgrade image verification succeeds, a first mark value corresponding to the original upgrade flash memory mark bit, a second mark value corresponding to the original running flash memory mark bit, and a third mark value corresponding to the original backup flash memory mark bit are read from the electrically erasable programmable read-only memory;

[0007] Determine the original upgrade flash memory according to the first tag value, determine the original running flash memory according to the second tag value, and determine the original backup flash memory according to the third tag value;

[0008] When the original upgrade flash memory is determined according to the first tag value, each data fragment of the upgrade image is written into the original upgrade flash memory based on the data address of each data fragment, so as to complete the image upgrade;

[0009] The original upgrade flash memory after the mirror upgrade is used as a new running flash memory, the original backup flash memory is used as a new upgrade flash memory, and the original running flash memory is used as a new backup flash memory.

[0010] This embodiment sets three flash memory roles, namely, running flash memory, backup flash memory, and upgrade flash memory, and uses a preset flash memory mark bit. After receiving and confirming the legitimacy of the new upgrade image, each data fragment of the upgrade image is immediately written into the original upgrade flash memory and written into the designated upgrade flash memory, avoiding searching space between multiple storage blocks and speeding up the image storage speed. After the upgrade is completed, the flash memory used for the upgrade becomes the new running flash memory, the original running flash memory is converted into the backup flash memory, and the original backup flash memory is converted into the new upgrade flash memory. The circular use of the flash memory roles ensures that the new upgrade flash memory is used immediately at the next upgrade without waiting for erasure. Since there is no need to wait for the erasure process, the overall baseboard management controller firmware upgrade speed is accelerated.

[0011] In an optional embodiment, the method further includes:

[0012] When the server is restarted, the new upgrade flash memory is erased so that a new upgrade image is stored in the new upgrade flash memory when the image is upgraded next time.

[0013] After erasing the flash memory in the embodiment of the present invention, there will be no useless old data in the flash memory. When the next firmware upgrade needs to store a new image, it can be written to a clean storage medium more quickly. By cleaning the flash memory when the server starts, the steps in the actual upgrade process are simplified, and there is no need to perform an additional data erasing step in the next upgrade process, thereby improving the firmware upgrade speed.

[0014] In an optional implementation, writing each data fragment of the upgrade image into the original upgrade flash memory based on the data address of each data fragment comprises:

[0015] Based on the data address of each block data, sequentially read the block data stored in each data address in the original upgrade flash memory, and determine whether the block data is a preset standard value;

[0016] When it is determined that the block data in the current data address is the preset standard value, extracting new block data corresponding to the data address from the upgrade image and storing it in the current data address;

[0017] Alternatively, when it is determined that the block data in the current data address is not the preset standard value, the block data in the current data address is erased so that the block data in the current data address is the preset standard value; wherein each of the block data corresponds to four bits, and when the values ​​of the four bits in the current data address are all 1, it is determined that the block data in the current data address is the preset standard value;

[0018] and extracting new block data corresponding to the data address from the upgraded image and storing it in the current data address;

[0019] The operation ends after all new block data in the upgrade image are written into the original upgrade flash memory.

[0020] Compared with the related art in which an erasing operation needs to be performed on each block during the upgrade process, the embodiment of the present invention quickly determines whether the flash memory block is empty, that is, whether it is in a state where it can be directly written. When all the block data are equal to the preset standard value, the erasing step can be directly skipped and data writing can be performed directly. Only when the data of the flash memory block does not meet the preset standard value, data erasure is performed, thereby reducing unnecessary erasing processes. Because the erasing process is usually more time-consuming than data writing, the storage time of the upgrade image is further reduced, and the burning speed of the upgrade image is improved.

[0021] In an optional embodiment, a rollback mark bit is also pre-configured in the electrically erasable programmable read-only memory, and a fourth mark value mapped by the rollback mark bit is stored, wherein the fourth mark value is used to indicate whether to copy the upgraded image in the new running flash memory to the new backup flash memory to complete the image rollback operation.

[0022] The embodiment of the present invention automatically restores to the previous stable state through a preset rollback mark when a fault occurs or an upgrade fails. If there is a problem with the new image, the system can rely on the rollback mechanism to maintain the continuity and stability of the upgrade.

[0023] In an optional implementation, after the steps of using the original upgrade flash memory after the image upgrade as the new running flash memory, using the original backup flash memory as the new upgrade flash memory, and using the original running flash memory as the new backup flash memory, the method further includes:

[0024] Reading multiple loading images required for server startup from the new running flash memory;

[0025] And multiple programs required for server startup are loaded according to the loading image to complete the server startup.

[0026] This embodiment ensures the reliability of the server startup process and the stability of the firmware upgrade by ensuring that the correct startup image can be loaded from the new running flash memory after the firmware is upgraded.

[0027] In an optional implementation, the loading image at least includes a secondary program loader image, a universal boot loader image, and an operating system kernel image; the method further includes:

[0028] When any of the loading images is interrupted by a timeout during the process of loading multiple programs required for the server to start, the second mark value mapped by the running flash memory mark bit is exchanged with the third mark value mapped by the backup flash memory mark bit;

[0029] The backup flash memory to be restarted is determined according to the value mapped by the running flash memory flag bit after the flag value is updated.

[0030] The embodiment of the present invention uses a rollback flag to automatically synchronize the running flash memory image to the backup flash memory when detecting that the new image is running unstable, thereby ensuring rapid rollback to a normal state when an image runs incorrectly.

[0031] In an optional implementation manner, the image rollback and the process of erasing the new upgrade flash memory are not performed at the same time.

[0032] The embodiment of the present invention first ensures that the image can be safely rolled back to a known stable state as a primary task. Once the rollback is successful, the server is in a workable environment, and then operations that are not urgent tasks are performed, such as erasing the newly upgraded flash memory. Therefore, the image rollback and the erasing of the new upgraded flash memory are not performed at the same time, which can avoid performing erasure when the server may still rely on certain upgraded resources, reducing the probability of erasure errors.

[0033] In a second aspect, the present invention provides a baseboard management controller firmware upgrade device, which is applied to a baseboard management controller, wherein the baseboard management controller reads a value mapped by a flash memory flag bit from a powered erasable programmable read-only memory, wherein the powered erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types, and stores the values ​​mapped by the flash memory flag bits of different types, wherein the flash memory flag bits include a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit, and the above-mentioned device includes: a startup verification module, which is used to receive the upgrade image and the data address of each data fragment of the upgrade image after the server startup is completed, and verify the legitimacy of the upgrade image;

[0034] A tag value reading module is used to read a first tag value corresponding to the original upgrade flash memory tag bit, a second tag value corresponding to the original running flash memory tag bit, and a third tag value corresponding to the original backup flash memory tag bit from the electrically erasable programmable read-only memory when the upgrade image verification succeeds;

[0035] a flash memory selection module, configured to determine an original upgrade flash memory according to the first tag value, determine an original running flash memory according to the second tag value, and determine an original backup flash memory according to the third tag value;

[0036] an image upgrade execution module, configured to, when an original upgrade flash memory is determined according to the first tag value, write each data fragment of the upgrade image into the original upgrade flash memory based on the data address of each data fragment to complete the image upgrade;

[0037] The flash memory conversion module is used to use the original upgrade flash memory after the image upgrade as the new running flash memory, the original backup flash memory as the new upgrade flash memory, and the original running flash memory as the new backup flash memory.

[0038] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the baseboard management controller firmware upgrade method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0039] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the baseboard management controller firmware upgrade method of the first aspect or any corresponding embodiment thereof.

[0040] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the baseboard management controller firmware upgrade method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 is a flow chart of a method for upgrading firmware of a baseboard management controller according to an embodiment of the present invention;

[0043] Figure 2 is a flow chart of another baseboard management controller firmware upgrade method according to an embodiment of the present invention;

[0044] Figure 3 is a flow chart of another baseboard management controller firmware upgrade method according to an embodiment of the present invention;

[0045] Figure 4 is a flow chart of another baseboard management controller firmware upgrade method according to an embodiment of the present invention;

[0046] Figure 5 is a structural block diagram of a baseboard management controller firmware upgrade device according to an embodiment of the present invention;

[0047] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0049] In conjunction with the application scenarios on which the execution of the baseboard management controller firmware upgrade method depends, the application scenarios are described herein.

[0050] In the related art, BMC firmware generally adopts dual-image redundancy for upgrading, involving two Flash images: the main Flash image and the backup Flash image. BMC starts from the main image. Once the main image fails to start, it will seamlessly switch to the backup image to continue the startup process. The above is the basic startup logic of BMC dual-image redundancy. For the upgrade process, if the current operation is based on the main Flash image, the backup Flash image will be selected to perform the upgrade task, which includes loading a new upgrade image, performing a legitimacy verification, and gradually comparing the loaded upgrade image with the existing Flash image content according to the Flash block. When a difference is found, the corresponding block will be erased first, and then the new image data will be written. If the content is consistent, the rewriting of the block will be skipped until the traversal of all Flash blocks is completed.

[0051] However, since the relevant upgrade strategy includes the step of erasing the original Flash content, when the upgrade image is particularly different from the existing image, the time-consuming erase operation prolongs the overall upgrade time.

[0052] A baseboard management controller firmware upgrade method provided by an embodiment of the present invention is applied to a data center scenario of baseboard management controller firmware upgrade. Three different flash memory roles are used: a running flash memory, a backup flash memory, and an upgrade flash memory. The current running flash memory, the backup flash memory, and the upgrade flash memory are quickly identified through a pre-configured flash memory mark bit. After receiving a new upgrade image and verifying its legitimacy, the new image can be directly written into a predetermined original upgrade flash memory, that is, there is no need to search or prepare write space in multiple storage blocks. After the image upgrade is successful, the original upgrade flash memory will be converted into a new running flash memory, and the original running flash memory will be converted into a backup flash memory, and the backup flash memory will be converted into an upgrade flash memory. The conversion of these three flash memory roles ensures that there is an immediately available new upgrade flash memory after each upgrade. The new upgrade flash memory can be directly used in the next upgrade process without waiting for the erase process, thereby improving the speed of BMC firmware upgrade.

[0053] According to an embodiment of the present invention, an embodiment of a baseboard management controller firmware upgrade method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0054] In this embodiment, a baseboard management controller firmware upgrade method is provided, which is applied to the baseboard management controller, wherein the baseboard management controller reads the value mapped by the flash memory flag bit from the electrically erasable programmable read-only memory, wherein the electrically erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types and stores the values ​​mapped by the flash memory flag bits of different types, wherein the flash memory flag bits include a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit; and can be used for the above-mentioned computer, Figure 1 is a flowchart of a method for upgrading firmware of a baseboard management controller according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0055] Step S101, after the server is started, an upgrade image and the data address of each data fragment of the upgrade image are received, and the legitimacy of the upgrade image is verified.

[0056] It should be noted that when performing an image upgrade, the upgrade image will be divided into multiple data fragments for writing in pieces, and the data address of each data fragment refers to the specific location address where the data fragment is written into the flash memory. The legitimacy of the upgrade image can be verified by digital signature verification or hash verification.

[0057] It is understandable that the purpose of verifying the legitimacy of the upgrade image is to ensure the security of the server operating system. The legitimacy verification ensures that only verified images can be loaded, thereby improving the stability and security of the server operating system.

[0058] Specifically, after the server is started, the relevant personnel can upload the required upgrade image through the Web interface. Once the image is successfully uploaded, a series of legitimacy checks will be automatically performed, such as digital signature verification or hash value comparison, to ensure the security of the image. If any of the checks fails, the upgrade process will be terminated, and the relevant personnel will be notified through the Web interface that the upgrade image verification has failed, indicating that the upgrade cannot continue.

[0059] Step S102, when the upgrade image verification succeeds, read a first mark value corresponding to the original upgrade flash memory mark bit, a second mark value corresponding to the original running flash memory mark bit, and a third mark value corresponding to the original backup flash memory mark bit from the electrically erasable programmable read-only memory.

[0060] It should be noted that the flash memory flag bit is a data structure preset in the EEPROM (Electrically Erasable Programmable Read-Only Memory) for managing flash memory operations, and is used to indicate which flash memory is used for which functions (such as booting, backing up or upgrading flash memory).

[0061] Among them, the running flash memory is used to indicate which flash memory should be used to load the operating system when the system starts; the backup flash memory flag is used to identify the flash memory location where the backup image is stored; and the upgrade flash memory flag indicates which flash memory the new upgrade image is written to.

[0062] The above-mentioned running flash memory flag bit, backup flash memory flag bit and upgrade flash memory flag bit are stored in the form of a structure, and the form of the structure is as follows:

[0063] typedef struct{uint8_t RunFlashFlag;uint8_t BackupFlashFlag;uint8_tUpdateFlashFlag;}FlashFlag_T;

[0064] Among them, RunFlashFlag (Run Flash Flag): The value range is 0-2, the default value is 0, 0 means that the system starts up and loads the image from Flash0, 1 means that the system starts up and loads the image from Flash1, and 2 means that the system starts up and loads the image from Flash2. BackupFlashFlag (Backup Flash Flag): The value range is 0-2, the default value is 1, 0 means that the backup image is stored in Flash0, 1 means that the backup image is stored in Flash1, and 2 means that the backup image is stored in Flash2. UpdateFlashFlag (Upgrade Flash Flag): The value range is 0-2, the default value is 2, 0 means that the upgrade image is written to Flash0 during upgrade, 1 means that the upgrade image is written to Flash1 during upgrade, and 2 means that the upgrade image is written to Flash2 during upgrade.

[0065] Step S103: determining the original upgrade flash memory according to the first tag value, determining the original running flash memory according to the second tag value, and determining the original backup flash memory according to the third tag value.

[0066] Taking the determination process of the original upgrade flash memory as an example, after the upgrade image successfully passes all checks, the stored UpdateFlashFlag flag is read from the EEPROM. This flag indicates which Flash memory is used for the current upgrade operation. If the value of UpdateFlashFlag is 0, Flash0 is selected as the flash memory for the upgrade. If its value is 1, Flash1 is selected as the upgrade flash memory, and when the value is 2, Flash2 is selected for the upgrade. The original backup flash memory and the original running flash memory are similar, and will not be repeated here. Determining the flash memory type according to the tag value can direct the firmware upgrade operation to the correct flash memory location.

[0067] Step S104, when the original upgrade flash memory is determined according to the first tag value, each data fragment of the upgrade image is written into the original upgrade flash memory based on the data address of each data fragment, so as to complete the image upgrade.

[0068] It can be understood that the upgrade image is divided into multiple data fragments, which improves the writing efficiency. The specific writing location of each data fragment is specified by its data address, which accurately controls the storage location of the image in the flash memory and reduces the flash memory load jam caused by writing a large amount of data at one time, thereby improving the speed of upgrading the firmware.

[0069] Step S105 , using the original upgrade flash memory after the mirror upgrade as a new running flash memory, using the original backup flash memory as a new upgrade flash memory, and using the original running flash memory as a new backup flash memory.

[0070] It should be noted that the original upgrade flash memory becomes the new running flash memory, the original running flash memory becomes the backup flash memory, and the original backup flash memory becomes the new upgrade flash memory. According to this exchange mechanism, all flash memory blocks can be used evenly, ensuring that the next time the firmware is upgraded, the flash memory storing the upgrade image is not the original upgrade flash memory, but the original backup flash memory. It only needs to rewrite the upgrade image, thereby improving the upgrade speed of the BMC firmware.

[0071] Specifically, the flash memory role swap is completed by updating the preset flag bit in the EEPROM. For example, if the original UpdateFlashFlag points to Flash2, then according to the update rule, Flash2 will be set as the new running flash memory, Flash0 (the original running flash memory) will become the new backup flash memory, and Flash1 (the original backup flash memory) will be updated to the new upgrade flash memory.

[0072] For example, after each firmware upgrade, the flash memory role swap is as shown in Table 1:

[0073] Table 1 Flash memory role exchange table

[0074]

[0075] This embodiment sets three flash memory roles, namely, running flash memory, backup flash memory, and upgrade flash memory, and uses a preset flash memory mark bit. After receiving and confirming the legitimacy of the new upgrade image, each data fragment of the upgrade image is immediately written into the original upgrade flash memory and written into the designated upgrade flash memory, avoiding searching space between multiple storage blocks and speeding up the image storage speed. After the upgrade is completed, the flash memory used for the upgrade becomes the new running flash memory, the original running flash memory is converted into the backup flash memory, and the original backup flash memory is converted into the new upgrade flash memory. The circular use of the flash memory roles ensures that the new upgrade flash memory is used immediately at the next upgrade without waiting for erasure. Since there is no need to wait for the erasure process, the firmware upgrade speed of the baseboard management controller is accelerated.

[0076] In this embodiment, a baseboard management controller firmware upgrade method is provided, which can be used for the above-mentioned computer, and the process includes the following steps:

[0077] Step S201: After the server is started, the upgrade image and the data address of each data fragment of the upgrade image are received, and the legitimacy of the upgrade image is verified. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0078] Step S202, when the upgrade image verification succeeds, read the first mark value corresponding to the original upgrade flash memory mark bit, the second mark value corresponding to the original running flash memory mark bit, and the third mark value corresponding to the original backup flash memory mark bit from the electrically erasable programmable read-only memory. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0079] Step S203, determining the original upgrade flash memory according to the first tag value, determining the original running flash memory according to the second tag value, and determining the original backup flash memory according to the third tag value. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0080] Step S204, when the original upgrade flash memory is determined according to the first tag value, each data fragment of the upgrade image is fragmented and written into the original upgrade flash memory based on the data address of each data fragment, so as to complete the image upgrade.

[0081] Specifically, the above step S204 includes:

[0082] Step S2041, based on the data address of each block data, read the block data stored in each data address in the original upgrade flash memory in sequence, and determine whether the block data is a preset standard value.

[0083] It should be noted that block data refers to data units that can be read and written individually in flash memory. Data address refers to a pointer or index to a specific block data location in flash memory. Preset standard value refers to a pre-set value used to mark whether the block data in flash memory is cleared. Data erasure refers to resetting the data in flash memory to the preset standard value.

[0084] Step S2042: when it is determined that the block data in the current data address is the preset standard value, new block data corresponding to the data address is extracted from the upgrade image and stored in the current data address.

[0085] Step S2043, or, when it is determined that the block data in the current data address is not the preset standard value, the block data in the current data address is erased so that the block data in the current data address is the preset standard value; wherein each of the block data corresponds to four bits, and when the values ​​of the four bits in the current data address are all 1, it is determined that the block data in the current data address is the preset standard value.

[0086] Step S2044: extract new block data corresponding to the data address from the upgrade image and store it at the current data address.

[0087] Step S2045, the operation ends after all new block data in the upgrade image are written into the original upgrade flash memory.

[0088] For example, refer to Figure 2 , read the data of each flash block from the specified upgrade flash area in sequence. Access the address of each block data and read the data stored there. For each block data read, check whether all the data of the block is equal to 0xFF. 0xFF represents the preset standard value, which is used to indicate that the block data is empty, that is, not used. If the block data is the preset standard value (0xFF), it means that the block has been cleared and there is no need to perform an erase operation. The new block data corresponding to the data address is directly extracted from the upgrade image and written to the current data address; if the block data is not the preset standard value, it means that there is old data in the block. First, the block needs to be erased and each bit in the block data is reset to 1. After the erasure is completed, the new block data is extracted from the upgrade image and written to the block. Repeat the above process to check and update each block until all new block data is extracted from the upgrade image and successfully written to the original upgrade flash memory.

[0089] Specifically, a specific command in the operating system or firmware is used to send an erase instruction to the flash memory controller, that is, to send one or more specific erase commands to the flash memory chip, or a secure erase technology is used to ensure that the data is completely erased.

[0090] It can be understood that, compared with the related art that requires erasing each block during the upgrade process, it is possible to quickly determine whether the flash memory block is empty, that is, whether it is in a state where it can be directly written. When all block data are equal to the preset standard value, the erasing step can be skipped directly and data can be written directly. Only when the data of the flash memory block does not meet the preset standard value is data erased, thereby reducing unnecessary erasing processes. Because the erasing process is usually more time-consuming than data writing, the storage time of the upgrade image is further reduced, and the burning speed of the upgrade image is improved.

[0091] In an optional embodiment, the data erasure process specifically includes: setting an erase label for all data blocks that are not the preset standard value blocks, generating an erase instruction based on the erase label, and sending the erase instruction to the flash memory chip to complete the data erasure; wherein, before sending the erase instruction to the flash memory chip, a batch processing and sorting algorithm is introduced, and the erase tasks corresponding to multiple erase instructions are combined into a batch execution template, and the erase instruction is sent to the flash memory chip according to the batch execution template.

[0092] It can be understood that batch processing can balance the erase operations on the chip and extend the service life of the flash memory. The sorting algorithm can optimize the execution order of erase tasks and reduce instruction conflicts. By combining multiple erase tasks into batch execution, the number of times the flash memory chip receives and processes a single erase instruction can be reduced, thereby increasing the speed of the overall erase process and further increasing the writing speed of the upgrade image.

[0093] Step S205: Use the original upgrade flash memory after the image upgrade as the new running flash memory, use the original backup flash memory as the new upgrade flash memory, and use the original running flash memory as the new backup flash memory. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0094] Step S206, when the server is restarted, the new upgrade flash memory is erased, so as to store a new upgrade image in the new upgrade flash memory when the image is upgraded next time.

[0095] After erasing the flash memory in the embodiment of the present invention, there will be no useless old data in the flash memory. When the next firmware upgrade needs to store a new image, it can be written to a clean storage medium more quickly. By cleaning the flash memory when the server starts, the steps in the actual upgrade process are simplified, and there is no need to perform an additional data erasing step in the next upgrade process, thereby improving the firmware upgrade speed.

[0096] In an optional embodiment, a rollback mark bit is also pre-configured in the electrically erasable programmable read-only memory, and a fourth mark value mapped by the rollback mark bit is stored, wherein the fourth mark value is used to indicate whether to copy the upgraded image in the new running flash memory to the new backup flash memory to complete the image rollback operation.

[0097] It should be noted that the rollback flag is used to indicate whether a rollback operation needs to be performed under specific conditions (after the system is started).

[0098] Exemplarily, RollBackFlag: the value range is 0-1, the default value is 0, the rollback flag, 1 means that a rollback operation is required after the kernel is started, that is, the image in the running Flash is synchronized to the backup Flash, and 0 means that no rollback operation is required after the kernel is started.

[0099] The embodiment of the present invention automatically restores to the previous stable state through a preset rollback mark when a fault occurs or an upgrade fails. If there is a problem with the new image, the system can rely on the rollback mechanism to maintain the continuity and stability of the upgrade.

[0100] In an optional implementation manner, a baseboard management controller firmware upgrade method provided in this embodiment further includes:

[0101] A1, reading multiple loading images required for server startup from the new running flash memory;

[0102] A2, and loading multiple programs required for server startup according to the loading image to complete the server startup.

[0103] It should be noted that, in this embodiment, multiple loaded images refer to configuration images required for server startup, such as operating system images, driver images, system service images, etc. During the firmware upgrade process of the baseboard management controller, ensuring that the images required for startup are correctly loaded can ensure that the server can run stably after the firmware upgrade.

[0104] This embodiment ensures the reliability of the server startup process and the stability of the firmware upgrade by ensuring that the correct startup image can be loaded from the new running flash memory after the firmware is upgraded.

[0105] In an optional implementation, the loading image includes at least a secondary program loader image, a universal boot loader image, and an operating system kernel image; a baseboard management controller firmware upgrade method provided in this embodiment further includes:

[0106] B1, when any of the loading images is interrupted by a timeout during the process of loading multiple programs required for the server to start, the second tag value mapped by the running flash memory tag bit and the third tag value mapped by the backup flash memory tag bit are exchanged with each other;

[0107] B2: Determine the backup flash memory to be restarted according to the value mapped by the running flash memory flag bit after the flag value is updated.

[0108] For example, refer to Figure 3 When the device is powered on, it first enters the BootRom stage. At this time, the system will load the SPL (Secondary Program Loader) image from Flash0 and guide it to run. The SPL image is small in size and is mainly responsible for completing basic hardware initialization operations, such as initializing the watchdog. A key task of SPL is to load the uboot image from the specified Flash to the memory and guide the uboot to start. SPL will read the Flash flag RunFlashFlag from the EEPROM and decide which Flash to load the uboot image from based on its value: 0 means from Flash0, 1 means from Flash1, and 2 means from Flash2. If the EEPROM reading fails or by default, the system will load the uboot image from Flash0. After starting uboot, the system will initialize more hardware, load the kernel image from the corresponding Flash according to RunFlashFlag, and then guide the kernel to start. Once the kernel is successfully started, it will determine whether a rollback operation needs to be performed based on the rollback flag RollBackFlag (if RollBackFlag is 1, rollback is performed), that is, synchronizing the running Flash image to the backup Flash. During normal operation of the kernel, the system needs to feed the watchdog regularly to prevent restarts caused by the watchdog. If a failure occurs during the process of starting uboot or kernel, the watchdog timeout interrupt will be triggered. At this time, the system will exchange the values ​​of RunFlashFlag and BackupFlashFlag to ensure that the device can be started from the backup Flash the next time it restarts.

[0109] It is understandable that if a startup failure or running error occurs, the watchdog timeout interrupt will be triggered and the values ​​of RunFlashFlag and BackupFlashFlag will be automatically exchanged to ensure that the system loads the operating system from the backup Flash at the next startup, thereby achieving automatic error recovery.

[0110] The embodiment of the present invention uses a rollback flag to automatically synchronize the running flash memory image to the backup flash memory when detecting that the new image is running unstable, thereby ensuring rapid rollback to a normal state when an image runs incorrectly.

[0111] In an optional implementation manner, the image rollback and the process of erasing the new upgrade flash memory are not performed at the same time.

[0112] Specifically, the newly upgraded flash memory is tested. If there is a problem with the new upgrade, a known stable image is automatically selected as a rollback option. After confirming that a rollback is required, the previously verified stable image is switched to. After the rollback is completed, a preset waiting time is set. When this waiting time is reached, the newly upgraded flash memory data is erased.

[0113] The embodiment of the present invention first ensures that the image can be safely rolled back to a known stable state as a primary task. Once the rollback is successful, the server is in a workable environment, and then operations that are not urgent tasks are performed, such as erasing the newly upgraded flash memory. Therefore, the image rollback and the erasing of the new upgraded flash memory are not performed at the same time, which can avoid performing erasure when the server may still rely on certain upgraded resources, reducing the probability of erasure errors.

[0114] The overall process of upgrading the baseboard management controller firmware in the embodiment of the present invention can be referred to Figure 4First, upload the new firmware image through the Web interface. The system will automatically verify the uploaded image file to ensure its legitimacy. If the verification fails, the system will prompt the user in the Web interface that "Firmware image verification failed, upgrade failed" and terminate the upgrade process. If the image verification succeeds, the system will read the UpdateFlashFlag flag from the EEPROM to determine the Flash memory to be upgraded. Specifically, when the value of UpdateFlashFlag is 0, Flash0 is selected; when the value is 1, Flash1 is selected; when the value is 2, Flash2 is selected. After selecting the Flash to be upgraded, the system will read the data in the Flash block by block. For each data block, the system will check whether the block is all 0xFF. If not, the system will first erase the block and then write the corresponding data of the new firmware. If the block is already all 0xFF, the new firmware data is directly written without erasing. This process will be repeated until the new firmware is completely written to the selected Flash. After writing is completed, the system will update the flag of the Flash. The update rules are as follows: the original running Flash becomes the backup Flash, the original backup Flash becomes the upgrade Flash, and the upgraded Flash becomes the new running Flash. At the same time, the RollBackFlag rollback flag is set to 1, and the device is restarted. If the device fails to restart, it will restart from the backup Flash. If the device restarts successfully, the system will set RollBackFlag to 0 and erase the Flash used for upgrade. This process is executed in parallel with the normal running tasks. During the image rollback and erasing of the upgrade Flash, the system will no longer accept new upgrade requests.

[0115] In this embodiment, a baseboard management controller firmware upgrade device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0116] The present embodiment provides a baseboard management controller firmware upgrade device, which is applied to the baseboard management controller, wherein the baseboard management controller reads the value mapped by the flash memory flag bit from the electrically erasable programmable read-only memory, wherein the electrically erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types, and stores the values ​​mapped by the flash memory flag bits of different types, wherein the flash memory flag bits include a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit, such as Figure 5 As shown, including:

[0117] A tag value reading module is used to read a first tag value corresponding to the original upgrade flash memory tag bit, a second tag value corresponding to the original running flash memory tag bit, and a third tag value corresponding to the original backup flash memory tag bit from the electrically erasable programmable read-only memory when the upgrade image verification succeeds;

[0118] a flash memory selection module, configured to determine an original upgrade flash memory according to the first tag value, determine an original running flash memory according to the second tag value, and determine an original backup flash memory according to the third tag value;

[0119] an image upgrade execution module, configured to, when an original upgrade flash memory is determined according to the first tag value, write each data fragment of the upgrade image into the original upgrade flash memory based on the data address of each data fragment to complete the image upgrade;

[0120] The flash memory conversion module is used to use the original upgrade flash memory after the image upgrade as the new running flash memory, the original backup flash memory as the new upgrade flash memory, and the original running flash memory as the new backup flash memory.

[0121] In some optional embodiments, the above device further includes:

[0122] When the server is restarted, the new upgrade flash memory is erased so that a new upgrade image is stored in the new upgrade flash memory when the image is upgraded next time.

[0123] In some optional implementations, the image upgrade execution module includes:

[0124] A data reading and verification unit, configured to read the block data stored in each data address in the original upgrade flash memory in sequence based on the data address of each block data, and determine whether the block data is a preset standard value;

[0125] A data writing unit, configured to extract new block data corresponding to the data address from the upgrade image and store it in the current data address when it is determined that the block data in the current data address is the preset standard value;

[0126] A data erasing and resetting unit, configured to, when it is determined that the block data in the current data address is not the preset standard value, erase the block data in the current data address so that the block data in the current data address is the preset standard value; wherein each of the block data corresponds to four bits, and when the values ​​of the four bits in the current data address are all 1, it is determined that the block data in the current data address is the preset standard value;

[0127] A new data storage unit is used to extract and store new block data corresponding to the data address from the upgrade image to the current data address;

[0128] The upgrade completion confirmation unit is used to end the operation after all new block data in the upgrade image is written into the original upgrade flash memory.

[0129] In some optional embodiments, a rollback mark bit is also pre-configured in the electrically erasable programmable read-only memory, and a fourth mark value mapped by the rollback mark bit is stored, wherein the fourth mark value is used to indicate whether to copy the upgraded image in the new running flash memory to the new backup flash memory to complete the image rollback operation.

[0130] In some optional embodiments, the above device further includes:

[0131] The boot loading image reading module is used to read multiple loading images required for server startup from the new running flash memory; and load multiple programs required for server startup according to the loading images to complete the server startup.

[0132] In some optional implementations, the loading image includes at least a secondary program loader image, a universal boot loader image, and an operating system kernel image; the above-mentioned device also includes:

[0133] A startup interrupt processing module, used for exchanging the second mark value mapped by the running flash memory mark bit with the third mark value mapped by the backup flash memory mark bit when a timeout interrupt occurs in any of the loading images during the process of loading multiple programs required for the server startup;

[0134] The tag value updating module is used to determine the backup flash memory to be restarted according to the value mapped by the running flash memory tag bit after the tag value is updated.

[0135] In some optional implementations, the image rollback and the process of erasing the new upgrade flash memory are not performed at the same time.

[0136] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0137] The baseboard management controller firmware upgrade device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0138] The embodiment of the present invention also provides a computer device having the above Figure 5 The baseboard management controller firmware upgrade device is shown.

[0139] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0140] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0141] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0142] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0143] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0144] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0145] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0146] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0147] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the claims.

Claims

1. A method for upgrading baseboard management controller firmware, characterized in that: The method is applied to a baseboard management controller, and the baseboard management controller reads the value mapped by the flash memory flag bit from a powered erasable programmable read-only memory, wherein the powered erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types, and stores the values ​​mapped by the flash memory flag bits of different types, and the flash memory flag bits include a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit; the method comprises: After the server is started, the upgrade image and the data address of each data fragment of the upgrade image are received, and the legitimacy of the upgrade image is verified; When the upgrade image verification succeeds, a first mark value corresponding to the original upgrade flash memory mark bit, a second mark value corresponding to the original running flash memory mark bit, and a third mark value corresponding to the original backup flash memory mark bit are read from the electrically erasable programmable read-only memory; Determine the original upgrade flash memory according to the first tag value, determine the original running flash memory according to the second tag value, and determine the original backup flash memory according to the third tag value; When the original upgrade flash memory is determined according to the first tag value, each data fragment of the upgrade image is written into the original upgrade flash memory based on the data address of each data fragment, so as to complete the image upgrade; The original upgrade flash memory after the mirror upgrade is used as a new running flash memory, the original backup flash memory is used as a new upgrade flash memory, and the original running flash memory is used as a new backup flash memory.

2. The method according to claim 1, characterized in that The method further comprises: When the server is restarted, the new upgrade flash memory is erased so that a new upgrade image is stored in the new upgrade flash memory when the image is upgraded next time.

3. The method according to claim 1, characterized in that The step of writing each data fragment of the upgrade image into the original upgrade flash memory based on the data address of each data fragment comprises: Based on the data address of each block data, sequentially read the block data stored in each data address in the original upgrade flash memory, and determine whether the block data is a preset standard value; When it is determined that the block data in the current data address is a preset standard value, extracting new block data corresponding to the data address from the upgrade image and storing it in the current data address; Alternatively, when it is determined that the block data in the current data address is not the preset standard value, the block data in the current data address is erased so that the block data in the current data address is the preset standard value; wherein each of the block data corresponds to four bits, and when the values ​​of the four bits in the current data address are all 1, it is determined that the block data in the current data address is the preset standard value; and extracting new block data corresponding to the data address from the upgraded image and storing it in the current data address; The operation ends after all new block data in the upgrade image are written into the original upgrade flash memory.

4. The method according to any one of claims 1 to 3, characterized in that The electrically erasable programmable read-only memory is also pre-configured with a rollback mark bit, and stores a fourth mark value mapped by the rollback mark bit, wherein the fourth mark value is used to indicate whether to copy the upgraded image in the new running flash memory to the new backup flash memory to complete the image rollback operation.

5. The method according to any one of claims 1 to 3, characterized in that After using the original upgrade flash memory after the mirror upgrade as a new running flash memory, using the original backup flash memory as a new upgrade flash memory, and using the original running flash memory as a new backup flash memory, the method further includes: Reading multiple loading images required for server startup from the new running flash memory; And multiple programs required for server startup are loaded according to the loading image to complete the server startup.

6. The method according to claim 5, characterized in that The loading image at least includes a secondary program loader image, a universal boot loader image, and an operating system kernel image; the method further includes: When any of the loading images is interrupted by a timeout during the process of loading multiple programs required for the server to start, the second mark value mapped by the running flash memory mark bit is exchanged with the third mark value mapped by the backup flash memory mark bit; The backup flash memory to be restarted is determined according to the value mapped by the running flash memory flag bit after the flag value is updated.

7. The method according to claim 4, characterized in that The image rollback and the process of erasing the new upgraded flash memory are not performed at the same time.

8. A baseboard management controller firmware upgrade device, characterized in that: Applied to a baseboard management controller, the baseboard management controller reads the value mapped by the flash memory flag bit from a powered erasable programmable read-only memory, wherein the powered erasable programmable read-only memory is pre-configured with three flash memory flag bits of different types, and stores the values ​​mapped by the flash memory flag bits of different types, wherein the flash memory flag bits include a running flash memory flag bit, a backup flash memory flag bit, and an upgrade flash memory flag bit; the device comprises: The startup verification module is used to receive the upgrade image and the data address of each data fragment of the upgrade image after the server startup is completed, and verify the legitimacy of the upgrade image; A tag value reading module is used to read a first tag value corresponding to the original upgrade flash memory tag bit, a second tag value corresponding to the original running flash memory tag bit, and a third tag value corresponding to the original backup flash memory tag bit from the electrically erasable programmable read-only memory when the upgrade image verification succeeds; a flash memory selection module, configured to determine an original upgrade flash memory according to the first tag value, determine an original running flash memory according to the second tag value, and determine an original backup flash memory according to the third tag value; an image upgrade execution module, configured to, when an original upgrade flash memory is determined according to the first tag value, write each data fragment of the upgrade image into the original upgrade flash memory based on the data address of each data fragment to complete the image upgrade; The flash memory conversion module is used to use the original upgrade flash memory after the image upgrade as the new running flash memory, the original backup flash memory as the new upgrade flash memory, and the original running flash memory as the new backup flash memory.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for upgrading the firmware of a baseboard management controller according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for upgrading the firmware of a baseboard management controller according to any one of claims 1 to 7.

Citation Information

Cited By

  • Firmware upgrading method and system, server, equipment, medium and product

    CN120122972A

  • Server firmware recovery control method, storage medium and program product

    CN120723321A

  • Method for controlling server firmware recovery, storage medium, and program product

    CN120723321B

  • Logic controller, flash memory upgrading method and device, electronic equipment and medium

    CN120743318A

  • Logic controller, flash memory upgrading method and device, electronic equipment and medium

    CN120743318B