Firmware update method, system, server, device, medium, and product

By splitting the firmware image file into data packets and processing them into data blocks, the problem of excessive memory consumption during firmware upgrades is solved, achieving more efficient memory utilization and upgrade speed.

WO2026237352A1PCT designated stage Publication Date: 2026-11-19LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/141780
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-13
Filing Date
2025-12-11
Publication Date
2026-11-19

AI Technical Summary

Technical Problem

During the firmware upgrade process, the entire firmware image file occupies a large amount of memory space on the management controller, resulting in resource waste and slow upgrade speed.

Method used

The firmware image file is split into data packets and transmitted to the network device buffer. After waiting for instructions, data blocks of a preset size are extracted and stored in the management controller memory. The data blocks are then verified against the target data blocks. Identical data blocks are discarded, and only different data blocks are written to the flash memory.

Benefits of technology

It reduces the memory footprint of the management controller, improves memory space utilization, avoids repeated flash memory writes, and increases firmware upgrade speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025141780_19112026_PF_FP_ABST
    Figure CN2025141780_19112026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of servers, and discloses a firmware update method, a system, a server, a device, a medium, and a product. In absence of a response to an incoming instruction, entry of at least one data packet into a memory of a management controller is prevented, such that the at least one data packet remains in waiting in at least one network device buffer. When responding to the incoming instruction, at least one data block of a predetermined size is extracted from the at least one data packet in waiting and verification processing is performed in units of data blocks, eliminating the need to verify an entire firmware image file, and reducing granularity of an object being verified so as to save management controller memory resources. The at least one data block is verified and compared against a target data block obtained by partitioning a second image file stored in a flash memory, and when a verification result indicates a match, the data block is discarded; and when the verification result indicates a non-match, the data block is written to the flash memory, thereby preventing redundant writes to the flash memory, reducing flash memory storage space usage, and improving memory space utilization rates of management controllers.
Need to check novelty before this filing date? Find Prior Art

Description

Firmware upgrade methods, systems, servers, devices, media, and products

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 202510608700.7, filed on May 13, 2025, entitled "Firmware Upgrade Method, System, Server, Device, Media and Product", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of server technology, and in particular to a firmware upgrade method, system, server, device, medium, and product. Background Technology

[0004] During firmware upgrades using the operating system, users upload the entire firmware image file remotely or through other interfaces. After the transfer is complete, the entire firmware image file is uploaded to the management controller's memory for integrity verification to ensure that the firmware image file has not been tampered with. Because the entire firmware image file requires a large amount of memory, it consumes a significant amount of memory space on the management controller.

[0005] Therefore, how to reduce the memory space occupied by firmware image files on the management controller is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] This application provides a firmware upgrade method, system, server, device, medium, and product to at least solve the technical problem in related technologies where manual serial port burning, which is independent of the operating system, increases the difficulty and speed of firmware upgrade and maintenance.

[0007] This application provides a firmware upgrade method, including:

[0008] Receive firmware upgrade instructions, obtain the first image file to be upgraded, split the first image file into at least one data packet, and transmit at least one data packet to the buffer of at least one network device on the target link to wait for incoming instructions;

[0009] In response to an incoming command, extract at least one data block of a preset size from at least one waiting data packet, and store at least one data block in the memory of the management controller;

[0010] Obtain the target data block corresponding to at least one data block, and perform verification processing on at least one data block and the target data block to obtain the verification result; wherein, the target data block is obtained by segmenting a second image file, and the second image file is stored in flash memory;

[0011] If the verification results are the same, the data block will be discarded;

[0012] If the verification results are different, the data block is written to the flash memory.

[0013] This application also provides a dual operating system, which includes a first operating system and a second operating system; wherein the memory access resources of the first operating system are greater than those of the second operating system.

[0014] If the first operating system fails to boot the management controller, a second operating system is booted to perform the firmware upgrade steps described above and complete the firmware upgrade of the management controller.

[0015] This application also provides a server that includes a dual operating system.

[0016] This application also provides an electronic device, including: 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.

[0017] This application also provides a computer non-volatile 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.

[0018] This application 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.

[0019] This application addresses the issue that conventional firmware upgrades involve uploading the entire firmware image file to the management controller's memory and performing verification on it, resulting in significant memory consumption. Considering the limited memory resources of RTOS systems, where storing the entire firmware image file typically requires more memory than the RTOS system can access, this application addresses this issue. First, before uploading to the management controller's memory, a firmware upgrade command is received, the first image file to be upgraded is obtained, and the first image file is split into at least one data packet. This packet is then transmitted to at least one network device buffer on the target link, awaiting incoming commands. In other words, during this transmission, unless a response to an incoming command is received, the file will not enter the management controller's memory, instead waiting in at least one network device buffer. Upon responding to an incoming command, at least one data block of a preset size is extracted from the waiting at least one data packet. This allows the first image file to be accessed in data blocks as needed, rather than receiving the entire image file at once. This also enables flow control of the first image file at the flow control level, controlling its extraction in response to incoming commands. At least one data block is extracted and stored in the memory of the management controller, reducing the file storage granularity to the data block granularity. Compared to the conventional method of storing the entire firmware image file in the management controller's memory, extracting at least one data block according to a preset size reduces the memory footprint of the management controller under the RTOS system. Secondly, the target data block corresponding to the at least one data block is obtained, and the at least one data block and the target data block are verified to obtain the verification result. Compared to the conventional method of verifying the entire firmware image file, which consumes a large amount of management controller memory, this application performs verification in the form of data blocks, eliminating the need to verify the entire firmware image file, thus reducing the granularity of the verification object and saving memory resources for the management controller. Finally, compared to the conventional method of verifying the integrity of the entire firmware image file itself, this application requires verification and comparison with the target data block obtained by segmenting a second image file stored in flash memory. If the verification results are the same, the data block is discarded; if the verification results are different, the data block is written to flash memory, avoiding duplicate writes in flash memory, reducing the memory footprint of the management controller and the storage space occupied by flash memory, thereby improving the memory space utilization of the management controller. Avoid writing all firmware files to flash memory, reduce the amount of data written, improve write speed to some extent, and reduce flash memory write wear.

[0020] Therefore, this method can solve the technical problem of firmware image files occupying too much memory space in the management controller. It achieves the following: when the management controller receives the image file to be upgraded, it splits it and extracts at least one data block of a preset size from at least one waiting data packet. This data block is then stored in a flowing manner, reducing the storage granularity. During the verification process, verification is performed in the form of data blocks. Data blocks that are the same as the target data block are discarded. The data block that is actually written to the flash memory is different from the target data block. This saves the memory resources of the management controller, reduces the memory space occupied by the management controller, and avoids repeated writing to the flash memory. Attached Figure Description

[0021] To more clearly illustrate some embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 is a flowchart of a firmware upgrade method provided in some embodiments of this application;

[0023] Figure 2 is a schematic diagram of a double-ring buffer region provided in some embodiments of this application;

[0024] Figure 3 is a schematic diagram of local verification based on the size of a first data block, provided by some embodiments of this application;

[0025] Figure 4 is a schematic diagram of a head-to-tail recursive search and verification provided in some embodiments of this application;

[0026] Figure 5 is a schematic diagram of a firmware upgrade method based on an RTOS operating system provided in some embodiments of this application;

[0027] Figure 6 is a flowchart of a head-to-tail recursive search method provided in some embodiments of this application;

[0028] Figure 7 is a schematic diagram of the structure of a firmware upgrade device provided in some embodiments of this application. Detailed Implementation

[0029] The technical solutions of some embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0030] It should be noted that, in the description of this application, 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., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0031] To enable 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 accompanying drawings and specific embodiments.

[0032] The specific application environment architecture or specific hardware architecture on which the firmware upgrade method depends is described here.

