Firmware upgrading method and device, equipment and medium
By monitoring the server status and configuration flags, skipping the retained configuration area when obtaining and flushing the target firmware image, the problem of inefficient firmware upgrade in the existing technology is solved, and efficient firmware upgrades without restart are achieved.
Patent Information
- Application Number
- CN202510386268.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, when upgrading server firmware, multiple restarts are required to retain configuration, resulting in low upgrade efficiency and risk of data loss or transmission errors.
By monitoring the server's host status and retained configuration flags, when the conditions are met, the target firmware image is obtained and the corresponding configuration file is loaded. The target firmware image is flushed to the target memory device based on the configuration file, and the memory address area corresponding to the retained configuration is skipped during the flashing process.
It realizes that without multiple restarts without retaining configuration, improves firmware upgrade efficiency, reduces the risk of data loss and transmission errors, and reduces maintenance time and personnel costs.
Smart Images

Figure CN120255931A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of firmware upgrade, and in particular, to a firmware upgrade method, device, equipment and medium. Background Art
[0002] During on-site maintenance of servers, in general, the upgrade of some firmware requires retaining the current configuration. The current mainstream upgrade strategy for retaining configuration is implemented through the H2B (Host to BMC) bus. However, the program cannot be executed normally during the first startup after the configuration retention refresh is completed. Instead, only the previous configuration is obtained and saved, and the firmware can work normally after restarting again, resulting in low firmware upgrade efficiency.
[0003] It can be seen that how to improve the firmware upgrade efficiency while retaining the configuration is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of the present invention is to provide a firmware upgrade method, device, equipment and medium, which can improve the firmware upgrade efficiency while retaining the configuration. The specific solutions are as follows:
[0005] In a first aspect, the present invention provides a firmware upgrade method, including:
[0006] Monitoring the host status and the configuration retention flag of the server;
[0007] When the host status is the shutdown state and the configuration retention flag is a preset value, obtaining the target firmware image and loading the configuration file corresponding to the target firmware image, where the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the retained configuration;
[0008] Based on the configuration file, flashing the target firmware image to the target memory device and skipping the target memory address area during the flashing process.
[0009] Optionally, flashing the target firmware image to the target memory device based on the configuration file and skipping the target memory address area during the flashing process includes:
[0010] Judging whether the current address to be flashed of the target memory device belongs to the target memory address area based on the configuration file;
[0011] If it belongs to the target memory address area, skipping the current address to be flashed;
[0012] If it does not belong to the target memory address area, comparing the current data block to be flashed in the target firmware image with the data block in the current address to be flashed of the target memory device;
[0013] If the current data block to be flashed is inconsistent with the data block at the current address to be flashed of the target memory device, write the current data block to be flashed to the current address to be flashed;
[0014] If the current data block to be flashed is consistent with the data block at the current address to be flashed of the target memory device, retain the data block at the current address to be flashed and do not flash the current data block to be flashed.
[0015] Optionally, after writing the current data block to be flashed to the current address to be flashed, it further includes:
[0016] Read back the current data block to be flashed from the current address to be flashed to obtain the read-back data, and perform verification on the read-back data.
[0017] Optionally, it further includes:
[0018] When an exception occurs, exit the firmware upgrade;
[0019] Among them, if the verification of the read-back data fails, or the parsing of the configuration file fails, it is determined that an exception has occurred. The configuration file is parsed when flashing the target firmware image to the target memory device based on the configuration file.
[0020] Optionally, loading the configuration file corresponding to the target firmware image includes:
[0021] Determine the target image type of the target firmware image based on the command parameter;
[0022] Obtain the configuration file corresponding to the target image type, where different image types correspond to different configuration files.
[0023] Optionally, the image types include management controller firmware, basic input / output system firmware, complex programmable logic device firmware of the server motherboard, and complex programmable logic device firmware of the system control module board.
[0024] Optionally, obtaining the target firmware image and loading the configuration file corresponding to the target firmware image; flashing the target firmware image to the target memory device based on the configuration file and skipping the target memory address area during the flashing process includes:
[0025] Call the firmware upgrade tool, and through the firmware upgrade tool, execute the steps of obtaining the target firmware image and loading the configuration file corresponding to the target firmware image; flashing the target firmware image to the target memory device based on the configuration file and skipping the target memory address area during the flashing process;
[0026] Among them, the firmware upgrade tool is an application object that can be executed on the command line and is created based on a target executable file, which is obtained by compiling and building a target application program, and the target application program is created based on the interface functions of a target memory device.
[0027] In a second aspect, the present invention provides a firmware upgrade device, including:
[0028] A monitoring module, configured to monitor the host status of the server and the reserved configuration flag;
[0029] An acquisition module, configured to, when the host status is a shutdown state and the reserved configuration flag is a preset value, acquire a target firmware image and load a configuration file corresponding to the target firmware image, where the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the reserved configuration;
[0030] A flashing module, configured to flash the target firmware image to a target memory device based on the configuration file and skip the target memory address area during the flashing process.
[0031] In a third aspect, the present invention provides an electronic device, including:
[0032] A memory, configured to store a computer program;
[0033] A processor, configured to execute the computer program to implement the steps of the foregoing firmware upgrade method.
[0034] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the foregoing firmware upgrade method are implemented.
[0035] In a fifth aspect, the present invention provides a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the foregoing disclosed firmware upgrade method are implemented.
[0036] It can be seen from the above solutions that the present invention provides for monitoring the host status of the server and the reserved configuration flag; when the host status is a shutdown state and the reserved configuration flag is a preset value, acquiring a target firmware image and loading a configuration file corresponding to the target firmware image, where the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the reserved configuration; flashing the target firmware image to a target memory device based on the configuration file and skipping the target memory address area during the flashing process.
[0037] It can be seen that the beneficial effects of the present invention are as follows: when it is detected that the server host status is in the shutdown state and the retention configuration flag is a preset value, the target firmware image and the configuration file corresponding to the target firmware image are obtained, the target firmware image is flashed to the target memory device based on the configuration file, and the memory address area corresponding to the retention configuration, i.e., the target memory address area, is skipped during the flashing process. In this way, after the flashing is completed and the server is powered on, the new version of the firmware takes effect immediately without multiple restarts, and the firmware upgrade efficiency can be improved while retaining the configuration. Description of the Drawings
[0038] To more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0039] Figure 1 Flowchart of a firmware upgrade method provided by an embodiment of the present invention;
[0040] Figure 2 Flowchart of a firmware upgrade tool processing provided by an embodiment of the present invention;
[0041] Figure 3 Schematic diagram of a firmware upgrade provided by an embodiment of the present invention;
[0042] Figure 4 Flowchart of a firmware upgrade provided by an embodiment of the present invention;
[0043] Figure 5 Schematic diagram of the structure of a firmware upgrade device provided by an embodiment of the present invention;
[0044] Figure 6 Structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments
[0045] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.
[0046] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0047] In recent years, thanks to the accelerated development of Internet infrastructure such as Internet data centers and cloud computing, the server market has shown steady growth. Openbmc (open source BMC (i.e. Baseboard Management Controller)) is the main BMC architecture in the BMC field of the server industry in recent years. Thanks to its open source, flexibility and community sharing, it is favored by major server manufacturers and BMC manufacturers. BIOS (Basic Input Output System) is a standard firmware interface in the server industry. It is a set of programs fixed to a ROM (i.e. Read-Only Memory) chip on the motherboard of the computer. It stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program. It can read and write specific information of system settings from CMOS (i.e. Complementary Metal Oxide Semiconductor). Its main function is to provide the computer with the lowest and most direct hardware settings and control. In addition, BIOS also provides some system parameters to the operating system.
[0048] During on-site server maintenance, some firmware upgrades usually require retaining the current configuration. The current mainstream configuration-retaining upgrade strategy is implemented through the H2B (Host to BMC) bus, but the first boot after the configuration-retaining refresh is completed cannot execute its program normally, but only obtains the previous configuration and saves it. The firmware can only work normally after another restart, resulting in low firmware upgrade efficiency.
[0049] For example, during on-site maintenance of a server, the BIOS firmware refresh usually needs to retain the current configuration. The BIOS can be upgraded with configuration retention through BIOS Setup, operating system, and BMC. OS (i.e. operating system) refresh requires entering the operating system of each server in turn and executing the refresh tool script, which is very time-consuming; refresh under Setup requires restarting the server and entering BIOS Setup, which requires an additional restart during refresh, and also needs to be performed in sequence. BMC is usually used to upgrade the BIOS.
[0050] For example, common BIOS flashing methods for servers include flashing through the operating system, flashing under BIOS Setup, flashing with a burner, and flashing through BMC. Among these methods, the most commonly used one in actual operation and maintenance is to flash the BIOS image through BMC. This method has the characteristics of flexibility and high efficiency. It does not depend on the state of the server. The BIOS can be flashed through the out-of-band method of BMC. However, for the relatively mainstream BMCs on the market, especially OpenBmc which has developed rapidly in recent years, retaining configuration to flash the BIOS requires relying on the H2B bus (Host to BMC, a bus method for information interaction between BMC and the host). The basic principle is that when the BMC checks that the flashing parameter set by the administrator is for retaining configuration upgrade during flashing, it will save the parameters that need to be retained by the BIOS, such as BIOSsetup (settings interface) options, to the H2B bus backup. Then, it will pass the flag bit for retaining configuration to the BIOS. The BIOS sets this flag bit and stores it in the non-volatile storage area of the BIOS Flash (i.e., flash memory). After the BIOS Flash is refreshed and restarted, when the BIOS boot finishes and reads that the flag bit for retaining configuration has been set, the BIOS will go to the H2B bus to obtain the previously backed-up setup options, BIOS Logo, and other parameters by the BMC. This will cause the BIOS not to be able to execute its program normally during the first startup after the BIOS retaining configuration flashing is completed. Instead, it only obtains and saves the previous configuration, and the BIOS can work normally after restarting again. Although this strategy realizes the BMC retaining configuration to upgrade the BIOS, it requires the BMC to execute flashing -> shutdown and flash -> power on to obtain the BIOS configuration through the H2B bus -> restart again, and finally the flashing is completed. It can be seen that the whole process is very complex. The BIOS retaining configuration flashing performs a shutdown and a restart operation for the server. And after synchronizing data during the first startup, a manual server restart is required again. Executing this operation in the computer room of a large-data-volume server will greatly waste maintenance time and resources, and increase the personnel cost. In summary, this method requires an extra restart operation. Besides wasting time, in the data center computer room or production line, excessive server restarts may lead to many unpredictable problems, and there is a risk of data loss or transmission error when retrieving the BIOS configuration through the H2B bus method. Such methods need to be improved.
[0051] Therefore, the present invention provides a firmware upgrade solution that can improve the firmware upgrade efficiency while retaining the configuration.
[0052] To enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] Next, a firmware upgrade method provided by an embodiment of the present invention will be introduced in detail. Figure 1 A firmware upgrade method provided by an embodiment of the present invention, the firmware upgrade method includes:
[0054] Step S11: Monitor the host status of the server and the retention configuration flag.
[0055] In an alternative embodiment, the host status and the retention configuration flag can be obtained based on a preset period to determine whether the host status is the shutdown state and whether the retention configuration flag is a preset value, and the preset value indicates that a retention configuration upgrade is to be performed. For example, setting the retention configuration flag to 1 indicates that a retention configuration upgrade is to be performed. If the host status of the server is the power-on state, the upgrade is not executed to avoid affecting normal operation.
[0056] In another alternative embodiment, the user-selected time period can be obtained, and when the time period is reached, the host status of the server and the retention configuration flag are obtained. The user-selected time period is the firmware upgrade time period selected by the user, thus avoiding affecting normal operation.
[0057] Taking the BIOS retention configuration upgrade of the server as an example, the BIOS version of the server host is upgraded, and configurations such as the BIOS Setup option and the BIOS logo are ensured not to be lost.
[0058] The embodiment of the present invention can perform firmware upgrade through a management controller, and the management controller can be one of a BMC, an Integrated Light-Out (iLO) system, an Integrated Dell Remote Access Control (IDRAC), or a processing chip. For example, refreshing the BIOS through the BMC, and refreshing means upgrading. The embodiment of the present invention can perform asynchronous refreshing, that is, when the server is running, only the BIOS firmware image and some related refreshing parameters are uploaded, and the BIOS firmware is not actually started to be refreshed after the refreshing execution, nor does it need to immediately shut down the server to make it stop. Instead, after the server is shut down at night or when the server is idle, the BIOS can be automatically and batch-refreshed.
[0059] Step S12: When the host status is the shutdown state and the retention configuration flag is the preset value, obtain the target firmware image and load the configuration file corresponding to the target firmware image, where the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the retention configuration.
[0060] In an alternative embodiment, a file path may be determined based on command parameters; a target firmware image may be obtained based on the file path. The target firmware image is the firmware to be upgraded. A maintenance personnel may upload the target firmware image to a target location. The corresponding file path may be configured based on command parameters. Embodiments of the present invention may determine a file path based on command parameters, so as to obtain a target firmware image.
[0061] Further, a target image type of the target firmware image is determined based on command parameters; a configuration file corresponding to the target image type is obtained, where different image types correspond to different configuration files.
[0062] In embodiments of the present invention, the image types include but are not limited to management controller firmware, basic input / output system firmware, complex programmable logic device firmware of a server motherboard, and complex programmable logic device firmware of a system control module board.
[0063] In an alternative embodiment, the configuration file may be a JSON file, and the JSON file includes a memory address area corresponding to reserved configuration. Embodiments of the present invention may obtain the memory address area corresponding to the reserved configuration based on a mapping table of contents stored in each memory address area.
[0064] Step S13: Flash the target firmware image to a target memory device based on the configuration file, and skip the target memory address area during the flashing process.
[0065] Among them, the target memory device may be a flash memory device for storing a firmware image.
[0066] In an alternative embodiment, it may be determined based on the configuration file whether a current write address of the target memory device belongs to the target memory address area; if it belongs to the target memory address area, the current write address is skipped; if it does not belong to the target memory address area, the current write data block in the target firmware image is compared with the data block in the current write address of the target memory device; if the current write data block is inconsistent with the data block in the current write address of the target memory device, the current write data block is written to the current write address; if the current write data block is consistent with the data block in the current write address of the target memory device, the data block in the current write address is retained, and the current write data block is not flashed.
[0067] In this way, embodiments of the present invention can process data by block, and trigger an erase and write operation only when the data blocks are different, thereby prolonging the life of the memory device.
[0068] Further, after writing the current data block to be flashed to the current address to be flashed, the method further includes: reading back the current data block to be flashed from the current address to be flashed to obtain the read-back data, and performing a check on the read-back data. If the read-back data is inconsistent with the written current data block to be flashed, the check fails.
[0069] In an alternative embodiment, when an exception occurs, the firmware upgrade is exited; wherein, if the read-back data check fails or the configuration file parsing fails, it is determined that an exception has occurred, and the configuration file is parsed when flashing the target firmware image to the target memory device based on the configuration file. That is, the configuration file is first parsed, and the target firmware image is flashed to the target memory device based on the parsed configuration file.
[0070] In the embodiments of the present invention, in case of any check failure, including but not limited to JSON parsing and data comparison, an abnormal exit is directly performed to avoid damaging the device.
[0071] In addition, the embodiments of the present invention can also check the existence of the target firmware image and the target memory device. If the target firmware image or the target memory device does not exist, it is determined that an exception has occurred. Based on checking whether the size of the target firmware image file exceeds the capacity of the target memory device, if it exceeds the capacity of the target memory device, it is determined that an exception has occurred.
[0072] Moreover, the embodiments of the present invention can report the firmware upgrade progress, which is displayed through a progress bar.
[0073] In an alternative embodiment, obtaining the target firmware image and loading the configuration file corresponding to the target firmware image; flashing the target firmware image to the target memory device based on the configuration file, and skipping the target memory address area during the flashing process, includes: calling a firmware upgrade tool, and executing, through the firmware upgrade tool, obtaining the target firmware image and loading the configuration file corresponding to the target firmware image; flashing the target firmware image to the target memory device based on the configuration file, and skipping the target memory address area during the flashing process; wherein, the firmware upgrade tool is an application object executable on the command line created based on a target executable file, the target executable file is obtained by compiling and building a target application program, and the target application program is created based on the interface functions of the target memory device. The interface functions may include read and write functions.
[0074] Next, the firmware upgrade tool provided by the embodiments of the present invention is further elaborated:
[0075] The firmware upgrade tool provided by the embodiments of the present invention can be named otrd - flash. The following is a detailed description of the overall process and design concept of otrd - flash:
[0076] otrd-flash is a secure flashing tool for embedded systems (such as BMC / BIOS / motherboard CPLD / SCM board CPLD firmware). Its core function is to securely write image files to Flash devices, support skipping specified partitions, progress reporting (local / D-Bus), and block-level verification. The design emphasizes data integrity and erasure efficiency, avoiding unnecessary Flash erasure operations. See Figure 2 as shown Figure 2 A flowchart of the firmware upgrade tool processing provided by an embodiment of the present invention is as follows:
[0077] Parameter parsing: Use the CLI11 library to parse the parameters passed through the command line to obtain the image type, input file path (i.e., the file path of the target firmware image), output device (i.e., the target memory device, which can be flash), skip partition list (in the JSON configuration file), etc. Moreover, the embodiment of the present invention can verify the existence of the input file and the output device (flash).
[0078] Service and partition configuration loading: If the --path parameter is specified in the command line, obtain the D-Bus path of the image file from the parameter (getService function) for the subsequent image upgrade program to find the image file. If the --skip parameter is specified in the command line, load the partition address information from the JSON configuration file (confFile) (getPartitions function), and the content in certain address blocks can be skipped during the execution of the refresh. If the --type parameter is specified in the command line, identify the type of the image from the parameter.
[0079] Device initialization and verification: Obtain the target device information and source file information, and create a DeviceHandler object to manage the source file (srcHandler) and the target device (dstHandler). Check whether the size of the source file (i.e., the target image file) exceeds the capacity of the target device.
[0080] Block-by-block writing and verification: Process data block by block in the main loop (flashcp function). Among them, the skip logic: If the current address matches the partition configuration in the JSON file, directly skip the specified memory area. The comparison logic: Compare the source and target data block by block (compareOneBlock). If the data is the same, skip the writing; if the data is different, erase the target block, write the new data and perform secondary verification, and then the data block refresh is completed.
[0081] In addition, the progress bar can be updated in real time or the refresh progress can be reported through D-Bus.
[0082] The design concept of the firmware upgrade tool can include:
[0083] Modular design: Achieve function separation. getPartitions processes JSON file configurations, getService processes D-Bus communication to obtain image information, and flashcp implements the core flashing logic. Device operations (read / write / erase) are encapsulated through DeviceHandler. Parameter passing: Use the Param structure to centrally manage running parameters and avoid global variables.
[0084] Data integrity guarantee: Block-level operations, read and write according to the Flash block size (such as 64KB) to ensure that the erase granularity matches the hardware characteristics. Secondary verification, immediately read back and compare after writing (checkOneBlock) to prevent writing errors. Abnormal termination, directly exit abnormally for any verification failure (JSON parsing, data comparison) to avoid damaging the device.
[0085] Performance optimization: Utilize the skip mechanism, skip reserved partitions (such as log areas, BIOS setup options, BIOS logos, etc.) through the --skip parameter to reduce ineffective erasing and writing. Incremental writing, only trigger the erase operation when the data blocks are different to extend the Flash lifespan. Progress feedback, support local terminal progress bars and D-Bus remote notifications (such as sendProgress) to adapt to different deployment scenarios.
[0086] Scalability: Driven by JSON configuration, partition information is defined through an external JSON file (otrd-flash.json), and new hardware can be adapted without recompilation. Hot loading of configuration files, support online reloading of JSON configurations during runtime without shutting down to refresh the BMC firmware. Support for multiple device types, distinguish device types such as BMC and BIOS through the --type parameter, and dynamically load corresponding configurations.
[0087] In this way, through modular design and a strict data verification mechanism, an efficient and reliable embedded device firmware flashing function is achieved. Its core value lies in balancing performance and security, and it is applicable to scenarios with extremely high requirements for system stability (such as industrial control, server BMC). By expanding the JSON configuration or D-Bus interface, different hardware platforms and management systems can be quickly adapted.
[0088] The present invention designs and develops a general firmware upgrade solution that preserves configurations, such as the upgrade of server BIOS firmware. This solution does not require dedicated hardware design and can be implemented based on the OpenBMC software system. By calling the BIOS Flash chip interface, the otrd-flash application program is developed. The program code is compiled through Meson's executable function to build an executable file under Linux, and an application object otrd-flash that can be executed on the command line is created based on the CLI. This tool internally integrates a skip function interface, which has the function of skipping a specified flash memory area. The BMC application layer code can implement the BIOS image refresh while preserving the configuration by executing otrd-flash. Specifically, only by executing otrd-flash in the BMC application layer code and adding the memory area that needs to be skipped, the BIOS configuration refresh while preserving the configuration can be completed. Refreshing the BIOS through this method can not only solve the situation where the server needs to be powered on and off twice before, but also does not require the secondary acquisition of the original BIOS configuration through the H2B bus, reducing the risk of data errors.
[0089] Further, referring to Figure 3 As shown, the embodiment of the present invention provides a schematic diagram of firmware upgrade. Taking the BIOS as an example, the present invention implements a method and tool for upgrading the domestic server BIOS while preserving the configuration. First, the otrd-flash application program needs to be written. This program can implement refreshing an input file to a specified flash device (BIOS flash). This program is packaged into a command-line tool through meson and supports some command-line options, including skipping a specified memory area. Secondly, confirm the addresses of the BIOS Flash storing Setup options, BIOS Logo, and other data that need to be preserved one by one, and write them into the BMC's JSON file to facilitate identifying the address areas that need to be skipped during the refresh. Finally, call the otrd-flash tool in the BMC application layer code for refreshing the BIOS while preserving the configuration. When it is necessary to upgrade the BIOS while preserving the configuration, call this tool and read the memory areas that need to be skipped from the pre-edited JSON file to implement the BIOS refresh while preserving the configuration.
[0090] Further, referring to Figure 4As shown in the figure, an embodiment of the present invention provides a firmware upgrade flowchart. Taking the BIOS as an example, when the server is powered on and booted, the BMC runs normally and the operating system runs normally; the BMC Web interface or other out-of-band tools execute the retention configuration to refresh the BIOS. Upload the BIOS image file to the BMC, and the background judges the server host status and the retention configuration flag bit. If the host is powered on, wait for the host to shut down; if the host is shut down, execute the retention configuration refresh; refresh the BIOS image with the retention configuration, and call the otrd-flash tool; the otrd-flash tool reads the flash storage area that needs to be skipped configured in the JSON file in the corresponding format, and skips this address area during the refresh; after the refresh is completed, wait for the new version of the BIOS to take effect after the machine is powered on, which solves the defect that the current server BMC needs to restart twice when refreshing the BIOS firmware with the retention configuration. By calling the otrd-flash tool, it is possible to skip the memory area that needs to be saved during the BIOS refresh, reducing the workload of R & D, customer service, production line and maintenance personnel and improving work efficiency.
[0091] In this way, it is possible to solve the problem that the retention configuration refresh of the BIOS requires two restarts in the OpenBMC architecture. The present invention utilizes the characteristics of BIOS Flash refresh, adds a judgment on whether to skip the memory address in the original refresh code, and can directly skip certain storage addresses during the refresh. The refresh program generates a command-line execution tool otrd-flash through tools such as the CTL tool and the Meson tool. When refreshing the BIOS with the retention configuration, this tool is directly called. By calling this tool, a certain fixed storage area configured previously can be skipped without performing the refresh, thereby retaining the BIOS configuration during the refresh. This invention solves the problem that the Openbmc architecture needs to restart twice to obtain data from H2B when processing the BIOS retention configuration refresh, and solves the problem that the H2B data transmission may error when obtaining the BIOS configuration for the second time after restart, reducing the workload of R & D personnel for the BIOS retention configuration refresh and improving the work efficiency during the early-stage factory production and later-stage customer service maintenance of the product.
[0092] In addition, the present invention utilizes the skipping of a certain storage address during Flash refresh to achieve the retention of the BIOS configuration. This method can not only be used to implement the retention configuration refresh of the BIOS by the BMC, but also be applied to the refresh operations of other firmware by the BMC and the operations related to the BMC's own refresh.
[0093] Figure 5 The following is a schematic structural diagram of a firmware upgrade device provided by an embodiment of the present invention. An embodiment of the present invention provides a firmware upgrade device, including:
[0094] A monitoring module 51, configured to monitor the host status of the server and the retention configuration flag;
[0095] An acquisition module 52, configured to obtain a target firmware image and load a configuration file corresponding to the target firmware image when the host status is in a shutdown state and the retention configuration flag is a preset value, where the configuration file includes a target memory address area, and the target memory address area is a memory address area corresponding to the retention configuration;
[0096] A flashing module 53, configured to flash the target firmware image to a target memory device based on the configuration file, and skip the target memory address area during the flashing process.
[0097] In an optional implementation manner, the flashing module 53 is specifically configured to:
[0098] Judge whether the current address to be flashed of the target memory device belongs to the target memory address area based on the configuration file;
[0099] If it belongs to the target memory address area, skip the current address to be flashed;
[0100] If it does not belong to the target memory address area, compare the current data block to be flashed in the target firmware image with the data block in the current address to be flashed of the target memory device;
[0101] If the current data block to be flashed is inconsistent with the data block in the current address to be flashed of the target memory device, write the current data block to be flashed to the current address to be flashed;
[0102] If the current data block to be flashed is consistent with the data block in the current address to be flashed of the target memory device, retain the data block in the current address to be flashed and do not flash the current data block to be flashed.
[0103] In an optional implementation manner, the flashing module 53 is further configured to, after writing the current data block to be flashed to the current address to be flashed, read back the current data block to be flashed from the current address to be flashed to obtain a read-back data, and perform a check on the read-back data.
[0104] In an optional implementation manner, the device further includes an exception handling module, configured to:
[0105] When an exception occurs, exit the firmware upgrade;
[0106] Wherein, if the check of the read-back data fails or the parsing of the configuration file fails, it is determined that an exception has occurred, and the configuration file is parsed when the target firmware image is flashed to the target memory device based on the configuration file.
[0107] In an alternative embodiment, the obtaining module 52 may be specifically configured to determine a target image type of a target firmware image based on command parameters; obtain a configuration file corresponding to the target image type, where different image types correspond to different configuration files.
[0108] In an alternative embodiment, the image types include management controller firmware, basic input / output system firmware, complex programmable logic device firmware of a server motherboard, and complex programmable logic device firmware of a system control module board.
[0109] Moreover, in an alternative embodiment, the obtaining module 52 and the flashing module 53 may call a firmware upgrade tool to execute, through the firmware upgrade tool, obtaining a target firmware image and loading a configuration file corresponding to the target firmware image; flashing the target firmware image to a target memory device based on the configuration file, and skipping the target memory address area during the flashing process;
[0110] wherein the firmware upgrade tool is an application object executable at a command line created based on a target executable file, the target executable file is obtained by compiling and building a target application program, and the target application program is created based on an interface function of the target memory device.
[0111] It can be seen that in the embodiment of the present invention, when it is monitored that the server host status is in a shutdown state and the retention configuration flag is a preset value, a target firmware image is obtained and a configuration file corresponding to the target firmware image is loaded, and the target firmware image is flashed to a target memory device based on the configuration file, and the memory address area corresponding to the retention configuration, i.e., the target memory address area, is skipped during the flashing process. In this way, after the flashing is completed and the server is powered on, the new version of the firmware takes effect immediately, without multiple restarts, and the firmware upgrade efficiency can be improved while retaining the configuration.
[0112] Figure 5 For the description of the features in the corresponding embodiments, reference may be made to Figure 1 the relevant descriptions of the corresponding embodiments, which will not be elaborated herein one by one.
[0113] Figure 6 The following is a structural diagram of an electronic device provided by an embodiment of the present invention. As Figure 6 shown, the electronic device includes: a memory 60 for storing a computer program;
[0114] a processor 61 for implementing the steps of the firmware upgrade method in the above embodiment when executing the computer program.
[0115] Among them, the processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 61 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 61 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the central processing unit (CPU); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 61 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 61 may further include an artificial intelligence (AI) processor, and the AI processor is used to process computational operations related to machine learning.
[0116] The memory 60 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 60 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 60 is at least used to store the following computer program 601. After the computer program is loaded and executed by the processor 61, it can implement the relevant steps of the firmware upgrade method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 60 may further include an operating system 602 and data 603, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 602 may include Windows, Unix, Linux, etc. The data 603 may include, but is not limited to, the firmware upgrade method, etc.
[0117] In some embodiments, the electronic device may further include a display screen 62, an input / output interface 63, a communication interface 64, a power supply 65, and a communication bus 66.
[0118] Those skilled in the art can understand that Figure 6 the structure shown in
[0119] It can be understood that if the firmware upgrade method in the above embodiments is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The foregoing storage media include: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, magnetic disks, or optical discs, etc., all of which can store program codes.
[0120] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the firmware upgrade method as described above.
[0121] Next, a computer program product provided by an embodiment of the present invention will be introduced. The computer program product described below can be referred to each other with other embodiments described in this article.
[0122] A computer program product includes computer programs / instructions. When the computer programs / instructions are executed by a processor, they implement the steps of the firmware upgrade method disclosed above.
[0123] The above has introduced in detail a firmware upgrade method, device, equipment, and medium provided by an embodiment of the present invention. The various embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple. For the relevant parts, refer to the description of the method part.
[0124] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0125] The above has introduced in detail a firmware upgrade method, device, equipment and medium provided by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A firmware upgrade method, characterized in that, Including: Monitoring the host status of the server and retaining a configuration flag; When the host status is the shutdown state and the retaining configuration flag is a preset value, obtaining a target firmware image and loading a configuration file corresponding to the target firmware image, where the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the retained configuration; Flashing the target firmware image to a target memory device based on the configuration file and skipping the target memory address area during the flashing process.
2. The firmware upgrade method according to claim 1, wherein Flashing the target firmware image to a target memory device based on the configuration file and skipping the target memory address area during the flashing process, including: Judging whether the current address to be flashed of the target memory device belongs to the target memory address area based on the configuration file; If it belongs to the target memory address area, skipping the current address to be flashed; If it does not belong to the target memory address area, comparing the current data block to be flashed in the target firmware image with the data block in the current address to be flashed of the target memory device; If the current data block to be flashed is inconsistent with the data block in the current address to be flashed of the target memory device, writing the current data block to be flashed to the current address to be flashed; If the current data block to be flashed is consistent with the data block in the current address to be flashed of the target memory device, retaining the data block in the current address to be flashed and not flashing the current data block to be flashed.
3. The firmware upgrade method according to claim 2, wherein After writing the current data block to be flashed to the current address to be flashed, further including: Reading back the current data block to be flashed from the current address to be flashed to obtain a read-back data and performing a check on the read-back data.
4. The firmware upgrade method according to claim 3, characterized in that, Also including: When an exception occurs, exiting the firmware upgrade; Wherein, if the read-back data check fails or the configuration file parsing fails, it is determined that an exception has occurred, and the configuration file is parsed when flashing the target firmware image to the target memory device based on the configuration file.
5. The firmware upgrade method according to claim 1, wherein, Loading the configuration file corresponding to the target firmware image, including: Determining a target image type of the target firmware image based on command parameters; Obtaining the configuration file corresponding to the target image type, where different image types correspond to different configuration files.
6. The firmware upgrade method according to claim 5, wherein The image types include management controller firmware, basic input / output system firmware, complex programmable logic device firmware of a server motherboard, and complex programmable logic device firmware of a system control module board.
7. The firmware upgrade method according to any one of claims 1 to 6, characterized in that, Obtaining a target firmware image and loading the configuration file corresponding to the target firmware image; Flashing the target firmware image to a target memory device based on the configuration file and skipping the target memory address area during the flashing process, including: Invoking a firmware upgrade tool and, through the firmware upgrade tool, executing the steps of obtaining a target firmware image and loading the configuration file corresponding to the target firmware image; flashing the target firmware image to a target memory device based on the configuration file and skipping the target memory address area during the flashing process. Among them, the firmware upgrade tool is an application object that can be executed at the command line and is created based on a target executable file. The target executable file is obtained by compiling and building a target application program, and the target application program is created based on the interface functions of a target memory device.
8. A firmware upgrade device, characterized in that, It includes: A monitoring module, configured to monitor the host status of the server and a reserved configuration flag; An acquisition module, configured to, when the host status is the shutdown state and the reserved configuration flag is a preset value, acquire a target firmware image and load a configuration file corresponding to the target firmware image. Wherein, the configuration file includes a target memory address area, and the target memory address area is the memory address area corresponding to the reserved configuration; A flashing module, configured to flash the target firmware image to the target memory device based on the configuration file and skip the target memory address area during the flashing process.
9. An electronic device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to execute the computer program to implement the steps of the firmware upgrade method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the firmware upgrade method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
An out-of-band firmware upgrade method and device, electronic equipment and storage medium
CN122547387A