Firmware upgrading control method and device, storage medium and electronic equipment

By deploying the baseboard management controller and firmware controller in the server, and using the reference partition configuration information to upgrade the BMC firmware partition, the problems of low firmware upgrade efficiency and data loss in the existing technology are solved, and efficient and reliable firmware upgrade is achieved. process.

CN118819600APending Publication Date: 2024-10-22SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410933206.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

The existing server BMC firmware upgrade method is inefficient and cannot guarantee data integrity, resulting in a high probability of data loss.

Method used

Deploy the baseboard management controller, firmware controller and target storage in the server, upgrade the initial firmware partition by receiving the reference firmware file of the reference partition configuration information, and generate a target upgrade method based on the partition type to ensure that the required targets are retained during the upgrade process data.

Benefits of technology

It reduces the probability of data loss during firmware upgrade, improves upgrade efficiency, and ensures data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819600A_ABST
    Figure CN118819600A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading control method and device, a storage medium and electronic equipment. The firmware upgrading control method comprises the steps that a firmware upgrading request is received; responding to the firmware upgrading request, and detecting the partition type of each initial firmware partition in the plurality of initial firmware partitions according to the initial partition configuration information and the reference partition configuration information; generating a target upgrading mode matched with the partition type for each initial firmware partition in the plurality of initial firmware partitions; the corresponding initial firmware partition in the standby firmware is upgraded according to each target upgrading mode, the upgraded standby firmware is obtained, and the upgraded standby firmware is used after the server is restarted. By the adoption of the technical scheme, the problems that in the related technology, the probability of data loss in the firmware upgrading process is high, and the like are solved, and the user experience is improved. And the technical effect of reducing the probability of data loss in the firmware upgrading process is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and device for controlling firmware upgrades, a storage medium, and an electronic device. Background Art

[0002] The business functions of current servers are undergoing rapid changes. As the core management component of the server, BMC (Baseboard Management Controller) is responsible for hardware status monitoring, system startup, remote updates, and other key management tasks. However, with the continuous evolution of server business functions, BMC firmware also needs to be continuously iterated and upgraded.

[0003] The traditional way to upgrade BMC firmware is usually to use full image refresh. Although this method can update heterogeneous partition firmware (i.e. firmware with different partitions before and after the upgrade), it has obvious defects. First, when the firmware image file is large, the full image refresh process takes a long time and is inefficient, which is unacceptable for server environments that require fast response and continuous operation. More importantly, full image refresh cannot guarantee the integrity of user data, and the loss of important data will have a significant impact on users.

[0004] In view of the high probability of data loss during firmware upgrade in related technologies, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method and device for controlling firmware upgrade, a storage medium, and an electronic device, so as to at least solve the problem of a high probability of data loss during firmware upgrade in the related art.

[0006] According to an embodiment of the present application, a method for controlling firmware upgrade is provided. A baseboard management controller, a firmware controller and a target memory connected to each other are deployed in a server. The target memory stores a main firmware currently used by the baseboard management controller and a backup firmware identical to the main firmware. The main firmware includes a plurality of initial firmware partitions. Each of the initial firmware partitions stores initial firmware data for instructing the baseboard management controller to perform a corresponding function. The firmware controller stores initial partition configuration information for indicating a division method of the plurality of initial firmware partitions of the main firmware. The method is applied to the baseboard management controller. The method includes:

[0007] Receive a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate a division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition;

[0008] In response to the firmware upgrade request, detecting a partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information;

[0009] Generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process;

[0010] The corresponding initial firmware partition in the standby firmware is upgraded according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

[0011] Optionally, the detecting a partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information includes:

[0012] In the case where the main firmware includes N initial firmware partitions, the partition type of the i-th initial firmware partition among the N initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein N is an integer greater than 1, and i is an integer greater than or equal to 1 and less than or equal to N:

[0013] Extracting an i-th initial partition structure parameter, an i-th initial address parameter and an i-th initial partition size parameter corresponding to the i-th initial firmware partition from the initial partition configuration information, and extracting an i-th reference partition structure parameter, an i-th reference address parameter and an i-th reference partition size parameter corresponding to the i-th initial firmware partition from the reference partition configuration information, wherein the i-th initial partition structure parameter is used to indicate the current partition structure of the i-th initial firmware partition, the i-th initial address parameter is used to indicate the current starting address of the i-th initial firmware partition in the main firmware, the i-th initial partition size parameter is used to indicate the current partition size of the i-th initial firmware partition, the i-th reference partition structure parameter is used to indicate the partition structure of the i-th initial firmware partition in the upgraded firmware, the i-th reference address parameter is used to indicate the starting address of the i-th initial firmware partition in the upgraded firmware, and the i-th reference partition size parameter is used to indicate the partition size of the i-th initial firmware partition in the upgraded firmware;

[0014] The partition type of the i-th initial firmware partition is determined according to the i-th initial partition structure parameter, the i-th initial address parameter and the i-th initial partition size parameter, as well as the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter.

[0015] Optionally, determining the partition type of the i-th initial firmware partition according to the i-th initial partition structure parameter, the i-th initial address parameter, and the i-th initial partition size parameter, and the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter comprises:

[0016] Comparing the i-th initial partition structure parameter with the i-th reference partition structure parameter, the i-th initial address parameter with the i-th reference address parameter, and the i-th initial partition size parameter with the i-th reference partition size parameter;

[0017] When it is found that the i-th initial partition structure parameter is inconsistent with the i-th reference partition structure parameter, and / or the i-th initial address parameter is inconsistent with the i-th reference address parameter, and / or the i-th initial partition size parameter is inconsistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a heterogeneous partition type, and the initial firmware partition belonging to the heterogeneous partition type has a changed partition structure before and after the firmware upgrade, and / or a changed starting address, and / or a changed partition size;

[0018] When it is found that the i-th initial partition structure parameter is consistent with the i-th reference partition structure parameter, the i-th initial address parameter is consistent with the i-th reference address parameter, and the i-th initial partition size parameter is consistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a homogeneous partition type, wherein the partition structure and the starting address of the initial firmware partition belonging to the homogeneous partition type are changed before and after the firmware upgrade, but the partition size does not change.

[0019] Optionally, generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes:

[0020] Generate the i-th target upgrade mode matching the partition type for the i-th initial firmware partition among the N initial firmware partitions by the following steps:

[0021] In the case where the partition type of the i-th initial firmware partition is a heterogeneous partition type, the i-th target upgrade method is determined as follows: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the standby firmware with the i-th reference firmware data, and at the same time replacing the i-th initial partition structure parameter in the initial partition configuration information with the i-th reference partition structure parameter in the reference partition configuration information, replacing the i-th initial address parameter in the initial partition configuration information with the i-th reference address parameter in the reference partition configuration information, and replacing the i-th initial partition size parameter in the initial partition configuration information with the i-th reference partition size parameter in the reference partition configuration information, wherein the target data includes the i-th reference firmware data, the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter;

[0022] In the case where the partition type of the i-th initial firmware partition is a homogeneous partition type, the i-th target upgrade method is determined as: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the backup firmware with the i-th reference firmware data, wherein the target data includes the i-th reference firmware data.

[0023] Optionally, the detecting a partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information includes:

[0024] In the case where the main firmware includes M initial firmware partitions, the partition type of the jth initial firmware partition among the M initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein M is an integer greater than 1, and j is an integer greater than or equal to 1 and less than or equal to M:

[0025] Extracting a jth initial partition function parameter corresponding to the jth initial firmware partition from the initial partition configuration information, and extracting a jth reference partition function parameter corresponding to the jth initial firmware partition from the reference partition configuration information, wherein the jth initial partition function parameter is used to indicate the function of the jth initial firmware partition currently in the active firmware, and the jth reference partition function parameter is used to indicate the function of the jth initial firmware partition in the upgraded firmware;

[0026] In a case where the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store user data, determining that the partition type of the j-th initial firmware partition is a user partition type, wherein the function of the initial firmware partition belonging to the user partition type before and after the firmware upgrade is to store user data, and the target data includes the user data;

[0027] When the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store log data, the partition type of the j-th initial firmware partition is determined to be a log partition type, wherein the function of the initial firmware partition belonging to the log partition type before and after the firmware upgrade is to store log data, and the target data includes the log data.

[0028] Optionally, generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes:

[0029] Generate the jth target upgrade mode matching the partition type for the jth initial firmware partition among the M initial firmware partitions by the following steps:

[0030] In a case where the partition type of the jth initial firmware partition is a user partition type, determining the jth target upgrade mode as follows: during a firmware upgrade process, retaining the user data stored in the jth initial firmware partition, wherein the target data includes the user data;

[0031] When the partition type of the jth initial firmware partition is a log partition type, the jth target upgrade method is determined as: during the firmware upgrade process, the log data stored in the jth initial firmware partition is retained, wherein the target data includes the log data.

[0032] Optionally, the target memory includes a first memory and a second memory, the first memory is used to store the main firmware, the second memory is used to store the standby firmware, the first memory is connected to the baseboard management controller and the firmware controller respectively, and the second memory is connected to the baseboard management controller and the firmware controller respectively. After the initial firmware partition corresponding to the standby firmware is upgraded according to each target upgrade mode to obtain the upgraded standby firmware, the method further includes:

[0033] After detecting that the server is restarted, the firmware controller controls the baseboard management controller to use the upgraded standby firmware stored in the second memory to perform a startup operation, and detects received information within a target time period during the baseboard management controller performing the startup operation;

[0034] When it is detected that the startup success information is received within the target time, the firmware controller determines that the firmware currently used by the baseboard management controller is successfully upgraded, and controls the active firmware stored in the first memory to be synchronized with the upgraded standby firmware, wherein the startup success information is sent by the baseboard management controller to the firmware controller when the startup operation is successfully executed;

[0035] When it is detected that the startup success information is not received within the target time period, the firmware controller controls the baseboard management controller to re-execute the startup operation using the main firmware stored in the first memory.

[0036] According to another embodiment of the embodiment of the present application, a control device for firmware upgrade is also provided, wherein a baseboard management controller, a firmware controller and a target memory connected to each other are deployed in a server, wherein the target memory stores a main firmware currently used by the baseboard management controller, and a backup firmware identical to the main firmware, wherein the main firmware includes a plurality of initial firmware partitions, each of which stores initial firmware data for instructing the baseboard management controller to perform a corresponding function, and the firmware controller stores initial partition configuration information for indicating a division method of the plurality of initial firmware partitions of the main firmware, wherein the device is applied to the baseboard management controller, and the device includes:

[0037] A receiving module, configured to receive a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate a division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition;

[0038] A first detection module, configured to respond to the firmware upgrade request and detect a partition type of each of the initial firmware partitions in the plurality of initial firmware partitions according to the initial partition configuration information and the reference partition configuration information;

[0039] a generating module, configured to generate a target upgrade mode matching the partition type for each of the plurality of initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process;

[0040] An upgrade module is used to upgrade the corresponding initial firmware partition in the standby firmware according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

[0041] According to another embodiment of the present application, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to perform the steps in any of the above method embodiments.

[0042] According to another embodiment of the present application, a computer-readable storage medium is 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 run.

[0043] According to another embodiment of the present application, an electronic device is provided, including 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.

[0044] In an embodiment of the present application, a control method for firmware upgrade is proposed. A baseboard management controller, a firmware controller and a target memory are deployed in a server, and the target memory stores a main firmware currently used by the baseboard management controller, and a backup firmware that is the same as the main firmware. The main firmware includes multiple initial firmware partitions, each of which stores initial firmware data for instructing the baseboard management controller to execute a corresponding function. The firmware controller stores initial partition configuration information for indicating the division method of multiple initial firmware partitions of the main firmware. The method is applied to the baseboard management controller. First, the baseboard management controller receives a firmware upgrade request for requesting to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, wherein the reference partition configuration information is used to indicate the division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records the multiple reference firmware partitions in the upgraded firmware. The baseboard management controller detects the partition type of each initial firmware partition in the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information in response to the firmware upgrade request; and then generates a target upgrade method matching the partition type for each initial firmware partition in the multiple initial firmware partitions, the target upgrade method is an upgrade method that allows the corresponding initial firmware partition to save the target data that needs to be retained during the upgrade process; finally, the corresponding initial firmware partition in the standby firmware is upgraded according to each target upgrade method to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted, which is different from the full image refresh in the related art that takes the entire firmware as a unit. This scheme takes the firmware partition as a unit, and executes a matching upgrade method according to the partition type of each initial firmware partition, ensuring that the corresponding initial firmware partition saves the target data that needs to be retained during the upgrade process. The above technical scheme solves the problems in the related art that the probability of data loss during the firmware upgrade process is high, and achieves the technical effect of reducing the probability of data loss during the firmware upgrade process. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a hardware structure block diagram of a computer device of a firmware upgrade control method according to an embodiment of the present application;