[0033] Management controllers (such as Baseboard Management Controllers, BMCs) are crucial management components in servers, undertaking key tasks such as monitoring hardware status, managing system power, providing various management services, enabling remote user control, and facilitating remote fault diagnosis and maintenance. As a control unit operating independently of the main system, the BMC typically runs an embedded operating system to provide more flexible remote management capabilities, such as remote power control, hardware health monitoring, logging, and firmware updates via the Intelligent Platform Management Interface (IPMI) protocol.

[0034] During server startup, the BMC's boot image is typically stored in the Serial Peripheral Interface (SPI) NOR Flash on the BMC board, ensuring system reliability and stability. When the server powers on, the BMC initializes the SPI controller via the BootROM and reads the boot program from the SPI Flash through this controller. Typically, the boot program is U-Boot, which is responsible for initializing the hardware and loading necessary drivers. Subsequently, U-Boot guides the loading of the Linux kernel, which initializes various BMC services, such as network management, system logging, temperature monitoring, and hardware diagnostics, ensuring that the BMC can effectively communicate and interact with the server host system and remote management platform.

[0035] In servers with one or more operating systems, various fault conditions can lead to BMC image corruption. Specifically, since the BMC firmware is stored in SPI flash memory, and flash memory has a limited lifespan and is susceptible to accidental failure, its failure principle is similar to that of a solid-state drive (SSD). For example, prolonged high-load operation or manufacturing defects resulting in bad blocks can lead to the loss of critical data in the image file; sudden power outages during firmware updates or image writing (such as data center power failures or poor contact due to vibration) can cause incomplete image writing or verification failures; additionally, software issues leading to accidental erasure or overwriting can also cause image corruption; some environmental problems can also cause image corruption, such as excessively high data center temperatures causing flash memory malfunctions (such as increased charge leakage in NAND flash memory at high temperatures), causing image data bit flipping and resulting in verification failures. Typically, such situations require manual on-site intervention, such as image recovery or upgrades via serial port, which not only increases maintenance difficulty but also prolongs fault recovery time, affecting system availability and stability.

[0036] In a dual-system server architecture (System A and System B), System A handles complex applications and services, while System B handles tasks with high real-time requirements to ensure real-time system response and create redundancy to prevent system downtime. During the startup process of the management controller (such as a BMC), a boot image is typically generated from System A. Faults within the server (such as expired or damaged flash memory for firmware storage) can corrupt the management controller's image file, preventing normal startup. Even if System B takes over and restarts, the corrupted image will paralyze the management controller. The firmware upgrade method provided in this application solves the aforementioned technical problems.

[0037] Figure 1 is a flowchart of a firmware upgrade method provided in some embodiments of this application. As shown in Figure 1, the method includes:

[0038] S11: Receive firmware upgrade command, obtain the first image file to be upgraded, split the first image file into at least one data packet, and transmit at least one data packet to the buffer of at least one network device on the target link to wait for incoming command;

[0039] S12: In response to the incoming command, extract at least one data block of a preset size from at least one waiting data packet, and store at least one data block in the memory of the management controller;

[0040] S13: Obtain the target data block corresponding to at least one data block, and perform verification processing on at least one data block and the target data block to obtain the verification result; wherein, the target data block is obtained by segmenting the second image file, and the second image file is stored in flash memory;

[0041] S14: Determine whether the verification results are the same. If the verification results are the same, proceed to step S15. If the verification results are different, proceed to step S16.

[0042] S15: Discard the data block;

[0043] S16: Write the data block to flash memory.

[0044] Specifically, the first image file can be obtained by the user directly, remotely, or through IPMI commands, etc., without limitation. The method of obtaining the first image file can be directly from a file uploaded by the user, or by retrieving a pre-stored file in the buffer area after the user uploads the file, etc., without limitation.

[0045] Taking remote command issuance as an example, various interfaces and commands can be used to remotely execute firmware upgrade operations:

[0046] 1) IPMI commands: Users initiate remote upgrade commands via IPMI, and the operating system receives and responds;

[0047] 2) After logging in via Secure Shell (SSH), relevant commands are executed, and the operating system receives the instructions and initiates the upgrade process;

[0048] 3) Upload the image via Hyper Text Transfer Protocol (HTTP) / Hyper Text Transfer Protocol Secure (HTTPS). Users access the web interface provided by the BMC Real-Time Operating System (RTOS) through a browser or management tool, select and submit the image file, and the operating system receives the data through the built-in HTTP / HTTPS server and starts the upgrade.

[0049] 4) The image is transferred via the Trivial File Transfer Protocol (TFTP). The user uses a TFTP client to upload the image file to the BMC, and the operating system receives the file and initiates the upgrade process.

[0050] There are no restrictions on how users communicate with the operating system, nor are there any limitations on what interfaces the operating system can implement for remote upgrades.

[0051] Regardless of the method used, the process involves receiving a firmware upgrade command. The first image file is stored in the user device's memory, which is a memory resource allocated to user devices (computers, mobile phones, etc.) for storing user data. In response to the firmware upgrade command, the first image file to be upgraded is retrieved from the user device's memory. For network transmission, the first image file needs to be split into at least one data packet for subsequent transmission. This at least one data packet is transmitted to the buffer of at least one network device on the target link. This is because the source and destination objects need to be on the same target link during transmission. On a single target link, multiple network devices (such as switches and routers) will pass through. These devices typically have their own buffers for temporarily storing data packets until they are forwarded to the next node. During forwarding to the next node, an instruction is awaited to transmit at least one data packet to the management controller's memory.

[0052] The data requiring firmware upgrades is stored in the memory of the management controller. This data is extracted from at least one waiting data packet, similar to valve control. The amount of data to be upgraded is determined by the amount of data extracted from the network device buffer. This is different from the conventional approach of transferring the entire image file to the management controller's memory before performing the firmware upgrade. This application considers that the operating system for firmware upgrades is an RTOS system. If the standard firmware upgrade process of a Linux system is adopted, the image file is stored in memory after uploading. However, the verification and writing processes also require a large amount of memory resources. But the accessible memory resources of an RTOS are only 256KB, far less than the 64MB required to store a complete image, not to mention the memory usage of verification and other operations; 2) Verifying the complete 64MB image after transmission takes a lot of time, increasing user waiting time and actually reducing user experience; 3) The write speed of SPI Flash is usually slower than the read speed. Overwriting the entire image can easily become a bottleneck in the entire firmware upgrade process, and users may have to wait for tens of minutes.

[0053] In standard Linux firmware upgrades, users typically upload a local BMC firmware image file via remote management tools or other interfaces. This image file is usually 64MB in size, but the exact size may vary depending on feature expansion or customization requirements. The upload process is handled by network protocols (such as HTTP, File Transfer Protocol (FTP), or proprietary protocols), and the data is stored in the BMC's memory after transmission.

[0054] This application uses a method of capturing data blocks as needed, with the data block granularity being smaller than that of the image file. When responding to an incoming command, this application will capture at least one data block of a preset size and store it in the memory of the management controller to facilitate subsequent firmware upgrade operations.

[0055] It should be noted that this application refers to truncating at least one data block of a preset size. This truncating refers to truncating one block at a time, i.e., a block-by-block truncating method. For example, this application requires inputting one 4K data block and one 8K data block, and only one data block can be truncated at a time during this process. The preset size data block can be a regular fixed-value data block, or it can be an irregular, gradually increasing or decreasing non-fixed-value data block setting.

[0056] Regarding the operating system, it can be one operating system for the server, such as Linux, or it can be a dual operating system for the server, such as Linux and RTOS. There are no restrictions here, and you can set it according to the actual situation.

