Server firmware upgrading method and apparatus, non-volatile readable storage medium, and electronic device
Automatically determine the target version and obtain the mirror file content through the substrate management controller BMC, which solves the problem of low server firmware upgrade efficiency and realizes an automated and efficient firmware upgrade process.
Patent Information
- Application Number
- PCT/CN2024/121989
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-24
- Filing Date
- 2024-09-27
- Publication Date
- 2025-07-31
AI Technical Summary
In the prior art, server firmware upgrade efficiency is low, and it is necessary to manually determine the version and filter the image files, resulting in a long upgrade time and low efficiency.
Automatically determine the target version through the substrate management controller BMC and obtain file content from the mirror file to realize an automated firmware upgrade process and avoid manual confirmation and filtering.
Improves the efficiency of server firmware upgrades, simplifies operational steps, reduces the probability of errors, and ensures the security and efficiency of upgrades.
Smart Images

Figure CN2024121989_31072025_PF_FP_ABST
Abstract
Description
Server firmware upgrade method and device, non-volatile readable storage medium and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on January 24, 2024, with application number 202410098517.2, and application name “Server firmware upgrade method and device, storage medium and electronic device”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The embodiments of the present application relate to the field of computers, and in particular, to a server firmware upgrade method and device, a non-volatile readable storage medium, and an electronic device. Background Art
[0004] In the related art, when upgrading the version of the server's firmware, for example, when upgrading the CPLD (Complex Programmable Logic Device) firmware of Gaudi 2 in the server, the user needs to manually determine the version to which the CPLD firmware currently needs to be upgraded, and then manually confirm the files to be used when upgrading the firmware version, and then upgrade the firmware.
[0005] It is understandable that in the related art, the upgrade method for the server firmware version takes a long time and has low upgrade efficiency.
[0006] Summary of the Invention
[0007] Embodiments of the present application provide a server firmware upgrade method and apparatus, a non-volatile readable storage medium, and an electronic device to at least solve the problem of low server firmware upgrade efficiency in related technologies.
[0008] According to a first aspect of an embodiment of the present application, a server firmware upgrade method is provided, comprising: obtaining a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file including target image header information and file content of each image file in a plurality of image files, the file content of each image file in the plurality of image files being used to upgrade the version of the target firmware to a corresponding version, and the firmware upgrade request being used to request an upgrade of the version of the target firmware in the server; in response to the firmware upgrade request, determining, through a baseboard management controller (BMC), a target version to which the version of the target firmware is to be upgraded, and obtaining the file content of the target image file from the first image file, wherein the plurality of image files include the target image file, and the file content of the target image file being used to upgrade the version of the target firmware to the target version; and upgrading the version of the target firmware to the target version using the file content of the target image file.
[0009] In an exemplary embodiment, determining the target version to which the target firmware version is to be upgraded through a baseboard management controller BMC includes: obtaining a target quantity included in target image header information in a first image file, wherein the target quantity is used to represent the quantity of file contents of the image file included in the first image file; determining the target version to which the target firmware version is to be upgraded based on the target quantity, and obtaining the file contents of the target image file from the first image file.
[0010] In an exemplary embodiment, determining the target version to which the target firmware version is to be upgraded based on the target number, and obtaining the file content of the target image file from the first image file includes: when the target number is greater than or equal to 2, obtaining the target state value of the target firmware stored in the target register in the target firmware, wherein the target state value is used to indicate the target version to which the target firmware version is to be upgraded; determining the target version to which the target firmware version is to be upgraded based on the target state value, and obtaining the file content of the target image file from the first image file based on the target image header information.
[0011] In an exemplary embodiment, determining the target version to which the target firmware is to be upgraded based on the target status value includes: determining a first identifier of the target version of the target firmware having a corresponding relationship with the target status value from the status value and the version identifier having a corresponding relationship; obtaining the file content of the target image file from the first image file based on the target image header information includes: obtaining the file content of the target image file from the first image file based on the first identifier and the target image header information.
[0012] In an exemplary embodiment, obtaining the file content of a target image file from a first image file based on a first identifier and target image header information includes: determining a second identifier corresponding to the first identifier, wherein the second identifier is the identifier of the target image file; determining, from the target image header information, a target starting offset address and a target file size in the first image file of the file content of the target image file that has a corresponding relationship with the second identifier, wherein the target image header information stores one or more sets of identifiers of image files with corresponding relationships and the starting offset addresses and file sizes of the file contents of the image files in the first image file, and the one or more sets of identifiers of image files with corresponding relationships and the starting offset addresses and file sizes of the file contents of the image files in the first image file include the corresponding second identifier, the target starting offset address, and the target file size; and obtaining data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0013] In an exemplary embodiment, determining a second identifier corresponding to a first identifier includes: determining the second identifier corresponding to the first identifier from target image header information, wherein the target image header information also stores one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files, and the one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files include the first identifier and the second identifier with corresponding relationships.
[0014] In an exemplary embodiment, obtaining the file content of a target image file from a first image file according to a first identifier and target image header information includes: determining a second identifier corresponding to the first identifier, wherein the second identifier is the identifier of the target image file; determining a first starting offset address and a first ending offset address corresponding to the second identifier, and a second starting offset address and a second ending offset address corresponding to the second identifier from the target image header information, wherein the first starting offset address and the first ending offset address are used to determine a target starting offset address of the file content of the target image file in the first image file, and the second starting offset address and the second ending offset address are used to determine a target file size of the target image file; determining the target starting offset address according to the first starting offset address and the first ending offset address, and determining the target file size according to the second starting offset address and the second ending offset address; and obtaining data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0015] In an exemplary embodiment, determining a target starting offset address based on a first starting offset address and a first ending offset address, and determining a target file size based on a second starting offset address and a second ending offset address, includes: obtaining data stored from the first starting offset address to the first ending offset address from the first image file to obtain the target starting offset address, and obtaining data stored from the second starting offset address to the second ending offset address from the first image file to obtain the target file size.
[0016] In an exemplary embodiment, obtaining the file content of the target image file from the first image file further includes: when the target number is equal to 1, obtaining the file content of the first image file as the file content of the target image file.
[0017] In an exemplary embodiment, before determining, through a baseboard management controller (BMC), the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from a first image file, the method further includes: verifying the target image header information in the first image file and verifying the file content of multiple image files included in the first image file; determining, through the baseboard management controller (BMC), the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from the first image file, including: when the target image header information and the file content of the multiple image files pass the verification, determining, through the BMC, the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from the first image file.
[0018] In an exemplary embodiment, verifying the target image header information in the first image file includes: obtaining a first verification value stored in the target image header information, and obtaining data included in the target image header information other than the first verification value, wherein the first verification value is used to verify the target image header information, and the first verification value is a verification value obtained by a preset target verification algorithm; using the obtained data as input to the target verification algorithm to obtain a second verification value output by the target verification algorithm; and determining that the target image header information passes the verification when the first verification value and the second verification value are the same.
[0019] In an exemplary embodiment, verifying the file contents of multiple image files included in a first image file includes: obtaining a first group of verification values stored in target image header information, and obtaining the file content of each image file in the multiple image files included in the first image file to obtain the file content of a group of image files, wherein each verification value in the first group of verification values is used to verify the file content of a corresponding image file in the group of image files, and the first group of verification values is a verification value obtained by a preset target verification algorithm; using the file contents of the group of image files as input to the target verification algorithm, respectively, to obtain a second group of verification values output by the target verification algorithm, wherein when the file content of each image file in the group of image files is used as input to the target verification algorithm, the output of the target verification algorithm includes a verification value in the second group of verification values; and determining that the file contents of the group of image files have passed the verification if each verification value in the first group of verification values is the same as the corresponding verification value in the second group of verification values.
[0020] In an exemplary embodiment, the file contents of a group of image files are respectively used as inputs of a target verification algorithm to obtain a second group of verification values output by the target verification algorithm, including: using the file content of the i2th image file among N2 image files as inputs of the target verification algorithm to obtain the i2th verification value among the N2 verification values output by the target verification algorithm, wherein the group of image files includes N2 image files, the second group of verification values includes N2 verification values, N2 is a positive integer, and i2 is a positive integer less than or equal to N2; each verification value in the first group of verification values and the second group of verification values When the corresponding check values in the verification values are the same, determining that the file content of a group of image files passes the verification includes: when an i1-th check value in N1 check values and an i2-th check value in N2 check values are the same, determining that the file content of the i1-th image file in the N1 image files passes the verification, wherein the first group of check values includes N1 check values, the i1-th check value is a check value in the N1 check values corresponding to the file content of the i1-th image file, N1 is a positive integer, i1 is a positive integer less than or equal to N1, N1 is equal to N2, and i1 is equal to i2.
[0021] In an exemplary embodiment, before obtaining a firmware upgrade request, the method further includes: obtaining image header information included in each image file of a plurality of image files to obtain a set of image header information, wherein each image file of the plurality of image files includes the image header information of each image file and the file content of each image file; and determining the target image header information to include each image header information in the set of image header information.
[0022] In an exemplary embodiment, determining the target image header information to include each image header information in a set of image header information includes: using the set of image header information as input to a target verification algorithm to obtain a first verification value; and determining the target image header information to include each image header information in the set of image header information and the first verification value.
[0023] In an exemplary embodiment, the target image header information is determined to include each image header information in a set of image header information, including: recording the j-th image header information and the j+1-th image header information in the target image header information by performing the following steps, wherein the set of image header information includes M image header information, the j-th image header information is the image header information included in the j-th image file of the M image files, the j+1-th image header information is the image header information included in the j+1-th image file of the M image files, M is a positive integer greater than or equal to 2, and j is a positive integer less than or equal to M-1: recording the j-th image file identifier, the j-th check value, the j-th starting offset address and the j-th file size included in the j-th image header information, and the j-th image header information included in the j+1-th image header information in sequence in the target image header information. +1 image file identifier, j+1th check value, j+1th starting offset address and j+1th file size; wherein, the file content of the jth image file is used to upgrade the version of the target firmware to the jth version, the jth image file identifier is the identifier of the jth image file, the jth check value is a check value obtained by a preset target check algorithm, the file content of the jth image file includes data of the jth file size obtained from the jth starting offset address in the first image file, the file content of the j+1th image file is used to upgrade the version of the target firmware to the j+1th version, the j+1th image file identifier is the identifier of the j+1th image file, the j+1th check value is a check value obtained by the target check algorithm, and the file content of the j+1th image file includes data of the j+1th file size obtained from the j+1th starting offset address in the first image file.
[0024] In an exemplary embodiment, the target firmware version is upgraded to the target version using the file content of the target image file, including: enabling a target interface between the BMC and the target firmware, wherein the BMC and the target firmware are connected via the target interface, and the enabled target interface is configured to allow the target firmware version to be upgraded; writing the file content of the target image file into the target firmware through the enabled target interface so as to upgrade the target firmware version from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware.
[0025] In one exemplary embodiment, the target interface comprises a Joint Test Group (JTAG) interface.
[0026] In an exemplary embodiment, after upgrading the target firmware version to the target version using the file content of the target image file, the method further includes: determining whether the target firmware version is successfully upgraded to the target version; if it is determined that the target firmware version is not successfully upgraded to the target version, generating target prompt information, wherein the target prompt information is used to prompt that the target firmware version upgrade has failed.
[0027] In an exemplary embodiment, when it is determined that the version of the target firmware has not been successfully upgraded to the target version, the method further includes: re-enabling a target interface between the BMC and the target firmware, wherein the BMC and the target firmware are connected via the target interface, and the enabled target interface is set to allow the version of the target firmware to be upgraded; writing the file content of the target image file into the target firmware through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware; or writing the file content of the target image file into the target firmware again through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware.
[0028] In an exemplary embodiment, the method also includes: determining the number of times the version upgrade of the target firmware has failed; when the number is greater than or equal to a preset number threshold, determining that the file content of the target image file included in the first image file is abnormal, obtaining the file content of the second image file corresponding to the target version of the target firmware, and recording the file content of the second image file in the target reserved area of the first image file, wherein the file content of the second image file is used to upgrade the version of the target firmware to the target version; writing the file content of the second image file corresponding to the target version in the target reserved area into the target firmware through an enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the second image file into the target firmware.
[0029] According to a second aspect of an embodiment of the present application, a server firmware upgrade device is provided, comprising: a first acquisition module, configured to obtain a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file including target image header information and file content of each image file in a plurality of image files, the file content of each image file in the plurality of image files being used to upgrade the version of the target firmware to a corresponding version, and the firmware upgrade request being used to request an upgrade of the version of the target firmware in the server; a first determination module, configured to determine, in response to the firmware upgrade request, a target version to which the version of the target firmware is to be upgraded through a baseboard management controller BMC, and obtain the file content of the target image file from the first image file, wherein the plurality of image files include the target image file, and the file content of the target image file is used to upgrade the version of the target firmware to the target version; and an upgrade module, configured to use the file content of the target image file to upgrade the version of the target firmware to the target version.
[0030] According to a third aspect of the embodiments of the present application, a computer non-volatile readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0031] According to a fourth aspect of the embodiments of the present application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0032] Through the present application, when a firmware upgrade request is obtained, it can be indicated that the server firmware version is desired to be upgraded. In this case, the BMC can automatically determine the target version to which the firmware version is to be upgraded, and obtain the file content of the target image file used to upgrade the firmware version to the target version from the first image file. The file content of the image file is used to upgrade the server firmware version to the target version. In this way, the user is avoided from manually confirming the target version to which the server firmware is to be upgraded, and manually screening the file content of the target image file used to upgrade the firmware version to the target version. Therefore, the problem of low server firmware upgrade speed can be solved, and the server firmware upgrade effect can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] FIG1 is a hardware structure block diagram of a server device according to a server firmware upgrade method according to an embodiment of the present application;
[0034] FIG2 is a schematic diagram of an application scenario of an optional server firmware upgrade method according to an embodiment of the present application;
[0035] FIG3 is a flow chart of a server firmware upgrade method according to an embodiment of the present application;
[0036] FIG4 is a schematic diagram of an optional method for obtaining the file content of a target image file according to an embodiment of the present application;
[0037] 5 is a schematic diagram of an optional verification of target image header information and file contents of multiple image files according to an embodiment of the present application;
[0038] 6 is a schematic diagram of an optional method of recording the file content of the second image file in the target reserved area of the first image file according to an embodiment of the present application;
[0039] FIG7 is a schematic diagram of an optional server firmware upgrade according to an embodiment of the present application;
[0040] FIG8 is a structural block diagram of a server firmware upgrade device according to an embodiment of the present application. DETAILED DESCRIPTION
[0041] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0042] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0043] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking operation on a server device as an example, FIG1 is a hardware structure block diagram of a server device of a server firmware upgrade method in an embodiment of the present application. As shown in FIG1 , the server device may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a microprocessor MCU (Microcontroller Unit, micro control unit) or a programmable logic device FPGA (Field Programmable Gate Array, field programmable logic gate array) and a memory 104 configured to store data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is only for illustration and does not limit the structure of the above-mentioned server device. For example, the server device may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .
[0044] The memory 104 can be configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the server firmware upgrade method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may include a memory remotely located relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0045] The transmission device 106 is configured to receive or transmit data via a network. Optional examples of the aforementioned network may include a wireless network provided by a communication provider of the server device. In one embodiment, the transmission device 106 may include a network interface controller (NIC) that can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0046] A server firmware upgrade method is provided in this embodiment. In order to better understand the application scenarios of the server firmware upgrade method in the embodiment of the present application, the application scenarios of the server firmware upgrade method in the embodiment of the present application can be explained and illustrated in combination with, but not limited to, optional embodiments, and can be applied to, but not limited to, the embodiment of the present application.
[0047] Figure 2 is a schematic diagram of an application scenario of an optional server firmware upgrade method according to an embodiment of the present application. As shown in Figure 2, it can be but not limited to taking the upgrade of the CPLD firmware version of Gaudi 2 on the server as an example. An upgrade tool is deployed in the computer in the same network segment. The upgrade tool can be but not limited to including an upgrade application, an upgrade applet or an upgrade URL, etc. The user initiates a firmware upgrade request to the server BMC through the upgrade tool (for example, clicking to start upgrading, etc.), wherein the firmware upgrade request carries a first image file, which includes the target image header information and the file content of each image file in the multiple image files. The file content of each image file in the multiple image files is used to upgrade the version of the target firmware to the corresponding version. The firmware upgrade request is used to request to upgrade the version of the target firmware in the server (for example, the version of the CPLD firmware of Gaudi 2).
[0048] In such a case, in response to the firmware upgrade request, the baseboard management controller BMC determines the target version to which the version of the target firmware (for example, the version of the CPLD firmware of Gaudi 2) is to be upgraded, and obtains the file content of the target image file from the first image file, wherein the multiple image files include the target image file, and the file content of the target image file is used to upgrade the version of the target firmware to the target version.
[0049] Using the file content of the target image file, the version of the target firmware (e.g., the version of the CPLD firmware of Gaudi 2) is upgraded to the target version, for example, the version of the target firmware (e.g., the version of the CPLD firmware of Gaudi 2) is upgraded to the target version through the JTAG interface between the BMC and the CPLD firmware.
[0050] Compared with the related art, it is necessary to manually read the Gaudi 2 register information through the information reading tool deployed in the computer on the same network segment. The user manually determines the version to which the CPLD firmware of Gaudi 2 needs to be upgraded through the read register information, and then filters the image corresponding to the version to which the CPLD firmware of Gaudi 2 needs to be upgraded according to the judgment result. Only then can the upgrade tool be opened to upgrade the firmware version (i.e., corresponding to the dotted part in Figure 2). Through the server firmware upgrade method in the embodiment of the present application, the version to which the firmware is to be upgraded is automatically determined through the BMC, and the content of the image file corresponding to the version to which the firmware is to be upgraded can be automatically filtered, thereby improving the upgrade efficiency of the firmware version.
[0051] In this embodiment, a server firmware upgrade method is provided. FIG3 is a flow chart of the server firmware upgrade method according to an embodiment of the present application. As shown in FIG3 , the process includes the following steps:
[0052] Step S302: Obtain a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file including target image header information and file contents of each of a plurality of image files, the file contents of each of the plurality of image files being used to upgrade the target firmware version to a corresponding version, and the firmware upgrade request being used to request an upgrade of the target firmware version in the server;
[0053] Step S304: In response to the firmware upgrade request, determining, via the baseboard management controller (BMC), a target version to which the target firmware is to be upgraded, and obtaining file content of the target image file from the first image file, wherein the plurality of image files include the target image file, and the file content of the target image file is used to upgrade the target firmware to the target version;
[0054] Step S306: Using the file content of the target image file, the version of the target firmware is upgraded to the target version.
[0055] Through the above steps, when a firmware upgrade request is obtained, it can be indicated that the server firmware version is desired to be upgraded. In this case, the BMC can automatically determine the target version to which the firmware version is to be upgraded, and obtain the file content of the target image file used to upgrade the firmware version to the target version from the first image file. The file content of the image file is used to upgrade the server firmware version to the target version. In this way, the user is avoided from manually confirming the target version to which the server firmware is to be upgraded, and manually screening the file content of the target image file used to upgrade the firmware version to the target version. Therefore, the problem of low server firmware upgrade speed can be solved, and the server firmware upgrade effect can be improved.
[0056] In the technical solution provided in the above step S302, the target firmware may include but is not limited to a group of programs solidified in the server's hardware (for example, memory, etc.), the version of the target firmware may include but is not limited to a group of programs of different versions, the target firmware may include but is not limited to the server's BIOS (Basic Input / Output System), server OS (Operating System), RAM device and processor (for example, Gaudi2), etc.
[0057] Optionally, in this embodiment, the first image file includes the file content of each image file in the multiple image files. It can be understood that the file content of each image file in the multiple image files is included in the first image file. Compared with the related art, the multiple image files are independent image files. Through the method in the embodiment of the present application, the computer resources required to store multiple image files are saved and the utilization rate of computer resources is improved.
[0058] Optionally, in this embodiment, the file content of each image file in the multiple image files is used to upgrade the version of the target firmware to a different version. For example, the file content of image file 1 is used to upgrade the version of the target firmware to version 1, the file content of image file 2 is used to upgrade the version of the target firmware to version 2, and the file content of image file 3 is used to upgrade the version of the target firmware to version 3. It can be understood that the file content of each image file in the multiple image files is a complete version of the target firmware, and the file content of each image file in the multiple image files can be used, but is not limited to, to upgrade different functions of the version of the target firmware.
[0059] In this way, firmware version selection and image file content processing are all performed internally by the BMC, reducing the complexity of on-site user operations and improving upgrade efficiency. Simplifying upgrade steps also reduces the probability of errors, ensuring that upgrades can be completed safely and efficiently.
[0060] In an exemplary embodiment, before obtaining a firmware upgrade request, the method further includes: obtaining image header information included in each of a plurality of image files to obtain a set of image header information, wherein each of the plurality of image files includes the image header information of each image file and the file content of each image file; and determining the target image header information to include each image header information in the set of image header information.
[0061] Optionally, in this embodiment, in order to ensure the orderliness between the file contents of multiple mirror files in the first mirror file and avoid the disorder of the file contents of multiple mirror files, it is possible but not limited to obtaining the mirror header information included in each mirror file in the multiple mirror files, and determining the target mirror header information as the mirror header information included in each mirror file in the multiple mirror files. In this way, the header information in each mirror file is uniformly recorded in the target mirror header information.
[0062] In an exemplary embodiment, the target image header information can be determined to include each image header information in a set of image header information in the following manner, but is not limited to: using the set of image header information as input to a target verification algorithm to obtain a first verification value; and determining the target image header information to include each image header information in the set of image header information and the first verification value.
[0063] Optionally, in this embodiment, the target verification algorithm can be, but is not limited to, used to generate a first verification value based on a set of mirror header information. As an optional example, the target verification algorithm can be, but is not limited to, including a cyclic redundancy check algorithm, a longitudinal redundancy check algorithm, a redundant check algorithm, a summed XOR check algorithm, a cumulative sum check algorithm, and one of the parity check algorithms, etc. This application does not impose any restrictions on the target verification algorithm.
[0064] Optionally, in this embodiment, in order to improve the accuracy of the target image header information and avoid the failure of the firmware version upgrade due to incorrect image header information, a set of image header information can be used as but not limited to the input of the target verification algorithm. It can be understood that a verification value (equivalent to the first verification value) is calculated based on a set of image header information by the target verification algorithm, and then each image header information and the first verification value in a set of image header information are recorded in the target image header information.
[0065] In an exemplary embodiment, the j-th image header information and the j+1-th image header information in the M image header information can be recorded in the target image header information by, but not limited to, executing the following steps, wherein a group of image header information includes M image header information, the j-th image header information is the image header information included in the j-th image file of the M image files, the j+1-th image header information is the image header information included in the j+1-th image file of the M image files, M is a positive integer greater than or equal to 2, and j is a positive integer less than or equal to M-1: recording in the target image header information the j-th image file identifier, the j-th check value, the j-th starting offset address and the j-th file size included in the j-th image header information, and the j+1-th image file identifier, the j+1-th check value, the j-th starting offset address and the j-th file size included in the j-th image header information, and the j+1-th image file identifier, the j+1-th check value, the j-th starting offset address and the j-th file size included in the j+1-th image header information in sequence. A check value, a j+1th starting offset address, and a j+1th file size; wherein, the file content of the j-th image file is used to upgrade the version of the target firmware to the j-th version, the j-th image file identifier is the identifier of the j-th image file, the j-th check value is a check value obtained by a preset target check algorithm, the file content of the j-th image file includes data of the j-th file size obtained from the j-th starting offset address in the first image file, the file content of the j+1-th image file is used to upgrade the version of the target firmware to the j+1-th version, the j+1-th image file identifier is the identifier of the j+1-th image file, the j+1-th check value is a check value obtained by the target check algorithm, and the file content of the j+1-th image file includes data of the j+1-th file size obtained from the j+1-th starting offset address in the first image file.
[0066] Optionally, in this embodiment, the j-th image file identifier, j-th check value, j-th starting offset address and j-th file size included in the j-th image header information, and the j+1-th image file identifier, j+1-th check value, j+1-th starting offset address and j+1-th file size included in the j+1-th image header information can be recorded in the target image header information in a preset order, but is not limited to.
[0067] Optionally, in this embodiment, the file size of the mirror file can be but is not limited to the amount of data used to represent the data. For example, the j-th file size can be but is not limited to the amount of data used to represent the file content of the j-th mirror file, the j+1-th file size can be but is not limited to the amount of data used to represent the file content of the j+1-th mirror file, and so on.
[0068] In the technical solution provided in the above step S304, it is possible but not limited to responding to a firmware upgrade request and determining the target version to which the target firmware version is to be upgraded through the BMC (Baseboard Management Controller). Compared with the related art, which requires manual determination of the target version to which the firmware version is to be upgraded, the method in the embodiment of the present application realizes automatic determination of the target version to which the firmware version is to be upgraded, thereby improving the efficiency of determining the target version to which the firmware version is to be upgraded.
[0069] Optionally, in this embodiment, the file content of the target image file can be obtained from the file content of multiple image files in the first image file through the BMC, but is not limited to it. It can be understood that when the target version to which the target firmware version is to be upgraded is determined through the BMC, the file content of the target image file used to upgrade the target firmware version to the target version is automatically obtained from the first image file through the BMC. Compared with the related art, it is necessary to manually screen the file content of the target image file used to upgrade the target firmware version to the target version. Through the method in the embodiment of the present application, the efficiency of determining the file content of the target image file used to upgrade the target firmware version to the target version is improved.
[0070] In an exemplary embodiment, the target version to which the target firmware version is to be upgraded can be determined by the baseboard management controller BMC in the following manner, but not limited to: obtaining a target quantity included in the target image header information of the first image file, wherein the target quantity is used to represent the quantity of file contents of the image file included in the first image file; determining the target version to which the target firmware version is to be upgraded based on the target quantity, and obtaining the file contents of the target image file from the first image file.
[0071] Optionally, in this embodiment, the target number included in the target image header information in the first image file can be, but is not limited to, the number of file contents of the image files included in the first image file. For example, the first image file includes the file content of image file 1, the file content of image file 2, and the file content of image file 3. Then, the target number included in the target image header information of the first image file can be, but is not limited to, 3.
[0072] In an exemplary embodiment, the target version to which the target firmware is to be upgraded can be determined based on the target number, and the file content of the target image file is obtained from the first image file in the following manner, but is not limited to: when the target number is greater than or equal to 2, obtaining a target state value of the target firmware stored in a target register in the target firmware, wherein the target state value is used to indicate the target version to which the target firmware is to be upgraded; determining the target version to which the target firmware is to be upgraded based on the target state value, and obtaining the file content of the target image file from the first image file based on the target image header information.
[0073] Optionally, in this embodiment, when the target number is greater than or equal to 2, it may indicate that the first image file includes the file contents of at least two image files. In such a case, the target state value of the target firmware stored in the target register in the target firmware may be obtained through, but is not limited to, the BMC. The target state value may be used to indicate, but is not limited to, the target version to which the target firmware is to be upgraded. It can be understood that the target state value may have, but is not limited to, a corresponding relationship with the target version to which the target firmware is to be upgraded.
[0074] For example, taking the target firmware including the CPLD firmware of Gaudi2 in the server as an example, when adapting the CPLD firmware upgrade of Gaudi2, the manufacturer provides CPLD firmware for upgrading, which is generally distinguished by the three names fea_pub_cf0, cf0, and cf1. It can be understood that the file content of the image file fea_pub_cf0 included in the first image file is used to upgrade the version of the CPLD firmware to version 1, the file content of the image file cf0 included in the first image file is used to upgrade the version of the CPLD firmware to version 2, and the file content of the image file cf1 included in the first image file is used to upgrade the version of the CPLD firmware to version 3.
[0075] Before upgrading, ensure the firmware is in place. Before updating the Gaudi2 CPLD firmware, read the CFG_load_status status value (equivalent to the target status value) in the Gaudi2 cpld register (equivalent to the target register) through the BMC interface. The CFG_load_status value is primarily determined by the values of two bits. If the CFG_load_status value is 0x01, the CPLD firmware version needs to be upgraded to version 3. If the CFG_load_status value is 0x10, the CPLD firmware version needs to be upgraded to version 2. If the CFG_load_status value is 0x11, the CPLD firmware version needs to be upgraded to version 1.
[0076] Optionally, in this embodiment, the target state value of the target firmware stored in the target register may be, but is not limited to, dynamically changing. For example, when the version of the target firmware is successfully upgraded to the target version, the target state value of the target firmware stored in the target register may be, but is not limited to, adjusted to the first state value, so that when the version of the target firmware needs to be upgraded again next time, the version to which the target firmware needs to be upgraded may be determined based on, but is not limited to, the first state value.
[0077] In an exemplary embodiment, the target version to which the target firmware is to be upgraded can be determined based on the target status value in the following manner, but is not limited to: determining a first identifier of the target version of the target firmware that corresponds to the target status value from the status value and the version identifier that have a corresponding relationship; and obtaining the file content of the target image file from the first image file based on the target image header information can be obtained in the following manner, but is not limited to: obtaining the file content of the target image file from the first image file based on the first identifier and the target image header information.
[0078] Optionally, in this embodiment, different status values have one-to-one corresponding version identifiers. It can be understood that different status values correspond to different identifiers of target firmware versions.
[0079] For example, taking the CPLD firmware of Gaudi2 in the server as an example, the file content of the image file fea_pub_cf0 included in the first image file is used to upgrade the version of the CPLD firmware to version 1, the file content of the image file cf0 included in the first image file is used to upgrade the version of the CPLD firmware to version 2, and the file content of the image file cf1 included in the first image file is used to upgrade the version of the CPLD firmware to version 3.
[0080] Read the CFG_load_status status value (equivalent to the target status value) in the Gaudi2 CPLD register (equivalent to the target register) through the BMC interface. If the CFG_load_status value is 0x01, the version identifier corresponding to 0x01 is version 3. If the CFG_load_status value is 0x10, the version identifier corresponding to 0x10 is version 2. If the CFG_load_status value is 0x11, the version identifier corresponding to 0x11 is version 1.
[0081] In an exemplary embodiment, the file content of the target image file can be obtained from the first image file according to the first identifier and the target image header information in the following manner, but is not limited to: determining a second identifier corresponding to the first identifier, wherein the second identifier is the identifier of the target image file; determining a target starting offset address and a target file size of the file content of the target image file corresponding to the second identifier in the first image file from the target image header information, wherein the target image header information stores one or more sets of corresponding image file identifiers and starting offset addresses and file sizes of the file content of the image files in the first image file, and the one or more sets of corresponding image file identifiers and starting offset addresses and file sizes of the file content of the image files in the first image file include the corresponding second identifier, the target starting offset address, and the target file size; and obtaining data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0082] Optionally, in this embodiment, the file size may include but is not limited to the data volume of the file content of the image file. For example, the target file size may include but is not limited to the data volume of the file content of the target image file. For example, if the target file size is 200 bytes, it can be understood that the file content of the target image file is 200 bytes.
[0083] Optionally, in this embodiment, it is possible but not limited to starting from the target starting offset address in the first image file, obtaining data of the target file size, and obtaining the file content of the target image file. For example, the target starting offset address is 13 and the target file size is 200 bytes. It is possible but not limited to starting from address 13 in the first image file, obtaining 200 bytes of data, and obtaining the file content of the target image file.
[0084] In an exemplary embodiment, the second identifier corresponding to the first identifier can be determined in the following manner, but is not limited to: determining the second identifier corresponding to the first identifier from the target image header information, wherein the target image header information also stores one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files, and the one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files include the first identifier and the second identifier with corresponding relationships.
[0085] Optionally, in this embodiment, the second identifier corresponding to the first identifier can be determined from the identifier of the firmware version stored in the target image header information and the identifier of the image file, but is not limited to it. For example, the first identifier is the identifier of version 1 of the target firmware, and the second identifier is the identifier of the image file 1 corresponding to the identifier of version 1.
[0086] Optionally, in this embodiment, the first identifier and the second identifier may include but are not limited to at least one of letters, numbers and character strings, or the first identifier and the second identifier may include but are not limited to values in the corresponding base, for example, hexadecimal or binary, etc. This application does not impose any restrictions on this.
[0087] Figure 4 is a schematic diagram of an optional method of obtaining the file content of a target image file according to an embodiment of the present application. As shown in Figure 4, the first image file may include, but is not limited to, target image header information and the file content of image file 1, the file content of image file 2, the file content of image file 3, and a target reserved area. As an optional example, the target image header information stores one or more groups of identifiers of corresponding image files, the starting offset address and file size of the file content of the image files in the first image file, and one or more groups of identifiers of corresponding firmware versions and identifiers of the image files.
[0088] For example, the target image header information stores the corresponding relationship between the identifier 1 of firmware version 1 and the identifier 0x0001 of image file 1, the corresponding relationship between the identifier 2 of firmware version 2 and the identifier 0x0002 of image file 2, and the corresponding relationship between the identifier 3 of firmware version 3 and the identifier 0x0003 of image file 3. The target image header information stores the corresponding relationship between the identifier 0x0001 of image file 1 and the starting offset address 13 and file size 50 of the file content of image file 1 in the first image file, the corresponding relationship between the identifier 0x0002 of image file 2 and the starting offset address 63 and file size 40 of the file content of image file 2 in the first image file, and the corresponding relationship between the identifier 0x0003 of image file 3 and the starting offset address 103 and file size 45 of the file content of image file 3 in the first image file.
[0089] For example, when the target firmware to be upgraded to is version 2, a second identifier (e.g., image file 2 identifier 0x0002) corresponding to the first identifier (e.g., firmware version 2 identifier) is determined from the identifier of the firmware version and the identifier of the image file stored in the target image header information; the target starting offset address (e.g., 63) and target file size (e.g., 40) of the target image file (e.g., image file 2) corresponding to the second identifier (e.g., image file 2 identifier 0x0002) are determined from the target image header information. The target file size (e.g., 40) can be obtained by, but is not limited to, starting from the target starting offset address (e.g., 63) in the first image file to obtain data on the target file size (e.g., 40) to obtain the file content of the target image file (e.g., image file 2).
[0090] In an exemplary embodiment, the file content of the target image file can be obtained from the first image file according to the first identifier and the target image header information in the following manner, but not limited to: determining a second identifier corresponding to the first identifier, wherein the second identifier is the identifier of the target image file; determining a first starting offset address and a first ending offset address corresponding to the second identifier, and a second starting offset address and a second ending offset address corresponding to the second identifier from the target image header information, wherein the first starting offset address and the first ending offset address are used to determine a target starting offset address of the file content of the target image file in the first image file, and the second starting offset address and the second ending offset address are used to determine a target file size of the target image file; determining the target starting offset address according to the first starting offset address and the first ending offset address, and determining the target file size according to the second starting offset address and the second ending offset address; and obtaining data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0091] Optionally, in this embodiment, the target image header information stores a first set of offset addresses and a second set of offset addresses corresponding to the second identifier, wherein the first set of offset addresses includes a first starting offset address and a first ending offset address, and the second set of offset addresses includes a second starting offset address and a second ending offset address. The target image header information in the first image file can be explained and illustrated using, but not limited to, an example in which the first image file includes the file contents of image file 1, the file contents of image file 2, and the file contents of image file 3. The target image header information is shown in Table 1.
[0092] Table 1
[0093] As shown in Table 1, the firmware version number can be, but is not limited to, within the range of the minimum firmware version number and the maximum firmware version number. The image ID (equivalent to the second identifier) of image file 2 can be, but is not limited to, 0x0002, and 0x0002 has a corresponding first set of offset addresses and a second set of offset addresses, wherein the first set of offset addresses includes the starting offset address of the image offset address (equivalent to the first starting offset address) and the starting offset address of the image offset address (equivalent to the first ending offset address), and the second set of offset addresses includes the starting offset address (equivalent to the second starting offset address) and the ending offset address (equivalent to the second ending offset address) of the image size (equivalent to the target file size).
[0094] Optionally, in this embodiment, in order to improve the security of the file content of the image file, it is possible but not limited to not directly recording the starting offset address and file size of the file content of the image file in the target image header information, but recording the starting offset address and file size of the file content of the image file in less data in the target image header information. In this way, the possibility of leakage of the file content of the image file is reduced, and the security of the file content of the image file is improved.
[0095] In an exemplary embodiment, the target starting offset address can be determined based on the first starting offset address and the first ending offset address, and the target file size can be determined based on the second starting offset address and the second ending offset address in the following manner, but is not limited to: obtaining data stored from the first starting offset address to the first ending offset address from the first image file to obtain the target starting offset address, and obtaining data stored from the second starting offset address to the second ending offset address from the first image file to obtain the target file size.
[0096] Optionally, in this embodiment, the data stored at the first starting offset address to the first ending offset address can be obtained from the first image file, but is not limited to being obtained, to obtain the target starting offset address. For example, the first starting offset address is 15 and the first ending offset address is 17. In this case, the data stored at addresses 15 to 17 can be read starting from address 15, but is not limited to being read, to obtain a target starting offset address of 40.
[0097] Optionally, in this embodiment, the data stored at the second starting offset address to the second ending offset address can be obtained from the first image file, but is not limited to being obtained, to obtain the target file size. For example, the second starting offset address is 18 and the first ending offset address is 21. In this case, the data stored at addresses 18 to 21 can be read starting from address 18, but is not limited to being read, to obtain a target file size of 100 bytes.
[0098] In an exemplary embodiment, the file content of the target image file may be obtained from the first image file in the following manner, but is not limited to: when the target number is 1, the file content of the first image file is obtained as the file content of the target image file.
[0099] Optionally, in this embodiment, when the target number is equal to 1, it can be understood that the first image file only includes the file content of one image file. In this case, there is no need to filter the content of the image file included in the first image file, but directly obtain the file content of the image file included in the first image file as the file content of the target image file.
[0100] In an exemplary embodiment, before determining, through a baseboard management controller (BMC), the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from a first image file, the above method further includes: verifying the target image header information in the first image file and verifying the file content of multiple image files included in the first image file; determining, through the baseboard management controller (BMC), the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from the first image file, including: when the target image header information and the file content of the multiple image files pass the verification, determining, through the BMC, the target version to which the target firmware version is to be upgraded and obtaining the file content of the target image file from the first image file.
[0101] Optionally, in this embodiment, in order to improve the accuracy of the obtained target image file and avoid obtaining an erroneous image file or a modified image file, it is possible but not limited to verifying the target image header information in the first image file and verifying the file contents of multiple image files included in the first image file.
[0102] Optionally, in this embodiment, if the target image header information fails to pass the verification, and / or the file content of at least one image file among the file contents of multiple image files fails to pass the verification, it may indicate that an error may have occurred in the first image file. In such a case, continuing to use the first image file to upgrade the target firmware version may cause the firmware version upgrade to fail, or cause the target firmware version to crash after the upgrade. In such a case, the target firmware version is refused to be upgraded.
[0103] In an exemplary embodiment, the target image header information in the first image file can be verified in the following manner, but is not limited to: obtaining a first verification value stored in the target image header information, and obtaining data included in the target image header information other than the first verification value, wherein the first verification value is used to verify the target image header information, and the first verification value is a verification value obtained by a preset target verification algorithm; using the obtained data as input to the target verification algorithm to obtain a second verification value output by the target verification algorithm; when the first verification value and the second verification value are the same, determining that the target image header information has passed the verification.
[0104] Optionally, in this embodiment, when the first verification value and the second verification value are different, it is determined that the target image header information fails the verification.
[0105] Optionally, in this embodiment, the first verification value and the second verification value are generated in the same manner. For example, the first verification value and the second verification value are both verification values obtained through a preset target verification algorithm.
[0106] In an exemplary embodiment, the file contents of multiple image files included in the first image file can be verified in the following manner, but is not limited to: obtaining a first group of verification values stored in the target image header information, and obtaining the file content of each image file in the multiple image files included in the first image file, to obtain the file content of a group of image files, wherein each verification value in the first group of verification values is used to verify the file content of a corresponding image file in the group of image files, and the first group of verification values is a verification value obtained by a preset target verification algorithm; using the file contents of the group of image files as input to the target verification algorithm, respectively, to obtain a second group of verification values output by the target verification algorithm, wherein, when the file content of each image file in the group of image files is used as input to the target verification algorithm, the output of the target verification algorithm includes a verification value in the second group of verification values; when each verification value in the first group of verification values and the corresponding verification value in the second group of verification values are the same, it is determined that the file contents of the group of image files have passed the verification.
[0107] Optionally, in this embodiment, when there is at least one check value in the first set of check values that is different from a corresponding check value in the second set of check values, it is determined that the file contents of a group of image files fail the verification.
[0108] Optionally, in this embodiment, the generation method of each verification value in the first group of verification values and each verification value in the second group of verification values is the same. For example, each verification value in the first group of verification values and each verification value in the second group of verification values are verification values obtained through a preset target verification algorithm.
[0109] In an exemplary embodiment, the file contents of a group of image files can be used as inputs of a target verification algorithm respectively to obtain a second group of verification values output by the target verification algorithm in the following manner, but is not limited to: the file contents of the i2th image file among the N2 image files are used as inputs of the target verification algorithm to obtain the i2th verification value among the N2 verification values output by the target verification algorithm, wherein the group of image files includes N2 image files, the second group of verification values includes N2 verification values, N2 is a positive integer, and i2 is a positive integer less than or equal to N2; each verification value in the first group of verification values and When the corresponding check values in the second group of check values are the same, determining that the file content of a group of image files has passed the verification includes: when the i1-th check value in N1 check values and the i2-th check value in N2 check values are the same, determining that the file content of the i1-th image file in the N1 image files has passed the verification, wherein the first group of check values includes N1 check values, the i1-th check value is the check value in the N1 check values corresponding to the file content of the i1-th image file, N1 is a positive integer, i1 is a positive integer less than or equal to N1, N1 is equal to N2, and i1 is equal to i2.
[0110] Optionally, in this embodiment, when the i1th check value among the N1 check values and the i2th check value among the N2 check values are different, it is determined that the file content of the i1th mirror file among the N1 mirror files has failed the verification, wherein the first group of check values includes N1 check values, and the i1th check value is the check value among the N1 check values corresponding to the file content of the i1th mirror file.
[0111] In order to better understand the process of verifying the image header information included in the first image file and the file content of the image file in the embodiment of the present application, the process of verifying the image header information included in the first image file and the file content of the image file in the embodiment of the present application is explained and illustrated in combination with optional embodiments below, which can be applied to but is not limited to the embodiment of the present application.
[0112] FIG5 is a schematic diagram of an optional verification of target image header information and file contents of multiple image files according to an embodiment of the present application. As shown in FIG5 , the image security detection process may include, but is not limited to, the following steps:
[0113] Step S501, read the firmware image header content (equivalent to the target image header information) according to the agreed size and position. The firmware image header data (equivalent to the target image header information) can be taken out according to, but not limited to, the agreed rules of the firmware image header.
[0114] Step S502: Determine the number of images included in the firmware (equivalent to the target number). This may include, but is not limited to, determining the number of firmware sub-images packaged this time (equivalent to the target number).
[0115] In step S503, the image header content (equivalent to the target image header information) is subjected to CRC (Cyclic Redundancy Check, an example of a target verification algorithm) verification to implement verification of the image header data (equivalent to the target image header information).
[0116] In step S504, the calculated check value is compared with the mirror packet header check value (equivalent to the first check value) to determine whether they are consistent. If they are inconsistent, the mirror is determined to be illegal and the mirror packet legitimacy check is completed. If they are consistent, it can be indicated that the mirror header data is complete and accurate. In this case, step S505 is executed.
[0117] Step S505, determine whether the number of firmware images is 1 or 3. If the number of firmware images is not 1 or 3, determine that the image is illegal. It can be understood that the number of sub-images is read from the image header, and only 1 or 3 can be guaranteed to be used. Other cases are considered abnormal and exit directly. The image package legitimacy check is completed. If the number of firmware images is 1 or 3, execute step S506.
[0118] Step S506 , reading the offset address (equivalent to the target starting offset address) and size (equivalent to the target file size) of the image ID (identity document).
[0119] Step S507: Find the image content (equivalent to the file content of the image file) and calculate the CRC (as an optional example of a target verification algorithm) check value (equivalent to the second set of check values). This can be done, but is not limited to, by sequentially reading the starting offset address and length (equivalent to the file size) of each image from the corresponding position of the image header (equivalent to the target image header information) based on the number of sub-images (equivalent to the target number), thereby finding the sub-image content (equivalent to the file content of the image file). The content of the sub-image is then verified.
[0120] Step S508, the calculated check value is compared with the check value (equivalent to the first set of check values) of the corresponding image id in the firmware image header (equivalent to the target image header information) to determine whether they are equal. If they are not equal, the image is determined to be illegal and the legitimacy check of the image package is completed. If they are equal, it means that the content of the sub-image is also complete and accurate. Only when all the image header data (equivalent to the target image header information) and all the sub-image data (equivalent to the file content of multiple image files) are complete and accurate, can it be determined to be a legal image and the upgrade is carried out. Otherwise, an error is directly reported and the upgrade operation is exited.
[0121] In the technical solution provided in the above step S306, the target firmware version can be upgraded to the target version by using, but not limited to, the file content of the target image file. In this way, the time required to determine the target version to which the target firmware is to be upgraded is reduced, and the time required to obtain the content of the target image file used to upgrade the target firmware version to the target version is reduced, thereby improving the efficiency of upgrading the target firmware version to the target version.
[0122] In an exemplary embodiment, the version of the target firmware can be upgraded to the target version by using the file content of the target image file in the following manner, but is not limited to: enabling a target interface between the BMC and the target firmware, wherein the BMC and the target firmware are connected via the target interface, and the enabled target interface is configured to allow the target firmware version to be upgraded; writing the file content of the target image file into the target firmware through the enabled target interface so as to upgrade the target firmware version from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware.
[0123] Optionally, in this embodiment, the file contents of the target image file may be written into the target firmware through the enabled target interface in one of the following ways, but not limited to:
[0124] Method 1: Replace the current version in the target firmware with the file content of the target image file through the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware after completing the replacement of the current version in the target firmware with the file content of the target image file.
[0125] Method 2: Replace the current version in the target firmware with the file content of the target image file through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and retain the current version of the target firmware after completing the replacement of the current version in the target firmware with the file content of the target image file.
[0126] In one exemplary embodiment, the target interface comprises a Joint Test Group (JTAG) interface.
[0127] Optionally, in this embodiment, the target interface includes a Joint Test Action Group (JTAG) interface. After being enabled, the target interface is configured to allow upgrades to the target firmware version. It is understood that the target interface before being enabled is configured to not allow upgrades to the firmware version, or the target interface before being enabled is configured to not allow upgrades to the target firmware version but to allow upgrades to versions of firmware other than the target firmware.
[0128] In an exemplary embodiment, after upgrading the target firmware version to the target version using the file content of the target image file, the above method further includes: determining whether the target firmware version is successfully upgraded to the target version; if it is determined that the target firmware version is not successfully upgraded to the target version, generating target prompt information, wherein the target prompt information is used to prompt that the target firmware version upgrade has failed.
[0129] Optionally, in this embodiment, when it is determined that the target firmware version has been successfully upgraded to the target version, a prompt message is generated, wherein the prompt message is used to indicate that the target firmware version upgrade was successful. In this way, corresponding prompt messages are automatically generated based on whether the target firmware version upgrade was successful, and the upgrade results are promptly returned to the user.
[0130] In an exemplary embodiment, when it is determined that the version of the target firmware has not been successfully upgraded to the target version, the above method also includes: re-enabling the target interface between the BMC and the target firmware, wherein the BMC and the target firmware are connected through the target interface, and the enabled target interface is set to allow the version of the target firmware to be upgraded; writing the file content of the target image file into the target firmware through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing the writing of the file content of the target image file into the target firmware; or writing the file content of the target image file into the target firmware again through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing the writing of the file content of the target image file into the target firmware.
[0131] Optionally, in this embodiment, if it is determined that the target firmware version has not been successfully upgraded to the target version, in order to increase the probability of successfully upgrading the target firmware version to the target version, the target firmware version can be automatically retried to upgrade to the target version, but is not limited to. In such a case, there may be a problem with the target interface, for example, the target interface is not successfully enabled. In such a case, the target interface between the BMC and the target firmware can be re-enabled, and the file content of the target image file can be written into the target firmware through the enabled target interface, so that the target firmware version is upgraded from the current version to the target version.
[0132] Optionally, in this embodiment, if it is determined that the version of the target firmware has not been successfully upgraded to the target version, the upgrade failure may be caused by a connection failure. In such a case, it is possible, but not limited to, to directly write the file content of the target image file into the target firmware again through the enabled target interface to upgrade the version of the target firmware from the current version to the target version.
[0133] In an exemplary embodiment, the above method also includes: determining the number of times that the version upgrade of the target firmware has failed; when the number is greater than or equal to a preset number threshold, determining that the file content of the target image file included in the first image file is abnormal, obtaining the file content of the second image file corresponding to the target version of the target firmware, and recording the file content of the second image file in the target reserved area of the first image file, wherein the file content of the second image file is used to upgrade the version of the target firmware to the target version; writing the file content of the second image file corresponding to the target version in the target reserved area into the target firmware through an enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the second image file into the target firmware.
[0134] Optionally, in this embodiment, when the number of times is less than a preset number threshold, it is possible, but not limited to, to continue to directly write the file content of the target image file into the target firmware through the enabled target interface again, so that the version of the target firmware is upgraded from the current version to the target version, or, re-enable the target interface between the BMC and the target firmware, and then write the file content of the target image file into the target firmware through the enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version.
[0135] Optionally, in this embodiment, if the number of occurrences is greater than or equal to a preset threshold, it may be determined that the file content of the target image file included in the first image file is abnormal. In such a case, the file content of the second image file corresponding to the target version of the target firmware may be re-acquired, but is not limited to. It is understood that the file content of the second image file and the file content of the target image file are both used to upgrade the target firmware to the target version.
[0136] Figure 6 is a schematic diagram of an optional method of recording the file content of the second image file in the target reserved area of the first image file according to an embodiment of the present application. As shown in Figure 6, the first image file may include, but is not limited to, target image header information and the file content of image file 1, the file content of image file 2, the file content of image file 3, and the target reserved area. For example, when the version of the target firmware is upgraded to the target version (for example, version 2) using the file content of image file 2 in the first image file, if the number of times the version upgrade of the target firmware fails is greater than or equal to a preset number threshold, in such a case, the file content of image file 4 (equivalent to the file content of the second image file) may be obtained, and the file content of image file 4 may be recorded in the target reserved area of the first image file, wherein the file content of image file 4 is used to upgrade the version of the target firmware to the target version (for example, version 2).
[0137] In order to better understand the process of upgrading the server firmware version in the embodiment of the present application, the process of upgrading the server firmware version in the embodiment of the present application is explained and illustrated in combination with optional embodiments below, which can be applied to but not limited to the embodiment of the present application.
[0138] FIG7 is a schematic diagram of an optional server firmware upgrade according to an embodiment of the present application. As shown in FIG7 , the target firmware may include, but is not limited to, the CPLD firmware of Gaudi 2 as an example, and may include, but is not limited to, the following steps:
[0139] Step S701 , determining whether the Gaudi 2 upgrade is legal. If it is legal, executing step S702 . If it is not legal, setting all Gaudi 2 upgrades to failure, and then executing step 708 .
[0140] Step S702: Enable the JTAG switch used for Gaudi 2CPLD upgrade.
[0141] Step S703: determine whether the Gaudi 2 device to be upgraded is in place. If the Gaudi 2 device is not in place, the upgrade status of the Gaudi 2 is recorded as failed. If the Gaudi 2 device is in place, execute step S704.
[0142] Step S704: Select the version of the firmware to be upgraded according to the value of CFG_load_status.
[0143] For example, after opening the corresponding upgrade channel and selecting the hardware interface, you need to select the correct image and execute the upgrade. The system determines the number of image files in the firmware package being upgraded. If there is only one image file, the upgrade begins directly without performing a register check. If the number of image files is greater than one, the system begins reading the FPGA status register of the CPLD to determine the value of its CFG_load_status and confirm the selected image file.
[0144] If the CFG_load_status value (equivalent to the target status value) is 0x01, it means that the cf1 file needs to be refreshed next time, the second package in the image package needs to be removed, and the upgrade needs to be performed. If the CFG_load_status value is 0x02, it means that the cf0 file needs to be refreshed next time, the first package in the image package needs to be removed, and the upgrade needs to be performed. If the CFG_load_status value is 0x11, it means that the fea_pub_cf0 file needs to be refreshed next time, the third package in the image package needs to be removed, and the upgrade needs to be performed. In other cases, an error is reported and the upgrade is aborted.
[0145] Step S705: Enable the JTAG upgrade function of the CPLD corresponding to the Gaudi 2 device.
[0146] Step S706: Execute device upgrade operation.
[0147] Step S707: determine whether the upgrade is successful. If the upgrade is successful, the upgrade status of the Gaudi 2 is recorded as successful. If the upgrade is unsuccessful, the upgrade status of the Gaudi 2 is recorded as failed.
[0148] Step S708, detecting the upgrade status of all Gaudi 2 CPLDs and determining whether there is a failure. If all Gaudi 2 CPLDs are successfully upgraded, a prompt indicating that the upgrade is successful is given. If there is a Gaudi 2 CPLD that fails to upgrade, a prompt indicating that the upgrade has failed is given.
[0149] This approach eliminates the need for on-site personnel to sift through upgrade files. Users can simply and directly upgrade using the single firmware provided by the manufacturer, greatly simplifying the user's operation steps. Furthermore, users no longer need to understand the internal implementation principles of the device, significantly lowering the operational threshold and reducing labor costs. When faced with large-scale server upgrades, the convenient operation steps make it possible to trigger upgrades in batches. This efficient upgrade method also significantly reduces time costs. The rapid and convenient updating of components also facilitates the rapid implementation of optimized products by business departments, improving the efficiency of front-end users. The simplified procedures also reduce operational errors, avoiding direct hardware damage caused by the upgrade, thereby reducing direct equipment costs.
[0150] 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 the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a non-volatile readable storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0151] This embodiment also provides a server firmware upgrade device, which is configured to implement the above-mentioned embodiments and optional implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0152] FIG8 is a structural block diagram of a server firmware upgrade device according to an embodiment of the present application. As shown in FIG8 , the device includes:
[0153] A first obtaining module 802 is configured to obtain a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file including target image header information and file contents of each of a plurality of image files, the file contents of each of the plurality of image files being used to upgrade the version of the target firmware to a corresponding version, and the firmware upgrade request being used to request an upgrade of the version of the target firmware in the server;
[0154] a first determining module 804 configured to, in response to the firmware upgrade request, determine, via a baseboard management controller (BMC), a target version to which the target firmware is to be upgraded, and obtain file content of the target image file from a first image file, wherein the plurality of image files include the target image file, and the file content of the target image file is used to upgrade the target firmware to the target version;
[0155] The upgrade module 806 is configured to use the file content of the target image file to upgrade the version of the target firmware to the target version.
[0156] Through the embodiments of the present application, when a firmware upgrade request is obtained, it can be indicated that the server firmware version is desired to be upgraded. In this case, the BMC can automatically determine the target version to which the firmware version is to be upgraded, and obtain the file content of the target image file used to upgrade the firmware version to the target version from the first image file. The file content of the image file is used to upgrade the server firmware version to the target version. In this way, the user is avoided from manually confirming the target version to which the server firmware is to be upgraded, and manually screening the file content of the target image file used to upgrade the firmware version to the target version. Therefore, the problem of low server firmware upgrade rate can be solved, and the server firmware upgrade effect can be improved.
[0157] In an exemplary embodiment, the first determination module includes: a first acquisition unit, configured to obtain a target number included in the target image header information in the first image file, wherein the target number is used to represent the number of file contents of the image file included in the first image file; the first determination unit is configured to determine the target version to which the version of the target firmware is to be upgraded based on the target number, and obtain the file contents of the target image file from the first image file.
[0158] In an exemplary embodiment, the first determination unit is configured to: when the target number is greater than or equal to 2, obtain a target state value of the target firmware stored in a target register in the target firmware, wherein the target state value is used to indicate the target version to which the target firmware is to be upgraded; determine the target version to which the target firmware is to be upgraded based on the target state value, and obtain file content of the target image file from the first image file based on the target image header information.
[0159] In an exemplary embodiment, the first determination unit is further configured to: determine a first identifier of a target version of the target firmware having a corresponding relationship with the target status value from the status value and version identifier having a corresponding relationship; the first determination unit is further configured to: obtain the file content of the target image file from the first image file based on the first identifier and the target image header information.
[0160] In an exemplary embodiment, the first determination unit is further configured to: determine a second identifier corresponding to the first identifier, wherein the second identifier is an identifier of a target image file; determine, from the target image header information, a target starting offset address and a target file size of the file content of the target image file that has a corresponding relationship with the second identifier in the first image file, wherein the target image header information stores one or more sets of identifiers of image files that have a corresponding relationship and the starting offset addresses and file sizes of the file content of the image files in the first image file, and the one or more sets of identifiers of image files that have a corresponding relationship and the starting offset addresses and file sizes of the file content of the image files in the first image file include the second identifier that has a corresponding relationship, the target starting offset address, and the target file size; and obtain data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0161] In an exemplary embodiment, the first determination unit is further configured to: determine a second identifier corresponding to the first identifier from the target image header information, wherein the target image header information also stores one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files, and the one or more groups of identifiers of firmware versions with corresponding relationships and identifiers of image files include the first identifier and the second identifier with corresponding relationships.
[0162] In an exemplary embodiment, the first determining unit is configured to: determine a second identifier corresponding to the first identifier, wherein the second identifier is an identifier of the target image file; determine a first starting offset address and a first ending offset address corresponding to the second identifier, and a second starting offset address and a second ending offset address corresponding to the second identifier from the target image header information, wherein the first starting offset address and the first ending offset address are used to determine a target starting offset address of the file content of the target image file in the first image file, and the second starting offset address and the second ending offset address are used to determine a target file size of the target image file; determine the target starting offset address based on the first starting offset address and the first ending offset address, and determine the target file size based on the second starting offset address and the second ending offset address; and obtain data of the target file size starting from the target starting offset address in the first image file to obtain the file content of the target image file.
[0163] In an exemplary embodiment, the first determination unit is configured to: obtain data stored from a first starting offset address to a first ending offset address from the first image file to obtain a target starting offset address, and obtain data stored from a second starting offset address to a second ending offset address from the first image file to obtain a target file size.
[0164] In an exemplary embodiment, the first determining unit is further configured to: when the target number is equal to 1, obtain the file content of the first image file as the file content of the target image file.
[0165] In an exemplary embodiment, the device further includes: a verification module, configured to verify the target image header information in the first image file and the file contents of multiple image files included in the first image file before determining the target version to which the target firmware version is to be upgraded through the baseboard management controller BMC and obtaining the file content of the target image file from the first image file; the first determination module includes: a second determination unit, configured to determine the target version to which the target firmware version is to be upgraded through the BMC and obtain the file content of the target image file from the first image file when the target image header information and the file contents of the multiple image files pass the verification.
[0166] In an exemplary embodiment, a verification module includes: a second acquisition unit, configured to obtain a first verification value stored in the target image header information, and obtain data included in the target image header information other than the first verification value, wherein the first verification value is used to verify the target image header information, and the first verification value is a verification value obtained by a preset target verification algorithm; a first processing unit, configured to use the obtained data as input to the target verification algorithm to obtain a second verification value output by the target verification algorithm; and a third determination unit, configured to determine that the target image header information passes the verification when the first verification value and the second verification value are the same.
[0167] In an exemplary embodiment, a verification module includes: a third acquisition unit, configured to obtain a first set of verification values stored in target image header information, and obtain file content of each of a plurality of image files included in the first image file to obtain file content of a group of image files, wherein each verification value in the first set of verification values is used to verify the file content of a corresponding image file in the group of image files, and the first set of verification values is a verification value obtained by a preset target verification algorithm; a second processing unit, configured to use the file content of the group of image files as input to the target verification algorithm, respectively, to obtain a second set of verification values output by the target verification algorithm, wherein when the file content of each image file in the group of image files is used as input to the target verification algorithm, the output of the target verification algorithm includes a verification value in the second set of verification values; and a fourth determination unit, configured to determine that the file content of the group of image files passes verification if each verification value in the first set of verification values is the same as the corresponding verification value in the second set of verification values.
[0168] In an exemplary embodiment, the second processing unit is configured to: use the file content of the i2th image file among the N2 image files as input to the target verification algorithm, and obtain the i2th verification value among the N2 verification values output by the target verification algorithm, wherein the group of image files includes N2 image files, the second group of verification values includes N2 verification values, N2 is a positive integer, and i2 is a positive integer less than or equal to N2; the fourth determination unit is configured to: determine that the file content of the i1th image file among the N1 image files passes verification when the i1th verification value among the N1 verification values and the i2th verification value among the N2 verification values are the same, wherein the first group of verification values includes N1 verification values, the i1th verification value is the verification value among the N1 verification values corresponding to the file content of the i1th image file, N1 is a positive integer, i1 is a positive integer less than or equal to N1, N1 equals N2, and i1 equals i2.
[0169] In an exemplary embodiment, the device also includes: a second acquisition module, which is configured to obtain image header information included in each of the multiple image files before obtaining the firmware upgrade request, to obtain a set of image header information, wherein each of the multiple image files includes the image header information of each image file and the file content of each image file; a second determination module, which is configured to determine the target image header information as including each image header information in the set of image header information.
[0170] In an exemplary embodiment, the second determination module includes: a third processing unit, configured to use a set of image header information as input to a target verification algorithm to obtain a first verification value; and a fifth determination unit, configured to determine the target image header information to include each image header information in the set of image header information and the first verification value.
[0171] In an exemplary embodiment, the fifth determining unit is configured to record the j-th image header information and the j+1-th image header information in the target image header information by performing the following steps, wherein a group of image header information includes M image header information, the j-th image header information is the image header information included in the j-th image file of the M image files, the j+1-th image header information is the image header information included in the j+1-th image file of the M image files, M is a positive integer greater than or equal to 2, and j is a positive integer less than or equal to M-1: recording in the target image header information the j-th image file identifier, the j-th check value, the j-th starting offset address and the j-th file size included in the j-th image header information, and the j+1-th image file identifier, the j-th check value, the j-th starting offset address and the j-th file size included in the j-th image header information, and the j+1-th image file identifier, the j-th check value, the j-th starting offset address and the j-th file size included in the j+1-th image header information. +1 check value, j+1th starting offset address and j+1th file size; wherein, the file content of the jth image file is used to upgrade the version of the target firmware to the jth version, the jth image file identifier is the identifier of the jth image file, the jth check value is a check value obtained by a preset target check algorithm, the file content of the jth image file includes data of the jth file size obtained from the jth starting offset address in the first image file, the file content of the j+1th image file is used to upgrade the version of the target firmware to the j+1th version, the j+1th image file identifier is the identifier of the j+1th image file, the j+1th check value is a check value obtained by the target check algorithm, and the file content of the j+1th image file includes data of the j+1th file size obtained from the j+1th starting offset address in the first image file.
[0172] In an exemplary embodiment, an upgrade module includes: an enabling unit configured to enable a target interface between a BMC and target firmware, wherein the BMC and the target firmware are connected via the target interface, and the enabled target interface is configured to allow the version of the target firmware to be upgraded; a writing unit configured to write the file content of a target image file into the target firmware via the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware when the file content of the target image file is written into the target firmware.
[0173] In one exemplary embodiment, the target interface comprises a Joint Test Group (JTAG) interface.
[0174] In an exemplary embodiment, the device also includes: a third determination module, which is configured to determine whether the version of the target firmware is successfully upgraded to the target version after upgrading the version of the target firmware to the target version using the file content of the target image file; and a generation module, which is configured to generate target prompt information when it is determined that the version of the target firmware is not successfully upgraded to the target version, wherein the target prompt information is used to prompt that the version upgrade of the target firmware has failed.
[0175] In an exemplary embodiment, the device further includes: an enabling module, configured to re-enable a target interface between the BMC and the target firmware when it is determined that the version of the target firmware has not been successfully upgraded to the target version, wherein the BMC and the target firmware are connected via the target interface, and the enabled target interface is configured to allow the version of the target firmware to be upgraded; writing the file content of the target image file into the target firmware through the enabled target interface so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware; or a first writing module, configured to write the file content of the target image file into the target firmware again through the enabled target interface so that the version of the target firmware is upgraded from the current version to the target version, and deleting the current version of the target firmware after completing writing the file content of the target image file into the target firmware.
[0176] In an exemplary embodiment, the device further includes: a fourth determination module configured to determine the number of times the version upgrade of the target firmware has failed; a recording module configured to determine that the file content of the target image file included in the first image file is abnormal when the number of times is greater than or equal to a preset number threshold, obtain the file content of the second image file corresponding to the target version of the target firmware, and record the file content of the second image file in the target reserved area of the first image file, wherein the file content of the second image file is used to upgrade the version of the target firmware to the target version; a second writing module configured to write the file content of the second image file corresponding to the target version in the target reserved area into the target firmware through an enabled target interface, so that the version of the target firmware is upgraded from the current version to the target version, and delete the current version of the target firmware after completing writing the file content of the second image file into the target firmware.
[0177] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0178] An embodiment of the present application further provides a computer non-volatile 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 method embodiments when running.
[0179] In an exemplary embodiment, the above-mentioned computer non-volatile readable storage medium may include but is not limited to: 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, and other media that can store computer programs.
[0180] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0181] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0182] For optional examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be described in detail here.
[0183] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0184] The above are merely optional embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may be subject to various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for upgrading server firmware, characterized in that: It includes: Obtain a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file includes target image header information and the file content of each of multiple image files, and the file content of each of the multiple image files is used to upgrade the version of the target firmware to a corresponding version, and the firmware upgrade request is used to request an upgrade of the version of the target firmware in the server; In response to the firmware upgrade request, determine, through a baseboard management controller (BMC), the target version to which the version of the target firmware is to be upgraded, and obtain the file content of the target image file from the first image file, wherein the multiple image files include the target image file, and the file content of the target image file is used to upgrade the version of the target firmware to the target version; Use the file content of the target image file to upgrade the version of the target firmware to the target version.
2. The method according to claim 1, characterized in that: The determining, through a baseboard management controller (BMC), the target version to which the version of the target firmware is to be upgraded includes: Obtain the target quantity included in the target image header information in the first image file, wherein the target quantity is used to represent the quantity of the file content of the image files included in the first image file; According to the target quantity, determine the target version to which the version of the target firmware is to be upgraded, and obtain the file content of the target image file from the first image file.
3. The method according to claim 2, characterized in that: The determining, according to the target quantity, the target version to which the version of the target firmware is to be upgraded, and obtaining the file content of the target image file from the first image file includes: When the target quantity is greater than or equal to 2, obtain the target status value of the target firmware stored in the target register in the target firmware, wherein the target status value is used to indicate the target version to which the version of the target firmware is to be upgraded; According to the target status value, determine the target version to which the version of the target firmware is to be upgraded, and according to the target image header information, obtain the file content of the target image file from the first image file.
4. The method according to claim 3, characterized in that: The determining, according to the target status value, the target version to which the version of the target firmware is to be upgraded includes: determining a first identifier of the target version of the target firmware that has a corresponding relationship with the target status value from the status values and version identifiers that have a corresponding relationship; The obtaining, according to the target image header information, the file content of the target image file from the first image file includes: obtaining the file content of the target image file from the first image file according to the first identifier and the target image header information.
5. The method according to claim 4, characterized in that: Obtaining the file content of the target image file from the first image file according to the first identifier and the target image header information includes: Determining a second identifier corresponding to the first identifier, where the second identifier is the identifier of the target image file; Determining, from the target image header information, a target start offset address and a target file size of the file content of the target image file corresponding to the second identifier in the first image file, where a set or multiple sets of corresponding relationships between the identifiers of the image files and the start offset address and the file size of the file content of the image file in the first image file are stored in the target image header information, and the set or multiple sets of corresponding relationships between the identifiers of the image files and the start offset address and the file size of the file content of the image file in the first image file include the corresponding second identifier, the target start offset address, and the target file size; Starting from the target start offset address in the first image file, obtaining data of the target file size to obtain the file content of the target image file.
6. The method according to claim 5, wherein determining the second identifier corresponding to the first identifier includes: Determining the second identifier corresponding to the first identifier from the target image header information, where a set or multiple sets of corresponding relationships between the identifiers of the firmware versions and the identifiers of the image files are further stored in the target image header information, and the set or multiple sets of corresponding relationships between the identifiers of the firmware versions and the identifiers of the image files include the corresponding first identifier and the second identifier.
7. The method according to claim 4, wherein obtaining the file content of the target image file from the first image file according to the first identifier and the target image header information includes: Determining a second identifier corresponding to the first identifier, where the second identifier is the identifier of the target image file; Determining a first start offset address and a first end offset address corresponding to the second identifier, and a second start offset address and a second end offset address corresponding to the second identifier from the target image header information, where the first start offset address and the first end offset address are used to determine the target start offset address of the file content of the target image file in the first image file, and the second start offset address and the second end offset address are used to determine the target file size of the target image file; Determining the target start offset address according to the first start offset address and the first end offset address, and determining the target file size according to the second start offset address and the second end offset address; Starting from the target start offset address in the first image file, obtaining data of the target file size to obtain the file content of the target image file.
8. The method according to claim 7, wherein Determining the target starting offset address according to the first starting offset address and the first ending offset address, and determining the target file size according to the second starting offset address and the second ending offset address, includes: Obtaining the data stored from the first starting offset address to the first ending offset address in the first mirror file to obtain the target starting offset address, and obtaining the data stored from the second starting offset address to the second ending offset address in the first mirror file to obtain the target file size.
9. The method according to claim 2, wherein: The obtaining the file content of the target mirror file from the first mirror file further includes: When the target quantity is equal to 1, obtaining the file content of the first mirror file as the file content of the target mirror file.
10. The method according to claim 1, wherein: Before determining, by the baseboard management controller (BMC), the target version to which the version of the target firmware is to be upgraded and obtaining the file content of the target mirror file from the first mirror file, the method further includes: verifying the target mirror header information in the first mirror file and verifying the file content of the multiple mirror files included in the first mirror file; Determining, by the baseboard management controller (BMC), the target version to which the version of the target firmware is to be upgraded and obtaining the file content of the target mirror file from the first mirror file includes: when both the target mirror header information and the file content of the multiple mirror files pass the verification, determining, by the BMC, the target version to which the version of the target firmware is to be upgraded and obtaining the file content of the target mirror file from the first mirror file.
11. The method according to claim 10, wherein: The verifying the target mirror header information in the first mirror file includes: Obtaining a first verification value stored in the target mirror header information, and obtaining the data other than the first verification value included in the target mirror header information, wherein the first verification value is used to verify the target mirror header information and the first verification value is a verification value obtained by a preset target verification algorithm; Using the obtained data as the input of the target verification algorithm to obtain a second verification value output by the target verification algorithm; When the first verification value and the second verification value are the same, determining that the target mirror header information passes the verification.
12. The method according to claim 10, wherein: The verifying the file content of the multiple mirror files included in the first mirror file includes: Obtain the first set of check values stored in the target image header information, and obtain the file content of each of the multiple image files included in the first image file, to obtain the file content of a set of image files, where each check value in the first set of check values is used to check the file content of a corresponding one of the set of image files, and the first set of check values is the check values obtained through a preset target check algorithm; Use the file content of the set of image files as the input of the target check algorithm respectively, to obtain the second set of check values output by the target check algorithm, where when using the file content of each of the set of image files as the input of the target check algorithm, the output of the target check algorithm includes one of the check values in the second set of check values; When each check value in the first set of check values is the same as the corresponding check value in the second set of check values, determine that the file content of the set of image files passes the check.
13. The method according to claim 12, wherein The using the file content of the set of image files as the input of the target check algorithm respectively, to obtain the second set of check values output by the target check algorithm includes: using the file content of the i2-th image file among the N2 image files as the input of the target check algorithm, to obtain the i2-th check value among the N2 check values output by the target check algorithm, where the set of image files includes the N2 image files, the second set of check values includes the N2 check values, N2 is a positive integer, and i2 is a positive integer less than or equal to N2; When each check value in the first set of check values is the same as the corresponding check value in the second set of check values, determining that the file content of the set of image files passes the check includes: when the i1-th check value among the N1 check values is the same as the i2-th check value among the N2 check values, determining that the file content of the i1-th image file among the N1 image files passes the check, where the first set of check values includes the N1 check values, the i1-th check value is the check value corresponding to the file content of the i1-th image file among the N1 check values, N1 is a positive integer, i1 is a positive integer less than or equal to N1, N1 is equal to N2, and i1 is equal to i2.
14. The method according to claim 1, wherein Before obtaining the firmware upgrade request, the method further includes: Obtain the image header information included in each of the multiple image files, to obtain a set of image header information, where each of the multiple image files includes the image header information of each image file and the file content of each image file; Determine the target image header information as including each of the image header information in the set of image header information.
15. The method according to claim 14, wherein Determining the target mirror header information to include each piece of mirror header information in the set of mirror header information includes: Taking the set of mirror header information as the input of a target verification algorithm to obtain a first verification value; And determining the target mirror header information to include each piece of mirror header information in the set of mirror header information and the first verification value.
16. The method according to claim 15, wherein: Determining the target mirror header information to include each piece of mirror header information in the set of mirror header information includes: By performing the following steps, recording the j-th mirror header information and the (j + 1)-th mirror header information in the M mirror header information in the target mirror header information, where the set of mirror header information includes the M mirror header information, the j-th mirror header information is the mirror header information included in the j-th mirror file among the M mirror files, the (j + 1)-th mirror header information is the mirror header information included in the (j + 1)-th mirror file among the M mirror files, M is a positive integer greater than or equal to 2, and j is a positive integer less than or equal to M - 1: Sequentially recording in the target mirror header information the j-th mirror file identifier, the j-th verification value, the j-th starting offset address, and the j-th file size included in the j-th mirror header information, and the (j + 1)-th mirror file identifier, the (j + 1)-th verification value, the (j + 1)-th starting offset address, and the (j + 1)-th file size included in the (j + 1)-th mirror header information; Wherein, the file content of the j-th mirror file is used to upgrade the version of the target firmware to the j-th version, the j-th mirror file identifier is the identifier of the j-th mirror file, the j-th verification value is a verification value obtained through a preset target verification algorithm, the file content of the j-th mirror file includes data of the j-th file size obtained starting from the j-th starting offset address in the first mirror file, the file content of the (j + 1)-th mirror file is used to upgrade the version of the target firmware to the (j + 1)-th version, the (j + 1)-th mirror file identifier is the identifier of the (j + 1)-th mirror file, the (j + 1)-th verification value is a verification value obtained through the target verification algorithm, and the file content of the (j + 1)-th mirror file includes data of the (j + 1)-th file size obtained starting from the (j + 1)-th starting offset address in the first mirror file.
17. The method according to claim 1, wherein: Using the file content of the target mirror file to upgrade the version of the target firmware to the target version includes: Enabling a target interface between the BMC and the target firmware, where the BMC and the target firmware are connected through the target interface, and the enabled target interface is set to allow the version of the target firmware to be upgraded; Write the file content of the target image file into the target firmware through the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware when the file content of the target image file is successfully written into the target firmware.
18. The method according to claim 17, wherein The target interface includes a Joint Test Action Group (JTAG) interface.
19. The method according to claim 1, wherein After using the file content of the target image file to upgrade the version of the target firmware to the target version, the method further includes: Determine whether the version of the target firmware is successfully upgraded to the target version; Generate a target prompt message when it is determined that the version of the target firmware is not successfully upgraded to the target version, where the target prompt message is used to prompt that the version upgrade of the target firmware fails.
20. The method according to claim 19, wherein When it is determined that the version of the target firmware is not successfully upgraded to the target version, the method further includes: Re-enable the target interface between the BMC and the target firmware, where the BMC and the target firmware are connected through the target interface, and the enabled target interface is set to allow the version of the target firmware to be upgraded; write the file content of the target image file into the target firmware through the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware when the file content of the target image file is successfully written into the target firmware; or Write the file content of the target image file into the target firmware again through the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware when the file content of the target image file is successfully written into the target firmware.
21. The method according to claim 20, wherein The method further includes: Determine the number of times of failed version upgrade of the target firmware; When the number is greater than or equal to a preset number threshold, determine that the file content of the target image file included in the first image file is abnormal, obtain the file content of the second image file corresponding to the target version of the target firmware, and record the file content of the second image file in the target reserved area in the first image file, where the file content of the second image file is used to upgrade the version of the target firmware to the target version; Write the file content of the second image file corresponding to the target version in the target reserved area into the target firmware through the enabled target interface, so as to upgrade the version of the target firmware from the current version to the target version, and delete the current version of the target firmware when the file content of the second image file is written into the target firmware.
22. A server firmware upgrade device, characterized in that it includes: A first acquisition module, configured to acquire a firmware upgrade request, wherein the firmware upgrade request carries a first image file, the first image file includes target image header information and the file content of each of multiple image files, and the file content of each of the multiple image files is used to upgrade the version of the target firmware to a corresponding version, and the firmware upgrade request is used to request an upgrade of the version of the target firmware in the server; A first determination module, configured to, in response to the firmware upgrade request, determine, through a baseboard management controller (BMC), the target version to which the version of the target firmware is to be upgraded, and acquire the file content of the target image file from the first image file, wherein the multiple image files include the target image file, and the file content of the target image file is used to upgrade the version of the target firmware to the target version; An upgrade module, configured to use the file content of the target image file to upgrade the version of the target firmware to the target version.
23. A computer non-volatile readable storage medium, characterized in that a computer program is stored in the computer non-volatile readable storage medium, wherein when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 21 are implemented.
24. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the computer program, the steps of the method described in any one of claims 1 to 21 are implemented.
Citation Information
Patent Citations
Firmware updates for multiple product configurations
CN105144097A
Firmware upgrading method, device and equipment and storage medium
CN111104139A
Firmware upgrading method and device, equipment and storage medium
CN116009918A
Server firmware upgrading method and device, equipment and storage medium
CN116610343A
Component version management method and device, electronic equipment and storage medium
CN117348923A
Cited By
Firmware upgrading method, electronic equipment, storage medium and program product
CN120704722A
System, method, device and equipment for upgrading board card firmware of server and medium
CN120762710A