[0046] Figure 2 is a flowchart of a firmware upgrade control method according to an embodiment of the present application;

[0047] Figure 3 is a schematic diagram of a server hardware deployment according to an embodiment of the present application;

[0048] Figure 4 is a schematic diagram of an upgrade process of an initial firmware partition based on heterogeneous partition types according to an embodiment of the present application;

[0049] Figure 5 is a schematic diagram of a target memory according to an embodiment of the present application;

[0050] Figure 6 is a schematic diagram of a baseboard management controller startup process according to an embodiment of the present application;

[0051] Figure 7 is a structural block diagram of a control device for firmware upgrade according to an embodiment of the present application;

[0052] Figure 8 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0053] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0054] It should be noted that the terms "first", "second", etc. in the specification 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.

[0055] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a computer device of a firmware upgrade control method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0056] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the control method for firmware upgrade 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, to implement 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 examples, the memory 104 may further include a memory remotely arranged 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.

[0057] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0058] The nouns involved in the embodiments of the present application are explained as follows:

[0059] BMC: (Baseboard Management Controller) is an embedded computer subsystem, usually integrated into servers, network equipment, and industrial control systems. BMC is responsible for managing and monitoring hardware resources and providing remote management functions;

[0060] UFM (User Flash Memory): A non-volatile memory used to store user-defined data. It is usually an independent memory chip or area that can be used to store user-specific data such as system configuration, calibration data, keys, serial numbers, etc. The data in UFM remains unchanged after power failure or restart, so it is very suitable for storing data that requires persistence.

[0061] Heterogeneous partition firmware: In the present invention, heterogeneous partition refers specifically to the change of the structure and size of some or all partitions in the firmware due to the adjustment of business functions. For example, the kernel partition of the original BMC firmware is 1MB, and the kernel partition size of the new BMC firmware after the adjustment due to the change of business functions is 1.2MB. At this time, the new and old firmware are called heterogeneous partition BMC firmware;

[0062] Homogeneous partition firmware: Corresponding to heterogeneous partition firmware, homogeneous partition in the present invention specifically refers to two firmwares with exactly the same internal partition structure and size.

[0063] In this embodiment, a method for controlling firmware upgrade is provided. Figure 2 is a flowchart of a firmware upgrade control method according to an embodiment of the present application. Figure 2 As shown, a baseboard management controller, a firmware controller and a target memory connected to each other are deployed in the server, the target memory stores the main firmware currently used by the baseboard management controller, and the backup firmware identical to the main firmware, the main firmware includes a plurality of initial firmware partitions, each of the initial firmware partitions stores initial firmware data for instructing the baseboard management controller to execute a corresponding function, the firmware controller stores initial partition configuration information for indicating the division method of the plurality of initial firmware partitions of the main firmware, the method is applied to the baseboard management controller, and the process includes the following steps:

[0064] Step S12, receiving a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate a division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition;

[0065] Step S14, in response to the firmware upgrade request, detecting a partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information;

[0066] Step S16, generating a target upgrade mode that matches the partition type for each of the multiple initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process;

[0067] Step S18, upgrading the corresponding initial firmware partition in the standby firmware according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

[0068] Optionally, in this embodiment, Figure 3 is a schematic diagram of a server hardware deployment according to an embodiment of the present application, such as Figure 3As shown, the server is deployed with interconnected baseboard management controller BMC, firmware controller CPLD and target memory, the target memory stores the main firmware currently used by the baseboard management controller and the backup firmware that is the same as the main firmware. The firmware controller stores the initial partition configuration information through UFM.

[0069] The main firmware includes multiple initial firmware partitions, such as Bootloader partition, kernel partition, rootfs partition, DTB partition. The image files such as Bootloader partition, kernel partition, rootfs partition, DTB partition can be combined in a certain order through the BMC firmware packaging program, but are not limited to generating a firmware image file. The reference firmware file can be, but is not limited to, the firmware image file, which is used to upgrade the Bootloader partition, kernel partition, rootfs partition, and DTB partition in the main firmware.

[0070] The BMC firmware packaging program can, but is not limited to, combine the Bootloader partition, kernel partition, rootfs partition, DTB partition and other image files in a certain order to generate a firmware image file through the following steps:

[0071] Step 1. Read the partition configuration file (equivalent to the reference partition configuration information) of the BMC firmware (main firmware), parse and obtain the configuration information of each initial firmware partition in the BMC firmware;

[0072] Step 2. Obtain the configuration information of each partition image file supported by the BMC firmware packaging program, and compare and analyze it with the configuration information of each initial firmware partition in the BMC firmware in step 1. When the partition configuration file is inconsistent with the configuration information of each partition image file supported by the BMC firmware packaging program, it means that the BMC firmware packaging program does not support the packaging of the partition configuration file, and an alarm is issued and the packaging process is stopped;

[0073] Step 3. When the partition configuration file is consistent with the configuration information of each partition image file supported by the BMC firmware packaging program, it means that the BMC firmware packaging program supports the packaging of the partition configuration file. The partition configuration file can be filled into the header of the firmware image file in the form of PTH-HEADER to complete the filling of the image file partition table information. After that, the normal firmware packaging process is executed to complete the packaging of the upgrade image file.

[0074] Optionally, in this embodiment, the reference firmware file may be, but is not limited to, a packaged upgrade image file, and the header of the reference firmware file is filled with reference partition configuration information, which is presented in the form of PTH-HEADER. In the BMC firmware packaging program, the reference partition configuration information of the BMC firmware is added to the firmware upgrade package (upgrade image file) header information in the form of PTH-HEADER (including BMC firmware partition description, offset (starting address), size, etc.), and the data format of PTH-HEADER is shown in Table 1 below:

[0075] Table 1

[0076] length Composition elements describe Remark 8 PTH_Header Signature PTH Header Marking Fixed fill: $PTHSIG$ 1 Partition Tree major version PTH major version number Reserved Fields 1 Partition Tree minor version PTH minor version number Reserved Fields 4 PTH_Header size PTH header information length 4 Partition Number Number of partitions 21 Partition Dscription string PTH1 Field Description Identifier 4 Partition offset PTH1 field starting address 8 Partition size PTH1 field length 21 Partition Dscription string PTH2 Field Description Identifier 4 Partition offset PTH2 field starting address 8 Partition size PTH2 field length …… …… 21 Partition Dscription string PTH N Field Description Identifier 4 Partition Key offset DTH N field starting address 8 Partition Key size DTH N field length 6 DTH_TAIL signature DTH tail mark Fixed filling: $PTHT$

