Firmware In-Band Refresh Method, Electronic Device, Storage Medium and Program Product
By identifying the layout type of firmware to be refreshed and using the reference layout table for in-band refresh, the problem that UEFI BIOS cannot support Coreboot BIOS in-band refresh is solved, and efficient in-band refresh of heterogeneous firmware is achieved.
Patent Information
- Application Number
- CN202510368837.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-03-26
AI Technical Summary
In the prior art, UEFI BIOS can only support in-band refreshing of the same type of BIOS by default, and cannot directly support in-band refreshing of Coreboot BIOS, resulting in low operation and maintenance efficiency and high operation complexity.
By identifying the firmware layout type of firmware to be refreshed, determining its reference layout table, and performing in-band refresh of firmware to be refreshed based on the reference layout table in the cache of the current firmware, supporting in-band refresh of heterogeneous firmware.
In-band refresh of heterogeneous firmware is realized, operation and maintenance efficiency is improved, and operation and maintenance is reduced. The operation complexity of heterogeneous firmware in-band refresh is reduced.
Smart Images

Figure CN119883334B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer firmware updates, and in particular, to a firmware in-band refresh method, an electronic device, a storage medium, and a program product. Background Art
[0002] In the current server firmware field, the UEFI (Unified Extensible Firmware Interface) BIOS (Basic Input Output System) system is the mainstream technology. However, due to its closed-source nature and relatively high development threshold, it has gradually become a factor restricting its flexibility and response speed. Therefore, Coreboot, as an open-source firmware solution, has begun to attract attention. Compared with the traditional UEFI boot method, Coreboot is more open and flexible and can adapt to the needs of specific business scenarios faster.
[0003] However, for the specific application scenario of in-band refreshing the BIOS, the UEFI BIOS can only support in-band refreshing of the same type of BIOS (i.e., the UEFI layout type (layout, the physical or logical arrangement of components, modules, or data structures)) by default and cannot directly support in-band refreshing of the Coreboot BIOS. When different types of BIOS firmware need to be updated, it is usually only possible to rely on out-of-band BMC (Baseboard Management Controller) refreshing or manual flashing methods, which greatly affects the operation and maintenance efficiency and increases the operation complexity. Summary of the Invention
[0004] The present invention provides a firmware in-band refresh method, an electronic device, a storage medium, and a program product to at least solve the problem in the related art that the in-band refresh interrupt handler can only refresh firmware with the same layout.
[0005] The present invention provides a firmware in-band refresh method, including: identifying the firmware layout type of the firmware to be refreshed; determining a reference layout table for the firmware to be refreshed according to the firmware layout type; and performing in-band refresh of the firmware to be refreshed in the cache of the current firmware, where the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0006] The present invention also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above firmware in-band refresh methods when executing the computer program.
[0007] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above firmware in-band refresh methods.
[0008] The present invention also provides a computer program product including a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above firmware in-band refresh methods.
[0009] The present invention determines a reference layout table of the firmware to be refreshed according to the firmware layout type of the firmware to be refreshed, and performs in-band refresh of the firmware to be refreshed in the cache of the current firmware based on the reference layout table. In this way, even if the current firmware and the firmware to be refreshed are heterogeneous firmwares, the in-band refresh of the firmware can be realized. Thus, the in-band refresh of heterogeneous firmwares is realized through the introduced reference layout table, solving the technical problem that the in-band refresh interrupt handler in the related art can only refresh firmwares with the same layout, achieving the technical effects of supporting the in-band refresh of heterogeneous firmwares, improving the operation and maintenance efficiency, and reducing the operation complexity of the in-band refresh of heterogeneous firmwares. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] To more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0011] Figure 1 It is a schematic flowchart of a method for refreshing BIOS in the application layer of a Linux system in the related art;
[0012] Figure 2 It is a schematic flowchart of a firmware in-band refresh method provided by an embodiment of the present invention;
[0013] Figure 3 It is a schematic flowchart of a method for in-band refresh of heterogeneous BIOS firmware provided by an embodiment of the present invention;
[0014] Figure 4 It is a schematic layout diagram provided by an embodiment of the present invention;
[0015] Figure 5 It is a schematic structural diagram of a firmware in-band refresh device provided by an embodiment of the present invention;
[0016] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
[0017] Description of the accompanying drawings: 10 - in-band firmware refresh device; 301 - identification module; 302 - determination module; 303 - refresh module; 401 memory; 402 processor. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] It should be noted that, in the description of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0020] Figure 1 The present invention is a flowchart of a method for refreshing BIOS at the application layer of a Linux system in the related art. The method sends an SMI (System Management Interrupt) interrupt instruction through the out instruction of the processor to make the CPU (Central Processing Unit) enter the SMM (System Management Mode) mode. In the SMM mode, the BIOS obtains control, updates its own area, and refreshes the BIOS.
[0021] Specifically, if Figure 1As shown, when the process starts, first start the BIOS firmware update tool, then select a BIOS file and verify it. If the verification passes, continue with the subsequent steps; if the verification fails, return to re-select and verify the BIOS file. After passing the verification, obtain IO permissions, allocate a 4K buffer, and convert the buffer into a physical address. Then read 4K data from the file into the data buffer and request an SMI interrupt to enter the SMM mode. In the SMM mode, the BIOS handler parses and processes the data. Subsequently, write the data to the BIOS, exit the SMM mode, and check if the write is successful. If the write is successful, check if the end of the file has been reached; if the end of the file has not been reached, repeat the above process until the entire file is written. If the write is unsuccessful or the end of the file is reached, the process ends. This method first triggers a request to update the BIOS firmware through a specific interface in the application layer of the Linux system, starting the entire update process, and uses the out instruction of the processor to send an SMI interrupt instruction, causing the CPU to temporarily suspend the current task and switch to the SMM mode. The SMM is a special CPU operation mode that allows low-level hardware management and maintenance tasks to be executed without interfering with the normal operation of the operating system or other applications. When the CPU enters the SMM mode, the BIOS takes over control. In this protected environment, the BIOS can safely perform underlying hardware management and update operations, including its own firmware update.
[0022] However, this method focuses on the execution process of the BIOS interrupt handler for firmware update, but does not consider the situation where the BIOS to be updated has a different layout from the currently running BIOS layout. Therefore, it cannot support in-band firmware update between heterogeneous BIOSs with different layouts.
[0023] In view of the above-mentioned deficiencies in the related technologies, embodiments of the present invention propose a method for in-band firmware update, an electronic device, a storage medium, and a program product to solve the technical problem that the in-band firmware update interrupt handler in the related technologies can only update firmware with the same layout, and at the same time achieve the technical effects of supporting in-band firmware update for heterogeneous firmware and different firmware can also support update only by changing the structure of the reference layout table. The specific method will be described in detail below.
[0024] To enable those skilled in the art of this technology to better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] Figure 2 It is a schematic flowchart of a method for in-band firmware update provided by an embodiment of the present invention. As Figure 2 shown, the method specifically includes the following steps:
[0026] In step S101, identify the firmware layout type of the firmware to be refreshed.
[0027] Among them, the firmware layout type of the firmware to be refreshed can be layout types such as UEFI type, Coreboot type, etc., which are not specifically limited here; the UEFI type of firmware adopts a modular design, is easy to expand and maintain, and supports functional expansion through driver and application interfaces, provides a secure boot function, ensures that only signed firmware and operating system code can run, enhances the security of the system, and is widely used in modern computers, servers, and personal devices, especially in environments that require high security and high performance; the Coreboot type of firmware is lightweight and efficient, focuses on minimizing the boot time and reducing unnecessary complexity, is suitable for application scenarios that require fast boot, such as embedded systems and servers, and is completely open source, allowing developers to customize firmware functions according to specific needs, providing great flexibility, and can run on various hardware platforms.
[0028] It can be understood that in the embodiments of the present invention, it is first necessary to identify the firmware layout type of the firmware to be refreshed, so as to determine whether the firmware layout type of the firmware to be refreshed matches the format supported by the current server.
[0029] In the embodiments of the present invention, identifying the firmware layout type of the firmware to be refreshed includes: extracting the firmware identifier of the firmware to be refreshed; determining the firmware layout type of the firmware to be refreshed according to the firmware identifier.
[0030] Among them, the firmware identifier is the layout type identifier of the firmware to be refreshed, and the layout type of the firmware can be identified through this identifier, so as to know the data structure and organization method inside the firmware.
[0031] In the embodiments of the present invention, determining the firmware layout type of the firmware to be refreshed according to the firmware identifier includes: obtaining a first correspondence table between the firmware identifier and the firmware layout type; using the firmware identifier as an index, querying the first correspondence table to determine the firmware layout type of the firmware to be refreshed.
[0032] Among them, the first correspondence table is a mapping relationship table, which records the association between different firmware layout types and the corresponding firmware identifiers, and can be understood as a lookup table. The first correspondence table can be used to find the corresponding firmware layout type through the firmware identifier.
[0033] It can be understood that in the embodiments of the present invention, using the firmware identifier as an index, querying the first correspondence table, and obtaining the firmware layout type confirmation information of the firmware to be refreshed from the information in the first correspondence table, so as to determine the firmware layout type of the firmware to be refreshed.
[0034] In an embodiment of the present invention, before identifying the firmware layout type of the firmware to be refreshed, the following steps are further included: obtaining a request for in-band firmware update sent by a server; in response to the request for in-band firmware update, triggering an interrupt program of the current firmware; in the interrupt program of the current firmware, determining the firmware layout type of the firmware to be refreshed.
[0035] Among them, the request for in-band firmware update sent by the server usually includes location information, version information, etc. of the firmware file to be updated; the interrupt program is to send an SMI interrupt instruction to temporarily suspend the current task of the CPU and switch to the SMM mode to run a dedicated interrupt handler. The SMM mode provides a highly isolated and protected environment, and sensitive operations can be performed without interfering with the operating system or other application programs. This isolation ensures that even if there are vulnerabilities in the operating system or application programs, etc., it will not affect the ongoing system management tasks, so as to safely perform the relevant operations for refreshing the firmware to be updated.
[0036] It can be understood that in an embodiment of the present invention, when receiving the request for in-band firmware update sent by the server, in response to the request, an SMI interrupt instruction is sent to temporarily suspend the current task of the CPU and switch to the SMM mode to run the interrupt program of the current firmware. In the interrupt program of the current firmware, the firmware layout information of the firmware to be refreshed is extracted, and the firmware layout type is determined according to the firmware layout information.
[0037] In step S102, a reference layout table of the firmware to be refreshed is determined according to the firmware layout type.
[0038] Among them, the reference layout table is a preset layout table, which is preset in the SMRAM (System Management Random Access Memory), and contains reference firmware layout information, providing a standard template that can be used to verify and parse whether the layout of the firmware to be refreshed conforms to the expected format.
[0039] It can be understood that in an embodiment of the present invention, the target in-band refresh action of the firmware to be refreshed is determined through the reference layout table of the firmware layout type, which can ensure that the correct target in-band refresh action is taken according to the specific firmware layout type of the firmware to be refreshed, so as to achieve efficient and safe firmware update.
[0040] In an embodiment of the present invention, determining a reference layout table of the firmware to be refreshed according to the firmware layout type includes: reading a second correspondence table between the firmware layout type and the reference layout table in a database; using the firmware layout type as an index, querying the second correspondence table to obtain the reference layout table.
[0041] Among them, the second correspondence table is a mapping table that records the association between different firmware layout types and the corresponding reference layout tables, which can be understood as a lookup table. Using the second correspondence table, the corresponding reference layout table can be found through the firmware layout type.
[0042] It can be understood that in the embodiments of the present invention, in order to obtain the reference layout table of the firmware layout type, it is first necessary to find the second correspondence table in the database storing the data relationship between the firmware layout type and the reference layout table, and use the specific firmware layout type of the firmware to be refreshed as an index to query and extract the corresponding reference layout table in this second correspondence table.
[0043] In the embodiments of the present invention, before determining the reference layout table of the firmware to be refreshed according to the firmware layout type, it further includes: reading the reference layout table stored in the database; obtaining the first layout structure of the firmware when the reference layout table was established; identifying the second layout structure of the firmware to be refreshed; comparing the first layout structure with the second layout structure; if the first layout structure is inconsistent with the second layout structure, then update the reference layout table and the second correspondence table in the database according to the second layout structure.
[0044] It can be understood that in the embodiments of the present invention, before obtaining the reference layout table of the firmware layout type, it is first necessary to read the reference layout table stored in the database and obtain the first layout structure recorded when the reference layout table was established, that is, the original or standard firmware layout. Then, identify the second layout structure of the firmware to be refreshed, that is, the actual firmware layout information, and compare the first layout structure with the second layout structure. If the first layout structure is inconsistent with the second layout structure, it indicates that the layout of the current firmware has changed or been updated. In this case, it is necessary to update the reference layout table and the second correspondence table in the database according to the second layout structure to ensure that both reflect the latest firmware layout information, thus ensuring that subsequent firmware update operations can be based on the latest and accurate layout information and avoiding problems caused by layout mismatches.
[0045] In step S103, in the cache of the current firmware, perform in-band refresh on the firmware to be refreshed based on the reference layout table, where the current firmware and the firmware to be refreshed are heterogeneous firmwares.
[0046] Among them, heterogeneous firmwares refer to different types of firmwares with different hardware layouts and structures. For example, if there are significant differences in the internal organization forms between UEFI-type firmware and Coreboot-type firmware, then the two are heterogeneous firmwares; the current firmware is the firmware of the current server and by default does not support in-band refresh of heterogeneous firmwares; the cache of the current firmware is the SMRAM memory area, which is used to store and run code and data in the SMM mode.
[0047] It can be understood that when the target in-band refresh operation is performed on the firmware to be refreshed in the cache of the current firmware in the embodiments of the present invention, it is allowed that the current firmware and the firmware to be refreshed are heterogeneous firmwares. Even if the current firmware and the firmware to be refreshed belong to different types, they can be correctly processed, and the in-band refresh of the firmware to be refreshed is performed based on the reference layout table, so that the current firmware that does not support the in-band refresh of heterogeneous firmwares by default supports the in-band refresh of heterogeneous firmwares, solving the problems in the related art that the in-band refresh interrupt handler can only refresh firmwares with the same reference layout, and for heterogeneous firmwares, only the out-of-band BMC refresh or manual burning method can be relied on to complete, with low operation and maintenance efficiency, high operation complexity and high risk.
[0048] In the embodiments of the present invention, the in-band refresh of the firmware to be refreshed based on the reference layout table includes: extracting the reference layout information in the reference layout table; based on the reference layout information, reading multiple blocks of the firmware to be refreshed; identifying the target block order of the multiple blocks, and performing the in-band refresh of the firmware to be refreshed according to the target block order.
[0049] Among them, the reference layout information is the pre-set reference layout information in the reference layout table; the multiple areas, such as FV_BB (Firmware Volume Boot Block), FV_MAIN (Main Firmware Volume), and NVRAM (Non-Volatile Random Access Memory) in UEFI BIOS, or Romstage (Read-Only Memory stage), Ramstage (Random Access Memory stage), and Payload in Coreboot BIOS, etc.; the target block order is usually defined by the reference layout table to ensure that each block is correctly placed in its proper position.
[0050] It can be understood that in the embodiments of the present invention, through the obtained reference layout table, the required reference layout information is identified, and the target block order of multiple blocks predefined for the firmware to be refreshed is obtained. Through this target block order, the specific in-band refresh operation of the firmware to be refreshed can be performed, which will be described in detail below.
[0051] In the embodiments of the present invention, performing the in-band refresh of the firmware to be refreshed according to the target block order includes: block-refreshing multiple blocks into the cache of the current firmware according to the target block order.
[0052] Among them, multiple blocks are refreshed in chunks to the cache of the current firmware. The method is to brush the corresponding blocks of the firmware to be refreshed to the corresponding offsets of the current firmware according to the target block order.
[0053] It can be understood that when the target in-band refresh operation is performed on the firmware to be refreshed in the cache of the current firmware in the embodiment of the present invention, the target block order is obtained by parsing the parameter layout table, and the corresponding blocks of the firmware to be refreshed are brushed to the corresponding offsets of the current firmware according to the target block order, so that the current firmware that does not support in-band refresh of heterogeneous firmware by default supports in-band refresh of heterogeneous firmware.
[0054] In the embodiment of the present invention, before in-band refreshing the firmware to be refreshed based on the reference layout table, it includes: identifying the actual layout information of the firmware to be refreshed; extracting the reference layout information in the reference layout table; comparing the actual layout information and the reference layout information; and determining the execution of the in-band refresh operation of the firmware to be refreshed based on the comparison result.
[0055] Among them, the actual layout information is the information extracted from the actual firmware file to be refreshed, including the data structure and organization form of the firmware to be refreshed, as well as detailed information such as the position, size, and function of each block; the reference firmware layout information is the information extracted from the reference layout table, including the detailed descriptions of the positions, sizes, and functions of each part of the firmware to be refreshed preset.
[0056] It can be understood that before in-band refreshing the firmware to be refreshed based on the reference layout table, it is necessary to identify the reference firmware layout information in the reference layout table to obtain the detailed data of the internal structure of the specific type of firmware preset, such as the positions and sizes of each part. Then, the actual layout information of the firmware is extracted from the firmware file to be refreshed, and these information reflect the actual data structure and organization form of the firmware to be refreshed. The extracted firmware layout information of the firmware to be refreshed is compared with the reference firmware layout information to confirm whether they are consistent, and the target in-band refresh operation of the firmware to be refreshed is determined according to the comparison result, thus avoiding problems caused by incompatible layouts between the current firmware and the firmware to be refreshed.
[0057] In the embodiment of the present invention, comparing the actual layout information and the reference layout information includes: comparing the actual layout information and the reference layout information one by one; if the information at all the same positions is consistent, the comparison result is a layout consistent result; if the information at any position is consistent, the comparison result is a layout inconsistent result.
[0058] It can be understood that in the embodiments of the present invention, the reference firmware layout information and the actual layout information of the firmware to be refreshed are compared one by one. Specifically, each part of the actual layout information of the firmware to be refreshed is compared in detail with the corresponding predefined reference firmware layout information part in the reference layout table to check whether the information at the same position is consistent. If the information of all the compared parts is completely consistent at the same position, it is concluded that the layout is consistent, indicating that the firmware to be refreshed conforms to the expected layout format; otherwise, if the information is inconsistent at any position, it is concluded that the layout is inconsistent, indicating that the layout of the firmware to be refreshed does not match the reference layout table.
[0059] In the embodiments of the present invention, if the comparison result is a layout consistent result, an in-band refresh operation of the firmware to be refreshed is performed.
[0060] It can be understood that in the embodiments of the present invention, the reference firmware layout information and the actual layout information of the firmware to be refreshed are compared one by one. If the comparison result is a layout consistent result, that is, the actual layout information of the firmware to be refreshed completely matches the standard information in the reference layout table, an in-band refresh operation of the firmware to be refreshed is performed.
[0061] In the embodiments of the present invention, if the comparison result is a layout inconsistent result, the interrupt program of the current firmware is exited.
[0062] It can be understood that in the embodiments of the present invention, the reference firmware layout information and the actual layout information of the firmware to be refreshed are compared one by one. If the comparison result is a layout inconsistent, that is, there are differences between the actual layout information of the firmware to be refreshed and the reference firmware layout information, the interrupt program of the current firmware needs to be exited immediately. Specifically, when any part of the layout information is detected to be mismatched, in order to avoid system instability or other potential problems caused by forced refreshing, further operations need to be stopped and the interrupt handling program in the SMM mode needs to be exited.
[0063] In the embodiments of the present invention, before performing an in-band refresh of the firmware to be refreshed based on the reference layout table, it further includes: identifying the firmware layout type of the current firmware; if the firmware layout type of the current firmware is inconsistent with the firmware layout type of the firmware to be refreshed, it is determined that the current firmware and the firmware to be refreshed are heterogeneous firmwares.
[0064] It is understandable that before performing in-band refreshing of the firmware to be refreshed based on the reference layout table in the embodiments of the present invention, it is necessary to identify the firmware layout type of the current firmware, compare the firmware layout type of the current firmware with that of the firmware to be refreshed. If the two are inconsistent, it is determined that the current firmware and the firmware to be refreshed are heterogeneous firmwares, which means that they belong to different types and have different hardware layouts and structures, and special processing is required to ensure that the new firmware can be correctly written into the cache. In this way, it can be ensured that even in the case of cross-different types of firmwares, the firmware update operation can be successfully completed, improving the flexibility and adaptability of the system.
[0065] It should be noted that the heterogeneous firmwares in the embodiments of the present invention are not limited to the UEFI type of BIOS firmware and the Coreboot type. For other types of heterogeneous BIOS firmwares, such as the TianoCore EDK II type, OpenFirmware, etc., only by changing the structure of the reference layout table, the in-band refreshing of heterogeneous firmwares is also supported.
[0066] According to the firmware in-band refreshing method of the embodiments of the present invention, the reference layout table of the firmware to be refreshed is determined through the firmware layout type of the firmware to be refreshed, and in-band refreshing of the firmware to be refreshed is performed in the cache of the current firmware based on the reference layout table. In this way, even if the current firmware and the firmware to be refreshed are heterogeneous firmwares, the in-band refreshing of the firmware can be realized. Thus, the in-band refreshing of heterogeneous firmwares is realized through the introduced reference layout table, solving the technical problem that the in-band refreshing interrupt handler in the related technology can only refresh firmwares with the same layout, improving the operation and maintenance efficiency, and reducing the operation complexity of the in-band refreshing of heterogeneous firmwares.
[0067] The firmware in-band refreshing method is further described below through a specific embodiment.
[0068] Figure 3 It is a flowchart of a method for in-band refreshing of heterogeneous firmwares provided in this embodiment. In this embodiment, the UEFI type and the Coreboot type of BIOS heterogeneous firmwares are selected for in-band refreshing. As Figure 3 shown, the method specifically includes the following steps:
[0069] Step S201: Assume that the current server BIOS firmware belongs to the UEFI type, and a request for in-band updating the BIOS firmware is initiated under the server OS (Server Operating System).
[0070] The firmware update process is started by initiating a request for in-band updating the BIOS firmware under the server OS to ensure that the system can run the latest BIOS version to obtain performance improvements, security patches, or other enhancements.
[0071] Step S202: The UEFI BIOS triggers the SMI interrupt handler, and in the interrupt handler, it determines the type of the BIOS firmware to be updated.
[0072] Determine the actual type (UEFI type or Coreboot type) of the firmware to be updated, so as to take the correct processing steps subsequently.
[0073] Step S203: Determine whether the BIOS firmware to be updated belongs to the Coreboot type. If so, go to Step S204; otherwise, go to Step S208.
[0074] If the assumed current server BIOS firmware belongs to the Coreboot type, it is necessary to determine whether the BIOS firmware to be updated belongs to the UEFI type here, so as to select an appropriate processing method according to the firmware type and ensure that the subsequent steps are carried out for the correct BIOS firmware type to be updated.
[0075] Step S204: The UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be updated.
[0076] Read and analyze the layout information in the firmware file to be updated, extract its hardware layout details, and provide a necessary data basis for the next verification and update operations.
[0077] Step S205: Compare the layout of the BIOS firmware to be updated with the pre - set Coreboot layout reference layout table in the SMRAM. If they are the same, go to Step S206; otherwise, go to Step S207.
[0078] Use the pre - set Coreboot layout reference layout table as a reference to compare each part of the firmware to be updated one by one, and confirm whether the firmware to be updated conforms to the Coreboot standard format to ensure the security and accuracy of the update process.
[0079] Step S206: The UEFI BIOS interrupt handler continues to read each block of the Coreboot BIOS firmware to be updated according to the Coreboot layout reference layout table, and flash it into the current Flash memory in blocks, ending the process.
[0080] Under the guidance of the Coreboot layout reference layout table, read and write different blocks of the firmware into the Flash memory in sequence to complete the firmware update operation, ensuring that the new firmware is correctly installed and takes effect.
[0081] Step S207: If the layout of the BIOS firmware to be refreshed does not conform to the expected Coreboot layout reference layout, exit the refresh interrupt program and end the process.
[0082] Due to the firmware layout mismatch, the interrupt handler terminates the update operation and returns an error status to prevent potential problems caused by firmware incompatibility, ensuring the stability and security of the system. At the same time, it is possible to update the expected Coreboot layout reference layout in the database according to the layout of the BIOS firmware to be refreshed to ensure that both reflect the latest firmware layout information, thus ensuring that subsequent firmware update operations can be based on the latest and accurate layout information and avoiding problems caused by layout mismatch.
[0083] Step S208: The UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be refreshed.
[0084] Read and analyze the layout information in the firmware file to be refreshed, extract its hardware layout details, and provide the necessary data basis for the next verification and refresh operations.
[0085] Step S209: Compare the layout of the BIOS firmware to be refreshed with the pre - set UEFI layout reference table in the SMRAM. If they are the same, go to Step S210; otherwise, go to Step S211.
[0086] Use the pre - set UEFI layout reference table as a reference to compare each part of the firmware to be refreshed one by one to confirm whether the firmware to be refreshed conforms to the UEFI standard format, ensuring the security and accuracy of the refresh process.
[0087] Step S210: The UEFI BIOS interrupt handler continues to read each block of the UEFI BIOS to be refreshed according to the UEFI layout reference table and flash them into the current Flash memory in blocks, ending the process.
[0088] Under the guidance of the UEFI layout reference table, read and write different blocks of the firmware into the Flash memory in sequence to complete the firmware update operation, ensuring that the new firmware is correctly installed and takes effect.
[0089] Step S211: If the layout of the BIOS firmware to be refreshed does not conform to the expected UEFI layout reference table, exit the refresh interrupt program and end the process.
[0090] Due to the firmware layout mismatch, the interrupt handler terminates the update operation and returns an error status, preventing potential problems caused by firmware incompatibility and ensuring the stability and security of the system. At the same time, it is possible to choose to update the expected UEFI layout reference layout table in the database according to the layout of the BIOS firmware to be refreshed, so as to ensure that both reflect the latest firmware layout information, thus ensuring that subsequent firmware update operations can be carried out based on the latest and accurate layout information and avoiding problems caused by layout mismatch.
[0091] Among them, the UEFI BIOS layout reference layout table and the Coreboot BIOS layout reference layout table pre-set in SMRAM are as Figure 4 shown as follows:
[0092] The layout table of UEFI BIOS defines the positions, sizes and functions of each part in the firmware file. The following are the main components of the UEFI BIOS layout table:
[0093] FV_BB contains the boot loader and other initialization codes, which is the first part executed during the system startup process. Its function is to provide basic hardware initialization and boot services, and usually contains some immutable basic instruction sets.
[0094] FV_MAIN is the main firmware volume, which contains most of the BIOS codes and data. It is responsible for the initialization and configuration management of the system, including device drivers, platform-specific initialization codes, etc.
[0095] NVRAM is a non-volatile random access memory, which is used to save configuration parameters and other persistent data, and is used to store user settings, BIOS configuration options and other data that need to be saved long-term.
[0096] The layout table of Coreboot BIOS defines another different firmware file structure, which is mainly used in lightweight and highly customizable firmware environments. The following are the main components of the Coreboot BIOS layout table:
[0097] Romstage: Responsible for initializing the most basic hardware components, such as the CPU and chipset, providing a basic environment for subsequent operations, and ensuring that the system can continue to run more complex initialization steps.
[0098] Ramstage: Executed after the memory is initialized, it will load more device drivers and prepare the system to load the payload, further initialize the hardware, load the necessary drivers and services, and prepare for the operating system or other payloads.
[0099] Payload: It is a program specified by the user, which can be a bootloader (such as GRUB), an operating system kernel, etc., used to execute specific tasks or boot into the operating system, providing great flexibility and customization capabilities.
[0100] The reference layout table provides a standard firmware layout information template. By comparing the firmware layout information of the firmware to be refreshed with the firmware layout information in the reference layout table, the accuracy and consistency of the firmware refresh operation can be ensured.
[0101] In summary, this embodiment assumes that the current server BIOS firmware belongs to the UEFI type. A request to update the BIOS firmware is initiated under the server OS. The UEFI BIOS triggers the SMI interrupt handler. In the interrupt handler, it determines the type of the BIOS firmware to be refreshed. If it is the Coreboot type, the UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be refreshed and compares it with the Coreboot layout reference table preset in the SMRAM. If they are consistent, it reads each block of the Coreboot BIOS firmware to be refreshed and flashes them into the current Flash memory in blocks. If they are inconsistent, it means that the layout of the BIOS firmware to be refreshed does not conform to the expected Coreboot layout reference, and the refresh interrupt program exits. Similarly, if the refresh interrupt handler initially determines that the BIOS firmware to be refreshed is of the UEFI type, the UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be refreshed and compares it with the UEFI layout reference table preset in the SMRAM. If they are consistent, the UEFI BIOS interrupt handler continues to read each block of the UEFI BIOS firmware to be refreshed according to the UEFI layout reference table and flashes them into the current Flash memory in blocks. If they are inconsistent, it means that the layout of the BIOS firmware to be refreshed does not conform to the expected UEFI layout reference, and the refresh interrupt program exits.
[0102] In this way, a layout reference layout table for distinguishing heterogeneous BIOSs is innovatively added to the SMRAM area. The UEFI BIOS firmware corresponds to a layout table, and the Coreboot BIOS firmware corresponds to a layout table. The refresh interrupt handler obtains the names and offsets of each block by parsing the layout table, and then brushes the corresponding blocks of the BIOS firmware file to be refreshed to the corresponding offsets of the current BIOS Flash memory, thereby supporting the in-band refresh of heterogeneous BIOS firmware and solving the problem that the traditional in-band refresh interrupt handler can only refresh BIOS firmware with the same layout.
[0103] It should be noted that the heterogeneous BIOS firmware in this embodiment is not limited to UEFI type BIOS firmware and Coreboot type BIOS firmware. For other types of heterogeneous BIOS firmware, it also supports refreshing only by changing the structure of the layout reference layout table.
[0104] Through the description of the above implementation manners, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation manner.
[0105] Figure 5 The structural schematic diagram of an in-band firmware refresh device provided by an embodiment of the present invention is as Figure 5 shown. The in-band firmware refresh device 10 includes: an identification module 301, a determination module 302, and a refresh module 303.
[0106] Among them, the identification module 301 is used to identify the firmware layout type of the firmware to be refreshed; the determination module 302 is used to determine the reference layout table of the firmware to be refreshed according to the firmware layout type; the refresh module 303 performs in-band refresh of the firmware to be refreshed in the cache of the current firmware, where the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0107] In the embodiment of the present invention, the identification module 301 is further used to: identify the firmware layout type of the firmware to be refreshed, and extract the firmware identifier of the firmware to be refreshed; determine the firmware layout type of the firmware to be refreshed according to the firmware identifier.
[0108] In the embodiment of the present invention, determining the firmware layout type of the firmware to be refreshed according to the firmware identifier includes: obtaining a first correspondence table between the firmware identifier and the firmware layout type; using the firmware identifier as an index to query the first correspondence table to determine the firmware layout type of the firmware to be refreshed.
[0109] In an embodiment of the present invention, it further includes an interrupt module. Specifically, the interrupt module is further configured to: before identifying the firmware layout type of the firmware to be refreshed, obtain a request for in-band updating the firmware sent by the server; in response to the request for in-band updating the firmware, trigger an interrupt program of the current firmware; and in the interrupt program of the current firmware, determine the firmware layout type of the firmware to be refreshed.
[0110] In an embodiment of the present invention, the determining module 302 is further configured to: determine a reference layout table of the firmware to be refreshed according to the firmware layout type, including: reading a second correspondence table between the firmware layout type and the reference layout table in the database; and querying the second correspondence table with the firmware layout type as an index to obtain the reference layout table.
[0111] In an embodiment of the present invention, the refreshing module 303 is further configured to: perform in-band refreshing on the firmware to be refreshed based on the reference layout table, extract reference layout information from the reference layout table; based on the reference layout information, read multiple blocks of the firmware to be refreshed; identify the target block order of the multiple blocks, and perform in-band refreshing on the firmware to be refreshed according to the target block order.
[0112] In an embodiment of the present invention, performing in-band refreshing on the firmware to be refreshed according to the target block order includes: dividing the multiple blocks into chunks and refreshing them into the cache of the current firmware in accordance with the target block order.
[0113] In an embodiment of the present invention, it further includes a comparison module. Specifically, the comparison module is further configured to: before performing in-band refreshing on the firmware to be refreshed based on the reference layout table, identify the actual layout information of the firmware to be refreshed; extract the reference layout information from the reference layout table; compare the actual layout information with the reference layout information; and determine the execution of the in-band refreshing action of the firmware to be refreshed based on the comparison result.
[0114] In an embodiment of the present invention, comparing the actual layout information with the reference layout information includes: comparing the actual layout information with the reference layout information one by one; if the information at all the same positions is consistent, the comparison result is a layout-consistent result; if the information at any position is consistent, the comparison result is a layout-inconsistent result.
[0115] In an embodiment of the present invention, if the comparison result is a layout-consistent result, then perform the in-band refreshing action on the firmware to be refreshed.
[0116] In an embodiment of the present invention, if the comparison result is a layout-inconsistent result, then exit the interrupt program of the current firmware.
[0117] In an embodiment of the present invention, a judgment module is further included. The judgment module is further configured to: before performing in-band refreshing on the firmware to be refreshed based on the reference layout table, it further includes: identifying the firmware layout type of the current firmware; if the firmware layout type of the current firmware is inconsistent with the firmware layout type of the firmware to be refreshed, it is determined that the current firmware and the firmware to be refreshed are heterogeneous firmwares.
[0118] It should be noted that the description of the features in the corresponding embodiments of the in-band firmware refreshing device can refer to the relevant descriptions in the corresponding embodiments of the in-band firmware refreshing method, which will not be elaborated here one by one.
[0119] According to the in-band firmware refreshing device provided by the embodiments of the present invention, the reference layout table of the firmware to be refreshed is determined through the firmware layout type of the firmware to be refreshed, and in-band refreshing of the firmware to be refreshed is performed in the cache of the current firmware based on the reference layout table. In this way, even if the current firmware and the firmware to be refreshed are heterogeneous firmwares, in-band firmware refreshing can be realized. Thus, in-band refreshing of heterogeneous firmwares is achieved through the introduced reference layout table, solving the technical problem that the in-band refreshing interrupt handler in the related art can only refresh firmwares with the same layout, improving the operation and maintenance efficiency, and reducing the operation complexity of in-band refreshing of heterogeneous firmwares.
[0120] An embodiment of the present invention further provides an electronic device, as Figure 6 shown, including a memory 401 and a processor 402. A computer program is stored in the memory 401, and the processor 402 is configured to run the computer program to execute the steps in any one of the above embodiments of the in-band firmware refreshing method.
[0121] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above embodiments of the in-band firmware refreshing method when running.
[0122] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store computer programs.
[0123] An embodiment of the present invention further provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above embodiments of the in-band firmware refreshing method.
[0124] An embodiment of the present invention further provides another computer program product, including a non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in any of the above-described embodiments of the firmware in-band refresh method are implemented.
[0125] Those skilled in the art can further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.
[0126] The above has introduced in detail a firmware in-band refresh method, an electronic device, a storage medium, and a program product provided by the present invention. Specific examples are used herein to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A firmware in-band refresh method, characterized in that: include: Identify the firmware layout type of the firmware to be flashed; Determine a reference layout table of the firmware to be refreshed according to the firmware layout type; In the cache of the current firmware, the firmware to be refreshed is refreshed in-band based on the reference layout table, including extracting reference layout information in the reference layout table; Based on the reference layout information, reading a plurality of blocks of the firmware to be refreshed; A target block sequence of the plurality of blocks is identified, and the firmware to be refreshed is refreshed in-band according to the target block sequence, wherein the current firmware and the firmware to be refreshed are heterogeneous firmwares.
2. The firmware in-band refresh method according to claim 1, characterized in that: The step of refreshing the firmware to be refreshed in-band according to the target block sequence includes: The plurality of blocks are refreshed into the cache of the current firmware in blocks according to the target block sequence.
3. The firmware in-band refresh method according to claim 1, characterized in that: Before the firmware to be refreshed is refreshed in-band based on the reference layout table, the method includes: Identify actual layout information of the firmware to be refreshed; extracting reference layout information from the reference layout table; comparing the actual layout information with the reference layout information; The execution of the in-band refresh action of the firmware to be refreshed is determined based on the comparison result.
4. The firmware in-band refresh method according to claim 3, characterized in that: The comparing the actual layout information with the reference layout information includes: comparing the actual layout information with the reference layout information one by one; If the information at all identical positions is consistent, the comparison result is a layout consistency result; If the information at any position is consistent, the comparison result is a layout inconsistency result.
5. The firmware in-band refresh method according to claim 4, characterized in that: If the comparison result is a layout consistency result, an in-band refresh action of the firmware to be refreshed is executed.
6. The firmware in-band refresh method according to claim 4, characterized in that: If the comparison result is a layout inconsistency result, the interrupt program of the current firmware is exited.
7. The firmware in-band refresh method according to claim 1, characterized in that: The step of identifying the firmware layout type of the firmware to be refreshed includes: Extracting the firmware identifier of the firmware to be updated; The firmware layout type of the firmware to be updated is determined according to the firmware identifier.
8. The firmware in-band refresh method according to claim 7, characterized in that: The step of determining the firmware layout type of the firmware to be refreshed according to the firmware identifier includes: Obtain a first correspondence table between firmware identifiers and firmware layout types; The first corresponding relationship table is queried using the firmware identifier as an index to determine the firmware layout type of the firmware to be refreshed.
9. The firmware in-band refresh method according to claim 1, characterized in that: Before identifying the firmware layout type of the firmware to be flashed, it also includes: Get the in-band firmware update request sent by the server; In response to the request for in-band firmware update, triggering an interrupt procedure of the current firmware; In the interrupt program of the current firmware, the firmware layout type of the firmware to be refreshed is determined.
10. The firmware in-band refresh method according to claim 1, characterized in that: The step of determining the reference layout table of the firmware to be refreshed according to the firmware layout type includes: Read a second correspondence table between firmware layout types and reference layout tables in a database; The second corresponding relationship table is queried using the firmware layout type as an index to obtain the reference layout table.
11. The firmware in-band refresh method according to claim 1, characterized in that: Before refreshing the firmware to be refreshed in-band based on the reference layout table, the method further includes: Identify the firmware layout type of the current firmware; If the firmware layout type of the current firmware is inconsistent with the firmware layout type of the firmware to be refreshed, it is determined that the current firmware and the firmware to be refreshed are heterogeneous firmware.
12. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the firmware in-band refresh method as claimed in any one of claims 1 to 11 when executing the computer program.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the firmware in-band refresh method according to any one of claims 1 to 11.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the firmware in-band refresh method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Stability test method, device and apparatus for in-band firmware refreshing process
CN111104271A