[0057] In step S13, obtaining the target data block corresponding to at least one data block requires clarification. It should be noted that in some embodiments of this application, if there is only one data block, the data block and its corresponding target data block are verified. If there are multiple data blocks, each data block and its corresponding target data block must be verified. It should also be noted that the image format of the data block and the target data block are the same, meaning they correspond to the same data block size. The target data block is obtained through segmentation of a second image file, which is stored in flash memory. Furthermore, in some embodiments of this application, the size of the segmented data block corresponding to the target data block mentioned above is the same as the truncation size of the at least one data block.

[0058] Flash memory stores firmware images, typically non-volatile firmware image storage, ensuring that the data remains unchanged when the firmware is turned off or on during each firmware upgrade.

[0059] Regarding the verification process in step S13, it differs from the conventional firmware upgrade of Linux systems using BMC. The conventional firmware upgrade of Linux systems includes the following steps:

[0060] The Linux system on the BMC reads the complete image file from memory and prepares it for subsequent processing. During this stage, the image is temporarily stored in memory, which typically requires a significant amount of memory and places certain demands on the BMC's hardware resources.

[0061] Before overwriting the firmware storage device (usually SPI Flash), the Linux system performs an integrity check on the uploaded image. Common checksum methods include checksums and hash checks (such as MD5 and SHA256). The purpose of the check is to ensure that the uploaded image data has not been tampered with or corrupted during transmission. If the check fails, the system will refuse to continue the upgrade and prompt the user to re-upload the image.

[0062] After verification, the Linux system writes the complete image file to the firmware storage device via the SPI driver. This process needs to overwrite the existing firmware content. Since Flash write speed is relatively slow, the entire operation may take several minutes, depending on the performance of the storage device and the size of the image.

[0063] Once the image writing is complete, the system will update the operation status, indicating to the user that the firmware update has been successful. The user can then choose to reboot the system to load the new firmware version.

[0064] The purpose of the verification process in some embodiments of this application is to identify at least one data block that differs from the target data block, for subsequent writing to the mirror flash memory. Some embodiments of this application consider that the speed of data transmission over the network is often greater than the writing speed to the mirror flash memory. Therefore, writing all at least one data packet to the mirror flash memory would not keep up with the network transmission speed and would also consume a significant amount of memory space. Frequent writing to the mirror flash memory would increase write overhead. Therefore, in some embodiments of this application, the process of identifying at least one data block that differs from the target data block and writing it to the flash memory reduces the amount of data written to the flash memory relative to the data volume of the first image file, thus accelerating the writing speed and reducing write overhead. This also speeds up firmware upgrades.

[0065] The verification process here needs to consider the data in at least one data block and the target data block, in two scenarios: data alignment and data misalignment. In either case, at least one data block and its corresponding target data block need to be compared and verified. The verification process in some embodiments of this application differs from the conventional integrity verification process for an image file. The conventional integrity verification process is time-consuming, often comparing data block by block. Considering the large amount of data and the need for accurate comparison, if the entire first and second image files are compared based on their respective checksums, the large amount of data in a single image file would consume significant computational resources. Furthermore, some data might differ, but subsequent data might be normal, resulting in a normal checksum and potentially missing at least one data block from the first image file that differs from the corresponding target data block in the second image file, leading to inaccurate comparisons. Therefore, some embodiments of this application use data blocks to compare the data within each data block. This comparison can be either a data comparison or a checksum comparison within each data block; no limitation is made here.

[0066] The verification process in some embodiments of this application is based on a cyclic comparison of data blocks corresponding to the flash memory and the image file provided by the user. This cyclic comparison can be achieved by setting the cache area as a circular cache area. After verifying a data block, once a verification result is generated, the corresponding data block position is left blank to allow the next data block to be read from the flash memory. If the verification results are the same, the data block is discarded; if the verification results are different, the data block needs to be written to the flash memory.

[0067] This application addresses the issue that conventional firmware upgrades involve uploading the entire firmware image file to the management controller's memory and performing verification on it, resulting in significant memory consumption. Considering the limited memory resources of RTOS systems, where storing the entire firmware image file typically requires more memory than the RTOS system can access, this application addresses this issue. First, before uploading to the management controller's memory, a firmware upgrade command is received, the first image file to be upgraded is obtained, and the first image file is split into at least one data packet. This packet is then transmitted to at least one network device buffer on the target link, awaiting incoming commands. In other words, during this transmission, unless a response to an incoming command is received, the file will not enter the management controller's memory, instead waiting in at least one network device buffer. Upon responding to an incoming command, at least one data block of a preset size is extracted from the waiting at least one data packet. This allows the first image file to be accessed in data blocks as needed, rather than receiving the entire image file at once. This also enables flow control of the first image file at the flow control level, controlling its extraction in response to incoming commands. At least one data block is extracted and stored in the memory of the management controller, reducing the file storage granularity to the data block granularity. Compared to the conventional method of storing the entire firmware image file in the management controller's memory, extracting at least one data block according to a preset size reduces the memory footprint of the management controller under the RTOS system. Secondly, the target data block corresponding to the at least one data block is obtained, and the at least one data block and the target data block are verified to obtain the verification result. Compared to the conventional method of verifying the entire firmware image file, which consumes a large amount of management controller memory, this application performs verification in the form of data blocks, eliminating the need to verify the entire firmware image file, thus reducing the granularity of the verification object and saving memory resources for the management controller. Finally, compared to the conventional method of verifying the integrity of the entire firmware image file itself, this application requires verification and comparison with the target data block obtained by segmenting a second image file stored in flash memory. If the verification results are the same, the data block is discarded; if the verification results are different, the data block is written to flash memory, avoiding duplicate writes in flash memory, reducing the memory footprint of the management controller and the storage space occupied by flash memory, thereby improving the memory space utilization of the management controller. Avoid writing all firmware files to flash memory, reduce the amount of data written, improve write speed to some extent, and reduce flash memory write wear.

[0068] Therefore, this method can solve the technical problem of firmware image files occupying too much memory space in the management controller. It achieves the following: when the management controller receives the image file to be upgraded, it splits it and extracts at least one data block of a preset size from at least one waiting data packet. This data block is then stored in a flowing manner, reducing the storage granularity. During the verification process, verification is performed in the form of data blocks. Data blocks that are the same as the target data block are discarded. The data block that is actually written to the flash memory is different from the target data block. This saves the memory resources of the management controller, reduces the memory space occupied by the management controller, and avoids repeated writing to the flash memory.

[0069] In some embodiments, verifying at least one data block and a target data block to obtain a verification result includes:

[0070] At least one data block stored in the memory of the management controller is used to form a data packet to be detected;

[0071] The target data block corresponding to at least one acquired data block is formed into a target data packet; the data packet to be detected and the data block to be verified corresponding to the same data block position in the target data packet are acquired;

[0072] The verification results are obtained by verifying the data blocks of the data packets to be detected and the target data packets one by one in a preset order.

[0073] Specifically, when storing data in the memory of the management controller, it is processed in a circular buffer manner. In the initial comparison process, the data block positions of the storage structure corresponding to the circular buffer need to be filled with data blocks, thus forming a circular buffer area corresponding to a data packet. In this application, it is necessary to correspond to two circular buffer areas. One circular buffer area stores the data packet to be detected formed by at least one data block intercepted from at least one data packet transmitted from the network device buffer, and the other circular buffer area stores the target data packet formed by the target data block divided by the second image file in the flash memory.

[0074] It should be noted that in some embodiments of this application, the data packets to be detected and the target data packets are distinct from at least one data packet stored in the network device buffer, and their sources are different.

[0075] In the two circular buffer areas, the corresponding data blocks are at the same position. The data blocks to be verified in the same data block position corresponding to both the data packet to be detected and the target data packet are compared one by one. Ultimately, the two data packets are comparing the same data block position. The preset order can be clockwise or counterclockwise, starting from the first data block position or the last data block position, but in a certain cyclical sequence, the data blocks to be verified in their respective corresponding data block positions are processed one by one.