[0077] As an optional solution, detecting the partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information includes:

[0078] In the case where the main firmware includes N initial firmware partitions, the partition type of the i-th initial firmware partition among the N initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein N is an integer greater than 1, and i is an integer greater than or equal to 1 and less than or equal to N:

[0079] S21, extracting the i-th initial partition structure parameter, the i-th initial address parameter and the i-th initial partition size parameter corresponding to the i-th initial firmware partition from the initial partition configuration information, and extracting the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter corresponding to the i-th initial firmware partition from the reference partition configuration information, wherein the i-th initial partition structure parameter is used to indicate the current partition structure of the i-th initial firmware partition, the i-th initial address parameter is used to indicate the current starting address of the i-th initial firmware partition in the main firmware, the i-th initial partition size parameter is used to indicate the current partition size of the i-th initial firmware partition, the i-th reference partition structure parameter is used to indicate the partition structure of the i-th initial firmware partition in the upgraded firmware, the i-th reference address parameter is used to indicate the starting address of the i-th initial firmware partition in the upgraded firmware, and the i-th reference partition size parameter is used to indicate the partition size of the i-th initial firmware partition in the upgraded firmware;

[0080] S22, determining the partition type of the i-th initial firmware partition according to the i-th initial partition structure parameter, the i-th initial address parameter and the i-th initial partition size parameter, and the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter.

[0081] Optionally, in this embodiment, the initial partition configuration information may be, but is not limited to, the partition configuration information of the main image (main firmware) currently running in the BMC system. The reference partition configuration information may be, but is not limited to, the information obtained by parsing the header information of the upgrade image file. Both the initial partition configuration information and the reference partition configuration information include at least three parts of information: partition structure parameters, address parameters (or offset parameters), and size parameters.

[0082] As an optional solution, determining the partition type of the i-th initial firmware partition according to the i-th initial partition structure parameter, the i-th initial address parameter, and the i-th initial partition size parameter, and the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter comprises:

[0083] S31, comparing the i-th initial partition structure parameter with the i-th reference partition structure parameter, the i-th initial address parameter with the i-th reference address parameter, and the i-th initial partition size parameter with the i-th reference partition size parameter;

[0084] S32, when it is found that the i-th initial partition structure parameter is inconsistent with the i-th reference partition structure parameter, and / or the i-th initial address parameter is inconsistent with the i-th reference address parameter, and / or the i-th initial partition size parameter is inconsistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a heterogeneous partition type, and the initial firmware partition belonging to the heterogeneous partition type has a changed partition structure before and after the firmware upgrade, and / or a changed start address, and / or a changed partition size;

[0085] S33, when it is compared that the i-th initial partition structure parameter is consistent with the i-th reference partition structure parameter, and the i-th initial address parameter is consistent with the i-th reference address parameter, and the i-th initial partition size parameter is consistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a homogeneous partition type, wherein the partition structure and the starting address of the initial firmware partition belonging to the homogeneous partition type are changed before and after the firmware upgrade, but the partition size does not change.

[0086] Optionally, in this embodiment, when the BMC receives a firmware upgrade request, it receives and parses the upgrade image file header information, and obtains the upgrade image file partition configuration information. At the same time, the partition configuration information of the main image currently running in the system is obtained. The two are compared and analyzed to confirm whether the partition type of the i-th initial firmware partition is a heterogeneous partition type. If the i-th initial firmware partition is a heterogeneous partition type, a heterogeneous partition upgrade is performed. The heterogeneous partition refresh flag is set, and the user data partition information is updated, and the refresh (upgrade) process of the i-th initial firmware partition of the heterogeneous partition type is executed.

[0087] As an optional solution, generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes:

[0088] Generate the i-th target upgrade mode matching the partition type for the i-th initial firmware partition among the N initial firmware partitions by the following steps:

[0089] S41, when the partition type of the i-th initial firmware partition is a heterogeneous partition type, the i-th target upgrade method is determined as: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the standby firmware with the i-th reference firmware data, and at the same time replacing the i-th initial partition structure parameter in the initial partition configuration information with the i-th reference partition structure parameter in the reference partition configuration information, replacing the i-th initial address parameter in the initial partition configuration information with the i-th reference address parameter in the reference partition configuration information, and replacing the i-th initial partition size parameter in the initial partition configuration information with the i-th reference partition size parameter in the reference partition configuration information, wherein the target data includes the i-th reference firmware data, the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter;

[0090] S42, when the partition type of the i-th initial firmware partition is a homogeneous partition type, the i-th target upgrade method is determined as: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the backup firmware with the i-th reference firmware data, wherein the target data includes the i-th reference firmware data.

[0091] Optionally, in this embodiment, if the i-th initial firmware partition is a heterogeneous partition type, the heterogeneous partition upgrade is performed. The heterogeneous partition refresh flag is set, and the user data partition information is updated, and the upgrade process of the i-th initial firmware partition of the heterogeneous partition type is performed. Figure 4 is a schematic diagram of an upgrade process of an initial firmware partition based on heterogeneous partition types according to an embodiment of the present application, such as Figure 4 As shown, the schematic diagram of the upgrade process includes the following steps:

[0092] Step 1. The BMC communicates with the CPLD to set the heterogeneous partition refresh flag;

[0093] Step 2. Obtain the partition configuration information (initial partition configuration information) of the currently running BMC firmware (main firmware) from the UFM of the CPLD;

[0094] Step 3. Analyze the partition configuration information (initial partition configuration information and reference partition configuration information) of the new and old BMC firmware to confirm whether the partition structure, starting address, and size of each firmware partition are consistent before and after the upgrade;

[0095] Step 4. When at least one item of the partition configuration information of the main BMC firmware is inconsistent with the partition configuration information of the BMC firmware to be updated (i.e., the partition type of the i-th initial firmware partition is a heterogeneous partition type), calculate whether the storage space size of the existing flash (target memory) matches the partition configuration information of the firmware to be updated (the storage space size is required to be larger than the partition configuration information of the firmware to be updated);

[0096] Step 5. When the existing flash storage space does not match the partition configuration information of the firmware to be updated (i.e., the storage space size is less than or equal to the partition configuration information of the firmware to be updated), record the heterogeneous partition refresh failure log information, issue an alarm, and reset the heterogeneous partition refresh flag;

[0097] Step 6. When the existing flash storage space matches the partition configuration information of the firmware to be updated, execute step 7;

