Firmware in-band refreshing method, electronic equipment, storage medium and program product
By identifying the layout type of firmware to be refreshed and determining the reference layout table, the problem that UEFI BIOS cannot support Coreboot BIOS in-band refresh is solved, and in-band refresh of heterogeneous firmware is realized, which improves operation and maintenance efficiency and reduces operation complexity.
Patent Information
- Application Number
- CN202510368837.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-04-25
- 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 CN119883334A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer firmware update, and in particular to a firmware in-band refresh method, electronic equipment, storage medium and program product. Background Art
[0002] In the current server firmware field, UEFI (Unified Extensible Firmware Interface) BIOS (Basic Input Output System) system is the mainstream technology, but its closed-source nature and relatively high development threshold have gradually become factors that limit its flexibility and response speed. As a result, 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 more quickly.
[0003] However, for the specific application scenario of in-band BIOS refresh, UEFI BIOS can only support in-band refresh of BIOS of the same type (i.e. UEFI layout type (layout, structural layout, usually refers to the physical or logical arrangement of components, modules or data structures)) by default, and cannot directly support in-band refresh of 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) refresh or manual burning, which greatly affects the operation and maintenance efficiency and increases the complexity of the operation. Summary of the invention
[0004] The present invention provides a firmware in-band refresh method, electronic equipment, storage medium and program product, so as to at least solve the problem in the related art that the in-band refresh interrupt processing program can only refresh the firmware with the same layout.
[0005] The present invention provides a firmware in-band refresh method, comprising: identifying the firmware layout type of firmware to be refreshed; determining a reference layout table of the firmware to be refreshed according to the firmware layout type; in the cache of the current firmware, refreshing the firmware to be refreshed in-band based on the reference layout table, wherein the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned firmware in-band refresh methods when executing the computer program.
[0007] The present invention also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned firmware in-band refresh methods are implemented.
[0008] The present invention also provides a computer program product, comprising a computer program, which implements the steps of any of the above-mentioned firmware in-band refresh methods when executed by a processor.
[0009] The present invention determines the reference layout table of the firmware to be refreshed by the firmware layout type of the firmware to be refreshed, and performs in-band refresh on 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 firmware, firmware in-band refresh can be achieved, thereby achieving in-band refresh of heterogeneous firmware through the introduced reference layout table, solving the technical problem that the in-band refresh interrupt handler in the related technology can only refresh firmware with the same layout, and achieving the technical effect of supporting in-band refresh of heterogeneous firmware, improving operation and maintenance efficiency, and reducing the operational complexity of in-band refresh of heterogeneous firmware. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 A flowchart of a method for refreshing BIOS at the application layer of a Linux system in the related art; Figure 2 A flowchart of a firmware in-band refresh method provided by an embodiment of the present invention; Figure 3 A flowchart of a method for in-band refreshing of heterogeneous BIOS firmware provided by an embodiment of the present invention; Figure 4 A schematic diagram of a layout provided for an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a firmware in-band refresh device provided by an embodiment of the present invention; Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0012] 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
[0013] 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.
[0014] 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.
[0015] 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.
[0016] Specifically, if Figure 1As shown, at the beginning of the process, the BIOS refresh tool is first started, then a BIOS file is selected and verified. If the verification is successful, the subsequent steps are continued; if the verification is not successful, the BIOS file is returned to be reselected and verified. After the verification is successful, the IO permission is obtained, a 4K buffer is allocated, and the buffer is converted to a physical address. Then, the 4K data in the file is read into the data buffer, and an SMI interrupt is requested to enter the SMM mode. In the SMM mode, the BIOS handler parses and processes the data, then writes the data to the BIOS, exits the SMM mode, and checks whether the write is successful. If the write is successful, check whether it reaches the end of the file; if it does not reach the end of the file, repeat the above process until the file is completely written. If the write is unsuccessful or reaches the end of the file, the process ends. The method first triggers a request to refresh the BIOS firmware through a specific interface at the application layer of the Linux system, starts the entire refresh process, and uses the processor's out instruction to send an SMI interrupt instruction, causing the CPU to temporarily suspend the current task and switch to SMM mode. SMM is a special CPU operating mode that allows low-level hardware management and maintenance tasks to be performed without interfering with the normal operation of the operating system or other applications. When the CPU enters SMM mode, the BIOS takes over control. In this protected environment, the BIOS can safely perform low-level hardware management and update operations, including its own firmware updates.
[0017] However, this method focuses on refreshing the execution process of the BIOS interrupt handler, but does not take into account the situation where the layout of the BIOS to be refreshed is different from that of the currently running BIOS, and therefore cannot support in-band refresh between heterogeneous BIOS with different layouts.
[0018] In view of the defects of the above-mentioned related technologies, the embodiments of the present invention propose a firmware in-band refresh method, electronic device, storage medium and program product to solve the technical problem that the in-band refresh interrupt handler of the related technology can only refresh firmware with the same layout, and at the same time achieve the technical effect of supporting in-band refresh of heterogeneous firmware, and different firmware can also support refresh by only changing the structure of the reference layout table. The specific method will be described in detail below.
[0019] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0020] Figure 2 A flowchart of a firmware in-band refresh method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the method specifically comprises the following steps: In step S101 , the firmware layout type of the firmware to be refreshed is identified.
[0021] Among them, the firmware layout type of the firmware to be refreshed can be UEFI type, Coreboot type and other layout types, which are not specifically limited here; UEFI type firmware adopts a modular design, which is easy to expand and maintain, and supports functional expansion through drivers and application interfaces, and provides a secure boot function to ensure that only signed firmware and operating system code can run, thereby enhancing the security of the system. It is widely used in modern computers, servers and personal devices, especially in environments that require high security and high performance; Coreboot type firmware is lightweight and efficient, focusing on minimizing boot time and reducing unnecessary complexity, suitable for application scenarios that require fast startup, 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.
[0022] It is understandable that the embodiment of the present invention first needs 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.
[0023] In an embodiment 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; and determining the firmware layout type of the firmware to be refreshed according to the firmware identifier.
[0024] The firmware identifier is a layout type identifier of the firmware to be refreshed, and the layout type of the firmware can be identified through the identifier, so as to know the data structure and organization method inside the firmware.
[0025] In an 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; and querying the first correspondence table to determine the firmware layout type of the firmware to be refreshed using the firmware identifier as an index.
[0026] The first correspondence table is a mapping table, which records the association between different firmware layout types and 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.
[0027] It can be understood that the embodiment of the present invention uses the firmware identifier as an index to query the first correspondence table, obtains the firmware layout type confirmation information of the firmware to be refreshed from the information in the first correspondence table, and thus determines the firmware layout type of the firmware to be refreshed.
[0028] In an embodiment of the present invention, before identifying the firmware layout type of the firmware to be refreshed, it also includes: obtaining a request for in-band firmware update issued by a server; responding to the request for in-band firmware update, triggering an interrupt program of the current firmware; and determining the firmware layout type of the firmware to be refreshed in the interrupt program of the current firmware.
[0029] Among them, the in-band firmware update request sent by the server usually contains the location information and version information of the firmware file to be updated; the interrupt program sends the SMI interrupt instruction to make the CPU temporarily suspend the current task and switch to SMM mode to run a special interrupt handler. The SMM mode provides a highly isolated and protected environment, which can perform sensitive operations without interfering with the operating system or other applications. This isolation ensures that even if there are vulnerabilities in the operating system or applications, it will not affect the ongoing system management tasks, thereby safely executing related operations of the firmware update to be refreshed.
[0030] It can be understood that when an embodiment of the present invention receives a request for in-band firmware update sent by a server, it responds to the request, sends an SMI interrupt instruction, causes the CPU to temporarily suspend the current task and switch to SMM mode to run the interrupt program of the current firmware, extracts the firmware layout information of the firmware to be refreshed in the interrupt program of the current firmware, and determines the firmware layout type according to the firmware layout information.
[0031] In step S102, a reference layout table of the firmware to be refreshed is determined according to the firmware layout type.
[0032] The reference layout table is a preset layout table preset in SMRAM (System Management Random Access Memory), which contains reference firmware layout information and provides 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.
[0033] It can be understood that the embodiment of the present invention determines the target in-band refresh action of the firmware to be refreshed 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, thereby achieving efficient and secure firmware update.
[0034] 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; and querying the second correspondence table to obtain the reference layout table using the firmware layout type as an index.
[0035] The second correspondence table is a mapping table, which records the association between different firmware layout types and corresponding reference layout tables, and can be understood as a lookup table. The second correspondence table can be used to find the corresponding reference layout table by firmware layout type.
[0036] It can be understood that in order to obtain the reference layout table of the firmware layout type, the embodiment of the present invention first needs 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 the second correspondence table.
[0037] In an embodiment of the present invention, before determining the reference layout table of the firmware to be refreshed according to the firmware layout type, it also includes: reading the reference layout table stored in the database; obtaining the first layout structure of the firmware when the reference layout table is in the establishment stage; 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, updating the reference layout table and the second correspondence table in the database according to the second layout structure.
[0038] It can be understood that before obtaining the reference layout table of the firmware layout type, the embodiment of the present invention first needs to read the reference layout table stored in the database, and obtain the first layout structure recorded in the reference layout table during the establishment phase, that is, the original or standard firmware layout, and 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 the two reflect the latest firmware layout information, thereby ensuring that subsequent firmware update operations can be performed based on the latest and accurate layout information, avoiding problems caused by layout mismatch.
[0039] In step S103, in the cache of the current firmware, the firmware to be refreshed is refreshed in-band based on the reference layout table, wherein the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0040] Among them, heterogeneous firmware refers to different types of firmware with different hardware layouts and structures. For example, UEFI-type firmware and Coreboot-type firmware have significant differences in internal organization, so the two are heterogeneous firmware; the current firmware is the firmware of the current server, and by default, it does not support in-band refresh of heterogeneous firmware; the cache of the current firmware is the SMRAM memory area, which is used to store and run code and data in SMM mode.
[0041] It can be understood that, in the embodiment of the present invention, when executing the target in-band refresh action on the firmware to be refreshed in the cache of the current firmware, the current firmware and the firmware to be refreshed are allowed to be heterogeneous firmware, and even if the current firmware and the firmware to be refreshed are of different types, they can be processed correctly, and the firmware to be refreshed is refreshed in-band based on the reference layout table, so that the current firmware that does not support in-band refresh of heterogeneous firmware by default supports in-band refresh of heterogeneous firmware, which solves the problem in the related art that the in-band refresh interrupt handler can only refresh the firmware with the same reference layout, and heterogeneous firmware can only be completed by relying on out-of-band BMC refresh or manual burning, resulting in low operation and maintenance efficiency, high operation complexity and high risk.
[0042] In an embodiment of the present invention, in-band refreshing of the firmware to be refreshed based on the reference layout table includes: extracting reference layout information in the reference layout table; reading multiple blocks of the firmware to be refreshed based on the reference layout information; identifying the target block order of the multiple blocks, and in-band refreshing the firmware to be refreshed according to the target block order.
[0043] Among them, the reference layout information is the reference layout information preset in the reference layout table; multiple areas, namely 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; the target block order is usually defined by the reference layout table to ensure that each block is correctly placed in its proper position.
[0044] It can be understood that the embodiment of the present invention identifies the required reference layout information by obtaining the reference layout table, and obtains the target block sequence of multiple blocks pre-defined in the firmware to be refreshed. Through this target block sequence, a specific in-band refresh action of the firmware to be refreshed can be performed, which will be described in detail below.
[0045] In the embodiment of the present invention, the in-band refreshing of the firmware to be refreshed according to the target block sequence includes: refreshing the multiple blocks into the cache of the current firmware in blocks according to the target block sequence.
[0046] The multiple blocks are refreshed into the cache of the current firmware in blocks, and the method is to refresh the corresponding blocks of the firmware to be refreshed to the offset corresponding to the current firmware according to the target block order.
[0047] It can be understood that when the embodiment of the present invention performs a target in-band refresh action on the firmware to be refreshed in the cache of the current firmware, the target block order is obtained by parsing the parameter layout table, and the corresponding blocks of the firmware to be refreshed are refreshed to the corresponding offsets of the current firmware according to the target block order, thereby enabling the current firmware, which does not support in-band refresh of heterogeneous firmware by default, to support in-band refresh of heterogeneous firmware.
[0048] In an embodiment of the present invention, before in-band refreshing of the firmware to be refreshed based on the reference layout table, the steps include: identifying actual layout information of the firmware to be refreshed; extracting reference layout information in the reference layout table; comparing the actual layout information with the reference layout information; and determining the execution of the in-band refresh action of the firmware to be refreshed based on the comparison result.
[0049] Among them, the actual layout information is the information extracted from the actual firmware to be refreshed file, including the data structure and organization form of the firmware to be refreshed, and detailed information such as the location, size and function of each block; the reference firmware layout information is the information extracted from the reference layout table, including detailed descriptions such as the location, size and function of each part of the preset firmware to be refreshed.
[0050] It can be understood that before the firmware to be refreshed is refreshed in-band based on the reference layout table, it is necessary to identify the reference firmware layout information in the reference layout table, so as to obtain the detailed data of the preset internal structure of the specific type of firmware, such as the position and size of each part. Then, the actual layout information of the firmware to be refreshed is extracted from the firmware file to be refreshed. This information reflects the actual data structure and organizational 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 the two are consistent. The target in-band refresh action of the firmware to be refreshed is determined according to the comparison result, thereby avoiding problems caused by incompatible layouts of the current firmware and the firmware to be refreshed.
[0051] 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.
[0052] It can be understood that the embodiment of the present invention compares the reference firmware layout information with the actual layout information of the firmware to be refreshed 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 at the same position of all compared parts is completely consistent, a result of consistent layout is obtained, indicating that the firmware to be refreshed meets the expected layout format; conversely, if the information at any position is inconsistent, a result of inconsistent layout is obtained, indicating that the layout of the firmware to be refreshed does not match the reference layout table.
[0053] In the embodiment of the present invention, if the comparison result is a layout consistency result, an in-band refresh action of the firmware to be refreshed is performed.
[0054] It can be understood that the embodiment of the present invention compares the reference firmware layout information and the actual layout information of the firmware to be refreshed one by one. If the comparison result is a layout consistency result, that is, the actual layout information of the firmware to be refreshed completely matches the standard information in the reference layout table, then the in-band refresh action of the firmware to be refreshed is executed.
[0055] In the embodiment of the present invention, if the comparison result is a layout inconsistency result, the interrupt program of the current firmware is exited.
[0056] It can be understood that in the embodiment 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 that the layout is inconsistent, that is, there is a difference between the actual layout information of the firmware to be refreshed and the reference firmware layout information, it is necessary to immediately exit the interrupt program of the current firmware. Specifically, when it is detected that any part of the layout information does not match, in order to avoid system instability or other potential problems due to forced refresh, it is necessary to stop further operations and exit the interrupt handler in SMM mode.
[0057] In an embodiment of the present invention, before the firmware to be refreshed is refreshed in-band based on the reference layout table, it also 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, determining that the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0058] It can be understood that, before the embodiment of the present invention performs in-band refreshing of the firmware to be refreshed based on the reference layout table, it is necessary to identify the firmware layout type of the current firmware, and compare the firmware layout type of the current firmware with the firmware layout type 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 firmware, which means that the two are of different types and have different hardware layouts and structures, and require special processing to ensure that the new firmware can be correctly written into the cache. In this way, it can be ensured that the firmware update operation can be successfully completed even across different types of firmware, thereby improving the flexibility and adaptability of the system.
[0059] It should be noted that the heterogeneous firmware of the embodiments of the present invention is not limited to UEFI type BIOS firmware and Coreboot type. For other types of heterogeneous BIOS firmware, such as TianoCore EDK II type, OpenFirmware, etc., it only needs to change the structure of the reference layout table to also support the refresh of in-band heterogeneous firmware.
[0060] According to the firmware in-band refresh method of the embodiment of the present invention, the reference layout table of the firmware to be refreshed is determined by the firmware layout type of the firmware to be refreshed, and the firmware to be refreshed is 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 firmware, firmware in-band refresh can be achieved, thereby realizing the in-band refresh of heterogeneous firmware through the introduced reference layout table, solving the technical problem of the related art that the in-band refresh interrupt handler can only refresh firmware with the same layout, improving the operation and maintenance efficiency, and reducing the operational complexity of in-band refresh of heterogeneous firmware.
[0061] The firmware in-band refresh method is further described below through a specific embodiment.
[0062] Figure 3 A flowchart of a method for in-band refresh of heterogeneous firmware provided in this embodiment. In this embodiment, UEFI type and Coreboot type BIOS heterogeneous firmware are selected for in-band refresh. Figure 3 As shown, the method specifically comprises the following steps: Step S201: Assuming that the current server BIOS firmware is of UEFI type, a request for in-band updating of the BIOS firmware is initiated under the server OS (Server Operating System).
[0063] The firmware update process is initiated by initiating an in-band BIOS firmware update request under the server OS to ensure that the system can run the latest BIOS version to obtain performance improvements, security patches, or other improvements.
[0064] Step S202: UEFI BIOS triggers an SMI interrupt handler, and determines the type of BIOS firmware to be refreshed in the interrupt handler.
[0065] Determine the actual type of the firmware to be flashed (UEFI type or Coreboot type) so that you can take the correct steps later.
[0066] Step S203, determine whether the BIOS firmware to be refreshed is of Coreboot type, if yes, proceed to step S204, otherwise proceed to step S208.
[0067] If the current server BIOS firmware is assumed to be of the Coreboot type, it is necessary to determine whether the BIOS firmware to be refreshed is of the UEFI type, so as to select an appropriate processing method according to the firmware type to ensure that subsequent steps are performed for the correct BIOS firmware type to be refreshed.
[0068] Step S204: The UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be refreshed.
[0069] 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 step of verification and refresh operations.
[0070] Step S205: Compare the layout of the BIOS firmware to be refreshed with the Coreboot layout reference table preset in the SMRAM. If they are consistent, proceed to step S206; otherwise, proceed to step S207.
[0071] Use the preset Coreboot layout reference layout table as a reference, compare each part of the firmware to be flashed one by one, confirm whether the firmware to be flashed conforms to the standard format of Coreboot, and ensure the security and accuracy of the flashing process.
[0072] Step S206, the UEFI BIOS interrupt processing program continues to read each block of the Coreboot BIOS firmware to be refreshed according to the Coreboot layout reference layout table, refreshes each block into the current Flash memory, and ends the process.
[0073] According to the guidance of the Coreboot layout reference layout table, read and write different blocks of the firmware to the Flash memory in sequence to complete the firmware update operation and ensure that the new firmware is correctly installed and effective.
[0074] Step S207: If the layout of the BIOS firmware to be refreshed does not conform to the expected Coreboot layout reference layout, the refresh interrupt program is exited and the process ends.
[0075] 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 and ensure the stability and security of the system. At the same time, you can choose to update the expected Coreboot layout reference layout in the database according to the layout layout of the BIOS firmware to be refreshed to ensure that both reflect the latest firmware layout information, thereby ensuring that subsequent firmware update operations can be based on the latest and accurate layout information to avoid problems caused by layout mismatch.
[0076] Step S208: The UEFI BIOS interrupt handler continues to parse the layout of the BIOS firmware to be refreshed.
[0077] 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 step of verification and refresh operations.
[0078] Step S209: Compare the layout of the BIOS firmware to be refreshed with the UEFI layout reference table preset in the SMRAM. If they are consistent, proceed to step S210; otherwise, proceed to step S211.
[0079] Use the preset UEFI layout reference layout table as a reference, compare each part of the firmware to be flashed one by one, confirm whether the firmware to be flashed complies with the standard format of UEFI, and ensure the security and accuracy of the flashing process.
[0080] Step S210, the UEFI BIOS interrupt processing program continues to read each block of the UEFI BIOS to be refreshed according to the UEFI layout reference layout table, and refreshes each block into the current Flash memory, and ends the process.
[0081] According to the guidance of the UEFI layout reference layout table, read and write different blocks of the firmware to the Flash memory in sequence to complete the firmware update operation and ensure that the new firmware is correctly installed and effective.
[0082] Step S211: If the layout of the BIOS firmware to be refreshed does not conform to the expected UEFI layout reference table, the refresh interrupt program is exited and the process ends.
[0083] 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 and ensure the stability and security of the system. At the same time, you can choose to update the expected UEFI layout reference layout table in the database according to the layout of the BIOS firmware to be refreshed to ensure that both reflect the latest firmware layout information, thereby ensuring that subsequent firmware update operations can be based on the latest and accurate layout information to avoid problems caused by layout mismatch.
[0084] Among them, the UEFI BIOS layout reference layout table and the CorebootBIOS layout reference layout table preset in SMRAM are as follows Figure 4 As shown, the details are as follows: The UEFI BIOS layout table defines the location, size, and function of each part in the firmware file. The following are the main components of the UEFI BIOS layout table: FV_BB contains the boot loader and other initialization codes. It is the first part executed during the system startup process. Its function is to provide basic hardware initialization and boot services. It usually contains some immutable basic instruction sets.
[0085] FV_MAIN is the main firmware volume, which contains most of the BIOS code and data. It is responsible for the initialization and configuration management of the system, including device drivers, platform-specific initialization code, etc.
[0086] NVRAM is a non-volatile random access memory used to store configuration parameters and other persistent data. It is used to store user settings, BIOS configuration options, and other data that needs to be saved for a long time.
[0087] The Coreboot BIOS layout table defines a 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: Romstage: Responsible for initializing the most basic hardware components, such as the CPU and chipset, providing a basic environment for subsequent stages of operation and ensuring that the system can continue to run more complex initialization steps.
[0088] Ramstage: Executed after memory is initialized, it loads more device drivers and prepares the system to load payloads, further initializes the hardware, loads necessary drivers and services, and prepares for the operating system or other payloads.
[0089] Payload: is a program specified by the user, which can be a boot loader (such as GRUB), an operating system kernel, etc., used to perform specific tasks or boot into the operating system, providing great flexibility and customization capabilities.
[0090] 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.
[0091] In summary, this embodiment assumes that the current server BIOS firmware is of UEFI type, and a request for in-band updating of the BIOS firmware is initiated under the server OS. The UEFI BIOS triggers the SMI interrupt handler, and the type of the BIOS firmware to be refreshed is determined in the interrupt handler. If it is of 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 layout table preset in the SMRAM. If they are consistent, each block of the Coreboot BIOS firmware to be refreshed is read, and the blocks are refreshed to the current Flash memory. If they are inconsistent, it means that the layout of the BIOS firmware to be refreshed does not meet the expected Coreboot layout reference layout, and the refresh interrupt program is exited. Similarly, if the refresh interrupt handler initially determines that the BIOS firmware to be refreshed is of 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 layout table preset in 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 layout table, and refreshes 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 layout, and the refresh interrupt handler exits.
[0092] In this way, a layout reference table for distinguishing heterogeneous BIOS 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 name and offset of each block by parsing the layout table, and then refreshes the corresponding block of the BIOS firmware file to be refreshed to the corresponding offset of the current BIOS Flash memory, thereby supporting 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.
[0093] It should be noted that the heterogeneous BIOS firmware of this embodiment is not limited to UEFI type BIOS firmware and Coreboot type BIOS firmware. For other types of heterogeneous BIOS firmware, refreshing is also supported by only changing the structure of the layout reference layout table.
[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0095] Figure 5 A schematic diagram of the structure of a firmware in-band refresh device provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the firmware in-band refresh device 10 includes: an identification module 301 , a determination module 302 and a refresh module 303 .
[0096] 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 refreshes the firmware to be refreshed in-band based on the reference layout table in the cache of the current firmware, wherein the current firmware and the firmware to be refreshed are heterogeneous firmware.
[0097] 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, extract the firmware identifier of the firmware to be refreshed; and determine the firmware layout type of the firmware to be refreshed according to the firmware identifier.
[0098] In an 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; and querying the first correspondence table to determine the firmware layout type of the firmware to be refreshed using the firmware identifier as an index.
[0099] In an embodiment of the present invention, a terminal interrupt module is also included, wherein the interrupt module is further used to: before identifying the firmware layout type of the firmware to be refreshed, obtain a request for in-band firmware update issued by the server; respond to the request for in-band firmware update, trigger an interrupt program of the current firmware; and determine the firmware layout type of the firmware to be refreshed in the interrupt program of the current firmware.
[0100] In an embodiment of the present invention, the determination module 302 is further used to: determine the 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; using the firmware layout type as an index, querying the second correspondence table to obtain the reference layout table.
[0101] In an embodiment of the present invention, the refresh module 303 is further used to: perform in-band refresh of the firmware to be refreshed based on the reference layout table, extract reference layout information in the reference layout table; read multiple blocks of the firmware to be refreshed based on the reference layout information; identify the target block order of the multiple blocks, and perform in-band refresh of the firmware to be refreshed according to the target block order.
[0102] In the embodiment of the present invention, the in-band refreshing of the firmware to be refreshed according to the target block sequence includes: refreshing the multiple blocks into the cache of the current firmware in blocks according to the target block sequence.
[0103] In an embodiment of the present invention, a comparison module is also included, wherein the comparison module is further used to: identify actual layout information of the firmware to be refreshed before in-band refreshing the firmware to be refreshed based on the reference layout table; extract reference layout information in the reference layout table; compare the actual layout information with the reference layout information; and determine the execution of the in-band refresh action of the firmware to be refreshed based on the comparison result.
[0104] 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.
[0105] In the embodiment of the present invention, if the comparison result is a layout consistency result, an in-band refresh action of the firmware to be refreshed is performed.
[0106] In the embodiment of the present invention, if the comparison result is a layout inconsistency result, the interrupt program of the current firmware is exited.
[0107] In an embodiment of the present invention, a judgment module is also included, wherein the judgment module is further used to: before in-band refreshing the firmware to be refreshed based on the reference layout table, it also 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 firmware.
[0108] It should be noted that the description of the features in the above-mentioned embodiments corresponding to the firmware in-band refresh device can refer to the relevant description of the embodiments corresponding to the firmware in-band refresh method, which will not be repeated here.
[0109] According to the firmware in-band refresh device provided by the embodiment of the present invention, the reference layout table of the firmware to be refreshed is determined by the firmware layout type of the firmware to be refreshed, and the firmware to be refreshed is refreshed in-band 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 firmware, firmware in-band refresh can be achieved, thereby realizing the in-band refresh of heterogeneous firmware through the introduced reference layout table, solving the technical problem that the in-band refresh interrupt handler in the related art can only refresh firmware with the same layout, improving the operation and maintenance efficiency, and reducing the operational complexity of in-band refresh of heterogeneous firmware.
[0110] An embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a memory 401 and a processor 402, wherein the memory 401 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any of the above firmware in-band refresh method embodiments.
[0111] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned firmware in-band refresh method embodiments when running.
[0112] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0113] An embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the steps in any of the above firmware in-band refresh method embodiments are implemented.
[0114] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium, the 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-mentioned firmware in-band refresh method embodiments are implemented.
[0115] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0116] The above is a detailed introduction to a firmware in-band refresh method, electronic device, storage medium and program product provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this 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 scope of protection 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, wherein the current firmware and the firmware to be refreshed are heterogeneous firmware.
2. The firmware in-band refresh method according to claim 1, characterized in that: The in-band refreshing of the firmware to be refreshed based on the reference layout table includes: Extracting reference layout information from 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.
3. The firmware in-band refresh method according to claim 2, 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 order.
4. The firmware in-band refresh method according to claim 1 or 2, 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.
5. The firmware in-band refresh method according to claim 4, 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.
6. The firmware in-band refresh method according to claim 5, 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.
7. The firmware in-band refresh method according to claim 5, characterized in that: If the comparison result is a layout inconsistency result, the interrupt program of the current firmware is exited.
8. 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.
9. The firmware in-band refresh method according to claim 8, 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.
10. 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 in-band firmware update request, trigger 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.
11. 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.
12. 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.
13. 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 12 when executing the computer program.
14. 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 12.
15. 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 12 are implemented.
Citation Information
Patent Citations
Stability test method, device and apparatus for in-band firmware refreshing process
CN111104271A
Firmware updating method and device
CN116257272A
Hard disk firmware version refreshing method and device, electronic equipment and medium
CN116643768A
Method and Apparatus to Enable Dynamically Activated Firmware Updates
US20090007089A1
System and method for updating GPTS (global partitioning tables) and partition contents of a computing device in real-time system recovery mode
US20240378047A1