[0076] Some embodiments of this application provide that the verification results are obtained by sequentially verifying the same data block positions of the data packet to be detected and the target data packet in a preset order, thereby making the verification orderly and cyclical and avoiding repeated writing to the flash memory.

[0077] In some embodiments, before performing verification processing on at least one data block and the target data block to obtain a verification result, the method further includes:

[0078] A first buffer zone and a second buffer zone are pre-established; wherein the first buffer zone and the second buffer zone adopt a ring structure;

[0079] The data block to be verified in the data packet to be detected is stored in the first buffer area;

[0080] The data block to be verified in the target data packet is stored in the second buffer area.

[0081] Specifically, considering other operating systems, such as RTOS, the image file is stored in memory after being uploaded. The verification and writing processes also require a large amount of memory resources. However, the accessible memory resources of RTOS are only 256KB, which is far less than the 64MB required to store the complete image, not to mention the memory usage caused by verification and other operations. After the transfer is completed, verifying the complete 64MB image takes a lot of time, increasing user waiting time and actually reducing the user experience. The write speed of SPI Flash is usually slower than the read speed. Overwriting the entire image can easily become a bottleneck in the entire firmware upgrade process, and users may have to wait for tens of minutes.

[0082] Therefore, before the actual writing, a first buffer region and a second buffer region are pre-established. These two buffer regions adopt a circular structure. This circular structure is due to the limited memory resources available for RTOS processing a complete image file. The circular structure consists of multiple data block positions, with each position corresponding to a data block. This data block-based caching method avoids caching the entire image file. Simultaneously, the circular shape corresponds to the flow of data; after the data blocks at corresponding positions in the first and second buffer regions are compared, the corresponding data block position is freed up for the addition of data blocks from the next image file, forming a cyclical usage.

[0083] In some embodiments of this application, considering that the two image files are obtained through different methods, the second image file is read from flash memory and the first image file is transmitted from an external device, therefore, it is necessary to divide them into two different buffer areas. The first buffer area is used for writing and storing at least one data block extracted from the first image file, and the second buffer area is used for reading and storing the target data block of the second image file segmentation process.

[0084] Some embodiments of this application provide a pre-established first buffer area and a second buffer area, which respectively store at least one data block extracted from the first image file and the target data block of the second image file segmentation process, saving the operating system's memory and computing resources, while facilitating the management of the verification process of the two types of data blocks.

[0085] In some embodiments, when the data block to be verified of the data packet to be detected and the data block to be verified of the target data packet are aligned, the first buffer area and the second buffer area constitute a double-ring buffer area.

[0086] Specifically, the comparison performed under the standard mirror format ensures that the mirror file will not become misaligned. This means that at least one data block is aligned with the target data block; that is, the data block to be verified in the data packet under test is aligned with the data block to be verified in the target data packet. This avoids consistency issues caused by data offset. Here, the first and second buffer areas are grouped together to form a double-ring buffer area.

[0087] Some embodiments of this application provide a double-ring buffer area when the data block to be verified of the data packet to be detected and the data block to be verified of the target data packet are aligned. This can effectively avoid the situation where a small-scale modification of the firmware image causes the entire large-scale flash memory to be completely overwritten during the upgrade.

[0088] In some embodiments, the verification results are obtained by sequentially verifying the data blocks to be verified of the data packet to be detected and the target data packet in a preset order, including:

[0089] Obtain the location of the first data block in the double-ring buffer region;

[0090] The data blocks to be verified of the data packets to be detected and the target data packets stored in the first and second buffer areas are verified one by one, starting from the data at the first data block position, in order to obtain the verification result.

[0091] Specifically, in some embodiments of this application, the preset order is based on the position of the first data block, and each data block to be verified in the same data block position of the data packet to be detected and the target data packet is verified one by one to obtain the verification result. In essence, it is a cyclic operation from the position of the first data block to the position of the last data block. In some embodiments of this application, it is not based on the first data block, but takes into account the cyclic verification of data blocks in the double-shaped buffer area, which has fluidity and follows the order of data block positions.

[0092] Some embodiments of this application provide a method that verifies the data blocks to be verified one by one at the same data block position as the target data packet, starting from the first data block position, thereby making the data block comparison during verification orderly and fluid.

[0093] In other embodiments, when the data boundary between the data packet to be detected and the target data packet is shifted, the first buffer region and the second buffer region constitute multiple double-ring buffer regions.

[0094] Since the first image file for user upgrades is an iterative version of the original image on the flash memory, modifications to the first image file may cause data block boundaries to shift, leading to the failure of the original block verification. For example, in a 100MB data segment, if only a few bytes are modified or added, verification will fail if performed on a 100MB segment. However, if verified on a 1MB segment, the content before the modified portion will pass verification, while the content after the modification will fail due to the offset caused by the modification.

[0095] Based on statistics and observations of the image iteration process, the BMC image has a detailed hierarchical structure and clear modularity. Changes are usually local and concentrated, while most of the image content remains unchanged. Furthermore, since the image may contain compilation-related information such as compilation time after compilation, this header content is often dynamically changing. Therefore, this data needs to be removed during verification to avoid affecting the consistency comparison results.

[0096] Considering the above, dynamic windowing or rolling hashing algorithms are typically used to find consistency. However, these methods involve high computational complexity and are impractical for some operating systems due to resource constraints. Therefore, to quickly locate consecutive consistent data blocks in the first image file, unnecessary parts are skipped, reducing data transfer volume and improving upgrade speed. Some embodiments of this application construct multiple circular buffer areas for the first and second buffer areas. Specifically, the first and second buffer areas of one double-circular buffer area compare the header data blocks of the data packet to be detected and the target data packet, while the first and second buffer areas of another double-circular buffer area compare the tail data blocks of the data packet to be detected and the target data packet. Other double-circular buffer areas can also be added to compare data blocks in the middle of the data packet to be detected and the target data packet, etc. This is not limited, but at least two double-circular buffer areas must perform recursive searches from beginning to end to speed up comparison and improve verification accuracy.

[0097] The multiple double-ring buffer areas provided in some embodiments of this application facilitate rapid location of different regions of data blocks, improve the efficiency of verification processing, reduce data transmission volume, and also increase firmware upgrade speed.

[0098] In some embodiments, the number of dual-ring buffer regions is two, and the data blocks to be verified of the data packet to be detected and the target data packet are verified one by one in a preset order, including:

[0099] Obtain the positions of the first and last data blocks in the double-ring buffer region;

[0100] In the first and second buffer areas of the first double-ring buffer area, the data blocks to be verified of the data packets to be detected and the target data packets stored in the first and second buffer areas of the first double-ring buffer area are verified one by one, starting from the data at the position of the first data block.

[0101] In the second double-ring buffer area, the data blocks to be checked in the first and second buffer areas of the data packet to be detected and the target data packet to be checked are processed one by one, starting from the data at the last data block position.

[0102] Specifically, considering that modifications to image files are typically localized and concentrated during firmware upgrades, and also taking into account resource constraints in some operating systems, some embodiments of this application, combined with the aforementioned dual-ring buffer structure, employ a head-to-tail recursive approach. This is to facilitate rapid location, using two dual-ring buffers: one for verifying the header data blocks of the two image files, and the other for verifying the tail data blocks, thus performing a head-to-tail approach with simultaneous verification. In the first dual-ring buffer, the data blocks to be verified for the target data packet and the data packet to be tested, stored in the first and second buffer areas respectively, are verified one by one, starting from the first data block position. Similarly, in the second dual-ring buffer, the data blocks to be checked for the target data packet and the data packet to be inspected, stored in the first and second buffer areas respectively, are verified one by one, starting from the last data block position. This double-sided approach effectively sandwiches the target data packet between the two sets of dual-ring buffers.

[0103] It should be noted that, in some embodiments of this application, considering the limitations of the operating system, the corresponding buffer area is configured to occupy as little memory resources as possible. Therefore, the number of sets of dual-ring buffer areas can be set according to actual usage and is not limited here.