[0098] Step 7. Loop through the configuration information of each partition in the BMC firmware to be updated (except for the user partition and the log partition. For the user partition and the log partition, the user data and log data stored in the user partition and the log partition of the new and old BMC firmware can be obtained respectively, and the user partition and log partition data of the new and old BMC firmware can be synchronized, and the log information of the user partition and the log partition synchronization can be recorded). The flash is erased and burned in units of firmware partitions. For firmware partitions of homogeneous partition types, only the data in the firmware partition of the old version of the firmware needs to be erased, and the data in the firmware partition of the new version needs to be burned. For firmware partitions of heterogeneous partition types, in addition to the above-mentioned erasing and burning operations, since the division method of the new and old versions of the firmware partitions has changed, it is also necessary to update the information that has changed in the initial partition configuration information, that is, the i-th initial partition structure parameter, the i-th initial address parameter, and the i-th initial partition size parameter corresponding to the i-th initial firmware partition. They are updated to the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter, respectively. Finally, the partition update success log information is recorded;

[0099] Step 8. Update the backup image BMC firmware partition configuration information in UFM (not required for firmware partitions of homogeneous partition type, required for firmware partitions of heterogeneous partition type);

[0100] Step 9. Update the next boot flash flag in the environment variable to UFM and restart the BMC.

[0101] As an optional solution, detecting the partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information includes:

[0102] In the case where the main firmware includes M initial firmware partitions, the partition type of the jth initial firmware partition among the M initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein M is an integer greater than 1, and j is an integer greater than or equal to 1 and less than or equal to M:

[0103] S51, extracting a jth initial partition function parameter corresponding to the jth initial firmware partition from the initial partition configuration information, and extracting a jth reference partition function parameter corresponding to the jth initial firmware partition from the reference partition configuration information, wherein the jth initial partition function parameter is used to indicate a function of the jth initial firmware partition currently in the main firmware, and the jth reference partition function parameter is used to indicate a function of the jth initial firmware partition in the upgraded firmware;

[0104] S52, when the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store user data, determining that the partition type of the j-th initial firmware partition is a user partition type, wherein the function of the initial firmware partition belonging to the user partition type before and after the firmware upgrade is to store user data, and the target data includes the user data;

[0105] S53, when the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store log data, determine that the partition type of the j-th initial firmware partition is a log partition type, wherein the function of the initial firmware partition belonging to the log partition type before and after the firmware upgrade is to store log data, and the target data includes the log data.

[0106] Optionally, in this embodiment, regarding the user data in the user partition and the log data in the log partition, in the traditional full image refresh upgrade method, the user data and log data are directly overwritten and deleted without being retained, while in this solution, the user data and log data are retained to ensure that they will not be lost.

[0107] As an optional solution, generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes:

[0108] Generate the jth target upgrade mode matching the partition type for the jth initial firmware partition among the M initial firmware partitions by the following steps:

[0109] S61, when the partition type of the jth initial firmware partition is a user partition type, determining the jth target upgrade mode as: during the firmware upgrade process, retaining the user data stored in the jth initial firmware partition, wherein the target data includes the user data;

[0110] S62, when the partition type of the jth initial firmware partition is a log partition type, the jth target upgrade method is determined as: during the firmware upgrade process, the log data stored in the jth initial firmware partition is retained, wherein the target data includes the log data.

[0111] Optionally, in this embodiment, the method for retaining the user data stored in the jth initial firmware partition may be, but is not limited to, extracting the user data from the jth initial firmware partition in advance, and then writing it after the jth initial firmware partition is upgraded. The method for retaining log data is similar, and in this way, it is ensured that important data such as user data and log data will not be lost during the upgrade process. The probability of data loss during the firmware upgrade process is reduced.

[0112] As an optional solution, the target memory includes a first memory and a second memory, the first memory is used to store the main firmware, the second memory is used to store the standby firmware, the first memory is connected to the baseboard management controller and the firmware controller respectively, and the second memory is connected to the baseboard management controller and the firmware controller respectively. After the initial firmware partition corresponding to the standby firmware is upgraded according to each target upgrade mode to obtain the upgraded standby firmware, the method further includes:

[0113] S71, after detecting that the server is restarted, the firmware controller controls the baseboard management controller to use the upgraded standby firmware stored in the second memory to perform a startup operation, and during the baseboard management controller performing the startup operation, detects the received information within a target time length;

[0114] S72, when detecting that a startup success message is received within the target time, the firmware controller determines that the firmware currently used by the baseboard management controller is successfully upgraded, and controls the primary firmware stored in the first memory to be synchronized with the upgraded standby firmware, wherein the startup success message is sent by the baseboard management controller to the firmware controller when the startup operation is successfully executed;

[0115] S73: When it is detected that the startup success information is not received within the target time period, the firmware controller controls the baseboard management controller to re-execute the startup operation using the main firmware stored in the first memory.

[0116] Optionally, in this embodiment, Figure 5 is a schematic diagram of a target memory according to an embodiment of the present application, such as Figure 5As shown, the target memory includes a first memory Flash1 and a second memory Flash2. The Flash1 is used to store the main firmware, and the Flash2 is used to store the backup firmware. The Flash1 is connected to the baseboard management controller BMC and the firmware controller CPLD respectively, and the second memory Flash2 is connected to the baseboard management controller BMC and the firmware controller CPLD respectively. After obtaining the upgraded backup firmware, the server can be restarted so that the BMC in the restarted server uses the upgraded backup firmware to start the BMC system. Figure 6 is a schematic diagram of a baseboard management controller startup process according to an embodiment of the present application, such as Figure 6 As shown, the baseboard management controller runs the upgraded standby firmware through the following startup process:

[0117] Step 1. After the BMC system is powered on, the CPLD enables the corresponding flash according to the CS status recorded in the UFM (for example, the CS status indicates reading the upgraded standby firmware from flash1), and the BMC starts from the refreshed standby image (the upgraded standby firmware);

[0118] Step 2. BMC reads the image file (the upgraded backup firmware) stored in the backup flash, boots and starts the BMC system;

[0119] Step 3. At the same time, CPLD starts the WDT timer. If the dog feeding signal (startup success information) is received before the timer times out, it is considered that the system starts normally and continues to step 4. If the BMC dog feeding information is still not received after the WDT times out, it is considered that the system starts unsuccessfully and continues to step 5.

[0120] Step 4. When the BMC system starts normally, call the SYNC module to perform the master-slave mirror synchronization operation in units of partitions, and update the master mirror partition configuration information to UFM, and continue to step 7;

[0121] Step 5. When the BMC system starts abnormally, the CPLD enables the main flash according to the CS status recorded in the UFM, and performs a reset operation on the BMC, and the BMC starts from the main flash;

