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 upgrades. This solves the compatibility and rollback issues during the firmware upgrade process, achieving zero-interruption upgrades and second-level rollbacks, reducing maintenance costs, and improving upgrade efficiency and success rate.
Patent Information
- Application Number
- CN202511438210.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing firmware upgrade methods suffer from poor compatibility, irreversible upgrade failures, high maintenance costs, and difficulties in compatibility testing due to hardware deficiencies, all of 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 upgrade, and zero-interruption upgrade and second-level rollback are achieved by combining differential compression and atomic switching technology.
It enables zero-interruption upgrades and second-level rollbacks in scenarios where physical machines are missing or online business scenarios, reducing operation and maintenance costs, improving upgrade efficiency and success rate, and ensuring the continuity and reliability of server business.
Smart Images

Figure CN120929115A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic digital data processing technology, and in particular to firmware upgrade methods, apparatus, electronic devices, and storage media. Background Technology
[0002] In related technologies, firmware upgrade methods have many shortcomings. For example, firmware incompatibility with the server can lead to upgrade failures, the selected firmware may not match the server, and it is difficult to use real machine models for firmware verification and testing. The lack of an effective firmware verification mechanism can easily cause server failures due to firmware problems during firmware upgrades, thereby affecting the server's business processes. These issues urgently need to be addressed. Summary of the Invention
[0003] This invention provides a firmware upgrade method, apparatus, electronic device, and storage medium to at least solve the technical problem in related technologies where the lack of an effective firmware verification mechanism easily leads to server failures due to firmware issues during firmware upgrades, thereby affecting the server's business processes.
[0004] This invention provides a firmware upgrade method applied to a server. The method includes the following steps: responding to a firmware upgrade command and generating a corresponding firmware simulation command based on the firmware upgrade command; simulating the state and behavior of the server's registers based on the firmware simulation command to construct a firmware runtime environment for the server; running the firmware to be upgraded in the firmware runtime environment to collect runtime data of the firmware to be upgraded, and determining whether the firmware to be upgraded meets preset verification conditions based on the runtime data; if the preset verification conditions are met, generating a differential packet based on the firmware to be upgraded and the corresponding currently running firmware in the server to upgrade the corresponding currently running firmware in the server using the differential packet.
[0005] The present invention also provides a firmware upgrade device applied to a server, wherein the device includes: a response module, used to respond to a firmware upgrade command and generate corresponding firmware simulation commands based on the firmware upgrade command; a construction module, used to simulate the state and behavior of the server's registers based on the firmware simulation commands to construct the server's firmware runtime environment; a verification module, used to run the firmware to be upgraded in the firmware runtime 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; and an upgrade module, used to generate a differential packet based on the firmware to be upgraded and the corresponding currently running firmware in the server when the preset verification pass conditions are met, so as to upgrade the corresponding currently running firmware in the server using the differential packet.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above firmware upgrade methods.
[0007] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described firmware upgrade methods.
[0008] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described firmware upgrade methods.
[0009] This application utilizes a simulated server operating environment to verify the firmware to be upgraded. After successful verification, the server is controlled to perform the firmware upgrade. This solves the technical problem in related technologies where the lack of an effective firmware verification mechanism easily leads to server failures due to firmware issues during firmware upgrades, thus affecting the server's business processes. By simulating firmware verification before the upgrade, upgrade failures caused by firmware incompatibility and other issues can be avoided. Furthermore, by generating differential packets, the bandwidth and storage space usage can be reduced, improving upgrade efficiency and success rate. Attached Figure Description
[0010] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart of a firmware upgrade method provided in an embodiment of the present invention; Figure 2 A flowchart for verifying firmware to be upgraded is provided in one embodiment of the present invention; Figure 3 A flowchart of differential compression provided in one embodiment of the present invention; Figure 4 A schematic diagram illustrating the principle of a firmware upgrade method provided in one embodiment of the present invention; Figure 5 A flowchart illustrating a firmware upgrade method provided in one embodiment of the present invention; Figure 6 This is a schematic diagram of a firmware upgrade device provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0013] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0014] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0015] Understandably, with the explosive growth of cloud computing, big data, and AI computing power, 24 / 7 online operation of data center servers has become the norm. The need for bug fixes and new feature iterations for BIOS (Basic Input Output System), BMC (Baseboard Management Controller), or CPLD (Complex Programmable Logic Device) firmware is increasingly frequent. Firmware upgrade methods in these technologies suffer from the following pain points: For example, long downtime: out-of-band upgrades require a 3–10 minute cold boot; in-band kexec restarts still result in a 30–120 second interruption. No rollback after failure: manual rewriting is required after a failed upgrade, and the RTO (Recovery Time Objective) is uncontrollable. Poor compatibility: The firmware upgrade toolchains for ARM (Advanced RISC Machine), x86 (x86 architecture or x86 instruction set), and RISC-V (Reduced Instruction Set Computing – V) servers are not standardized, leading to high maintenance costs. Hardware deficiencies make compatibility testing difficult: real-world models have been discontinued or taken off the market, making it impossible to obtain physical devices for regression testing.
[0016] To address the aforementioned issues, embodiments of the present invention can utilize QEMU (Quick Emulator) virtualization technology to construct a virtual management controller (shadow BMC) that is consistent with the register level of the target server. In other words, the constructed virtual structure can accurately replicate the state and behavior of every CPU register in the real physical server, making it impossible for software (especially the operating system) running in this virtual environment to distinguish whether it is running in a virtual environment or on real physical hardware.
[0017] The firmware upgrade is simulated through a virtual management controller. The firmware is verified first, and the differences are compressed after verification. The difference data is then hot-written to the backup firmware partition within a millisecond window of server memory freeze. An atomic switch is completed through a 200ms hardware reset, thereby achieving zero-interruption upgrade and second-level rollback in scenarios where the physical machine is missing or online business is in operation.
[0018] Specifically, such as Figure 1 As shown, an embodiment of the present invention provides a firmware method applied to a server, wherein the method includes the following steps: In step S101, in response to the firmware upgrade command, a corresponding firmware simulation command is generated based on the firmware upgrade command.
[0019] In actual implementation, the embodiments of the present invention can be based on a virtual management controller that is consistent with the register level of the server to be upgraded, which is built using QEMU virtualization technology, to verify the firmware to be upgraded, i.e. the firmware to be upgraded.
[0020] For example, after receiving the firmware to be upgraded or the upgrade instruction entered by the user, it is determined that the server has received the firmware upgrade instruction. At this time, the corresponding firmware simulation instruction can be generated to simulate the server's operating state using the virtual management controller.
[0021] In step S102, the state and behavior of the server's registers are simulated based on firmware simulation instructions to build the server's firmware runtime environment.
[0022] The virtual management controller can simulate the BMC (Browser Control Center) functions of the server requiring upgrades, including IPMI / Redfish interface and hardware monitoring. This allows the virtual management controller to simulate the server's operating state, enabling simulated firmware upgrades within this simulated environment. This avoids directly running incompatible or faulty firmware on the server.
[0023] In step S103, the firmware to be upgraded is run in the firmware running environment to collect the running data of the firmware to be upgraded, and to determine whether the firmware to be upgraded meets the preset verification pass conditions based on the running data.
[0024] The embodiments of the present invention can run the firmware to be upgraded in a virtual management controller simulated operating environment to perform compatibility testing and functional verification.
[0025] The purpose of compatibility testing is to ensure that the firmware to be upgraded can work together with the existing hardware, software and management ecosystem. Test items may 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.).
[0026] The purpose of functional verification is to ensure that all functions of the firmware to be upgraded, including the regression of old functions and the implementation of new functions, meet the design requirements and expectations. Verification items may include security verification, fault verification, boundary verification, performance verification, etc.
[0027] Specifically, compatibility testing and functional verification can be set according to the corresponding structure and functions of the server and firmware to be upgraded, without any specific restrictions here.
[0028] Furthermore, based on the test data from compatibility testing and functional verification, i.e., the firmware's operating data, it is determined whether the firmware to be upgraded meets the pass conditions. For example, corresponding data thresholds or data standards can be set according to the expected upgrade goals of the firmware to be upgraded, and then a comparison can be made to determine whether the data thresholds or data standards are met.
[0029] In step S104, if the preset verification pass 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.
[0030] After verifying the compatibility and functionality of the firmware to be upgraded, embodiments of the present invention can generate differential packets based on the differences between the firmware to be upgraded and the currently running firmware of the server that needs to be upgraded. The differential packets are then sent to the server using differential compression, for example, by using RDMA (Remote Direct Memory Access) technology to transfer the differential packets from the S-Master to the server's memory. This allows the server to perform firmware upgrades based on the differential packets, significantly reducing transmission bandwidth and storage space usage.
[0031] Optionally, in one embodiment of the present invention, generating a differential package based on the firmware to be upgraded and the corresponding currently running firmware in the server includes: calculating the difference rate between the firmware to be upgraded and the currently running firmware; determining whether the difference rate is less than a preset difference threshold; if it is less than the difference threshold, generating a differential package; otherwise, generating a full image of the firmware to be upgraded, so as to upgrade the currently running firmware using the full image.
[0032] Specifically, embodiments of the present invention can calculate the difference between the new firmware (the firmware to be upgraded) and the currently running firmware (the old firmware) of the server that needs to be upgraded, i.e., the difference between the new and old firmware.
[0033] Wherein, the difference rate = (image_new - image_old) / image_old.
[0034] The system determines whether differential compression is feasible based on a difference threshold, such as 60%. For example, in an embodiment of the present invention, a difference rate > 60% indicates a significant difference between the two firmware versions, resulting in a complex differential packet that is difficult to guarantee against minor errors during differential compression, potentially leading to corrupted differential packets. This makes it difficult for the server to effectively upgrade based on corrupted differential packets. Therefore, this embodiment of the present invention can mitigate this risk by using a more reliable full image. When the difference rate is ≤ 60%, this embodiment of the present invention can use the bsdiff + LZ4 algorithm to compress and generate differential packets. The size of the differential packet is typically much smaller than the full firmware image, thereby significantly reducing transmission bandwidth and storage space usage.
[0035] Optionally, in one embodiment of the present invention, upgrading the corresponding currently running firmware in the server using a differential package includes: restoring the firmware to be upgraded based on the differential package and the currently running firmware; and running the firmware to be upgraded to complete the firmware upgrade instruction.
[0036] After verifying the firmware to be upgraded, this embodiment of the invention can send the generated differential packet to the corresponding area in the server. By combining the differential packet with the currently running firmware, the firmware to be upgraded can be reconstructed. Then, the firmware upgrade can be completed by using the reconstructed firmware. Data transmission via differential packets can significantly reduce transmission bandwidth and storage space usage, thereby improving firmware upgrade efficiency.
[0037] Optionally, in one embodiment of the present invention, before upgrading the corresponding currently running firmware in the server using differential packets, the method further includes: obtaining the server's structure data; and determining, based on the structure data, whether there exists a first flash memory partition in the server for independently storing the currently running firmware and a second flash memory partition for storing the firmware to be upgraded.
[0038] In actual implementation, the embodiments of the present invention require hardware checks on the server to ensure that the server supports SPI-NOR dual partitioning, so that the currently running firmware and the firmware to be upgraded can be stored independently through two different flash memory partitions, such as Bank A and Bank B, so that flash memory interval switching can be performed later to achieve seamless upgrades, improve upgrade efficiency, and reduce the impact of firmware upgrades on business continuity.
[0039] Optionally, in one embodiment of the present invention, upgrading the corresponding currently running firmware in the server using differential packets includes: switching the server's boot partition to the second flash partition and generating a reset signal; using the reset signal 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 boot conditions and restores the services running on the server before the upgrade.
[0040] Before upgrading, this embodiment of the invention can enable KVM_DIRTY_RING on the server to mark dirty pages in memory. The server's business processes are paused using a cgroup freezer to ensure stable memory data during synchronization. Differential packets are transferred from the S-Master to the server's memory using RDMA technology. RDMA technology provides high-speed, low-latency data transmission, ensuring the efficiency of the synchronization process. Furthermore, this embodiment of the invention can store the firmware to be upgraded in a different flash memory partition than the currently running firmware for subsequent firmware upgrades.
[0041] In this embodiment of the invention, the running partition can be switched to the flash memory partition storing the firmware to be upgraded, and the firmware to be upgraded can be run as the new firmware of the server, so that the electronic control unit can boot from the new firmware to complete the firmware upgrade.
[0042] After data transmission and firmware reconstruction are completed, this embodiment of the invention can unfreeze the server's business processes and restore normal business operation to complete memory hot synchronization, reduce the impact of firmware upgrades on business continuity, and avoid the probability of business processes being affected during data synchronization, thereby increasing the stability of business operation.
[0043] Optionally, in one embodiment of the present invention, before upgrading the corresponding currently running firmware in the server using differential packets, the method further includes: obtaining the server's hardware model, current firmware version, current hardware sensor data, and current running service data; inputting the hardware model, current firmware version, current hardware sensor data, and current running service data into a pre-built upgrade success probability prediction model to predict the server's current upgrade success rate, wherein the upgrade success probability prediction model is trained using the server's hardware model, historical upgrade difference rate, historical hardware sensor data, historical running service data, and corresponding historical upgrade success records; and responding to a firmware upgrade command if the current upgrade success rate is greater than a preset success rate threshold.
[0044] It is understandable that firmware upgrades may cause server malfunctions and upgrade failures under high load conditions. Therefore, in some embodiments, in order to reduce the probability of upgrade failure, the present invention can perform a success assessment of firmware upgrades in advance to determine an appropriate upgrade time.
[0045] The embodiments of the present invention can obtain data such as the server's hardware model, the version of the currently running firmware, historical upgrade success / failure records, hardware sensor data (temperature, voltage, error counter, etc.), and business load cycle.
[0046] By utilizing data such as server hardware model, current firmware version, historical upgrade success / failure records, hardware sensor data (temperature, voltage, error counters, etc.), and business load cycles, a non-linear data relationship is constructed between upgrade success results and hardware, differences between old and new firmware versions (such as difference rate), sensor data, and business load. This is used to train an upgrade success probability prediction model.
[0047] Based on nonlinear data relationships, embodiments of the present invention can determine the corresponding success probability of the upgrade based on current upgrade data, such as the complexity of differential packets, hardware model, sensor data, and business load. In cases where the success rate is low, direct upgrades are prohibited. Furthermore, the success rate is calculated in real time based on the dynamic changes in server data until the success rate reaches the standard before firmware upgrades are performed.
[0048] Optionally, in one embodiment of the present invention, before upgrading the corresponding currently running firmware in the server using differential packets, the method further includes: simulating the current upgrade environment of the server when the current upgrade success rate is less than or equal to a preset success rate threshold; simulating the upgrade process of the firmware to be upgraded in the current upgrade environment to obtain simulated upgrade data; analyzing the simulated upgrade data to obtain the reasons for upgrade failure; and generating a corresponding upgrade path based on the reasons for upgrade failure, so as to complete the firmware upgrade instruction based on the upgrade path.
[0049] This invention allows the simulation management controller to simulate the server's current upgrade environment based on the server's current status data. By comparing successful and failed node data and performing correlation analysis, the cause of upgrade failure can be determined. This enables the server to re-determine a secure upgrade path based on the cause of the failure. For example, upgrading from version A to version D might be high-risk, but upgrading from version A to version B to version C to version D might be safe. In this case, simulation can be performed on the simulation management controller, and the reliability of the secure upgrade path can be determined based on the simulation results. If reliable, the server can then be controlled to complete the upgrade according to the secure upgrade path.
[0050] Optionally, in one embodiment of the present invention, the method further includes: verifying 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 method rolls back to the currently running firmware so that the server meets the preset usability conditions.
[0051] In some embodiments, after a firmware upgrade, the business process can be reset, and a version verification can be performed within a certain time after the reset, such as within 5 seconds, to confirm whether the new firmware (the new firmware currently running after the server starts) has successfully started. If the new firmware fails to start, it can be rolled back to the old firmware (the firmware running on the server before the upgrade) within 15 seconds to ensure that the system is always available.
[0052] Optionally, in one embodiment of the present invention, before rolling back to the currently running firmware, the method further includes: responding to a rollback simulation request, simulating a faulty operating state of the server that does not meet the preset successful startup conditions; in the faulty operating state, rolling back to the currently running firmware to obtain a rollback result; and completing the server rollback operation or triggering an upgrade failure reminder based on the rollback result.
[0053] Before a rollback is required, embodiments of the present invention can back up the current BIOS and BMC firmware so that a rollback can be performed when needed, avoiding the server from becoming unusable after an upgrade failure, which would cause business operations to be suspended for a long time and affect work efficiency.
[0054] This invention can also utilize a simulation management controller to perform simulations to determine whether the server can roll back normally in its current state, thus avoiding rolling back the server when it cannot roll back normally, which could lead to more server failures.
[0055] First, the server can send its current status, such as hardware status (CPU microcode version, memory SPD data, PCIe device ID and status, sensor readings (temperature, voltage)); firmware status (metadata of old and new firmware, rollback counter value); error logs, etc., to the virtual management controller to simulate the server's current operating environment. Based on this, it can attempt to roll back to determine the rollback result.
[0056] If the current firmware can boot successfully and run stably, the server is allowed to roll back; if it cannot boot successfully and run stably, a reminder is generated for timely maintenance.
[0057] Furthermore, combined Figures 2 to 5 As shown, the working principle of the firmware upgrade method of the present invention is illustrated by an embodiment.
[0058] in, Figure 2 and Figure 3 During the process of verifying the firmware to be upgraded for the virtual management controller and generating differential packets. Figure 4 and Figure 5 The process of upgrading firmware.
[0059] like Figure 2 As shown, in step S201, the embodiments of the present invention can construct a virtual management controller based on the parameters and configuration documents of the server to be compatible, so as to construct a simulated running environment for the firmware.
[0060] In step S202, it is determined whether the firmware to be upgraded has passed the verification, that is, the compatibility and functionality of the firmware to be upgraded are verified. If the verification is passed, the process proceeds to step S203 and then to step S204.
[0061] In step S203, a differential package is generated based on the differences between the firmware to be upgraded and the firmware currently running on the server, and then pushed to the server for firmware upgrade.
[0062] In step S204, the process is terminated and an alarm is issued to remind the user that the firmware to be upgraded does not meet the upgrade requirements.
[0063] like Figure 3 As shown, the differential compression process is further explained.
[0064] Step S301: Calculate the difference rate between the firmware to be upgraded and the firmware currently running on the server.
[0065] Step S302: Determine whether the difference rate is less than a certain threshold, such as whether it is ≤60%. If the difference rate is ≤60%, proceed to step S303; otherwise, proceed to step S304.
[0066] In step S303, the embodiments of the present invention can compress and generate differential packets using the bsdiff + LZ4 algorithm. The size of the differential packets is usually much smaller than that of the complete firmware image, thereby significantly reducing the transmission bandwidth and storage space usage.
[0067] Step S304: The complexity of differential packets is relatively high, making it difficult to guarantee that no minor errors will occur during the differential compression process. Damaged differential packets are easily generated, and the server cannot effectively upgrade based on the damaged differential packets. Therefore, this embodiment of the invention can reduce the risk by using a more reliable full image.
[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0069] Furthermore, the architecture of the embodiments of the present invention can be as follows: Figure 4 As shown, a virtual management controller, consistent with the server's register level, is constructed using virtualization technology. The new firmware runs on this virtual management controller for compatibility testing and functional verification. If verification passes, the process proceeds to the next step; if verification fails, the upgrade process terminates and an alarm is triggered. Then, the differences between the old and new firmware are calculated, a differential packet is generated, and the differential packet is transferred from the S-Master (upgrade control node) to the server's memory via RDMA technology for an atomic switch. Finally, a version verification is performed after the upgrade to confirm whether the new firmware has successfully booted. If the new firmware fails to boot, the system is rolled back to the old firmware, ensuring the server's system remains operational at all times.
[0070] Based on this, such as Figure 5 As shown, embodiments of the present invention may include the following steps: Step S501: In this embodiment of the invention, a virtual management controller can be constructed based on the parameters and configuration documentation of the server to be compatible. This embodiment can prepare an S-Master, which can be a small host or container with an x86 architecture. Ensure it has sufficient computing power to run the QEMU virtualization environment and is equipped with a high-speed network interface to support RDMA communication. Install a Linux operating system (such as Ubuntu 22.04) on the S-Master and ensure the following packages are installed: QEMU: for building the virtual management controller; rdma-core: for RDMA communication; ipmitool: for interacting with the BMC; bsdiff4 and lz4: for differential compression.
[0071] Server Preparation: Hardware Check: Ensure the server supports SPI-NOR dual partitioning and has a USB-NCSI or PCIe-GPIO interface for bridge connection. Firmware Backup: Before upgrading, back up the current BIOS and BMC firmware for rollback if needed.
[0072] Step S502: Determine whether the firmware to be upgraded has passed verification.
[0073] This invention can extract hardware parameters to obtain server parameters: The official configuration document (HTML / PDF format) of the server is obtained from the server manufacturer. Regular expressions are used to extract hardware parameters from the configuration document, including CPU model, memory capacity, hard drive model, RAID card model, etc. These parameters are stored as a JSON file for subsequent processing and comparison.
[0074] QEMU Configuration: Based on the extracted hardware parameters, configure QEMU on the S-Master to build a virtual management controller that is consistent with the target server's register level.
[0075] Run QEMU to start the virtual management controller and ensure that it can start and run the firmware to be upgraded (firmware to be upgraded / new firmware).
[0076] Functional Verification: Run a series of compatibility tests and functional verification scripts on the virtual management controller to ensure the new firmware functions correctly. Check that hardware devices are correctly recognized and functioning. Test network connectivity, storage devices, RAID functionality, etc. Verify that the BMC's IPMI / Redfish interface functions correctly.
[0077] Performance testing: Run performance test scripts to ensure that there is no significant performance degradation in the new firmware.
[0078] Result evaluation: If all tests pass, the virtual management controller is successfully verified and can proceed to the next step; if the tests fail, the firmware needs to be adjusted or repaired.
[0079] Step S503: Generate the differential package.
[0080] The binary difference of the BIOS region before and after the upgrade was calculated using bsdiff, followed by LZ4 compression. When the difference rate is ≤60%, the differential packet is <1 MB; when the difference rate is >60%, it automatically falls back to full image hot write.
[0081] Step S504: End the process.
[0082] Step S505, memory hot synchronization.
[0083] This invention allows enabling KVM_DIRTY_RING on the server to mark dirty pages in memory. A cgroup freezer is used to suspend the target server's business processes, ensuring stable memory data during synchronization. Differential packets are transferred from the S-Master to the server's memory using RDMA technology. After data transfer is complete, the server's business processes are unfrozen, resuming normal operation.
[0084] Step S506, atomic switching.
[0085] The embodiments of the present invention can perform dual-partition switching based on the server structure to achieve seamless upgrades.
[0086] The embodiments of the present invention can ensure that the server's SPI-NOR flash memory is divided into two partitions, Bank A and Bank B, which are used to store old firmware and new firmware, respectively.
[0087] Send the IPMI OEM command to the BMC via the bridge, set the Boot_Select bit, and select the new firmware partition.
[0088] A PLTRST# low-level 200 ms reset signal is triggered, causing the CPU to boot from the new firmware. During the reset process, the DDR memory enters self-refresh mode to maintain the OS context and ensure that business processes can quickly resume after the reset.
[0089] Step S507: After the upgrade, perform a version verification to determine whether the startup was successful.
[0090] Within 5 seconds of resetting, read the SMBIOS Type 0 version number from the server to confirm whether the new firmware has booted successfully. Compare the read version number with the expected new version number to ensure they match.
[0091] Step S508: Roll back the fuse.
[0092] If the version verification fails, it means that the new firmware has failed to boot successfully.
[0093] The IPMI OEM command is sent to the BMC again via the bridge, setting the Boot_Select bit to select the old firmware partition. The PLTRST# low-level 200 ms reset signal is triggered again, causing the CPU to boot from the old firmware and restore it to its state before the upgrade.
[0094] Step S509: End the process.
[0095] In summary, this invention enables seamless firmware upgrades based on a virtual management controller. According to server parameters, it employs a four-step closed-loop process: virtual management controller verification, differential hot writing, atomic switching, and rollback fuse activation. This completes the seamless firmware upgrade process from virtual management controller verification, differential compression and hot synchronization, to atomic switching and rollback fuse activation. These steps not only ensure the efficiency and reliability of the upgrade process but also significantly reduce service downtime and maintenance costs.
[0096] Through the embodiments of the present invention, zero-interruption upgrades can be ensured through virtual management controller verification and memory hot synchronization technology, reducing business downtime, providing a fast and reliable rollback mechanism, achieving efficient differential compression, being compatible with multiple server architectures, reducing operation and maintenance costs, improving system availability and reliability, and enhancing data security and integrity. By transmitting only the difference data between the old and new versions through differential compression, the transmission bandwidth and storage space usage are greatly reduced. In the event of an upgrade failure, the system can automatically roll back to the old version in a short period of time without manual intervention, ensuring that the system is always available.
[0097] These advantages represent significant innovation and practicality in the field of server firmware upgrades, and are particularly suitable for scenarios with extremely high requirements for business continuity and system reliability.
[0098] like Figure 6 As shown, an embodiment of the present invention also provides a firmware upgrade device applied to a server, wherein the device 10 includes: a first response module 100, a construction module 200, a verification module 300, and an upgrade module 400.
[0099] Specifically, the first response module 100 is used to respond to the firmware upgrade command and generate a corresponding firmware simulation command based on the firmware upgrade command.
[0100] Module 200 is used to simulate the state and behavior of the server's registers based on firmware simulation instructions in order to build the server's firmware runtime environment.
[0101] The verification module 300 is used to run the firmware to be upgraded in the firmware running environment, to collect the running data of the firmware to be upgraded, and to determine whether the firmware to be upgraded meets the preset verification pass conditions based on the running data.
[0102] Upgrade module 400 is used to generate a differential package based on the firmware to be upgraded and the corresponding currently running firmware in the server, under the condition that the preset verification pass conditions are met, so as to upgrade the corresponding currently running firmware in the server using the differential package.
[0103] Optionally, in one embodiment of the present invention, the upgrade module 400 includes: a calculation unit, a judgment unit, and a generation unit.
[0104] The calculation unit is used to calculate the difference rate between the firmware to be upgraded and the currently running firmware.
[0105] The judgment unit is used to determine whether the difference rate is less than a preset difference threshold.
[0106] The generation unit is used to generate a differential package if the difference is less than the difference threshold; otherwise, it generates a full image of the firmware to be upgraded, so as to upgrade the currently running firmware using the full image.
[0107] Optionally, in one embodiment of the present invention, the upgrade module 400 includes a restore unit and a run unit.
[0108] The restore unit is used to restore the firmware to be upgraded based on the differential packet and the currently running firmware.
[0109] The running unit is used to run the firmware to be upgraded in order to complete the firmware upgrade instructions.
[0110] Optionally, in one embodiment of the present invention, the upgrade module 400 includes: a verification unit and a first rollback unit.
[0111] The verification unit is used to verify the firmware version in the server to determine whether the server meets the preset successful startup conditions.
[0112] The first rollback unit is used to roll back to the currently running firmware if the preset successful startup conditions are not met, so that the server meets the preset usability conditions.
[0113] Optionally, in one embodiment of the present invention, the upgrade module 400 further includes: a first simulation unit, a second rollback unit, and an execution unit.
[0114] The first simulation unit is used to respond to a rollback simulation request and simulate the fault operation state of the server when the preset successful startup conditions are not met.
[0115] The second rollback unit is used to roll back to the currently running firmware in the event of a fault, and obtain the rollback result.
[0116] The execution unit is used to complete the server rollback operation or trigger an upgrade failure notification based on the rollback result.
[0117] Optionally, in one embodiment of the present invention, the firmware upgrade device 20 further includes a first acquisition module and a judgment module.
[0118] The first acquisition module is used to acquire the server's structural data.
[0119] The judgment module is used to determine, based on the structured data, whether there is a first flash partition in the server for independently storing the currently running firmware and a second flash partition for storing the firmware to be upgraded.
[0120] Optionally, in one embodiment of the present invention, the upgrade module 400 includes a switching unit and a reset unit.
[0121] The switching unit is used to switch the server's boot partition to the second flash partition and generate a reset signal.
[0122] The reset unit is used to control the server to perform corresponding hardware reset actions using a reset signal, 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.
[0123] Optionally, in one embodiment of the present invention, the firmware upgrade device 20 further includes: a second acquisition module, a prediction module, and a second response module.
[0124] The second acquisition module is used to acquire the server's hardware model, current firmware version, current hardware sensor data, and current running business data.
[0125] The prediction module is used to input the hardware model, current firmware version, current hardware sensor data, and current running business data 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 business data, and corresponding historical upgrade success records.
[0126] The second response module is used to respond to firmware upgrade commands when the current upgrade success rate is greater than a preset success rate threshold.
[0127] Optionally, in one embodiment of the present invention, the firmware upgrade device 20 further includes: a first simulation module, a second simulation module, an analysis module, and a generation module.
[0128] The first simulation module is used to simulate the current upgrade environment of the server when the current upgrade success rate is less than or equal to a preset success rate threshold.
[0129] The second simulation module is used to simulate the upgrade process of the firmware to be upgraded in the current upgrade environment and obtain simulated upgrade data.
[0130] The analysis module is used to analyze simulated upgrade data and determine the reasons for upgrade failure.
[0131] The generation module is used to generate the corresponding upgrade path based on the reason for the upgrade failure, and to complete the firmware upgrade command based on the upgrade path.
[0132] Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the firmware upgrade method embodiments described above.
[0133] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program configured to execute the steps in any of the firmware upgrade method embodiments described above when running.
[0134] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0135] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the firmware upgrade method embodiments described above.
[0136] Embodiments of the present invention also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the firmware upgrade method embodiments described above.
[0137] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented 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 implementations should not be considered beyond the scope of this invention.
[0138] The firmware upgrade method, apparatus, electronic device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, 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, 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 the 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
Simulation of hardware based on smart buffer objects
US20040215440A1
Firmware generated register file for use in hardware validation
US20140173348A1