[0104] The first and last synchronization verification processing provided in some embodiments of this application can quickly locate the target image data, save operating system memory resources, improve the efficiency of verification processing, and thus improve firmware upgrade speed.

[0105] In some embodiments, extracting at least one data block of a preset size from at least one pending data packet includes:

[0106] Pre-determine the preset data block sizes for the first and second buffer regions;

[0107] Use the preset data block size as the preset size for truncating data blocks;

[0108] Obtain the target data block corresponding to at least one data block, including:

[0109] The second image file is divided into corresponding target data blocks according to the preset data block size.

[0110] Specifically, the preset data block size is a specification for setting the size of data block positions based on the circular buffer structure of the first and second buffer regions. This preset data block size can be used as the preset size for truncating at least one data block. Simultaneously, the second image file is segmented according to the preset data block size to obtain the corresponding target data blocks.

[0111] It should be noted that the specific values ​​of the preset data block sizes here can be the same or different; there is no limitation here. The truncated and segmented data blocks are stored in the corresponding data block positions of the ring structure. It is worth noting that the same operation is performed for subsequent storage when the data in the two mirror files is offset; this will not be elaborated upon here. Finally, the actual verification processing involves comparing the data block positions under the ring structure. This comparison is based on verifying data blocks at the same positions. The verification can be the data in the data block or the checksum of the data block, etc., and there is no limitation here.

[0112] Some embodiments of this application provide the following: at least one data block is truncated according to a preset data block size, and a second image file is segmented to store the data block in the corresponding circular buffer area. This facilitates the verification of data blocks in the same data block position, improves the consistency of data verification, and enhances the efficiency of verification processing.

[0113] In some embodiments, the preset data block size is a fixed data block size; at least one data block of the fixed data block size is extracted from at least one waiting data packet;

[0114] Correspondingly, the second image file is divided into target data blocks according to a fixed data block size.

[0115] Specifically, if the preset data block size is a fixed data block size, then the corresponding truncated and segmented data blocks will have the same specifications. Subsequent comparisons will be made using data blocks of the same specifications to ensure consistent data verification and processing.

[0116] In some embodiments, the verification results are obtained by sequentially verifying the data blocks to be verified of the data packet to be detected and the target data packet in a preset order, including:

[0117] Get the current data block position;

[0118] Compare the data blocks to be verified at the current data block positions corresponding to the first and second buffer areas;

[0119] If the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area are the same, then it is determined that the data blocks to be verified at the current data block positions are the same. The data block to be verified at the next data block position corresponding to the current data block positions of the first buffer area and the second buffer area is taken as the new current data block position, and the process returns to the step of comparing the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area.

[0120] If the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area are different, it is determined that the data blocks to be verified at the current data block positions are different, and the process returns to the step of comparing the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area, until all the data blocks to be verified in the first buffer area and the second buffer area have been compared.

[0121] Figure 2 is a schematic diagram of a dual-ring buffer region provided in some embodiments of this application. As shown in Figure 2, the current data block position is obtained, and the data blocks to be verified at the current data block positions corresponding to the first buffer region and the second buffer region are compared. If the data blocks to be verified at the current data block positions corresponding to the first buffer region and the second buffer region are the same, the comparison continues to the next one. If they are the same, they are directly deleted, indicating that the data of the data block to be verified at the current data block position has been stored in the flash memory. If the data blocks to be verified at the current data block positions corresponding to the first buffer region and the second buffer region are different, the data of the data block to be verified at the current data block position of the first buffer region is retained, indicating that the data of the data block to be verified at the current data block position has not been stored in the flash memory. Subsequent data comparison and reading continue. The rings in Figure 2 can be rotated in the same direction. The verified data blocks can be written with new data until all the first image files to be upgraded provided by the user are compared.

[0122] Some embodiments of this application provide a method to compare multiple data blocks of the same specifications in different buffer areas, which effectively avoids the complete overwriting of the entire data packet during firmware upgrade due to minor modifications to the data packet to be detected. The different data blocks are then written to the flash memory, improving the speed of subsequent firmware upgrades and reducing write wear on the flash memory.

[0123] In other embodiments, the preset data block size is a non-fixed data block size; multiple preset data block sizes increase progressively, and there is an integer multiple relationship between the multiple preset data block sizes; at least one data block is intercepted from at least one waiting data packet in the order of multiple progressively increasing non-fixed data block sizes;

[0124] Correspondingly, the second image file is divided into target data blocks according to the order of multiple progressively increasing non-fixed data block sizes.

[0125] Specifically, considering that there may be discrepancies within a certain range of data comparisons during the data comparison process, while the remaining large range of comparisons may be identical, the specifications of the data blocks corresponding to the ring structure of the buffer area can be different to facilitate rapid location and lookup. Therefore, in some embodiments of this application, the length of the preset data block size is set to a non-fixed value, using a progressively increasing method, such as starting with a 4K data block and then using data blocks of different sizes such as 4K, 8K, 16K, 32K, and 64K. Simultaneously, considering that during the comparison process of data blocks of different specifications, if there are discrepancies in the data comparison corresponding to the position of a 64K data block, in order to reduce the amount of data subsequently written, precise location is performed, and the 64K data is re-verified locally, splitting into 32K, 16K, and then further down to 4K, progressively reducing the size to find the difference corresponding to the smallest specification. Therefore, in some embodiments of this application, there are integer multiples between the multiple preset data block sizes to simplify subsequent splitting calculations.

[0126] Some embodiments of this application provide a method for segmenting at least one data block and a second image file into multiple data blocks according to a sequence of multiple progressively increasing preset data block sizes, which saves verification time and improves firmware upgrade speed.

[0127] In some embodiments, the verification results are obtained by sequentially verifying the data blocks to be verified of the data packet to be detected and the target data packet in a preset order, including:

[0128] Get the current data block position;

[0129] Compare the data blocks to be verified at the current data block positions corresponding to the first and second buffer areas;

[0130] If the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area are the same, then it is determined that the data blocks to be verified at the current data block positions are the same. The data block to be verified at the next data block position corresponding to the current data block positions of the first buffer area and the second buffer area is taken as the new current data block position, and the process returns to the step of comparing the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area.

[0131] If the data blocks to be verified at the current data block positions corresponding to the first buffer area and the second buffer area are different, then it is determined that the data blocks to be verified at the current data block positions are different, and the data blocks to be verified at the current data block positions are used as the initial verification data blocks and the size of the first data block is obtained; wherein, the length of the first data block size is a non-fixed value, the sizes of multiple first data blocks decrease step by step, and there is an integer multiple relationship between the sizes of multiple first data blocks.

[0132] The data is divided from the initial check data block in a sequence of multiple progressively smaller, non-fixed data block sizes to determine multiple current first data blocks;

[0133] The position of the current first data block is obtained in the order of the data block positions of multiple current first data blocks; wherein, the current first data block position is compared starting from the first position of the data block positions of multiple first data blocks;

[0134] Compare the data at the current first data block position corresponding to the first buffer area and the second buffer area;

[0135] If the data at the current first data block position corresponding to the first buffer area and the second buffer area are the same, then the initial check data block at the current first data block position is determined to be the same. The next first data block position at the current first data block position corresponding to the first buffer area and the second buffer area is taken as the new current first data block position, and the process returns to the step of comparing the data at the current first data block position corresponding to the first buffer area and the second buffer area.

[0136] If the data at the current first data block position corresponding to the first buffer area and the second buffer area are different, then the initial check data block at the current first data block position is determined to be the same, and the next first data block position at the current first data block position corresponding to the first buffer area and the second buffer area is taken as the new current first data block position. Then, the process returns to the step of comparing the data at the current first data block position corresponding to the first buffer area and the second buffer area until all the data in the first buffer area and the second buffer area are compared.