[0122] Step 6. After the BMC starts up normally from the primary image, obtain the heterogeneous partition refresh flag. When the heterogeneous partition refresh flag is set, call the SYNC module to perform dual-image synchronization operations in units of partitions, record heterogeneous partition refresh failure log information, and update the backup image partition configuration information to UFM;

[0123] Step 7. Reset the heterogeneous partition refresh flag saved in UFM.

[0124] The firmware upgrade control method proposed in this application can solve the convenience and security issues while implementing heterogeneous partition system updates. Specifically, the firmware partition configuration information is added to the firmware upgrade package header information in the form of PTH_HEADER (including the number of BMC firmware partitions, offset, size and other information). The BMC determines whether to perform a heterogeneous partition firmware upgrade based on the header information, and then performs the corresponding actions to avoid the inefficiency of full image refresh, file system format damage and system downtime caused by partition structure adjustment, and can effectively realize the retention and recovery of user data in the process of BMC firmware refresh based on heterogeneous partitions.

[0125] The present application provides a BMC firmware refresh (upgrade) and startup method based on heterogeneous partitions. Although the implementation scheme described in the present application is as above, the above description content and definition are only for the convenience of understanding the implementation scheme of the present application, and are not intended to limit the present invention. Any modifications and changes made without departing from the spirit and scope of the present invention, especially the method of identifying heterogeneous partition refreshes by adding firmware partition configuration information and performing image update and synchronization in units of partitions, are within the protection scope of the present application.

[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0127] In this embodiment, a control device for firmware upgrade is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0128] Figure 7 is a structural block diagram of a control device for firmware upgrade according to an embodiment of the present application; Figure 7As shown, a baseboard management controller, a firmware controller and a target memory connected to each other are deployed in the server, the target memory stores the main firmware currently used by the baseboard management controller, and the backup firmware identical to the main firmware, the main firmware includes a plurality of initial firmware partitions, each of the initial firmware partitions stores initial firmware data for instructing the baseboard management controller to perform a corresponding function, the firmware controller stores initial partition configuration information for indicating the division method of the plurality of initial firmware partitions of the main firmware, the device is applied to the baseboard management controller, and the device includes:

[0129] A receiving module 702 is used to receive a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate the division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition;

[0130] A first detection module 704 is used to respond to the firmware upgrade request and detect the partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information;

[0131] A generating module 706, configured to generate a target upgrade mode matching the partition type for each of the plurality of initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process;

[0132] The upgrade module 708 is used to upgrade the corresponding initial firmware partition in the standby firmware according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

[0133] In an exemplary embodiment, the first detection module includes:

[0134] A first detection unit is configured to detect, when the main firmware includes N initial firmware partitions, a partition type of an i-th initial firmware partition among the N initial firmware partitions according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein N is an integer greater than 1, and i is an integer greater than or equal to 1 and less than or equal to N:

[0135] Extracting an i-th initial partition structure parameter, an i-th initial address parameter and an i-th initial partition size parameter corresponding to the i-th initial firmware partition from the initial partition configuration information, and extracting an i-th reference partition structure parameter, an i-th reference address parameter and an i-th reference partition size parameter corresponding to the i-th initial firmware partition from the reference partition configuration information, wherein the i-th initial partition structure parameter is used to indicate the current partition structure of the i-th initial firmware partition, the i-th initial address parameter is used to indicate the current starting address of the i-th initial firmware partition in the main firmware, the i-th initial partition size parameter is used to indicate the current partition size of the i-th initial firmware partition, the i-th reference partition structure parameter is used to indicate the partition structure of the i-th initial firmware partition in the upgraded firmware, the i-th reference address parameter is used to indicate the starting address of the i-th initial firmware partition in the upgraded firmware, and the i-th reference partition size parameter is used to indicate the partition size of the i-th initial firmware partition in the upgraded firmware;

[0136] The partition type of the i-th initial firmware partition is determined according to the i-th initial partition structure parameter, the i-th initial address parameter and the i-th initial partition size parameter, as well as the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter.

[0137] In an exemplary embodiment, the first detection unit is further configured to:

[0138] Comparing the i-th initial partition structure parameter with the i-th reference partition structure parameter, the i-th initial address parameter with the i-th reference address parameter, and the i-th initial partition size parameter with the i-th reference partition size parameter;

[0139] When it is found that the i-th initial partition structure parameter is inconsistent with the i-th reference partition structure parameter, and / or the i-th initial address parameter is inconsistent with the i-th reference address parameter, and / or the i-th initial partition size parameter is inconsistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a heterogeneous partition type, and the initial firmware partition belonging to the heterogeneous partition type has a changed partition structure before and after the firmware upgrade, and / or a changed starting address, and / or a changed partition size;

[0140] When it is found that the i-th initial partition structure parameter is consistent with the i-th reference partition structure parameter, the i-th initial address parameter is consistent with the i-th reference address parameter, and the i-th initial partition size parameter is consistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a homogeneous partition type, wherein the partition structure and the starting address of the initial firmware partition belonging to the homogeneous partition type are changed before and after the firmware upgrade, but the partition size does not change.

[0141] In an exemplary embodiment, the generating module comprises:

[0142] The first generating unit is configured to generate an i-th target upgrade mode matching the partition type for the i-th initial firmware partition among the N initial firmware partitions through the following steps:

[0143] In the case where the partition type of the i-th initial firmware partition is a heterogeneous partition type, the i-th target upgrade method is determined as follows: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the standby firmware with the i-th reference firmware data, and at the same time replacing the i-th initial partition structure parameter in the initial partition configuration information with the i-th reference partition structure parameter in the reference partition configuration information, replacing the i-th initial address parameter in the initial partition configuration information with the i-th reference address parameter in the reference partition configuration information, and replacing the i-th initial partition size parameter in the initial partition configuration information with the i-th reference partition size parameter in the reference partition configuration information, wherein the target data includes the i-th reference firmware data, the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter;

[0144] In the case where the partition type of the i-th initial firmware partition is a homogeneous partition type, the i-th target upgrade method is determined as: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the backup firmware with the i-th reference firmware data, wherein the target data includes the i-th reference firmware data.

[0145] In an exemplary embodiment, the first detection module includes:

[0146] A second detection unit is configured to detect, when the main firmware includes M initial firmware partitions, a partition type of a j-th initial firmware partition among the M initial firmware partitions according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein M is an integer greater than 1, and j is an integer greater than or equal to 1 and less than or equal to M:

