Basic input and output system firmware upgrade method, product, device and medium
By splitting the flash memory chip into multiple memory technology devices partitions and generating a comprehensive image information file, the high hardware cost and system complexity of the BIOS firmware upgrade method of the main and backup FLASH chip is solved, ensuring the integrity of the BIOS firmware and the system. Start normally.
Patent Information
- Application Number
- CN202411045155.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-07-31
AI Technical Summary
Currently, the BIOS firmware upgrade method that uses the main and backup FLASH chips is costly, which increases system complexity and risks that the computer cannot start.
Split the flash memory chip into multiple memory technology device partitions, including the first partition that stores the original image file of the BIOS firmware and the free second partition, generate the mirror information comprehensive file and store it in the second partition, and integrate the file through the mirror information comprehensive file. Determine whether the BIOS firmware has been upgraded and perform necessary replacement operations after power outage to ensure the system starts.
It reduces hardware costs, improves system stability and reliability, avoids BIOS firmware damage caused by power outage, and ensures normal system startup.
Smart Images

Figure CN118567692B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer hardware, and in particular to a basic input / output system firmware upgrade method, product, device and medium. Background Art
[0002] Basic Input / Output System (BIOS) firmware upgrade is an important task in computer system maintenance, which involves writing a new firmware version to the flash memory chip (FLASH) on the computer motherboard. As a key component in the computer startup process, BIOS is responsible for hardware initialization, self-test, and booting the operating system. Therefore, during the upgrade process, any unexpected power outage or interference may cause the BIOS firmware in the FLASH chip to be damaged, making the computer unable to boot.
[0003] In order to avoid the computer being unable to boot due to a failed BIOS firmware upgrade, some systems use a master-slave FLASH chip design. In this scheme, there are two FLASH chips, one as the master chip and the other as the backup chip. During the upgrade process, the new BIOS firmware version is first written to the master chip. If a power outage or other problem occurs during the upgrade process, the system can switch to the backup chip to ensure that the computer can continue to boot normally. However, this design scheme also brings some problems. First, it increases the complexity of the system, including aspects such as design, verification, testing, and maintenance. This may increase development time and cost and introduce more potential failure points. Second, for some systems, it may be necessary to upgrade all firmware at once, including the master and backup firmware. If a power outage occurs during the upgrade process, it may cause the device to be unable to boot.
[0004] In view of the above problems, how to solve the current BIOS firmware upgrade method using active and standby FLASH chips has high hardware cost, increased system complexity, and still has the risk of the computer failing to start, which is an urgent problem to be solved by technicians in this field. Summary of the invention
[0005] The purpose of the present invention is to provide a basic input and output system firmware upgrade method, product, device and medium to solve the problem that the current BIOS firmware upgrade method using active and standby FLASH chips has high hardware cost, increases system complexity, and still has the risk of the computer failing to start.
[0006] In order to solve the above technical problems, the present invention provides a basic input and output system firmware upgrade method, comprising:
[0007] Splitting the flash memory chip into a plurality of memory technology device partitions; wherein the memory technology device partitions include a first partition storing an original image file of a basic input / output system firmware and an idle second partition;
[0008] Generate a comprehensive image information file and store it in the idle second partition; wherein the comprehensive image information file at least includes the original image file and its corresponding upgrade flag;
[0009] When upgrading the basic input and output system firmware, obtaining the image file to be upgraded of the basic input and output system firmware, refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed;
[0010] When the system is powered off and then powered on again, judging whether the basic input and output system firmware has been upgraded according to the upgrade flag in the image information comprehensive file;
[0011] If not, the image file to be upgraded in the first partition is refreshed and replaced according to the original image file in the image information comprehensive file.
[0012] On the one hand, the flash memory chip is split into a plurality of memory technology device partitions, including:
[0013] Determine the space size of the flash memory chip;
[0014] Based on a preset partition size and a space size of the flash memory chip, the flash memory chip is split into a plurality of the memory technology device partitions by a memory technology device driver;
[0015] The parameters of each of the memory technology device partitions are defined according to a device tree or a configuration platform file; wherein the parameters at least include a starting address, a space size and a name of the memory technology device partition.
[0016] On the other hand, the step of dividing the flash memory chip into a plurality of memory technology device partitions by using a memory technology device driver includes:
[0017] Registering the memory technology device partition in a driver of the flash memory chip;
[0018] Calling a memory technology device subsystem function to create the first partition and the second partition;
[0019] The first partition and the second partition are of equal size, and both the first partition and the second partition include a preset number of sub-partitions; the original image file of the basic input / output system firmware is stored in each sub-partition of the first partition in the form of a preset number of original image blocks.
[0020] On the other hand, generating the image information comprehensive file and storing it in the idle second partition includes:
[0021] Reading each of the original image blocks in the first partition into a file system;
[0022] Based on the file system, calculating the checksum and file size information of each of the original image blocks;
[0023] Setting the upgrade flag bit corresponding to each of the original image blocks; wherein the initial value of the upgrade flag bit indicates that it has not been upgraded;
[0024] Generate the image information comprehensive file corresponding to each original image block according to each check value, each file size information, each upgrade flag bit and each original image block;
[0025] Each of the mirror information comprehensive files is stored in each sub-partition of the second partition respectively.
[0026] On the other hand, the step of obtaining the image file to be upgraded of the basic input / output system firmware includes:
[0027] Obtaining the encrypted image file to be upgraded of the basic input and output system firmware;
[0028] Decrypting the image file to be upgraded;
[0029] The decrypted image file to be upgraded is converted into a preset format.
[0030] On the other hand, refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed, comprises:
[0031] Dividing the image file to be upgraded into a preset number of image blocks to be upgraded;
[0032] Determining a target original image block to be upgraded and its corresponding target image block to be upgraded according to the difference between each of the original image blocks and each of the image blocks to be upgraded;
[0033] Determine a target sub-partition of the first partition where the target original image block is located, and flash the corresponding target image block to be upgraded to the target sub-partition;
[0034] Determine a target image information comprehensive file in the second partition corresponding to the target original image block, and update the upgrade flag in the target image information comprehensive file to upgraded.
[0035] On the other hand, determining the target original mirror block to be upgraded and its corresponding target mirror block to be upgraded according to the difference between each of the original mirror blocks and each of the mirror blocks to be upgraded includes:
[0036] According to the offset of each original mirror block and the offset of each mirror block to be upgraded, each original mirror block is matched with each mirror block to be upgraded one by one;
[0037] Determine whether there is a difference between the file contents of the original image blocks in each group and the image blocks to be upgraded;
[0038] If yes, confirm that the original image block needs to be upgraded;
[0039] If not, it is confirmed that the original image block does not need to be upgraded.
[0040] On the other hand, after confirming that the original image block does not need to be upgraded, the method further includes:
[0041] Acquire the image information comprehensive file in the second partition corresponding to the original image block that does not need to be upgraded, so as to obtain the upgrade-free image information comprehensive file;
[0042] The upgrade flag in the upgrade-free image information comprehensive file is updated to upgraded.
[0043] On the other hand, judging whether the basic input and output system firmware is upgraded according to the upgrade flag in the image information comprehensive file includes:
[0044] Traversing each of the image information comprehensive files in the second partition through a baseboard management controller;
[0045] Determining whether the upgrade flags in each of the image information comprehensive files all indicate that they have been upgraded;
[0046] If yes, then confirm that the BIOS firmware upgrade is complete;
[0047] If not, it is confirmed that the basic input and output system firmware has not been upgraded due to the power outage, and the step of refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file is entered.
[0048] On the other hand, refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file includes:
[0049] Determine the image information comprehensive file to which the upgrade flag bit indicating non-upgrade belongs, so as to determine a backup image information comprehensive file;
[0050] Parsing the backup original image block in the backup image information comprehensive file;
[0051] The backup original image block is written to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded.
[0052] On the other hand, the step of parsing the backup original image block in the backup image information comprehensive file includes:
[0053] Calculating the checksum of the backup original image block;
[0054] Determine whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file;
[0055] If yes, confirm that the backup original image block is parsed successfully;
[0056] If not, it is confirmed that the parsing of the backup original image block fails.
[0057] On the other hand, after confirming that the basic input and output system firmware upgrade is completed, it also includes:
[0058] Trigger the system restart process on the CPU side;
[0059] Generate a basic input and output system firmware upgrade log through a baseboard management controller;
[0060] The image information comprehensive file in the second partition is cleared.
[0061] In order to solve the above technical problem, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above basic input and output system firmware upgrade method when executed by a processor.
[0062] In order to solve the above technical problems, the present invention further provides a basic input and output system firmware upgrade device, comprising:
[0063] Memory for storing computer programs;
[0064] The processor is used to implement the steps of the basic input and output system firmware upgrade method when executing the computer program.
[0065] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above basic input and output system firmware upgrade method are implemented.
[0066] The basic input / output system firmware upgrade method provided by the present invention specifically divides a flash memory chip into a plurality of memory technology device partitions; wherein the memory technology device partition includes a first partition storing an original image file of the basic input / output system firmware and an idle second partition; generates an image information comprehensive file and stores it in the idle second partition; wherein the image information comprehensive file at least includes the original image file and its corresponding upgrade flag; when upgrading the basic input / output system firmware, obtains the image file to be upgraded of the basic input / output system firmware, refreshes and upgrades the original image file in the first partition according to the image file to be upgraded, and updates the upgrade flag after the refreshing and upgrading is completed; when the system is powered off and then powered on again, determines whether the basic input / output system firmware is upgraded according to the upgrade flag in the image information comprehensive file; if not, refreshes and replaces the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file.
[0067] The beneficial effect of the present invention is that the flash memory chip is split into multiple memory technology device partitions: the first partition stores the original image file to be upgraded, and the second partition stores the image information comprehensive file containing the backup of the original image file. When upgrading the BIOS firmware, the image file to be upgraded is obtained and the original image file in the first partition is refreshed and upgraded, thereby realizing the BIOS firmware upgrade. If a power outage occurs during the BIOS firmware upgrade process, after power is restored, it is determined whether the BIOS firmware upgrade is completed based on the upgrade flag in the image information comprehensive file; if it is confirmed that the BIOS firmware upgrade is not completed, in order to ensure the normal boot and start of the BIOS, the image file to be upgraded in the first partition is refreshed and replaced based on the backup of the original image file in the image information comprehensive file, thereby ensuring the consistency and integrity of the BIOS image file and ensuring the normal boot of the system. This solution does not require the addition of additional flash memory chips, reduces hardware costs, and improves the stability and reliability of the system.
[0068] On the other hand, the present invention specifically splits the flash memory chip into multiple memory technology device partitions through the memory technology device driver based on the preset partition size and the space size of the flash memory chip, defines the parameters of each memory technology device partition according to the device tree or the configuration platform file, and realizes the splitting of the memory technology device partition to facilitate the storage of the image file. The memory technology device partition is registered in the driver of the flash memory chip, and the memory technology device subsystem function is called to realize the creation of the first partition and the second partition; at the same time, the first partition and the second partition are equal in size and both contain a preset number of sub-partitions, so that the original image file is stored in each sub-partition of the first partition in the form of a preset number of original image blocks, respectively, to realize the splitting and storage of the original image file. By reading each original image block in the first partition into the file system, calculating the check value and file size information of each original image block based on the file system, and setting the upgrade flag corresponding to each original image block; generating the image information comprehensive file corresponding to each original image block according to each check value, each file size information, each upgrade flag and each original image block, and storing them in each sub-partition of the second partition respectively, the backup of the original image file and the setting of the upgrade flag are realized, so as to ensure the integrity and consistency of the image file when the BIOS firmware upgrade is abnormal. By obtaining the image file to be upgraded of the encrypted basic input and output system firmware; decrypting the image file to be upgraded, converting the decrypted image file to be upgraded into a preset format, the acquisition of the image file to be upgraded for upgrading the BIOS firmware is realized. By cutting the image file to be upgraded into a preset number of image blocks to be upgraded, determining the target original image block to be upgraded according to the difference between the image block to be upgraded and the original image block, and refreshing and upgrading the target original image block by the corresponding target image block to be upgraded, and updating the upgrade flag at the same time, the update and upgrade of the BIOS firmware is realized. According to the offset, each original image block is matched with each image block to be upgraded one by one; it is judged whether there is a difference in the file content of each group of original image blocks and the image blocks to be upgraded; if so, it is confirmed that the original image block needs to be upgraded, otherwise it does not need to be upgraded; it is realized that only the original image blocks with differences are upgraded, which greatly improves the upgrade efficiency of the BIOS firmware and reduces the impact of the power outage window. According to the upgrade flag in the image information comprehensive file, it is realized to judge whether the BIOS firmware upgrade is completed, so that when it is confirmed that the upgrade is not completed, the image block to be upgraded affected by the power outage is replaced. Determine the backup image information comprehensive file to which the upgrade flag representing the non-upgrade belongs, and parse out the backup original image block therein; write the backup original image block to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded, so as to ensure the consistency and integrity of the image file. By calculating the check value of the backup original image block, and judging whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file, the correctness of the backup original image block parsing is guaranteed.
[0069] In addition, the present invention also provides a computer program product, a basic input and output system firmware upgrade device and a medium, the effects of which are the same as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0071] Figure 1 A flowchart of a basic input / output system firmware upgrade method provided by an embodiment of the present invention;
[0072] Figure 2 A schematic diagram of a basic input / output system firmware upgrade device provided by an embodiment of the present invention;
[0073] Figure 3 A schematic diagram of a basic input / output system firmware upgrade device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0075] The core of the present invention is to provide a basic input and output system firmware upgrade method, product, device and medium to solve the problem that the current BIOS firmware upgrade method using active and standby FLASH chips has high hardware cost, increases system complexity, and still has the risk of the computer failing to start.
[0076] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0077] At present, in the BIOS upgrade process, since it is necessary to design two-way FLASH chips, main and standby, on the hardware board, this will increase additional hardware equipment and related design work, thereby increasing the cost of system design. In addition, the redundant design of the main and standby BIOS chips will also increase the complexity of the system, including aspects such as design, verification, testing and maintenance, which may extend the development time and increase costs, and also introduce more potential failure points. In many cases, it is necessary to upgrade all firmware, including the main and standby firmware, at one time. If the power is accidentally cut off during the upgrade process, errors may occur in the basic firmware of the device, making the machine unable to start. In order to solve the above problems, the present invention provides a BIOS firmware upgrade method.
[0078] It should be noted that the present invention does not limit the application scenario of the BIOS firmware upgrade method. For example, it can be applied to a server, a computer device, or a switch device, depending on the specific implementation situation.
[0079] Figure 1 A flowchart of a basic input / output system firmware upgrade method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0080] S10: Split the flash memory chip into multiple memory technology device partitions.
[0081] The memory technology device partition includes a first partition storing an original image file of a basic input / output system firmware and an idle second partition.
[0082] In a specific implementation, the FLASH chip in the device is first split into multiple memory technology device (MTD) partitions. It can be understood that the MTD partition is a logical address range defined on the FLASH chip, which is mapped to a certain area of the physical address space of the device. The MTD partition allows the storage device to be divided into multiple logical partitions to better organize and manage data. Each MTD partition corresponds to one or more physical blocks on the flash memory device and has its own size and starting offset. By defining, operating and releasing the MTD partition, the flash memory can be read, written, erased and other operations can be performed. In this embodiment, there is no restriction on the specific division method of the MTD partition, which depends on the specific implementation situation.
[0083] It should be noted that in this embodiment, the flash memory chip is specifically divided into two partitions: a first partition and a second partition. The first partition stores the original image file of the BIOS firmware. When the BIOS firmware is upgraded, the original image file is actually updated and upgraded; the second partition is an idle partition. In this embodiment, there is no restriction on the size of the first partition and the second partition. In specific implementation, more sub-partitions can be divided in the first partition and the second partition respectively, so as to better store the image file.
[0084] S11: Generate a comprehensive image information file and store it in the free second partition.
[0085] The image information comprehensive file at least includes the original image file and its corresponding upgrade flag.
[0086] Further, a comprehensive image information file is generated, and the comprehensive image information file is stored in the idle second partition. It should be noted that the comprehensive image information file at least contains the original image file and its corresponding upgrade flag. In other words, the comprehensive image information file is actually a backup of the original image file in the first partition. The upgrade flag is used to characterize the upgrade status of the BIOS firmware: when the BIOS firmware upgrade is not performed, the upgrade flag indicates that it has not been upgraded; when the BIOS firmware upgrade is completed, the upgrade flag indicates that it has been upgraded. In addition to the original image file and its corresponding upgrade flag, the comprehensive image information file may also include other parameters such as checksum values, which are not limited in this embodiment. In addition, in this embodiment, there is no limitation on the generation process of the comprehensive image information file, which depends on the specific implementation situation.
[0087] S12: when upgrading the BIOS firmware, obtaining the image file to be upgraded of the BIOS firmware, refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed.
[0088] When upgrading the BIOS firmware, the image file to be upgraded of the BIOS firmware is obtained. It can be understood that the image file to be upgraded is the image file that refreshes and upgrades the original image file. Specifically, the original image file in the first partition is refreshed and upgraded according to the image file to be upgraded, so as to realize the BIOS firmware upgrade. In addition, after the refresh and upgrade is completed, the upgrade flag is updated, specifically from not upgraded to upgraded.
[0089] It should be noted that this embodiment does not limit the method for obtaining the image file to be upgraded, nor does it limit the refreshing process of the original image file during the BIOS upgrade, which depends on the specific implementation situation.
[0090] S13: When the system is powered off and then powered on again, it is determined whether the basic input / output system firmware has been upgraded according to the upgrade flag in the image information comprehensive file; if so, the process ends; if not, the process proceeds to step S14.
[0091] S14: Refresh and replace the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file.
[0092] When upgrading the BIOS firmware, an abnormal power outage may occur at any time. In order to avoid abnormal power outages causing the integrity and consistency of the image file in the FLASH chip to be destroyed, which further causes the system to be unable to start and automatically recover, in this embodiment, when the system is powered off and then powered on again, it is determined whether the BIOS firmware upgrade is completed based on the upgrade flag in the image information comprehensive file. It is understandable that since the upgrade flag is different before and after the upgrade is completed, it is possible to determine whether the BIOS firmware upgrade is completed based on the upgrade flag.
[0093] If the BIOS firmware upgrade is completed according to the upgrade flag in the image information comprehensive file, it is considered that the abnormal power outage has no effect on the BIOS firmware upgrade, and the upgrade process can be terminated. If the BIOS firmware upgrade is not completed according to the upgrade flag in the image information comprehensive file, it is considered that the abnormal power outage has an impact on the BIOS firmware upgrade, and the image file to be upgraded refreshed during the upgrade process may be incomplete or damaged. In order to ensure the integrity and consistency of the image file, the image file to be upgraded in the first partition is refreshed and replaced according to the original image file in the image information comprehensive file, so as to ensure that the BIOS can boot normally.
[0094] In this embodiment, there is no restriction on the specific process of determining whether the BIOS firmware upgrade is completed according to the upgrade flag bit, and there is no restriction on the specific process of refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file, which depends on the specific implementation situation.
[0095] In this embodiment, the flash memory chip is split into multiple memory technology device partitions: the first partition stores the original image file to be upgraded, and the second partition stores the image information comprehensive file containing the backup of the original image file. When upgrading the BIOS firmware, the image file to be upgraded is obtained and the original image file in the first partition is refreshed and upgraded, thereby realizing the BIOS firmware upgrade. If a power outage occurs during the BIOS firmware upgrade process, after power is restored, it is determined whether the BIOS firmware upgrade is complete based on the upgrade flag in the image information comprehensive file; if it is confirmed that the BIOS firmware upgrade is not complete, in order to ensure the normal boot and start of the BIOS, the image file to be upgraded in the first partition is refreshed and replaced based on the backup of the original image file in the image information comprehensive file, thereby ensuring the consistency and integrity of the BIOS image file and ensuring the normal boot of the system. This solution does not require the addition of additional flash memory chips, reduces hardware costs, and improves the stability and reliability of the system.
[0096] Based on the above embodiments, in some embodiments, the flash memory chip is split into multiple memory technology device partitions, including:
[0097] S101: Determine the space size of the flash memory chip;
[0098] S102: splitting the flash memory chip into a plurality of memory technology device partitions through a memory technology device driver based on a preset partition size and a space size of the flash memory chip;
[0099] S103: defining parameters of each memory technology device partition according to a device tree or a configuration platform file;
[0100] The parameters at least include the starting address, space size and name of the memory technology device partition.
[0101] In a specific implementation, in order to split the flash memory chip into multiple MTD partitions, it is first necessary to determine the space size of the FLASH chip, and based on the preset partition size and the space size of the FLASH chip, split the flash memory chip into multiple MTD partitions through the MTD driver.
[0102] MTD driver is a subsystem in Linux kernel, which is used to manage FLASH chip. The main functions of MTD driver include device abstraction and management, device erasure and programming, etc. The design purpose of MTD driver is to simplify the driver development of new memory device. It provides an abstract interface between hardware and upper layer, so that upper layer application can easily access and operate various types of non-volatile memory devices without caring about the details of underlying hardware. MTD driver is usually composed of several levels, including hardware driver layer, MTD original device layer and MTD partition layer. The hardware driver layer is responsible for communicating with the underlying hardware, the MTD original device layer provides an abstract representation of the memory device, and the MTD partition layer allows the memory device to be divided into multiple logical partitions. In addition, in the present embodiment, there is no restriction on the preset partition size, which depends on the specific implementation situation.
[0103] Finally, the parameters of each MTD partition are defined according to the device tree or the configuration platform file, and the parameters include at least the starting address, space size and name of the MTD partition. It can be understood that the device tree is a data structure that describes the hierarchy and properties of the hardware system. It is organized in the form of a tree structure, including nodes and properties. The nodes represent hardware devices, and the properties describe the detailed information of the devices. The device tree is commonly used in embedded systems, servers, desktop computing and other fields to describe the configuration information of the hardware platform so that the operating system can identify and configure the hardware devices. Like the function of the device tree, the configuration platform file can also describe the configuration information and parameters of the hardware platform. Therefore, in this embodiment, for the setting method of the parameters of the MTD partition, you can choose either the device tree or the configuration platform file.
[0104] In this embodiment, based on the preset partition size and the space size of the flash memory chip, the flash memory chip is split into multiple memory technology device partitions through the memory technology device driver, and the parameters of each memory technology device partition are defined according to the device tree or configuration platform file, thereby realizing the splitting of the memory technology device partitions to facilitate the storage of image files.
[0105] Based on the above embodiments, in some embodiments, a flash memory chip is split into multiple memory technology device partitions through a memory technology device driver, including:
[0106] S104: registering the memory technology device partition in the driver of the flash memory chip;
[0107] S105: calling the memory technology device subsystem function to create a first partition and a second partition;
[0108] The first partition and the second partition are of equal size, and both contain a preset number of sub-partitions; the original image file of the basic input / output system firmware is stored in each sub-partition of the first partition in the form of a preset number of original image blocks.
[0109] In the specific implementation, the FLASH chip is split into multiple MTD partitions through the MTD driver, and the MTD partition is specifically registered in the driver of the FLASH chip, so that other modules in the system can access and use the device. The MTD subsystem function is further called to create the first partition and the second partition.
[0110] It is worth noting that the first partition and the second partition are equal in size, and both the first partition and the second partition contain a preset number of sub-partitions. Therefore, in the file system, the first partition can be displayed as / dev / mtd0 to / dev / mtdN, and the second partition can be displayed as / dev / mtdN to / dev / mtd2N. In addition, the original image file of the BIOS firmware is stored in each sub-partition of the first partition in the form of a preset number of original image blocks, thereby realizing the splitting and storage of the original image file.
[0111] In this embodiment, a memory technology device partition is registered in a driver program of a flash memory chip, and a memory technology device subsystem function is called to realize the creation of a first partition and a second partition; at the same time, the first partition and the second partition are equal in size and both contain a preset number of sub-partitions, so that the original image file is stored in each sub-partition of the first partition in the form of a preset number of original image blocks, thereby realizing the splitting and storage of the original image file.
[0112] Based on the above embodiment, in some embodiments, generating a comprehensive image information file and storing it in an idle second partition includes:
[0113] S111: reading each original image block in the first partition into the file system;
[0114] S112: Calculate the checksum and file size information of each original image block based on the file system;
[0115] S113: Setting the upgrade flag corresponding to each original image block;
[0116] Among them, the initial value of the upgrade flag indicates that it has not been upgraded;
[0117] S114: Generate image information comprehensive files corresponding to the original image blocks according to the check values, the file size information, the upgrade flags and the original image blocks;
[0118] S115: storing each mirror information comprehensive file in each sub-partition of the second partition respectively.
[0119] In a specific implementation, in order to generate a comprehensive image information file, each original image block in the first partition is specifically read into the file system. Based on the file system, the check value and file size information of each original image block are calculated. It should be noted that in this embodiment, there is no restriction on the calculation method of the check value. For example, the MD5 hash algorithm can be used to calculate the check value, the cyclic redundancy check (CRC) algorithm can be used to calculate the check value, and the secure hash (SHA) algorithm can also be used to calculate the check value, depending on the specific implementation situation.
[0120] Further, the upgrade flag bit corresponding to each original image block is set. It is understandable that before the BIOS firmware is upgraded, the initial value of the upgrade flag bit indicates that it has not been upgraded. For example, the initial value of the upgrade flag bit can be set to 0x4E, thereby indicating the N character of the American Standard Code for Information Interchange (ASCII), which specifically indicates that it has not been upgraded at present.
[0121] Then, the checksum, file size information and upgrade flag are used as the file header, and the image information comprehensive file is generated in combination with the corresponding original image block. Since there are multiple original image blocks, multiple image information comprehensive files can be generated respectively in the above manner. Finally, each image information comprehensive file is stored in each sub-partition of the second partition, thereby realizing the backup of the original image file.
[0122] In this embodiment, by reading each original image block in the first partition into the file system, the check value and file size information of each original image block are calculated based on the file system, and the upgrade flag corresponding to each original image block is set; according to each check value, each file size information, each upgrade flag and each original image block, the image information comprehensive file corresponding to each original image block is generated respectively, and is stored in each sub-partition of the second partition respectively, thereby realizing the backup of the original image file and the setting of the upgrade flag, so as to ensure the integrity and consistency of the image file when the BIOS firmware upgrade is abnormal.
[0123] Based on the above embodiments, in some embodiments, obtaining the image file to be upgraded of the basic input / output system firmware includes:
[0124] S121: Obtaining the encrypted image file of the basic input and output system firmware to be upgraded;
[0125] S122: decrypting the image file to be upgraded;
[0126] S123: Convert the decrypted image file to be upgraded into a preset format.
[0127] In a specific implementation, in order to obtain the image file to be upgraded for upgrading the BIOS firmware, the encrypted image file to be upgraded of the BIOS firmware is specifically obtained. It can be understood that encrypting and transmitting the image file to be upgraded can ensure the security and integrity of the image file to be upgraded; the encryption method is not limited in this embodiment and depends on the specific implementation situation.
[0128] The image file to be upgraded is further decrypted, and the decrypted image file to be upgraded is converted into a preset format. The image file to be upgraded after conversion into the preset format can be directly used for refresh upgrade. In this embodiment, there is no restriction on the preset format, for example, it can be set to a bin format. It can be understood that the bin format is a binary file format, which represents the content of the file in binary code. This format is commonly used to store various types of data, including computer programs, firmware, documents, images, audio and video; BIN files can be used to load code and data into FLASH chips, and can also be used to transfer data from one embedded system to another. The size of the bin file is the actual size of the data contained in the file.
[0129] In this embodiment, the image file to be upgraded for upgrading the BIOS firmware is acquired by acquiring the encrypted image file to be upgraded of the basic input / output system firmware; the image file to be upgraded is decrypted, and the decrypted image file to be upgraded is converted into a preset format, thereby achieving acquisition of the image file to be upgraded for upgrading the BIOS firmware.
[0130] Based on the above embodiments, in some embodiments, refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed, including:
[0131] S124: dividing the image file to be upgraded into a preset number of image blocks to be upgraded;
[0132] S125: Determine the target original image block to be upgraded and its corresponding target image block to be upgraded according to the difference between each original image block and each image block to be upgraded;
[0133] S126: Determine the target sub-partition of the first partition where the target original image block is located, and write the corresponding target image block to be upgraded to the target sub-partition;
[0134] S127: Determine the target image information comprehensive file in the second partition corresponding to the target original image block, and update the upgrade flag in the target image information comprehensive file to upgraded.
[0135] In order to implement the BIOS firmware upgrade, the image file to be upgraded is specifically divided into a preset number of image blocks to be upgraded. It is understandable that the number of image blocks to be upgraded obtained after the division is equal to the number of original image blocks in the first partition. Further, according to the difference between each original image block and each image block to be upgraded, the target original image block to be upgraded and its corresponding target image block to be upgraded are determined. In this embodiment, the specific process of determining the target original image block to be upgraded and its corresponding target image block to be upgraded is not limited, and it depends on the specific implementation situation.
[0136] After determining the target original image block that needs to be upgraded, determine the target sub-partition of the first partition where the target original image block is located, and write the corresponding target image block to be upgraded to the target sub-partition, thereby realizing the refresh upgrade of the target original image block. Finally, determine the target image information comprehensive file in the second partition corresponding to the target original image block, and update the upgrade flag in the target image information comprehensive file to upgraded. For example, update the upgrade flag in the target image information comprehensive file to 0x59 to represent the ASCII code Y character, which specifically indicates that it has been upgraded.
[0137] In this embodiment, the image file to be upgraded is divided into a preset number of image blocks to be upgraded, the target original image block to be upgraded is determined according to the difference between the image block to be upgraded and the original image block, and the target original image block is refreshed and upgraded by the corresponding target image block to be upgraded, and the upgrade flag is updated at the same time, thereby realizing the update and upgrade of the BIOS firmware.
[0138] Based on the above embodiments, in some embodiments, according to the differences between each original image block and each image block to be upgraded, determining the target original image block to be upgraded and its corresponding target image block to be upgraded includes:
[0139] S128: According to the offset of each original image block and the offset of each image block to be upgraded, each original image block is matched with each image block to be upgraded one by one;
[0140] S129: Determine whether there are differences in the file contents of each group of original image blocks and the image blocks to be upgraded; if so, confirm that the original image blocks need to be upgraded; if not, confirm that the original image blocks do not need to be upgraded.
[0141] In a specific implementation, in order to determine the target original image block to be upgraded and its corresponding target image block to be upgraded, the offset of each original image block and the offset of each image block to be upgraded are first obtained. Since the offsets between corresponding image blocks are equal, each original image block can be matched with each image block to be upgraded one by one according to the offset of each original image block and the offset of each image block to be upgraded.
[0142] After the original image blocks are matched one by one with the image blocks to be upgraded to obtain multiple groups of original image blocks and image blocks to be upgraded, it is determined whether there is a difference in the file content between each group of original image blocks and the image blocks to be upgraded. If it is confirmed that there is a difference in the file content between the original image block and the image block to be upgraded, it is confirmed that the original image block needs to be upgraded; if it is confirmed that there is no difference in the file content between the original image block and the image block to be upgraded, it is confirmed that the original image block does not need to be upgraded.
[0143] On this basis, after confirming that the original image block does not need to be upgraded, the image information comprehensive file in the second partition corresponding to the original image block that does not need to be upgraded can be further obtained to obtain the upgrade-free image information comprehensive file; the upgrade flag in the upgrade-free image information comprehensive file is updated to upgraded, thereby indicating that the original image block does not need to be upgraded.
[0144] In this embodiment, each original image block is matched with each image block to be upgraded according to the offset; it is determined whether there is a difference in the file content of each group of original image blocks and the image blocks to be upgraded; if so, it is confirmed that the original image blocks need to be upgraded, otherwise they do not need to be upgraded; only the original image blocks with differences are upgraded, which greatly improves the upgrade efficiency of the BIOS firmware and reduces the impact of the power-off window.
[0145] Based on the above embodiments, in some embodiments, judging whether the basic input / output system firmware is upgraded according to the upgrade flag in the image information comprehensive file includes:
[0146] S131: traversing each image information comprehensive file in the second partition through the baseboard management controller;
[0147] S132: Determine whether the upgrade flags in each image information comprehensive file all indicate that they have been upgraded; if so, proceed to step S133; if not, proceed to step S134;
[0148] S133: confirming that the basic input and output system firmware upgrade is completed;
[0149] S134: confirming that the basic input and output system firmware has not been upgraded due to the power outage, and proceeding to step S14.
[0150] In a specific implementation, this solution can be specifically applied to a server. After powering off and then powering on again, the baseboard management controller (BMC) can be used to traverse the image information comprehensive files in the second partition, that is, to traverse the image information comprehensive files in / dev / mtdN to / dev / mtd2N. It is determined whether the upgrade flag bits in each image information comprehensive file all indicate that they have been upgraded.
[0151] It is understandable that, for the original image blocks that need to be upgraded, their corresponding upgrade flags will be updated to upgraded after the upgrade is completed; for the original image blocks that do not need to be upgraded, their corresponding upgrade flags will be directly updated to upgraded. Therefore, when the BIOS firmware upgrade is completed, the upgrade flags in each image information comprehensive file should all be indicated as upgraded, otherwise the BIOS firmware upgrade is considered incomplete. Specifically, when the upgrade flags in each image information comprehensive file all indicate that they have been upgraded, it is confirmed that the BIOS firmware upgrade is complete; when the upgrade flags in each image information comprehensive file do not all indicate that they have been upgraded, it is confirmed that the BIOS firmware upgrade has not been completed due to the power outage, and the affected image blocks to be upgraded need to be replaced.
[0152] In this embodiment, the upgrade flag in the image information comprehensive file is used to determine whether the BIOS firmware upgrade is complete, so that when it is confirmed that the upgrade is not complete, the image block to be upgraded affected by the power outage is replaced.
[0153] Based on the above embodiments, in some embodiments, refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file includes:
[0154] S141: Determine the image information comprehensive file to which the upgrade flag bit indicating non-upgrade belongs, so as to determine the backup image information comprehensive file;
[0155] S142: parsing the backup original image block in the backup image information comprehensive file;
[0156] S143: Flashing the backup original image block to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded.
[0157] It is understandable that the upgrade flag is marked as not upgraded because a power outage occurs when the image block to be upgraded is flashing the corresponding original image block in the first partition, resulting in the incomplete flashing, which in turn causes the upgrade flag to not be updated. Since the image block to be upgraded has not been flashed, the consistency and integrity of the image file will be affected.
[0158] In order to prevent power failure from affecting the consistency and integrity of the image file, in this embodiment, the image information comprehensive file to which the upgrade flag indicating non-upgrade belongs is specifically determined to determine the backup image information comprehensive file. The backup original image block in the backup image information comprehensive file is parsed, and the backup original image block is written to the sub-partition corresponding to the first partition to replace the image block to be upgraded with abnormal writing, thereby ensuring the consistency and integrity of the image file.
[0159] In this embodiment, the backup image information comprehensive file to which the upgrade flag bit representing the non-upgrade belongs is determined, and the backup original image block therein is parsed; the backup original image block is flushed to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded, thereby ensuring the consistency and integrity of the image file.
[0160] Based on the above embodiments, in some embodiments, parsing the backup original image block in the backup image information comprehensive file includes:
[0161] S144: Calculate the checksum of the backup original image block;
[0162] S145: Determine whether the checksum of the backup original image block is the same as the checksum in the backup image information comprehensive file; if so, proceed to step S146; if not, proceed to step S147;
[0163] S146: confirming that the backup original image block is parsed successfully;
[0164] S147: Confirm that the parsing of the backup original image block fails.
[0165] In order to ensure that the correct backup original image block is parsed, in a specific implementation, when parsing the backup original image block in the backup image information comprehensive file, it is necessary to calculate the check value of the backup original image block to determine whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file. It should be noted that the calculation method of the check value of the backup original image block here should be the same as the calculation method of the check value in the backup image information comprehensive file, so as to ensure the comparability of the two.
[0166] If the checksum of the backup original image block is confirmed to be the same as the checksum in the backup image information comprehensive file, then the backup original image block is confirmed to be parsed successfully and the parsed backup original image block is correct. If the checksum of the backup original image block is confirmed to be different from the checksum in the backup image information comprehensive file, then the backup original image block is confirmed to have failed to be parsed and the parsed backup original image block is wrong and needs to be parsed again.
[0167] In this embodiment, by calculating the check value of the backup original image block and judging whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file, the correctness of the analysis of the backup original image block is ensured.
[0168] Based on the above embodiment, in some embodiments, after confirming that the basic input and output system firmware upgrade is completed, the method further includes:
[0169] S15: triggering the CPU side system restart process;
[0170] S16: Generate a basic input / output system firmware upgrade log through a baseboard management controller;
[0171] S17: Clear the image information comprehensive file in the second partition.
[0172] After the BIOS firmware upgrade is completed and the consistency and integrity of the image file are ensured, the system restart process on the central processing unit (CPU) side is triggered to achieve normal system startup. At the same time, in order to enable users to understand the entire process of BIOS firmware upgrade, the BIOS firmware upgrade log is generated through the BMC.
[0173] Specifically, the log can contain information from multiple aspects. First, the log records the start and end time of the upgrade, which helps to understand the duration of the entire upgrade process. Secondly, the log lists the BIOS firmware version numbers before and after the upgrade to verify whether the upgrade was successful and confirm whether it was upgraded to the expected version. In addition, the log will describe the key steps and status of the upgrade process, such as downloading, verifying, erasing, and writing firmware, as well as the execution results of each step, including success or failure. If any errors occur during the upgrade process, the log will provide error codes, error descriptions, and possible solutions to assist in troubleshooting and resolution. Finally, the log will also record the system configuration information during the upgrade, such as CPU model, memory size, and hard disk type, which is very useful for troubleshooting hardware-related upgrade issues.
[0174] By analyzing the BIOS firmware upgrade log, you can perform many operations. First, you can verify the results of the upgrade to ensure that the upgrade is successful and meets expectations. Second, if the upgrade fails or an error occurs, you can use the error information and system information in the log to locate the cause of the problem and take appropriate solutions. In addition, you can evaluate the impact of the upgrade on system performance and optimize the upgrade strategy based on the information in the log to improve efficiency. Finally, you can also check whether the upgrade process complies with security policies and compliance requirements based on the information in the log, such as whether a verified firmware version is used. From the above content, it can be seen that the BIOS firmware upgrade log provides detailed information about the upgrade process, which plays an important role in verifying results, troubleshooting, performance evaluation, and compliance checks.
[0175] Finally, in order to save the storage space of the FLASH chip, the image information comprehensive file in the second partition is cleared after the upgrade is completed to release the storage space.
[0176] In the above embodiments, the basic input output system firmware upgrade method is described in detail. The present invention also provides a corresponding embodiment of the basic input output system firmware upgrade device.
[0177] Figure 2 A schematic diagram of a basic input / output system firmware upgrade device provided by an embodiment of the present invention. Figure 2 As shown, the device comprises:
[0178] The splitting module 10 is used to split the flash memory chip into a plurality of memory technology device partitions; wherein the memory technology device partitions include a first partition storing an original image file of a basic input / output system firmware and an idle second partition.
[0179] The generating module 11 is used to generate a comprehensive image information file and store it in the free second partition; wherein the comprehensive image information file at least includes the original image file and its corresponding upgrade flag.
[0180] The upgrade module 12 is used to obtain the image file to be upgraded of the basic input and output system firmware when upgrading the basic input and output system firmware, refresh and upgrade the original image file in the first partition according to the image file to be upgraded, and update the upgrade flag after the refresh and upgrade is completed.
[0181] The judging module 13 judges whether the basic input and output system firmware has been upgraded according to the upgrade flag in the image information comprehensive file when the system is powered off and then powered on again; if not, the replacing module 14 is triggered.
[0182] The replacement module 14 refreshes and replaces the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file.
[0183] In some embodiments, the splitting module 10 includes:
[0184] The first determination submodule is used to determine the space size of the flash memory chip;
[0185] A first splitting submodule is used to split the flash memory chip into a plurality of memory technology device partitions through a memory technology device driver based on a preset partition size and a space size of the flash memory chip;
[0186] The parameter configuration submodule is used to define the parameters of each memory technology device partition according to the device tree or the configuration platform file; wherein the parameters at least include the starting address, space size and name of the memory technology device partition.
[0187] In some embodiments, the first splitting submodule includes:
[0188] A registration submodule, used to register the memory technology device partition in the driver of the flash chip;
[0189] A calling submodule is used to call a memory technology device subsystem function to create a first partition and a second partition;
[0190] The first partition and the second partition are of equal size, and both contain a preset number of sub-partitions; the original image file of the basic input / output system firmware is stored in each sub-partition of the first partition in the form of a preset number of original image blocks.
[0191] In some embodiments, the generating module 11 includes:
[0192] A reading submodule, used for reading each original image block in the first partition into the file system;
[0193] A first calculation submodule, used to calculate the checksum and file size information of each original image block based on the file system;
[0194] The first setting submodule is used to set the upgrade flag corresponding to each original image block; wherein the initial value of the upgrade flag indicates that it has not been upgraded;
[0195] The first generation submodule is used to generate the image information comprehensive file corresponding to each original image block according to each check value, each file size information, each upgrade flag bit and each original image block;
[0196] The first storage submodule is used to store each mirror information comprehensive file in each sub-partition of the second partition respectively.
[0197] In some embodiments, the upgrade module 12 includes:
[0198] A first acquisition submodule is used to acquire the encrypted image file of the basic input and output system firmware to be upgraded;
[0199] The decryption submodule is used to decrypt the image file to be upgraded;
[0200] The format conversion submodule is used to convert the decrypted image file to be upgraded into a preset format.
[0201] In some embodiments, the upgrade module 12 includes:
[0202] A sub-splitting module is used to split the image file to be upgraded into a preset number of image blocks to be upgraded;
[0203] The second determination submodule is used to determine the target original image block to be upgraded and its corresponding target image block to be upgraded according to the difference between each original image block and each image block to be upgraded;
[0204] A third determination submodule is used to determine a target subpartition of the first partition where the target original image block is located, and to write the corresponding target image block to be upgraded to the target subpartition;
[0205] The fourth determination submodule is used to determine the target image information comprehensive file in the second partition corresponding to the target original image block, and update the upgrade flag in the target image information comprehensive file to upgraded.
[0206] In some embodiments, the second determining submodule includes:
[0207] A corresponding submodule, used for making a one-to-one correspondence between each original image block and each image block to be upgraded according to the offset of each original image block and the offset of each image block to be upgraded;
[0208] The first judgment submodule is used to judge whether there are differences in the file contents of each group of original image blocks and the image blocks to be upgraded; if so, it is confirmed that the original image blocks need to be upgraded; if not, it is confirmed that the original image blocks do not need to be upgraded.
[0209] In some embodiments, it also includes:
[0210] The second acquisition submodule is used to acquire the image information comprehensive file in the second partition corresponding to the original image block that does not need to be upgraded, so as to obtain the upgrade-free image information comprehensive file;
[0211] The update submodule is used to update the upgrade flag in the upgrade-free image information comprehensive file to upgraded.
[0212] In some embodiments, the determination module 13 includes:
[0213] A traversal submodule, used for traversing each image information comprehensive file in the second partition through the baseboard management controller;
[0214] The second judgment submodule is used to judge whether the upgrade flag bits in each image information comprehensive file all indicate that they have been upgraded; if so, it is confirmed that the basic input and output system firmware upgrade is completed; if not, it is confirmed that the basic input and output system firmware upgrade is not completed due to the power outage, and the replacement module 14 is triggered.
[0215] In some embodiments, the replacement module 14 includes:
[0216] A fifth determination submodule is used to determine the image information comprehensive file to which the upgrade flag bit representing non-upgrade belongs, so as to determine the backup image information comprehensive file;
[0217] The parsing submodule is used to parse out the backup original image block in the backup image information comprehensive file;
[0218] The flashing submodule is used to flash the backup original image block to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded.
[0219] In some embodiments, the parsing submodule includes:
[0220] A second calculation submodule, used for calculating the checksum of the backup original image block;
[0221] The third judgment submodule is used to judge whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file; if so, it is confirmed that the backup original image block is parsed successfully; if not, it is confirmed that the backup original image block is parsed failed.
[0222] In some embodiments, it also includes:
[0223] The restart submodule is used to trigger the system restart process on the CPU side;
[0224] A log generation submodule, used to generate a basic input and output system firmware upgrade log through a baseboard management controller;
[0225] The clearing module is used to clear the image information comprehensive file in the second partition.
[0226] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0227] In addition, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the basic input and output system firmware upgrade method in the above embodiment when the computer program / instruction is executed by a processor.
[0228] Figure 3 A schematic diagram of a basic input / output system firmware upgrade device provided by an embodiment of the present invention. Figure 3 As shown, the basic input and output system firmware upgrade device includes:
[0229] A memory 20, used for storing computer programs;
[0230] The processor 21 is used to implement the steps of the basic input and output system firmware upgrade method mentioned in the above embodiment when executing the computer program.
[0231] The basic input and output system firmware upgrade device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0232] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0233] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, the relevant steps of the basic input and output system firmware upgrade method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to data involved in the basic input and output system firmware upgrade method.
[0234] In some embodiments, the BIOS firmware upgrade device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0235] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the basic input and output system firmware upgrading device, and may include more or less components than those shown in the figure.
[0236] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0237] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.
[0238] The above is a detailed introduction to a basic input / output system firmware upgrade method, product, device and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.
[0239] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A basic input / output system firmware upgrade method, characterized in that: include: Splitting the flash memory chip into a plurality of memory technology device partitions; wherein the memory technology device partitions include a first partition storing an original image file of a basic input / output system firmware and an idle second partition; Generate a comprehensive image information file and store it in the idle second partition; wherein the comprehensive image information file at least includes the original image file and its corresponding upgrade flag; When upgrading the basic input / output system firmware, obtaining the image file to be upgraded of the basic input / output system firmware, refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed; When the system is powered off and then powered on again, judging whether the basic input and output system firmware has been upgraded according to the upgrade flag in the image information comprehensive file; If not, refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file; The step of splitting the flash memory chip into a plurality of memory technology device partitions includes: Determine the space size of the flash memory chip; Based on a preset partition size and a space size of the flash memory chip, the flash memory chip is split into a plurality of the memory technology device partitions by a memory technology device driver; Defining parameters of each of the memory technology device partitions according to a device tree or a configuration platform file; wherein the parameters at least include a starting address, a space size, and a name of the memory technology device partition; The step of dividing the flash memory chip into a plurality of memory technology device partitions by using a memory technology device driver includes: Registering the memory technology device partition in a driver of the flash memory chip; Calling a memory technology device subsystem function to create the first partition and the second partition; The first partition and the second partition are of equal size, and both the first partition and the second partition include a preset number of sub-partitions; the original image file of the basic input / output system firmware is stored in each sub-partition of the first partition in the form of a preset number of original image blocks; The step of generating a comprehensive image information file and storing the file in the idle second partition includes: Reading each of the original image blocks in the first partition into a file system; Based on the file system, calculating the checksum and file size information of each of the original image blocks; Setting the upgrade flag bit corresponding to each of the original image blocks; wherein the initial value of the upgrade flag bit indicates that it has not been upgraded; Generate the image information comprehensive file corresponding to each original image block according to each check value, each file size information, each upgrade flag bit and each original image block; storing each of the image information comprehensive files in each sub-partition of the second partition respectively; The refreshing and upgrading the original image file in the first partition according to the image file to be upgraded, and updating the upgrade flag after the refreshing and upgrading is completed, comprises: Dividing the image file to be upgraded into a preset number of image blocks to be upgraded; Determining a target original image block to be upgraded and its corresponding target image block to be upgraded according to the difference between each of the original image blocks and each of the image blocks to be upgraded; Determine a target sub-partition of the first partition where the target original image block is located, and flash the corresponding target image block to be upgraded to the target sub-partition; Determine a target image information comprehensive file in the second partition corresponding to the target original image block, and update the upgrade flag in the target image information comprehensive file to upgraded; The step of determining the target original mirror block to be upgraded and its corresponding target mirror block to be upgraded according to the difference between each of the original mirror blocks and each of the mirror blocks to be upgraded includes: According to the offset of each original mirror block and the offset of each mirror block to be upgraded, each original mirror block is matched with each mirror block to be upgraded one by one; Determine whether there is a difference between the file contents of the original image blocks in each group and the image blocks to be upgraded; If yes, confirm that the original image block needs to be upgraded; If not, confirm that the original image block does not need to be upgraded; Also includes: Generate a basic input and output system firmware upgrade log; wherein the basic input and output system firmware upgrade log includes the upgrade start time and end time, basic input and output system firmware version numbers before and after the upgrade, key steps and status of the upgrade process and the results of the key step execution, error code, error description and corresponding solution, and also includes system configuration information; Analyze the basic input and output system firmware upgrade log. When it is confirmed that the upgrade fails or an error occurs during the upgrade, locate the cause based on the error description and system configuration information, and implement the corresponding solution.
2. The basic input / output system firmware upgrade method according to claim 1, characterized in that: The step of obtaining the image file to be upgraded of the basic input / output system firmware includes: Obtaining the encrypted image file to be upgraded of the basic input and output system firmware; Decrypting the image file to be upgraded; The decrypted image file to be upgraded is converted into a preset format.
3. The basic input / output system firmware upgrade method according to claim 1, characterized in that: After confirming that the original image block does not need to be upgraded, the method further includes: Acquire the image information comprehensive file in the second partition corresponding to the original image block that does not need to be upgraded, so as to obtain the upgrade-free image information comprehensive file; The upgrade flag in the upgrade-free image information comprehensive file is updated to upgraded.
4. The basic input / output system firmware upgrade method according to claim 1, characterized in that: The step of judging whether the basic input / output system firmware has been upgraded according to the upgrade flag in the image information comprehensive file includes: Traversing each of the image information comprehensive files in the second partition through a baseboard management controller; Determining whether the upgrade flags in each of the image information comprehensive files all indicate that they have been upgraded; If so, confirm that the BIOS firmware upgrade is complete; If not, it is confirmed that the basic input and output system firmware has not been upgraded due to the power outage, and the step of refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file is entered.
5. The basic input / output system firmware upgrade method according to claim 4, characterized in that: The refreshing and replacing the image file to be upgraded in the first partition according to the original image file in the image information comprehensive file includes: Determine the image information comprehensive file to which the upgrade flag bit indicating non-upgrade belongs, so as to determine a backup image information comprehensive file; Parsing the backup original image block in the backup image information comprehensive file; The backup original image block is written to the sub-partition corresponding to the first partition to replace the abnormal image block to be upgraded.
6. The basic input / output system firmware upgrade method according to claim 5, characterized in that: The step of parsing the backup original image block in the backup image information comprehensive file includes: Calculating the checksum of the backup original image block; Determine whether the check value of the backup original image block is the same as the check value in the backup image information comprehensive file; If yes, confirm that the backup original image block is parsed successfully; If not, it is confirmed that the parsing of the backup original image block fails.
7. The basic input / output system firmware upgrade method according to any one of claims 4 to 6, characterized in that: After confirming that the BIOS firmware upgrade is complete, it also includes: Trigger the system restart process on the CPU side; Generate a basic input and output system firmware upgrade log through a baseboard management controller; The image information comprehensive file in the second partition is cleared.
8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the basic input / output system firmware upgrade method according to any one of claims 1 to 7 are implemented.
9. A basic input and output system firmware upgrade device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the basic input / output system firmware upgrade method as claimed in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the basic input and output system firmware upgrade method according to any one of claims 1 to 7 are implemented.