[0137] In some embodiments of this application, the process for determining the difference and sameness of the data blocks to be verified at the current data block position is the same as the loop comparison process in the above embodiments, and will not be repeated here. In some embodiments of this application, after determining the difference of the data blocks to be verified at the current data block position, the size of the first data block is directly obtained. Here, the size of the first data block and the size of the preset data block are both non-fixed values ​​and decrease step by step. The step-by-step decrease here is the same as the step-by-step increase of the preset data block size in the above embodiments, and will not be repeated here.

[0138] The initial data block is divided into multiple non-fixed-size, progressively decreasing blocks to determine multiple current first data blocks. It's important to note that local verification is performed on each block as needed until all comparisons are complete. During local verification, since the data is divided into multiple first data blocks, some blocks may initially contain identical data. If the blocks to be verified show different data, the next current first data block location needs to be found and the comparison continued until all data has been compared.

[0139] It is worth noting that in some embodiments of this application, the data is divided in a progressively decreasing order based on the size of the first data block. For example, if the original 64K data is divided into 32K blocks, it is then divided into two data blocks. These two blocks are used as the current first data block for comparison of subsequent data blocks. This process continues until all data blocks in the current iteration are compared. Simultaneously, the 32K data is compared again, becoming the current first data block for another iteration. This iterative comparison continues until the smallest unit of data block is found for localization. For example, Figure 3 illustrates a partial verification diagram of data block division based on the first data block size, provided by some embodiments of this application. As shown in Figure 3, when comparing a 32K data block, if an inconsistency in hash values ​​is found, the system will re-perform partial verification starting from 4K in the last 16K of the 32K data block until a matching verification value is found. The final boundary is an integer multiple of 4K, such as 36K.

[0140] The local verification process based on data block segmentation of the first data block size provided in some embodiments of this application can save verification time and quickly locate the final verification result, thereby improving the location efficiency.

[0141] In some embodiments, the verification results are obtained by sequentially verifying the data blocks to be verified of the data packet to be detected and the target data packet in a preset order, including:

[0142] The first marked position is obtained by marking the positions of data blocks with different verification results in the first double-ring buffer region.

[0143] The second marked position is obtained by marking the positions of data blocks with different verification results in the second double-ring buffer region.

[0144] The data blocks corresponding to the first and second marker positions are written to the flash memory within the dual-ring buffer area.

[0145] Figure 4 is a schematic diagram of a head-tail recursive search verification provided in some embodiments of this application. As shown in Figure 4, the system will attack the data packet from both the head and tail. The data block with the longest consecutive consistency at the head and tail in Figure 4 does not need to be transmitted. Instead, the data block is directly reduced to a local area and then written to the flash memory.

[0146] Specifically, some embodiments of this application take into account that multiple different data blocks may appear during the pincer attack process. Therefore, it is not necessary to concern ourselves with the different data blocks in the middle; only the position of the first different data block among the data block positions with different verification results in the first double-ring buffer area is considered and marked as the first marker position. The position of the first different data block among the data block positions with different verification results in the second double-ring buffer area is marked as the second marker position. Here, the data blocks corresponding to the first marker position to the second marker position are written to the flash memory.

[0147] In the recursive search process provided by some embodiments of this application, a local concentrated region is determined corresponding to different data blocks, thereby improving the efficiency of the verification process.

[0148] In some embodiments, the verification results are obtained by sequentially verifying the data blocks to be verified of the data packet to be detected and the target data packet in a preset order, including:

[0149] Obtain the first target data of the data block to be verified in the data packet to be detected and the second target data of the data block to be verified in the target data packet;

[0150] Determine the verification value based on the first target data;

[0151] The hash value is determined based on the second target data;

[0152] Determine if the checksum and hash value are the same;

[0153] If the checksum and the hash value are different, then the checksum results are different.

[0154] If the checksum and the hash value are the same, then the checksum results are considered to be the same.

[0155] Specifically, the verification process in some embodiments of this application corresponds to the comparison of checksums within a data block. The checksum, calculated from the data block's checksum, can quickly check whether errors have occurred in the transmission or storage of the data. Hash values ​​are used to detect minute changes in the data.

[0156] In some embodiments of this application, the process for determining the check value and the hash value can be the same as or different from the conventional processing method. No limitation is made here, and it can be set according to the actual situation.

[0157] Some embodiments of this application provide a comparison of the checksum and hash value of the data block, which employs a dual-verification mechanism to effectively ensure the integrity and reliability of the data block.

[0158] Figure 5 is a schematic diagram of a firmware upgrade method based on an RTOS operating system provided in some embodiments of this application. As shown in Figure 5, some embodiments of this application take into account the fault tolerance capability of the RTOS operating system, fully consider resource constraints, and optimize the efficiency and reliability of the upgrade process. The RTOS operating system runs normally and the network protocol stack works normally. The user establishes communication with the RTOS operating system through the network. Each module, RTOS network stack, and SPI driver in Figure 5 are all implemented by software design within the RTOS operating system. When a remote user uses remote commands to execute a BMC remote upgrade task on the RTOS operating system, the RTOS operating system is built and initialized in memory.

[0159] On RTOS operating system

[0160] The network protocol stack provides streamlined network capabilities for the RTOS operating system, supporting Transmission Control Protocol (TCP) / User Datagram Protocol (UDP), receiving data blocks transmitted by remote users, and controlled by the streaming management module. In the remote BMC firmware image upgrade process described in this patent, the TCP protocol is used.

[0161] In Figure 5, the acquisition of the data packet to be detected corresponding to at least one data block adopts two approaches: one is to send it down to the streaming transmission management module through the RTOS network stack, process it, and then send it to the verification module for verification processing; the other is to send it to the verification module through the writing module for verification processing.

[0162] The streaming management module transmits and processes data in the form of a continuous stream. Its streaming transmission allows data to be processed step by step during transmission. At the same time, for applications with high real-time requirements, it can transmit data with low latency, ensuring a smooth and natural interaction.

[0163] In some embodiments, before storing at least one data block into the memory of the management controller, the method further includes:

[0164] An index tag is created for at least one data block;

[0165] A first check value is determined based on data from at least one data block;

[0166] The first checksum and index tag are saved, along with at least one data block, and stored in the memory of the management controller.

[0167] Specifically, at least one data block (e.g., 4KB in size) is received, and an index tag (Identity, ID) is created for the data block. Simultaneously, a hash algorithm is used to calculate the first checksum for the data block. The streaming transmission management module handles the verification of the received network data blocks to improve parallelism and avoid latency caused by centralized computation. Subsequently, the data block is written to the circular buffer in the write module, and the index tag and the first checksum are synchronously sent to the verification module. Based on the buffer status fed back by the write module, the module performs transmission speed control at the TCP protocol flow control layer.

[0168] Some embodiments of this application provide that the index tag and the first check value are stored in the memory of the controller along with the data block. To a certain extent, this takes into account the availability of memory resources of the RTOS operating system, so that the content can be used without downloading the complete image file, thus reducing storage requirements.

[0169] Referring to Figure 5, some embodiments of this application obtain the data based on the first buffer area. The specific process of establishing the index marker and the first check value is the same as that of the above embodiments, and will not be repeated here.

[0170] The at least one data packet acquisition method provided by some embodiments of this application saves operating system memory resources, improves the accuracy and integrity of subsequent data block verification processing, and also improves data verification processing efficiency.

[0171] As shown in Figure 5, the write module and read module are responsible for operating the SPI driver to efficiently write and read mirrored data blocks from the Flash memory, respectively. To achieve parallelism in data transmission and processing while optimizing system resource utilization, a double-ring buffer architecture is designed. Each buffer is 64KB in length. In the write module, the received mirrored data blocks are first stored in the write buffer, which can cache up to 16 data blocks. Based on the buffer's state and capacity, the blocks are written to the Flash memory one by one. The write operation employs a block-based write strategy to ensure stable system operation under resource-constrained conditions. The read module extracts mirrored data blocks from the Flash memory into the ring read buffer and provides support for subsequent verification. Read and write operations run independently, with the internal control module dynamically controlling the input speed based on the buffer's output speed.