[0147] Extracting a jth initial partition function parameter corresponding to the jth initial firmware partition from the initial partition configuration information, and extracting a jth reference partition function parameter corresponding to the jth initial firmware partition from the reference partition configuration information, wherein the jth initial partition function parameter is used to indicate the function of the jth initial firmware partition currently in the active firmware, and the jth reference partition function parameter is used to indicate the function of the jth initial firmware partition in the upgraded firmware;

[0148] In a case where the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store user data, determining that the partition type of the j-th initial firmware partition is a user partition type, wherein the function of the initial firmware partition belonging to the user partition type before and after the firmware upgrade is to store user data, and the target data includes the user data;

[0149] When the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store log data, the partition type of the j-th initial firmware partition is determined to be a log partition type, wherein the function of the initial firmware partition belonging to the log partition type before and after the firmware upgrade is to store log data, and the target data includes the log data.

[0150] In an exemplary embodiment, the generating module comprises:

[0151] The second generating unit is configured to generate a j-th target upgrade mode matching the partition type for the j-th initial firmware partition among the M initial firmware partitions through the following steps:

[0152] In a case where the partition type of the jth initial firmware partition is a user partition type, determining the jth target upgrade mode as follows: during a firmware upgrade process, retaining the user data stored in the jth initial firmware partition, wherein the target data includes the user data;

[0153] When the partition type of the jth initial firmware partition is a log partition type, the jth target upgrade method is determined as: during the firmware upgrade process, the log data stored in the jth initial firmware partition is retained, wherein the target data includes the log data.

[0154] In an exemplary embodiment, the target memory includes a first memory and a second memory, the first memory is used to store the main firmware, the second memory is used to store the standby firmware, the first memory is connected to the baseboard management controller and the firmware controller respectively, and the second memory is connected to the baseboard management controller and the firmware controller respectively, and the device further includes:

[0155] A second detection module is used for, after upgrading the corresponding initial firmware partition in the standby firmware according to each target upgrade mode to obtain the upgraded standby firmware, and after detecting that the server is restarted, the firmware controller controls the baseboard management controller to use the upgraded standby firmware stored in the second memory to perform a startup operation, and in the process of the baseboard management controller performing the startup operation, detects the received information within a target time length;

[0156] A first control module is configured to, when detecting that a startup success message is received within the target time, determine by the firmware controller that the firmware currently used by the baseboard management controller is successfully upgraded, and control the primary firmware stored in the first memory to be synchronized with the upgraded standby firmware, wherein the startup success message is sent by the baseboard management controller to the firmware controller when the startup operation is successfully executed;

[0157] The second control module is used for, when it is detected that the startup success information is not received within the target time period, the firmware controller controls the baseboard management controller to use the main firmware stored in the first memory to re-execute the startup operation.

[0158] It should be noted that the above modules can be implemented by 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.

[0159] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in each embodiment of the present application; the computer program product also includes a non-volatile computer-readable storage medium, which stores the computer program, and when executed by a processor, implements the steps of the method described in each embodiment of the present application.

[0160] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0161] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0162] An embodiment of the present application further provides an electronic device, Figure 8 is a schematic diagram of an electronic device according to an embodiment of the present application, such as Figure 8 As shown, the electronic device includes a memory and a processor, 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.

[0163] 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.

[0164] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0165] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that 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 executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0166] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for controlling firmware upgrade, characterized in that: A baseboard management controller, a firmware controller and a target memory connected to each other are deployed in the server, the target memory stores the main firmware currently used by the baseboard management controller, and the backup firmware identical to the main firmware, the main firmware includes a plurality of initial firmware partitions, each of the initial firmware partitions stores initial firmware data for instructing the baseboard management controller to execute a corresponding function, the firmware controller stores initial partition configuration information for indicating a division method of the plurality of initial firmware partitions of the main firmware, the method is applied to the baseboard management controller, the method includes: Receive a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate a division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition; In response to the firmware upgrade request, detecting a partition type of each of the multiple initial firmware partitions according to the initial partition configuration information and the reference partition configuration information; Generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process; The corresponding initial firmware partition in the standby firmware is upgraded according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

2. The method according to claim 1, characterized in that The detecting the partition type of each of the initial firmware partitions in the plurality of initial firmware partitions according to the initial partition configuration information and the reference partition configuration information comprises: In the case where the main firmware includes N initial firmware partitions, the partition type of the i-th initial firmware partition among the N initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein N is an integer greater than 1, and i is an integer greater than or equal to 1 and less than or equal to N: Extracting an i-th initial partition structure parameter, an i-th initial address parameter and an i-th initial partition size parameter corresponding to the i-th initial firmware partition from the initial partition configuration information, and extracting an i-th reference partition structure parameter, an i-th reference address parameter and an i-th reference partition size parameter corresponding to the i-th initial firmware partition from the reference partition configuration information, wherein the i-th initial partition structure parameter is used to indicate the current partition structure of the i-th initial firmware partition, the i-th initial address parameter is used to indicate the current starting address of the i-th initial firmware partition in the main firmware, the i-th initial partition size parameter is used to indicate the current partition size of the i-th initial firmware partition, the i-th reference partition structure parameter is used to indicate the partition structure of the i-th initial firmware partition in the upgraded firmware, the i-th reference address parameter is used to indicate the starting address of the i-th initial firmware partition in the upgraded firmware, and the i-th reference partition size parameter is used to indicate the partition size of the i-th initial firmware partition in the upgraded firmware; The partition type of the i-th initial firmware partition is determined according to the i-th initial partition structure parameter, the i-th initial address parameter and the i-th initial partition size parameter, as well as the i-th reference partition structure parameter, the i-th reference address parameter and the i-th reference partition size parameter.

3. The method according to claim 2, characterized in that The determining the partition type of the i-th initial firmware partition according to the i-th initial partition structure parameter, the i-th initial address parameter, and the i-th initial partition size parameter, and the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter comprises: Comparing the i-th initial partition structure parameter with the i-th reference partition structure parameter, the i-th initial address parameter with the i-th reference address parameter, and the i-th initial partition size parameter with the i-th reference partition size parameter; When it is found that the i-th initial partition structure parameter is inconsistent with the i-th reference partition structure parameter, and / or the i-th initial address parameter is inconsistent with the i-th reference address parameter, and / or the i-th initial partition size parameter is inconsistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a heterogeneous partition type, and the initial firmware partition belonging to the heterogeneous partition type has a changed partition structure before and after the firmware upgrade, and / or a changed starting address, and / or a changed partition size; When it is found that the i-th initial partition structure parameter is consistent with the i-th reference partition structure parameter, the i-th initial address parameter is consistent with the i-th reference address parameter, and the i-th initial partition size parameter is consistent with the i-th reference partition size parameter, it is determined that the partition type of the i-th initial firmware partition is a homogeneous partition type, wherein the partition structure and the starting address of the initial firmware partition belonging to the homogeneous partition type are changed before and after the firmware upgrade, but the partition size does not change.

