Firmware upgrading method and device, electronic equipment and storage medium
By using QEMU virtualization and differential compression technologies, a virtual management controller is constructed to perform firmware simulation verification and differential package upgrades. This solves the problems of compatibility and high operation and maintenance costs during the firmware upgrade process, and achieves efficient firmware upgrades with zero interruption and second-level rollback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2026-03-27
AI Technical Summary
Existing firmware upgrade methods suffer from problems such as poor compatibility, irreversible upgrade failures, high maintenance costs, and difficulties in compatibility testing due to hardware deficiencies, which affect server business processes.
By using QEMU virtualization technology to build a virtual management controller that is consistent with the register level of the target server, firmware simulation verification is performed, differential packets are generated for upgrades, and differential compression technology is used to reduce transmission bandwidth and storage space usage. Combined with hardware reset, zero-interruption upgrades and second-level rollbacks are achieved.
It enables zero-interruption upgrades and second-level rollbacks in scenarios where physical machines are missing or online services are in operation, reducing maintenance costs, improving upgrade efficiency and success rate, and ensuring the continuity and reliability of server services.
Smart Images

Figure CN120929115B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electric digital data processing, and in particular to a firmware upgrading method and device, an electronic device and a storage medium. BACKGROUND
[0002] In related technologies, there are many defects in the firmware upgrading method, for example, firmware and server are incompatible during upgrading, resulting in upgrading failure, firmware selection and server do not match during upgrading, it is difficult to use real machine type for firmware verification and testing, and there is a lack of effective firmware verification mechanism, which is easy to cause server failure during firmware upgrading due to firmware problems, and further affect the business process of the server, and needs to be improved. SUMMARY
[0003] The present application provides a firmware upgrading method and device, an electronic device and a storage medium to at least solve the technical problem that related technologies lack effective firmware verification mechanism, which is easy to cause server failure during firmware upgrading due to firmware problems, and further affect the business process of the server.
[0004] The present application provides a firmware upgrading method applied to a server, wherein the method comprises the following steps: in response to a firmware upgrading instruction, and based on the firmware upgrading instruction, a corresponding firmware simulation instruction is generated; based on the firmware simulation instruction, the state and behavior of the register of the server are simulated to construct a firmware running environment of the server; the to-be-upgraded firmware is run in the firmware running environment to collect running data of the to-be-upgraded firmware, and whether the to-be-upgraded firmware meets a preset verification pass condition is judged according to the running data; if the preset verification pass condition is met, a difference package is generated based on the to-be-upgraded firmware and the corresponding current running firmware in the server to upgrade the corresponding current running firmware in the server by using the difference package.
[0005] The present application also provides a firmware upgrading device applied to a server, wherein the device comprises: a response module for responding to a firmware upgrading instruction and generating a corresponding firmware simulation instruction based on the firmware upgrading instruction; a construction module for simulating the state and behavior of the register of the server based on the firmware simulation instruction to construct a firmware running environment of the server; a verification module for running the to-be-upgraded firmware in the firmware running environment to collect running data of the to-be-upgraded firmware, and judging whether the to-be-upgraded firmware meets a preset verification pass condition according to the running data; an upgrading module for generating a difference package based on the to-be-upgraded firmware and the corresponding current running firmware in the server to upgrade the corresponding current running firmware in the server by using the difference package in the case of meeting the preset verification pass condition.
[0006] The present application also provides an electronic device comprising: a memory for storing a computer program; a processor for executing the computer program to implement the steps of any one of the above firmware upgrading methods.
[0007] The application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program.
[0008] The application further provides a computer program product, which comprises a computer program.
[0009] By the application, the running environment of the simulation server can be used to verify the firmware to be upgraded, and after the verification, the server is controlled to perform the firmware upgrading action, thereby solving the technical problem that in the related art, there is no effective firmware verification mechanism, which easily leads to the server failure due to firmware problems when the firmware is upgraded, and further affects the business process of the server, so that the simulation verification of the firmware is completed before the firmware is upgraded, the upgrading failure caused by firmware incompatibility and the like is avoided, and the differential package is generated in the form, the transmission bandwidth and the storage space occupation are reduced, and the upgrading efficiency and the upgrading success rate are improved. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0011] Figure 1 A flowchart of a firmware upgrading method provided by an embodiment of the application is shown in FIG. 1;
[0012] Figure 2 A flowchart of verification of firmware to be upgraded provided by an embodiment of the application is shown in FIG. 2;
[0013] Figure 3 A flowchart of differential compression provided by an embodiment of the application is shown in FIG. 3;
[0014] Figure 4 A principle schematic diagram of a firmware upgrading method provided by an embodiment of the application is shown in FIG. 4;
[0015] Figure 5 A flowchart of a firmware upgrading method provided by an embodiment of the application is shown in FIG. 5;
[0016] Figure 6 A structural schematic diagram of a firmware upgrading device provided by an embodiment of the application is shown in FIG. 6. DETAILED DESCRIPTION
[0017] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0018] It should be noted that, in the description of the present application, the terms "comprise", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms "first", "second" and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0019] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0020] It can be understood that, with the explosive growth of cloud computing, big data and AI computing power, 7x24 hours online of data center servers has become the norm. The vulnerability repair and new function iteration demand of BIOS (Basic Input Output System, Basic Input Output System), BMC (Baseboard Management Controller, Baseboard Management Controller) or CPLD (Complex Programmable Logic Device, Complex Programmable Logic Device) firmware are increasing. The firmware upgrading method in the related art has the following pain points: for example, the downtime is long, and the out-of-band upgrade needs to be cold started for 3-10 minutes. The in-band kexec restart is still interrupted for 30-120 seconds. Failure is not rollbackable: after upgrade failure, manual re-writing is required, and the RTO (Recovery Time Objective) is uncontrollable. Poor compatibility: ARM (Advanced RISC Machine, Advanced RISC Machine), x86 (x86 architecture or x86 instruction set), RISC-V (Reduced Instruction Set Computing - V, Reduced Instruction Set Computing - V), server firmware upgrade tool chain is not unified, and the operation and maintenance cost is high. Hardware loss leads to difficulty in compatibility testing: real machine models are out of stock or discontinued, and physical machines cannot be obtained for regression testing.
[0021] To solve the above problems, the embodiment of the present application can use QEMU (Quick Emulator, virtual machine emulator) virtualization technology to construct a virtual management controller (shadow BMC) consistent with the register level of the target server, that is, the virtual structure constructed can accurately copy the state and behavior of each CPU register in the real physical server, so that the software (especially the operating system) running in the virtual environment cannot distinguish whether it is running in the virtual environment or running on the real physical hardware.
[0022] And through the simulation operation of the firmware upgrade by the virtual management controller, the firmware is verified in advance, and after the verification, the difference is compressed, and then the difference data is hot written into the standby firmware partition in the millisecond window of the server memory freeze, and the atomic switching is completed through a 200 ms hardware reset, so that zero interruption upgrade and second-level rollback in the entity machine missing or online business scene are realized.
[0023] Specifically, as shown in Figure 1 The embodiment of the present application provides a firmware method applied to a server, wherein the method comprises the following steps:
[0024] In step S101, in response to a firmware upgrade instruction, a corresponding firmware simulation instruction is generated based on the firmware upgrade instruction.
[0025] In the actual execution process, the embodiment of the present application can use the virtual management controller constructed by using the QEMU virtualization technology and consistent with the register level of the server to be upgraded as the basis to verify the firmware to be upgraded, that is, the firmware to be upgraded.
[0026] For example, after receiving the firmware to be upgraded for firmware upgrade or the upgrade indication input by the user, it is determined that the server receives the firmware upgrade instruction, at this time, the corresponding firmware simulation instruction can be generated to simulate the running state of the server by using the virtual management controller.
[0027] In step S102, the state and behavior of the register of the server are simulated based on the firmware simulation instruction to construct the firmware running environment of the server.
[0028] The virtual management controller can simulate the BMC function of the server to be upgraded, including the IPMI / Redfish interface, hardware monitoring and other functions. The running state of the server is simulated by using the virtual management controller, so that the simulation upgrade of the firmware to be upgraded is carried out in the environment simulated by the virtual management controller, so as to avoid that the firmware to be upgraded which cannot be compatible or has other faults is directly run on the server.
[0029] In step S103, the to-be-upgraded firmware is run in the firmware running environment to collect running data of the to-be-upgraded firmware, and whether the to-be-upgraded firmware meets a preset verification passing condition is determined according to the running data.
[0030] Embodiments of the present application can run the to-be-upgraded firmware in a running environment simulated by a virtual management controller, and perform compatibility testing and function verification.
[0031] The purpose of the compatibility testing is to ensure that the to-be-upgraded firmware can work with existing hardware, software and management ecosystem; the testing items can include hardware compatibility testing (component compatibility, firmware interaction compatibility, sensor compatibility, etc.), software compatibility testing (operating system compatibility, management tool compatibility, etc.), and protocol and security testing (encryption algorithm compatibility, authentication method compatibility, certificate compatibility, etc.).
[0032] The purpose of the function verification is to ensure that all functions of the to-be-upgraded firmware, including regression of old functions and implementation of new functions, meet the design requirements and expectations; the verification items can include security verification, fault verification, boundary verification, performance verification, etc.
[0033] Specifically, the compatibility testing and the function verification can be set according to the corresponding structures and functions of the to-be-upgraded server and the to-be-upgraded firmware, which are not limited here.
[0034] Further, according to the test data of the compatibility testing and the function verification, i.e., the running data of the firmware, whether the to-be-upgraded firmware meets the passing condition is determined, for example, a corresponding data threshold or data standard can be set according to the expected upgrade target of the to-be-upgraded firmware, and comparison is made on this basis to determine whether it meets the requirements of the data threshold or data standard.
[0035] In step S104, if the preset verification passing condition is met, a difference package is generated based on the to-be-upgraded firmware and the corresponding current running firmware in the server, so as to upgrade the corresponding current running firmware in the server by using the difference package.
[0036] After verifying the compatibility and function of the to-be-upgraded firmware, embodiments of the present application can generate a difference package according to the difference between the to-be-upgraded firmware (to-be-upgraded firmware) and the current running firmware of the server to be upgraded, and send the difference package to the server by difference compression, for example, by using the RDMA (Remote Direct Memory Access) technology to transmit the difference package from the S-Master to the memory of the server, so that the server can perform firmware upgrade according to the difference package, greatly reducing the transmission bandwidth and storage space occupation.
[0037] Optionally, in an embodiment of the present application, the generating the differential package based on the to-be-upgraded firmware and the corresponding current running firmware in the server comprises: calculating a difference rate between the to-be-upgraded firmware and the current running firmware; judging whether the difference rate is less than a preset difference threshold; if the difference rate is less than the difference threshold, generating the differential package, otherwise, generating a full-amount image of the to-be-upgraded firmware to upgrade the current running firmware by using the full-amount image.
[0038] Specifically, the embodiment of the present application can calculate the difference between the new firmware (to-be-upgraded firmware) and the current running firmware (old firmware) of the server that needs to be upgraded, that is, the difference between the new and old firmware.
[0039] Wherein, the difference rate=(image_new-image_old) / image_old.
[0040] And according to the difference threshold, such as 60%, whether the differential compression can be performed is judged. For example, the embodiment of the present application can indicate that the difference between the two versions of firmware is large and the complexity of the differential package is large in the case of difference rate>60%, it is difficult to ensure that there is no subtle error in the process of differential compression, and it is easy to produce damaged differential package, so the server is difficult to realize effective upgrade according to the damaged differential package, therefore, the embodiment of the present application can reduce the risk by using the full-amount image with higher reliability, in the case of difference rate≤60%, the embodiment of the present application can generate the differential package by using the bsdiff+LZ4 algorithm compression, and the size of the differential package is usually much smaller than the complete firmware image, thereby greatly reducing the transmission bandwidth and storage space occupation.
[0041] Optionally, in an embodiment of the present application, the upgrading the corresponding current running firmware in the server by using the differential package comprises: restoring the to-be-upgraded firmware based on the differential package and the current running firmware; running the to-be-upgraded firmware to complete the firmware upgrade instruction.
[0042] After completing the verification of the to-be-upgraded firmware, the embodiment of the present application can send the generated differential package to the corresponding area in the server to reconstruct the to-be-upgraded firmware by combining the differential package and the current running firmware, and then complete the firmware upgrade by the to-be-upgraded firmware obtained by reconstruction, and the data transmission by the differential package can greatly reduce the transmission bandwidth and storage space occupation, thereby improving the firmware upgrade efficiency.
[0043] Optionally, in an embodiment of the present application, before upgrading the corresponding current running firmware in the server by using the differential package, it further comprises: obtaining the structure data of the server; judging whether there is a first flash partition for storing the current running firmware and a second flash partition for storing the to-be-upgraded firmware in the server based on the structure data.
[0044] In actual implementation, the embodiment of the application needs to perform hardware checking on the server to ensure that the server supports SPI-NOR dual-partition, so as to store the current running firmware and the firmware to be upgraded independently through different two flash memory partitions, such as Bank A and Bank B, so as to subsequently perform flash memory partition switching, realize no-sense upgrading, improve upgrading efficiency, and reduce the influence of firmware upgrading on service continuity.
[0045] Optionally, in an embodiment of the application, the corresponding current running firmware in the server is upgraded by using the differential package, including: switching the startup partition of the server to the second flash memory partition, and generating a reset signal; controlling the server to perform a corresponding hardware reset action by using the reset signal, so that the running environment of the firmware to be upgraded meets the preset startup condition, and the service running before upgrading is restored.
[0046] Before upgrading, the embodiment of the application can enable KVM_DIRTY_RING on the server to mark the dirty page in the memory. The service process of the server is paused through cgroup freezer to ensure that the memory data remains stable during the synchronization process. The differential package is transmitted from the S-Master to the memory of the server through the RDMA technology. The RDMA technology can provide high-speed and low-delay data transmission to ensure the efficiency of the synchronization process. Further, the embodiment of the application can store the firmware to be upgraded in a flash memory partition different from the current running firmware, so as to subsequently perform firmware upgrading.
[0047] The embodiment of the application can switch the running partition to the flash memory partition storing the firmware to be upgraded, run the firmware to be upgraded as the new firmware of the server, and make the electronic control unit start from the new firmware to complete the firmware upgrading.
[0048] After completing the data transmission and the reconstruction of the firmware to be upgraded, the embodiment of the application can unfreeze the service process of the server to restore normal service running, complete the memory hot synchronization, reduce the influence of firmware upgrading on service continuity, and avoid the probability that the service process is affected during the data synchronization process, thereby increasing the stability of service running.
[0049] Optionally, in an embodiment of the present application, before upgrading the corresponding current running firmware in the server using the differential package, the following steps are further included: obtaining the hardware model, current firmware version, current hardware sensor data and current operation business data of the server; inputting the hardware model, current firmware version, current hardware sensor data and current operation business data into a pre-constructed upgrade success probability prediction model to predict the current upgrade success rate of the server, wherein the upgrade success probability prediction model is trained by the hardware model, historical upgrade difference rate, historical hardware sensor data, historical operation business data and corresponding historical upgrade success record of the server; and in the case that the current upgrade success rate is greater than a preset success rate threshold, responding to the firmware upgrade instruction.
[0050] It can be understood that in some cases with high load, the firmware upgrade of the server may cause the server to malfunction, thereby resulting in upgrade failure. Therefore, in some embodiments, in order to reduce the probability of upgrade failure, the firmware upgrade can be evaluated for success in advance, and then the appropriate upgrade time is determined.
[0051] The hardware model, current running firmware version, historical upgrade success / failure record, hardware sensor data (temperature, voltage, error counter, etc.), business load period and other data of the server can be obtained.
[0052] The hardware model, current running firmware version, historical upgrade success / failure record, hardware sensor data (temperature, voltage, error counter, etc.), business load period and other data of the server are used to construct a nonlinear data relationship between the upgrade success result and the hardware, the difference (such as the difference rate) between the new and old firmware versions, the sensor data and the business load, i.e., to train an upgrade success probability prediction model.
[0053] Based on the nonlinear data relationship, the upgrade success probability can be determined based on the current upgrade data such as the complexity of the differential package, the hardware model, the sensor data and the business load, so that in the case of low success rate, the direct upgrade is prohibited, and the success rate is calculated in real time according to the dynamic change data of the server until the success rate reaches the standard, and then the firmware upgrade is performed.
[0054] Optionally, in an embodiment of the present application, before upgrading the corresponding current running firmware in the server using the differential package, the following steps are further included: in the case that the current upgrade success rate is less than or equal to a preset success rate threshold, simulating the current upgrade environment of the server; in the current upgrade environment, simulating the upgrade process of the to-be-upgraded firmware to obtain simulation upgrade data; analyzing the simulation upgrade data to obtain the upgrade failure reason; based on the upgrade failure reason, generating a corresponding upgrade path to complete the firmware upgrade instruction based on the upgrade path.
[0055] The embodiment of the present application can control the simulation server of the simulation management controller according to the current state data of the server to simulate the current upgrade environment of the server, compare the success and failure node data, and perform correlation analysis to determine the cause of the upgrade failure, so that the server can determine the safe upgrade path again according to the cause of the upgrade failure, for example, version A to version D may be high risk, but version A-version B-version C-version D may be safe, at this time, simulation can be performed on the simulation management controller, and whether the safe upgrade path is reliable is determined according to the simulation result. In the case of reliability, the server is controlled to complete the upgrade according to the safe upgrade path.
[0056] Optionally, in an embodiment of the present application, it also includes: checking the firmware version in the server to determine whether the server meets the preset successful startup condition; if the preset successful startup condition is not met, rolling back to the current running firmware to make the server meet the preset available condition.
[0057] In some embodiments, after the firmware upgrade, the business process can be reset, and the version check can be performed within a certain time after the reset, such as within 5 s after the reset, to confirm whether the new firmware (the current running new firmware after the server startup of the to-be-upgraded firmware) is successfully started. If the new firmware fails to start, the old firmware (the firmware running on the server before the upgrade of the to-be-upgraded firmware) is rolled back within 15 s to ensure that the system is always in an available state.
[0058] Optionally, in an embodiment of the present application, before rolling back to the current running firmware, it also includes: in response to a rollback simulation request, simulating a fault running state of the server under the condition that the preset successful startup condition is not met; in the fault running state, rolling back to the current running firmware to obtain a rollback result; based on the rollback result, completing the server rollback action or triggering an upgrade failure prompt.
[0059] Before the rollback is needed, the embodiment of the present application can back up the current BIOS and BMC firmware to perform the rollback when needed, so as to avoid that after the upgrade failure, the server cannot be normally used, thereby causing the operation business to be stalled for a long time and affecting the work efficiency.
[0060] The embodiment of the present application can also use the simulation management controller to perform simulation to determine whether the server can be normally rolled back in the current state, so as to avoid that when the server cannot be normally rolled back, the server is rolled back, thereby causing more faults of the server.
[0061] Firstly, the server can send the current state of the server, such as hardware state: CPU microcode version, memory SPD data, PCIe device ID and state, sensor readings (temperature, voltage); firmware state: metadata of new and old firmware, value of rollback counter; error log, to the virtual management controller, to simulate the current running environment of the server, and on this basis, try to roll back to determine the rollback result.
[0062] If the current running firmware can be successfully started and stably run, the server is allowed to roll back, and if it cannot be successfully started and stably run, a prompt is generated for timely maintenance.
[0063] Further, in combination with Figures 2 to 5 As shown in FIG. 1, the working principle of the firmware upgrade method of the embodiment of the present application is described in an embodiment.
[0064] Among them, Figure 2 And Figure 3 For the process of generating the verification and differential package of the firmware to be upgraded by the virtual management controller, Figure 4 And Figure 5 For the process of firmware upgrade.
[0065] As shown in FIG. 2, in step S201, the virtual management controller can be constructed based on the server parameters to be compatible and the configuration document, to construct the simulation running environment of the firmware. Figure 2
[0066] In step S202, it is judged whether the firmware to be upgraded passes the verification, that is, the compatibility and function of the firmware to be upgraded are verified, and if it passes the verification, it enters step S203 and enters step S204.
[0067] In step S203, a differential package is generated based on the difference between the firmware to be upgraded and the current running firmware of the server, to be pushed to the server for firmware upgrade.
[0068] In step S204, the process is ended, and an alarm is given to remind that the firmware to be upgraded does not meet the upgrade requirement.
[0069] As shown in FIG. 3, the differential compression process is further described. Figure 3
[0070] Step S301, the difference rate of the firmware to be upgraded and the current running firmware of the server is calculated.
[0071] Step S302, it is judged whether the difference rate is less than a certain threshold, such as whether ≤60%, if the difference rate ≤60%, it enters step S303, otherwise, it enters step S304.
[0072] At step S303, the embodiment of the present application can generate a difference package by compression through the bsdiff + LZ4 algorithm. The size of the difference package is usually much smaller than that of the complete firmware image, thereby greatly reducing the transmission bandwidth and storage space occupation.
[0073] At step S304, the complexity of the difference package is large, and it is difficult to ensure that no subtle errors occur in the process of difference compression. Damaged difference packages are prone to occur, and the server is difficult to implement effective upgrade according to the damaged difference package. Therefore, the embodiment of the present application can use a full-amount image with higher reliability to reduce the risk.
[0074] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.
[0075] Further, the architecture of the embodiment of the present application can be as shown in Figure 4 The virtual management controller consistent with the server register level is constructed by using the virtualization technology, the new firmware is run on the virtual management controller, and compatibility test and function verification are performed. If the verification is passed, the next step is entered; if the verification fails, the upgrade process is terminated and an alarm is given. Then, the difference between the new and old firmware is calculated, a difference package is generated, the difference package is transmitted from the S-Master (upgrade control node) to the memory of the server through the RDMA technology, and atomic switching is performed. Finally, version checking after upgrade is performed to confirm whether the new firmware is successfully started. If the new firmware fails to start, the old firmware is rolled back to ensure that the system of the server is always in a usable state.
[0076] On this basis, as shown in Figure 5 The embodiment of the present application can include the following steps:
[0077] At step S501, the embodiment of the present application can construct a virtual management controller based on the parameters of the server to be compatible and the configuration document. The embodiment of the present application can prepare an S-Master, which can be a small host or a container of x86 architecture. It is ensured that it has sufficient computing power to run the QEMU virtualization environment, and is equipped with a high-speed network interface to support RDMA communication. A Linux operating system (such as Ubuntu 22.04) is installed on the S-Master, and it is ensured that the following software packages are installed: QEMU: used for constructing a virtual management controller. rdma-core: used for RDMA communication. ipmitool: used for interacting with the BMC. bsdiff4 and lz4: used for difference compression.
[0078] Server preparation: Hardware check: Ensure the server supports SPI-NOR dual partition and has a USB-NCSI or PCIe-GPIO interface for bridge connection. Firmware backup: Backup the current BIOS and BMC firmware before upgrading to facilitate rollback when needed.
[0079] Step S502, determine whether the firmware to be upgraded is verified.
[0080] The embodiment of the application can extract hardware parameters to obtain the parameters of the server: obtain the official configuration document (HTML / PDF format) of the server from the server manufacturer. Use regular expressions to extract hardware parameters from the configuration document, including CPU model, memory capacity, hard disk model, RAID card model, etc. Store these parameters as a JSON file for subsequent processing and comparison.
[0081] QEMU configuration: Configure QEMU on S-Master according to the extracted hardware parameters to build a virtual management controller consistent with the target server register level.
[0082] Run QEMU to start the virtual management controller and ensure that it can start normally and run the firmware to be upgraded (firmware to be upgraded / new firmware).
[0083] Function verification: Run a series of compatibility tests and function verification scripts on the virtual management controller to ensure that the new firmware works normally. Check if the hardware devices can be normally recognized and run. Test network connection, storage device, RAID function, etc. Verify whether the IPMI / Redfish interface of the BMC can work normally.
[0084] Performance test: Run performance test scripts to ensure that the new firmware does not have significant performance degradation.
[0085] Result evaluation: If all tests pass, the virtual management controller verification is successful, and the next step can be entered; if the test fails, the firmware needs to be adjusted or repaired.
[0086] Step S503, generate a difference package.
[0087] Use bsdiff to calculate the binary difference of the BIOS area before and after the upgrade, and then compress it with LZ4
[0088] When the difference rate is ≤60%, the difference package is <1 MB; when the difference rate is >60%, automatically fallback to full image hot write.
[0089] Step S504, end the process.
[0090] Step S505, memory hot synchronization.
[0091] Embodiments of the present application can enable KVM_DIRTY_RING on the server to mark dirty pages in memory. By suspending the business process of the target server through the cgroup freezer, the memory data is ensured to remain stable during synchronization. The differential package is transmitted from the S-Master to the memory of the server through the RDMA technology. After completing the data transmission, the business process of the server is unfrozen to restore normal business operation.
[0092] Step S506, atomic switching.
[0093] Embodiments of the present application can perform dual-partition switching based on the structure of the server to realize inductive upgrading.
[0094] Embodiments of the present application can ensure that the SPI-NOR flash memory of the server is divided into two partitions of Bank A and Bank B, which are used to store old firmware and new firmware respectively.
[0095] The IPMI OEM command is sent to the BMC through the bridge to set the Boot_Select bit and select the new firmware partition.
[0096] The PLTRST# low-level 200 ms reset signal is triggered to make the CPU start from the new firmware. During the reset process, the DDR memory enters the self-refresh mode to maintain the OS context, ensuring that the business process can quickly recover after the reset.
[0097] Step S507, after upgrading, version checking is performed to determine whether the start is successful.
[0098] Within 5 seconds after the reset, the SMBIOS Type 0 version number is read from the server to confirm whether the new firmware is successfully started. The read version number is compared with the expected new version number to ensure consistency.
[0099] Step S508, rollback fuse.
[0100] If the version checking fails, it indicates that the new firmware fails to start successfully.
[0101] The IPMI OEM command is sent to the BMC through the bridge again to set the Boot_Select bit and select the old firmware partition. The PLTRST# low-level 200 ms reset signal is triggered again to make the CPU start from the old firmware and restore to the state before upgrading.
[0102] Step S509, end process.
[0103] In summary, the embodiment of the present application can perform firmware non-inductive upgrading based on the virtual management controller, and perform four-step closed loop of "virtual management controller verification + differential hot writing + atomic switching + rollback fuse" according to the server parameters. The complete firmware non-inductive upgrading process includes virtual management controller verification, differential compression and hot synchronization, atomic switching and rollback fuse. These steps not only ensure the efficiency and reliability of the upgrading process, but also greatly reduce the business downtime and operation and maintenance costs.
[0104] Through the embodiment of the present application, zero interruption upgrading can be ensured by the virtual management controller verification and memory hot synchronization technology, business downtime is reduced, a fast and reliable rollback mechanism is provided, efficient differential compression is achieved, multiple architecture servers are compatible, operation and maintenance costs are reduced, the availability and reliability of the system are improved, the security and integrity of the data are enhanced, only the differential data between the old and new versions is transmitted through differential compression, the transmission bandwidth and storage space occupation are greatly reduced, the system can be automatically rolled back to the old version in a short period of time when upgrading fails, without manual intervention, and the system is always in an available state.
[0105] These advantages have significant innovation and practicality in the field of server firmware upgrading, and are particularly suitable for scenarios with extremely high requirements for business continuity and system reliability.
[0106] As shown in Figure 6 The embodiment of the present application further provides a firmware upgrading device applied to a server, wherein the device 10 comprises a first response module 100, a construction module 200, a verification module 300 and an upgrading module 400.
[0107] Specifically, the first response module 100 is configured to respond to a firmware upgrading instruction and generate a corresponding firmware simulation instruction based on the firmware upgrading instruction.
[0108] The construction module 200 is configured to simulate the state and behavior of the register of the server based on the firmware simulation instruction, so as to construct a firmware running environment of the server.
[0109] The verification module 300 is configured to run the to-be-upgraded firmware in the firmware running environment, collect running data of the to-be-upgraded firmware, and determine whether the to-be-upgraded firmware meets a preset verification pass condition according to the running data.
[0110] The upgrading module 400 is configured to generate a differential package based on the to-be-upgraded firmware and the corresponding current running firmware in the server when the preset verification pass condition is met, so as to upgrade the corresponding current running firmware in the server by using the differential package.
[0111] Optionally, in an embodiment of the present application, the upgrading module 400 comprises a calculation unit, a judgment unit and a generation unit.
[0112] The calculation unit is configured to calculate a difference rate between the to-be-upgraded firmware and the currently running firmware.
[0113] The judgment unit is configured to judge whether the difference rate is less than a preset difference threshold.
[0114] The generation unit is configured to generate a differential package when the difference rate is less than the difference threshold, or generate a full-amount image of the to-be-upgraded firmware, so as to upgrade the currently running firmware by using the full-amount image.
[0115] Optionally, in an embodiment of the present application, the upgrade module 400 comprises a restoration unit and a running unit.
[0116] The restoration unit is configured to restore the to-be-upgraded firmware based on the differential package and the currently running firmware.
[0117] The running unit is configured to run the to-be-upgraded firmware to complete the firmware upgrade instruction.
[0118] Optionally, in an embodiment of the present application, the upgrade module 400 comprises a verification unit and a first rollback unit.
[0119] The verification unit is configured to verify a firmware version in the server to judge whether the server satisfies a preset successful startup condition.
[0120] The first rollback unit is configured to rollback to the currently running firmware to make the server satisfy a preset available condition when the server does not satisfy the preset successful startup condition.
[0121] Optionally, in an embodiment of the present application, the upgrade module 400 further comprises a first simulation unit, a second rollback unit and an execution unit.
[0122] The first simulation unit is configured to simulate a fault running state of the server when the server does not satisfy the preset successful startup condition in response to a rollback simulation request.
[0123] The second rollback unit is configured to rollback to the currently running firmware to obtain a rollback result in the fault running state.
[0124] The execution unit is configured to complete a server rollback action or trigger an upgrade failure prompt based on the rollback result.
[0125] Optionally, in an embodiment of the present application, the firmware upgrade device 20 further comprises a first acquisition module and a judgment module.
[0126] The first acquisition module is configured to acquire structure data of the server.
[0127] A judging module is configured to judge, based on the structure data, whether the server has a first flash memory partition for storing the current running firmware and a second flash memory partition for storing the firmware to be upgraded.
[0128] Optionally, in an embodiment of the present application, the upgrading module 400 comprises a switching unit and a resetting unit.
[0129] The switching unit is configured to switch the starting partition of the server to the second flash memory partition and generate a resetting signal.
[0130] The resetting unit is configured to control the server to perform a corresponding hardware resetting action by using the resetting signal, so that the running environment of the firmware to be upgraded meets a preset starting condition and the server resumes the service running before the upgrading.
[0131] Optionally, in an embodiment of the present application, the firmware upgrading device 20 further comprises a second acquisition module, a prediction module and a second response module.
[0132] The second acquisition module is configured to acquire the hardware model, the current firmware version, the current hardware sensor data and the current running service data of the server.
[0133] The prediction module is configured to input the hardware model, the current firmware version, the current hardware sensor data and the current running service data into a pre-constructed upgrading success probability prediction model to predict the current upgrading success rate of the server, wherein the upgrading success probability prediction model is trained by the hardware model, the historical upgrading difference rate, the historical hardware sensor data, the historical running service data and the corresponding historical upgrading success record of the server.
[0134] The second response module is configured to respond to the firmware upgrading instruction in a case where the current upgrading success rate is greater than a preset success rate threshold.
[0135] Optionally, in an embodiment of the present application, the firmware upgrading device 20 further comprises a first simulation module, a second simulation module, an analysis module and a generation module.
[0136] The first simulation module is configured to simulate the current upgrading environment of the server in a case where the current upgrading success rate is less than or equal to the preset success rate threshold.
[0137] The second simulation module is configured to simulate the upgrading process of the firmware to be upgraded in the current upgrading environment to obtain simulation upgrading data.
[0138] The analysis module is configured to analyze the simulation upgrading data to obtain an upgrading failure reason.
[0139] The generation module is configured to generate a corresponding upgrading path based on the upgrading failure reason to complete the firmware upgrading instruction based on the upgrading path.
[0140] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, the memory storing a computer program, and the processor being configured to execute the computer program to perform the steps in any of the above-mentioned firmware upgrade method embodiments.
[0141] An embodiment of the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program is configured to perform the steps in any of the above-mentioned firmware upgrade method embodiments when executed.
[0142] In an example embodiment, the above-mentioned computer readable storage medium can include, but is not limited to, a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media capable of storing a computer program.
[0143] An embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps in any of the above-mentioned firmware upgrade method embodiments.
[0144] An embodiment of the present application further provides another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in any of the above-mentioned firmware upgrade method embodiments.
[0145] Those skilled in the art can further appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0146] The above describes in detail the firmware upgrading method, device, electronic equipment and storage medium provided by the present application. The principles and implementation manners of the present application are described by applying specific examples, and the above description of the embodiments is only applicable to help understand the method of the present application and its core idea. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, the present application can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A firmware upgrade method, characterized in that, Applied to a server, the method includes the following steps: In response to a firmware upgrade command, a corresponding firmware simulation command is generated based on the firmware upgrade command; The firmware simulation instructions are used to simulate the state and behavior of the server's registers in order to construct the server's firmware runtime environment. Run the firmware to be upgraded in the firmware running environment to collect the running data of the firmware to be upgraded, and determine whether the firmware to be upgraded meets the preset verification pass conditions based on the running data; If the preset verification conditions are met, a differential package is generated based on the firmware to be upgraded and the corresponding currently running firmware in the server, so as to upgrade the corresponding currently running firmware in the server using the differential package.
2. The firmware upgrade method according to claim 1, characterized in that, The process of generating a differential package based on the firmware to be upgraded and the corresponding currently running firmware in the server includes: Calculate the difference rate between the firmware to be upgraded and the currently running firmware; Determine whether the difference rate is less than a preset difference threshold; If the difference is less than the threshold, the differential package is generated; otherwise, a full image of the firmware to be upgraded is generated to upgrade the currently running firmware using the full image.
3. The firmware upgrade method according to claim 1, characterized in that, Upgrading the corresponding currently running firmware in the server using the differential packet includes: The firmware to be upgraded is restored based on the differential packet and the currently running firmware; Run the firmware to be upgraded to complete the firmware upgrade command.
4. The firmware upgrade method according to claim 1, characterized in that, Also includes: Verify the firmware version in the server to determine whether the server meets the preset successful startup conditions; If the preset successful startup conditions are not met, the system will roll back to the currently running firmware so that the server meets the preset availability conditions.
5. The firmware upgrade method according to claim 4, characterized in that, Before rolling back to the currently running firmware, the following is also included: In response to a rollback simulation request, simulate the server's fault operation state when the preset successful startup conditions are not met; In the faulty operating state, roll back to the currently running firmware to obtain the rollback result; Based on the rollback result, complete the server rollback operation or trigger an upgrade failure notification.
6. The firmware upgrade method according to claim 1, characterized in that, Before upgrading the corresponding currently running firmware in the server using the differential package, the process also includes: Obtain the structural data of the server; Based on the structure data, it is determined whether the server has a first flash partition for independently storing the currently running firmware and a second flash partition for storing the firmware to be upgraded.
7. The firmware upgrade method according to claim 6, characterized in that, Upgrading the corresponding currently running firmware in the server using the differential packet includes: The server's boot partition is switched to the second flash memory partition, and a reset signal is generated; The reset signal is used to control the server to perform a corresponding hardware reset action so that the operating environment of the firmware to be upgraded meets the preset startup conditions and restores the services that the server was running before the upgrade.
8. The firmware upgrade method according to claim 1, characterized in that, Before upgrading the corresponding currently running firmware in the server using the differential package, the process also includes: Obtain the server's hardware model, current firmware version, current hardware sensor data, and current running business data; The hardware model, the current firmware version, the current hardware sensor data, and the current running service data are input into a pre-built upgrade success probability prediction model to predict the current upgrade success rate of the server. The upgrade success probability prediction model is trained by the server's hardware model, historical upgrade difference rate, historical hardware sensor data, historical running service data, and corresponding historical upgrade success records. If the current upgrade success rate is greater than a preset success rate threshold, respond to the firmware upgrade command.
9. The firmware upgrade method according to claim 8, characterized in that, Before upgrading the corresponding currently running firmware in the server using the differential package, the process also includes: If the current upgrade success rate is less than or equal to the preset success rate threshold, simulate the current upgrade environment of the server; In the current upgrade environment, the upgrade process of the firmware to be upgraded is simulated to obtain simulated upgrade data; Analyze the simulated upgrade data to determine the reasons for upgrade failure; Based on the reasons for the upgrade failure, a corresponding upgrade path is generated, and the firmware upgrade instruction is completed based on the upgrade path.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the firmware upgrade method as described in any one of claims 1 to 9 when executing the computer program.
Citation Information
Patent Citations
Simulation device and method for firmware system, storage medium and electronic equipment
CN115878267A
Simulation method, model, electronic equipment and storage medium
CN117634369A