[0172] The verification module retrieves data blocks stored in Flash from the read buffer, calculates their hash values, and compares the results with the checksums of the remote data blocks received during streaming. Through this verification mechanism, the module can verify one by one whether the 16 data blocks in the buffer match the data transmitted from the remote end, thereby determining whether the received data needs to be written to Flash storage.

[0173] Furthermore, this application also provides a dual operating system, which includes a first operating system and a second operating system; wherein the memory resources accessed by the first operating system are greater than those accessed by the second operating system.

[0174] If the first operating system fails to boot the management controller, a second operating system is booted to perform the firmware upgrade steps described above and complete the firmware upgrade of the management controller.

[0175] Specifically, a dual-operating system architecture, such as Linux (the primary operating system) and an RTOS (the secondary operating system), has been introduced into the BMC to improve server fan control speed, system startup efficiency, and fault handling capabilities after power-on. This architecture runs the Linux operating system and the RTOS operating system on two cores of the BMC, respectively. The RTOS and Linux systems boot simultaneously. Due to the high real-time performance and lightweight nature of the RTOS, it can typically boot up quickly within seconds and control the server fans, while providing basic user management services. Specifically, after system power-on, the BMC first boots and loads the RTOS via U-Boot. The RTOS immediately begins executing critical functions such as fan control and temperature monitoring. Simultaneously, the BMC also begins providing users with basic remote management functions, such as system status monitoring and fault diagnosis. As Linux boots up, the RTOS gradually transfers control to the Linux system. At this point, the BMC enters a fully Linux-controlled mode, providing richer service functions, such as log management, network configuration, firmware updates, and more complex remote management operations. Meanwhile, the RTOS enters a status monitoring mode, responsible for continuously monitoring the health status of Linux and regaining system control when necessary. Through its dual-system architecture, BMC can provide comprehensive and flexible management functions while ensuring rapid response and efficient control, significantly improving the overall performance, reliability, and maintainability of the server.

[0176] However, due to the increasing complexity of the current Boot Control Center (BMC) and the influence of various uncertainties, Linux systems are at risk of crashing, potentially causing downtime, freezing, and other problems. In such cases, the Real-Time Operating System (RTOS) detects Linux crashes in real time and takes over system control, continuing to provide network services and basic management functions such as fan control, temperature monitoring, hardware status detection, and remote user management. This allows the RTOS or remote users to remotely restart the BMC even when the Linux system crashes, preventing complete loss of control due to a Linux crash. It also overcomes the challenge of limited RTOS memory resources during firmware upgrades, significantly improves the speed of remote image upgrades, and resolves the current issue of the BMC failing to boot due to a corrupted boot image, thereby enhancing system reliability and fault tolerance, and reducing operational costs.

[0177] Remote upgrade functionality is enabled on the RTOS operating system of the management controller, fully leveraging the real-time performance and stability of the RTOS. Even if both the Linux system and firmware image are corrupted simultaneously, remote firmware recovery and upgrades can still be completed using the RTOS operating system, enhancing the fault tolerance of the management controller. Remote firmware upgrades can be performed even in the event of a BMC crash or image corruption, effectively shortening system downtime and significantly improving system maintainability and user experience. Furthermore, by reducing data write operations, the lifespan of the Flash memory is extended, lowering device maintenance costs.

[0178] Furthermore, this application also provides a server, including the aforementioned operating system.

[0179] For a description of the features in the embodiment corresponding to the server, please refer to the relevant description in the embodiment corresponding to the firmware upgrade method, which will not be repeated here.

[0180] Figure 6 is a flowchart of a head-and-tail recursive search method provided in some embodiments of this application. As shown in Figure 6, it includes:

[0181] S21: Both parties establish communication;

[0182] S22: The firmware image in the current secondary operating system calculation image flash memory contains 2... n The hash value of each data block;

[0183] S23: Send the hash value to the remote end for synchronization comparison;

[0184] S24: Determine if the hash values ​​are consistent; if the hash values ​​are consistent, return to step S22 to obtain the next data block; if the hash values ​​are inconsistent, proceed to step S25.

[0185] S25: From 2 n-1 to 2n Recursively perform the recursion within the specified range;

[0186] S26: Determine if the check values ​​are the same; if the check values ​​are the same, return to step S25; if the check values ​​are different, proceed to step S27.

[0187] S27: Repeat from the end;

[0188] S28: Create an index for data blocks in 4K units and send data blocks with different verification results to the flash memory.

[0189] Some embodiments of this application also provide a firmware upgrade device. Figure 7 is a schematic diagram of the structure of a firmware upgrade device provided in some embodiments of this application. As shown in Figure 7, the device includes:

[0190] The receiving module 11 is used to receive firmware upgrade instructions, obtain the first image file to be upgraded, split the first image file into at least one data packet, and transmit at least one data packet to the buffer of at least one network device on the target link to wait for incoming instructions.

[0191] The response module 12 is used to respond to the incoming command, extract at least one data block of a preset size from at least one waiting data packet, and store at least one data block in the memory of the management controller;

[0192] The verification processing module 13 is used to obtain a target data block corresponding to at least one data block, and to perform verification processing on at least one data block and the target data block to obtain a verification result; wherein, the target data block is obtained by dividing a second image file, and the second image file is stored in flash memory;

[0193] The discard module 14 is used to discard data blocks when the verification results are the same.

[0194] The write module 15 is used to write the data block to the flash memory when the verification results are different.

[0195] For a description of the features in some embodiments of the firmware upgrade device, please refer to the relevant descriptions in some embodiments of the firmware upgrade method; they will not be repeated here.

[0196] Some embodiments of this application 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.

[0197] Some embodiments of this application also provide a computer non-volatile readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the firmware upgrade method embodiments described above when running.

[0198] In some embodiments of this application, the aforementioned non-volatile readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0199] Some embodiments of this application 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.

[0200] Some embodiments of this application also provide another computer program product, including a non-volatile computer non-volatile readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the firmware upgrade method embodiments described above.

[0201] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with some of 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 implementation should not be considered beyond the scope of this application.

[0202] The firmware upgrade method, system, server, device, medium, and product provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of these embodiments are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A firmware upgrade method characterized by comprising: The application relates to a method for checking a firmware upgrade, and belongs to the field of firmware upgrade. The method comprises the following steps: receiving a firmware upgrade instruction, obtaining a first image file to be upgraded, splitting the first image file into at least one data packet, and transmitting the at least one data packet to at least one network device buffer of a target link to wait for an incoming instruction; in response to the incoming instruction, intercepting at least one data block of a preset size from the at least one data packet in the waiting state, and storing the at least one data block into a memory of a management controller; obtaining a target data block corresponding to the at least one data block, and performing a checking process on the at least one data block and the target data block to obtain a checking result; wherein the target data block is obtained by splitting a second image file, and the second image file is stored in a flash memory; when the checking result is the same, discarding the data block; 2. The firmware upgrade method according to claim 1, wherein, when the checking result is different, writing the data block into the flash memory. The method for checking a firmware upgrade comprises the following steps: forming a to-be-detected data packet by using the at least one data block stored in the memory of the management controller; forming a target data packet by using the target data block corresponding to the at least one data block; obtaining a to-be-checked data block corresponding to a same data block position of the to-be-detected data packet and the target data packet; 3. The firmware upgrade method according to claim 2, wherein, performing a checking process on the to-be-checked data block of the to-be-detected data packet and the target data packet in a preset order to obtain a checking result. Before the checking process is performed on the at least one data block and the target data block to obtain the checking result, the method further comprises the following steps: pre-establishing a first buffer area and a second buffer area; wherein the first buffer area and the second buffer area adopt a ring structure; storing the to-be-checked data block of the to-be-detected data packet in the first buffer area; 4. The firmware upgrade method according to claim 3, wherein, storing the to-be-checked data block of the target data packet in the second buffer area.