4. The method according to claim 3, characterized in that Generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes: Generate the i-th target upgrade mode matching the partition type for the i-th initial firmware partition among the N initial firmware partitions by the following steps: In the case where the partition type of the i-th initial firmware partition is a heterogeneous partition type, the i-th target upgrade method is determined as follows: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the standby firmware with the i-th reference firmware data, and at the same time replacing the i-th initial partition structure parameter in the initial partition configuration information with the i-th reference partition structure parameter in the reference partition configuration information, replacing the i-th initial address parameter in the initial partition configuration information with the i-th reference address parameter in the reference partition configuration information, and replacing the i-th initial partition size parameter in the initial partition configuration information with the i-th reference partition size parameter in the reference partition configuration information, wherein the target data includes the i-th reference firmware data, the i-th reference partition structure parameter, the i-th reference address parameter, and the i-th reference partition size parameter; In the case where the partition type of the i-th initial firmware partition is a homogeneous partition type, the i-th target upgrade method is determined as: extracting the i-th reference firmware data stored in the i-th initial firmware partition in the upgraded firmware from the reference firmware file, and replacing the data currently stored in the i-th initial firmware partition in the backup firmware with the i-th reference firmware data, wherein the target data includes the i-th reference firmware data.

5. The method according to claim 1, characterized in that The detecting the partition type of each of the initial firmware partitions in the plurality of initial firmware partitions according to the initial partition configuration information and the reference partition configuration information comprises: In the case where the main firmware includes M initial firmware partitions, the partition type of the jth initial firmware partition among the M initial firmware partitions is detected according to the initial partition configuration information and the reference partition configuration information through the following steps, wherein M is an integer greater than 1, and j is an integer greater than or equal to 1 and less than or equal to M: Extracting a jth initial partition function parameter corresponding to the jth initial firmware partition from the initial partition configuration information, and extracting a jth reference partition function parameter corresponding to the jth initial firmware partition from the reference partition configuration information, wherein the jth initial partition function parameter is used to indicate the function of the jth initial firmware partition currently in the active firmware, and the jth reference partition function parameter is used to indicate the function of the jth initial firmware partition in the upgraded firmware; In a case where the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store user data, determining that the partition type of the j-th initial firmware partition is a user partition type, wherein the function of the initial firmware partition belonging to the user partition type before and after the firmware upgrade is to store user data, and the target data includes the user data; When the j-th initial partition function parameter and the j-th reference partition function parameter are used to indicate that the function of the j-th initial firmware partition is to store log data, the partition type of the j-th initial firmware partition is determined to be a log partition type, wherein the function of the initial firmware partition belonging to the log partition type before and after the firmware upgrade is to store log data, and the target data includes the log data.

6. The method according to claim 5, characterized in that Generating a target upgrade mode matching the partition type for each of the multiple initial firmware partitions includes: Generate the jth target upgrade mode matching the partition type for the jth initial firmware partition among the M initial firmware partitions by the following steps: In a case where the partition type of the jth initial firmware partition is a user partition type, determining the jth target upgrade mode as follows: during a firmware upgrade process, retaining the user data stored in the jth initial firmware partition, wherein the target data includes the user data; When the partition type of the jth initial firmware partition is a log partition type, the jth target upgrade method is determined as: during the firmware upgrade process, the log data stored in the jth initial firmware partition is retained, wherein the target data includes the log data.

7. The method according to claim 1, characterized in that The target memory includes a first memory and a second memory, the first memory is used to store the main firmware, the second memory is used to store the standby firmware, the first memory is connected to the baseboard management controller and the firmware controller respectively, and the second memory is connected to the baseboard management controller and the firmware controller respectively. After the initial firmware partition corresponding to the standby firmware is upgraded according to each target upgrade mode to obtain the upgraded standby firmware, the method further includes: After detecting that the server is restarted, the firmware controller controls the baseboard management controller to use the upgraded standby firmware stored in the second memory to perform a startup operation, and detects received information within a target time period during the baseboard management controller performing the startup operation; When it is detected that the startup success information is received within the target time, the firmware controller determines that the firmware currently used by the baseboard management controller is successfully upgraded, and controls the active firmware stored in the first memory to be synchronized with the upgraded standby firmware, wherein the startup success information is sent by the baseboard management controller to the firmware controller when the startup operation is successfully executed; When it is detected that the startup success information is not received within the target time period, the firmware controller controls the baseboard management controller to re-execute the startup operation using the main firmware stored in the first memory.

8. A control device for firmware upgrade, characterized in that: A baseboard management controller, a firmware controller and a target memory connected to each other are deployed in the server, the target memory stores the main firmware currently used by the baseboard management controller, and the backup firmware identical to the main firmware, the main firmware includes a plurality of initial firmware partitions, each of the initial firmware partitions stores initial firmware data for instructing the baseboard management controller to execute a corresponding function, the firmware controller stores initial partition configuration information for indicating a division method of the plurality of initial firmware partitions of the main firmware, the device is applied to the baseboard management controller, and the device includes: A receiving module, configured to receive a firmware upgrade request, wherein the firmware upgrade request is used to request to use a reference firmware file carrying reference partition configuration information to upgrade the firmware currently used by the baseboard management controller, the reference partition configuration information is used to indicate a division method of multiple firmware partitions in the upgraded firmware, and the reference firmware file records multiple reference firmware partitions in the upgraded firmware, and reference firmware data stored in each reference firmware partition; A first detection module, configured to respond to the firmware upgrade request and detect a partition type of each of the initial firmware partitions in the plurality of initial firmware partitions according to the initial partition configuration information and the reference partition configuration information; a generating module, configured to generate a target upgrade mode matching the partition type for each of the plurality of initial firmware partitions, wherein the target upgrade mode is an upgrade mode that allows the corresponding initial firmware partition to save target data that needs to be retained during the upgrade process; An upgrade module is used to upgrade the corresponding initial firmware partition in the standby firmware according to each target upgrade mode to obtain the upgraded standby firmware, wherein the upgraded standby firmware is used after the server is restarted.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in 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 7 are implemented.