5. The firmware upgrade method of claim 4, wherein, When the to-be-checked data block of the to-be-detected data packet and the to-be-checked data block of the target data packet are aligned, the first buffer area and the second buffer area form a double-ring buffer area. The method for checking a firmware upgrade comprises the following steps: obtaining a first data block position of the double-ring buffer area; 6. The firmware upgrade method according to claim 3, wherein performing a checking process on the to-be-checked data block of the to-be-detected data packet and the target data packet stored in the first buffer area and the second buffer area from the data of the first data block position one by one to obtain the checking result.

7. The firmware upgrade method according to claim 6, wherein When the data boundary of the to-be-detected data packet and the target data packet is displaced, the first buffer area and the second buffer area form a plurality of double-ring buffer areas. When the number of the double-ring buffer areas is two, the method for checking a firmware upgrade comprises the following steps: obtaining a first data block position and a last data block position of the double-ring buffer area; performing a checking process on the to-be-checked data block of the to-be-detected data packet and the target data packet stored in the first buffer area and the second buffer area of the first double-ring buffer area from the data of the first data block position one by one. The first buffer area and the second buffer area of the second double-ring buffer area correspond to the to-be-detected data blocks and the target data blocks of the to-be-detected data packet and the target data packet respectively, and the checking process is performed on the data from the last data block position one by one.

8. The firmware upgrade method of claim 5, wherein, The preset size of the at least one data block is obtained from the at least one data packet, including: The preset data block size of the first buffer area and the second buffer area is obtained in advance; The preset data block size is used as the preset size of the intercepted data block for interception; The target data block corresponding to the at least one data block is obtained, including: The second mirror file is segmented according to the preset data block size to obtain the corresponding target data block.

9. The firmware upgrade method of claim 8, wherein, The preset data block size is a fixed data block size; and the fixed data block size of the at least one data block is obtained from the at least one data packet; Correspondingly, the second mirror file is segmented according to the fixed data block size to obtain the corresponding target data block.

10. The firmware upgrade method of claim 9, wherein, The checking process is performed on the to-be-detected data blocks and the target data blocks of the to-be-detected data packet and the target data packet respectively according to a preset order to obtain a checking result, including: The current data block position is obtained; The to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area are compared; If the to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area are the same, it is determined that the to-be-checked data blocks at the current data block position are the same, the to-be-checked data blocks at the next data block position corresponding to the first buffer area and the second buffer area are taken as new current data block positions, and the step of comparing the to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area is returned to; If the to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area are different, it is determined that the to-be-checked data blocks at the current data block position are different, and the step of comparing the to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area is returned to until the to-be-checked data blocks of the first buffer area and the second buffer area are completely compared.

11. The firmware upgrade method of claim 8, wherein, The preset data block size is a non-fixed data block size; a plurality of preset data block sizes are sequentially increased, and there is an integral multiple relationship between the plurality of preset data block sizes; and the at least one data block is obtained from the at least one data packet according to the order of the plurality of sequentially increased non-fixed data block sizes; Correspondingly, the second mirror file is segmented according to the order of the plurality of sequentially increased non-fixed data block sizes to obtain the corresponding target data block.

12. The firmware upgrade method of claim 11, wherein, The checking process is performed on the to-be-detected data blocks and the target data blocks of the to-be-detected data packet and the target data packet respectively according to a preset order to obtain a checking result, including: The current data block position is obtained; The to-be-checked data blocks at the current data block position corresponding to the first buffer area and the second buffer area are compared; If the to-be-verified data blocks at the current data block positions corresponding to the first buffer region and the second buffer region are the same, it is determined that the to-be-verified data blocks at the current data block positions are the same, the to-be-verified data blocks at the next data block positions of the current data block positions corresponding to the first buffer region and the second buffer region are taken as new current data block positions, and the step of comparing the to-be-verified data blocks at the current data block positions corresponding to the first buffer region and the second buffer region is returned to. If the to-be-verified data blocks at the current data block positions corresponding to the first buffer region and the second buffer region are different, it is determined that the to-be-verified data blocks at the current data block positions are different, the to-be-verified data block at the current data block position is taken as an initial verification data block, and a first data block size is obtained; wherein the length of the first data block size is a non-fixed value, a plurality of first data block sizes are sequentially decreased, and there is an integral multiple relationship between the plurality of first data block sizes. The initial verification data block is segmented according to the order of a plurality of sequentially decreasing non-fixed data block sizes to determine a plurality of current first data blocks. The current first data block positions are obtained according to the data block position order of the plurality of current first data blocks; wherein the current first data block positions start from the first position of the data block positions of the plurality of first data blocks. The data at the current first data block positions corresponding to the first buffer region and the second buffer region are compared. If the data at the current first data block positions corresponding to the first buffer region and the second buffer region are the same, it is determined that the initial verification data blocks at the current first data block positions are the same, the next first data block position of the current first data block positions corresponding to the first buffer region and the second buffer region is taken as a new current first data block position, and the step of comparing the data at the current first data block positions corresponding to the first buffer region and the second buffer region is returned to. If the data at the current first data block positions corresponding to the first buffer region and the second buffer region are different, it is determined that the initial verification data blocks at the current first data block positions are the same, the next first data block position of the current first data block positions corresponding to the first buffer region and the second buffer region is taken as a new current first data block position, and the step of comparing the data at the current first data block positions corresponding to the first buffer region and the second buffer region is returned to.

13. The firmware upgrade method of claim 7, wherein, The to-be-verified data blocks of the to-be-detected data packet and the target data packet are sequentially verified according to a preset order to obtain a verification result, comprising: The data block positions with different verification results of the first double-ring buffer region are marked to obtain a first marked position; The data block positions with different verification results of the second double-ring buffer region are marked to obtain a second marked position; The data blocks corresponding to the first marked position to the second marked position in the double-ring buffer region are written to the flash memory.

14. The firmware upgrade method of claim 2, wherein, The checking result is obtained by checking the to-be-verified data block of the to-be-detected data packet and the to-be-verified data block of the target data packet one by one in a preset order, comprising: obtaining first target data of the to-be-verified data block of the to-be-detected data packet and second target data of the to-be-verified data block of the target data packet; determining a check value according to the first target data; determining a hash value according to the second target data; determining whether the check value and the hash value are the same; if the check value and the hash value are different, determining that the checking result is different; if the check value and the hash value are the same, determining that the checking result is the same.

15. The firmware upgrade method of claim 1, wherein, Before storing the at least one data block into the memory of the management controller, further comprising: correspondingly establishing an index mark for the at least one data block; determining a first check value according to the data of the at least one data block; saving the first check value and the index mark to be stored into the memory of the management controller together with the at least one data block.

16. A dual operating system, characterized by The dual operating system comprises a first operating system and a second operating system; wherein the access memory resource of the first operating system is greater than the access memory resource of the second operating system; in the case that the first operating system fails to start the management controller, starting the second operating system to execute the steps of the firmware upgrade method of any one of claims 1 to 15 to complete the firmware upgrade of the management controller.

17. A server, characterized by The dual operating system of claim 16 is included.

18. An electronic device, comprising: comprising: a memory configured to store a computer program; a processor configured to implement the steps of the firmware upgrade method of any one of claims 1 to 15 when executing the computer program.

19. A computer non-volatile readable storage medium characterized in that, The computer program is stored in the computer non-volatile readable storage medium, wherein the computer program is executed by the processor to implement the steps of the firmware upgrade method of any one of claims 1 to 15.

20. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the firmware upgrade method of any one of claims 1 to 15.