Image processing method, computer program product, device and storage medium
By obtaining and verifying the image file in the mirroring processing method and refreshing it to different partitions of the preset logical flash memory, the problem of insufficient traditional storage capacity is solved, and the system update and maintenance efficiency are improved and the storage space is expanded.
Patent Information
- Application Number
- CN202411141097.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-20
AI Technical Summary
Traditional Nand Flash storage capacity cannot meet the growing demand for mirror storage, resulting in difficulty in system update and maintenance.
By obtaining binary image files and folder image files, checking and refreshing to different partitions of preset logical flash memory, forming flash partitions and embedded memory partitions, expanding the image file storage space, and refreshing them according to the image file type. Improve the refresh speed of the target image file.
It has achieved the efficiency of system update and maintenance, expanded storage space, simplified the management and update process of mirror files, and ensured the stable operation of the system.
Smart Images

Figure CN118656036B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image processing method, a computer program product, a device and a storage medium. Background Art
[0002] In terms of storage technology, the storage of the baseboard management controller image mainly relies on advanced storage devices such as Nand Flash (non-volatile memory based on Nand technology) and eMMC (embedded multimedia card). Nand Flash occupies an important position in the field of data storage with its high-speed writing performance and large storage capacity, and is particularly suitable for application scenarios that require frequent writing operations and large-capacity data storage. At the same time, eMMC, as a storage device integrated with a storage controller, is also widely used due to its high performance and large capacity.
[0003] However, with the continuous growth of customer demand and the continuous expansion of the Linux system kernel, the traditional Nand Flash storage capacity can no longer meet the growing demand for image storage, which also makes system updates and maintenance difficult. Summary of the invention
[0004] Based on this, it is necessary to provide an image processing method, computer program product, device and storage medium that can improve the efficiency of system update and maintenance in order to solve the above technical problems.
[0005] In order to solve the above technical problems, in a first aspect, a mirror processing method is provided, the method comprising:
[0006] Obtain a first image file and a second image file, the first image file is a binary image file, and the second image file is a folder image file;
[0007] Verifying the first image file and the second image file;
[0008] Refresh the first image file that has been successfully verified to the first partition of the preset logical flash memory, and refresh the second image file that has been successfully verified to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is a flash memory partition, and the second partition of the preset logical flash memory is an embedded memory partition;
[0009] The first image file refreshed to the first partition of the preset logical flash memory and the second image file refreshed to the second partition of the preset logical flash memory are spliced to obtain a target image file, and the target image file is processed.
[0010] In one embodiment, obtaining the first image file and the second image file includes:
[0011] Acquire information of a first storage area corresponding to a first partition of a preset logical flash memory;
[0012] Acquire information of a second storage area corresponding to a second partition of a preset logical flash memory;
[0013] Determine whether the first partition and the second partition are readable and writable according to the information of the first storage area and the information of the second storage area;
[0014] If the first partition and the second partition are readable and writable, export the file system path;
[0015] Mounting a first storage area corresponding to the first partition to the file system based on the file system path;
[0016] The second storage area corresponding to the second partition is mounted to the file system based on the file system path.
[0017] In one embodiment, a first image file refreshed to a first partition of a preset logical flash memory and a second image file refreshed to a second partition of a preset logical flash memory are spliced to obtain a target image file, and processing the target image file includes:
[0018] Obtaining a starting address position and an ending address position of a first partition of a preset logical flash memory corresponding to the first image file;
[0019] Obtaining a starting address position and an ending address position of a second partition of a preset logical flash memory corresponding to the second image file;
[0020] The first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
[0021] In one embodiment, verifying the first image file and the second image file includes:
[0022] Verify the first image file and the second image file respectively according to a preset method to obtain a first verification result;
[0023] Verifying the first partition of the preset logical flash memory and the second partition of the preset logical flash memory respectively to obtain a second verification result;
[0024] Whether the verification results of the first image file and the second image file are abnormal is determined according to the first verification result and the second verification result.
[0025] In one embodiment, the method further comprises:
[0026] If the verification results of the first image file and the second image file are abnormal, obtaining the read start offset, data segment size and data value corresponding to the first image file and the second image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the basic management controller;
[0027] The baseboard management controller parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
[0028] In one embodiment, the method further comprises:
[0029] Setting a plurality of preset logical flash memories, wherein the plurality of preset logical flash memories are used to store a plurality of target image files;
[0030] The plurality of preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the plurality of target image files include a primary target image file and a backup target image file;
[0031] The main target image file is refreshed into the first preset logical flash memory, and the backup target image file is refreshed into the second preset logical flash memory.
[0032] In one embodiment, the method further comprises:
[0033] Real-time monitoring of whether the main target image file has changed;
[0034] If the main target image file changes, the setting item will be changed;
[0035] When the setting change item is triggered, the information to be synchronized of the main target image file is obtained;
[0036] The backup target image file is updated according to the information to be synchronized, so as to achieve information synchronization between the main target image file and the backup target image file.
[0037] In one embodiment, updating the standby target image file according to the information to be synchronized includes:
[0038] In response to a change in the primary target image file, obtaining information to be synchronized and location information of the information to be synchronized in the primary target image file;
[0039] The backup target image file is updated according to the information to be synchronized and the location information of the information to be synchronized in the primary target image file.
[0040] In one embodiment, the method further comprises:
[0041] The boot program started by the baseboard management controller calls the main target image file to start the baseboard management controller;
[0042] The number of times the boot program calls the main target image file is obtained. When the number of times the boot program calls the main target image file is greater than the preset number of calls, the boot program is directed to call the backup target image file.
[0043] In one embodiment, the method further comprises:
[0044] When the time for starting the baseboard management controller by using the main target image file exceeds the first time period and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller;
[0045] After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, the backup target image file is used to start the baseboard management controller. If the baseboard management controller is not started when the time length for starting the baseboard management controller using the main target image file exceeds a second time length, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0046] In one embodiment, the preset logical flash memory further includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes:
[0047] After the information to be synchronized is detected, the information to be synchronized is stored in a third partition of a preset logical flash memory, where the third partition is a shared partition for the primary target image file and the backup target image file.
[0048] In one embodiment, the method further comprises:
[0049] Get the volume of information to be synchronized;
[0050] Obtaining the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory;
[0051] The third partition of the preset logical flash memory is divided according to the volume of the upgrade data corresponding to the target image file and the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory.
[0052] In order to solve the above technical problem, in a second aspect, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0053] In order to solve the above technical problem, in the third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: the processor implements the steps of the method described in the first aspect when executing the computer program.
[0054] In order to solve the above technical problem, in a fourth aspect, the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0055] Different from the prior art, the present application obtains a first image file and a second image file, wherein the first image file is a binary image file and the second image file is a folder image file; verifies the first image file and the second image file; refreshes the first image file that has been successfully verified to the first partition of the preset logical flash memory, and refreshes the second image file that has been successfully verified to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is a flash memory partition, and the second partition of the preset logical flash memory is an embedded memory partition. In this way, the preset logical partition formed by the flash memory partition and the embedded memory partition is designed, which can expand the image file storage space, and divide the image file into binary image files and folder image files according to different types, and refresh the image file in different regions according to different types of image files, which can improve the refresh speed of the target image file. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of the structure of an image processing system in one embodiment;
[0057] Figure 2 A schematic diagram of the structure of a preset logic flash memory in an embodiment;
[0058] Figure 3 A schematic diagram of a process flow of a mirror processing method in one embodiment;
[0059] Figure 4 is a structural block diagram of an image processing device in an embodiment;
[0060] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0062] In one embodiment, the image processing method of the present application is applied to an image processing system, such as Figure 1 As shown in the figure, the image processing system includes BMC Soc (system on chip of baseboard management controller), Flash (flash memory), and eMMC (embedded multimedia card). The first end of BMC Soc is connected to the first end of Flash, and the second end of BMC Soc is connected to the first end of eMMC. BMC Soc integrates multiple chips with different functional components, including processor core, memory controller, graphics processor, hardware accelerator, interface controller, etc. In the server, SoC usually refers to an integrated chip on the server motherboard, which integrates the main functions of the server, such as processor, memory controller, PCIe controller, etc. SoC plays the role of connecting and coordinating various hardware components in the server, and provides the computing and processing capabilities required by the server system. Flash includes Flash0 and Flash1 in the figure, wherein Flash can be specifically Nand Flash (non-volatile memory based on Nand technology). Compared with traditional Flash, Nand Flash has higher storage density, lower power consumption and longer life. eMMC refers to a package consisting of flash memory and flash memory controller integrated on the same silicon chip. Nand Flash and eMMC are suitable for application scenarios that require frequent write operations and large-capacity data storage.
[0063] Among them, in this application, the first partition (non-volatile memory 0, non-volatile memory 1) and the second partition (storage area 0, storage area 1) in the eMMC are set to form a preset logical flash memory (logical non-volatile memory 0 and logical non-volatile memory 1). The non-volatile memory 0 and non-volatile memory 1 shown in the figure are specifically Nand Flash. Combining the non-volatile memory and the storage area in the eMMC to design a logical non-volatile memory for expansion can optimize hardware resources. Figure 2 As shown, two non-volatile memories (non-volatile memory 0, non-volatile memory 1) are used together with two storage areas (storage area 0, storage area 1) in the eMMC to form two logical non-volatile memories (logical non-volatile memory 0 and logical non-volatile memory 1 shown in the figure) for capacity expansion.
[0064] In one embodiment, Figure 3 As shown, the present application provides a mirror processing method, which specifically includes the following steps:
[0065] Step 101, obtaining a first image file and a second image file, wherein the first image file is a binary image file, and the second image file is a folder image file.
[0066] Specifically, the first image file and the second image file are files required for the server component to perform a firmware upgrade, that is, image files that need to be refreshed during the firmware upgrade. It can be understood that since the firmware upgrade is required, the first image file and the second image file are both new version image files. Among them, the first image file is a binary image file, and the second image file is a folder image file.
[0067] In a specific implementation, taking the commonly used 64M Nand Flash as an example, if the required image space is 256M, the first 64M will be encoded in binary form to form a first image file. This encoding method ensures the compactness and efficiency of the image, and provides strong support for the rapid startup and operation of the system. The remaining 192M space is stored in a folder format to form a second image file. This format has higher flexibility and scalability, and is convenient for subsequent data updates and management. Finally, the first image file and the second image file will be spliced, signed and packaged into a complete target image file for subsequent use.
[0068] In one embodiment, before obtaining the first image file and the second image file, it also includes: obtaining information of a first storage area corresponding to a first partition of a preset logical flash memory; obtaining information of a second storage area corresponding to a second partition of the preset logical flash memory; judging whether the first partition and the second partition are readable and writable based on the information of the first storage area and the information of the second storage area; if the first partition and the second partition are readable and writable, exporting a file system path; mounting the first storage area corresponding to the first partition to the file system based on the file system path; mounting the second storage area corresponding to the second partition to the file system based on the file system path.
[0069] The first partition of the preset logical flash memory here is the flash memory partition, that is, the non-volatile memory storage area in the logical non-volatile memory. The second partition here is the embedded memory partition. That is, the storage area in the eMMC in the logical non-volatile memory. The first storage area information can be the storage data and address information of the first partition, and the second storage area information can be the storage data and address information of the second partition. According to the first storage area and the second storage area information, it is determined whether the first partition and the second partition are readable and writable. If the first partition and the second partition are readable and writable, the file system path is exported; the first storage area corresponding to the first partition is mounted to the file system based on the file system path; the second storage area corresponding to the second partition is mounted to the file system based on the file system path. That is, after confirming that all partitions in all logical non-volatile memories are readable and writable, subsequent operations are performed, and the path of the exported file system is recorded at the same time, which can realize tracking and confirming which file systems are being shared and the specific location of the file system on the server. This process not only helps to ensure the stability and reliability of the file system, but also can improve the overall work efficiency and effectively avoid the occurrence of problems such as interruptions during the operation of the server.
[0070] When the server is started later, the Soc processor is first responsible for loading the u-boot boot program. This key step lays a solid foundation for the subsequent system startup. When the u-boot boot kernel starts, it will mount the corresponding storage area in the eMMC to the Linux file system of the BMC, and will also mount the non-volatile memory to the Linux file system formed by the BMC, forming a logical storage space, that is, a logical non-volatile memory. In this way, the BMC can easily read and write the logical non-volatile memory file system, thereby realizing efficient management of system data.
[0071] In the present application, a second image file is set to store some specific execution function files. In this case, during the mounting process, the non-volatile memory can be mounted to the Linux file system formed by the BMC first, and then the corresponding storage area in the eMMC can be mounted to the Linux file system of the BMC. Since the second image file is some specific execution functions, even after the non-volatile memory is mounted, mounting the eMMC will not affect the startup of the BMC.
[0072] Step 102: verify the first image file and the second image file.
[0073] Step 103, refresh the first image file that has been verified successfully to the first partition of the preset logical flash memory, and refresh the second image file that has been verified successfully to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is the flash memory partition, and the second partition of the preset logical flash memory is the embedded memory partition.
[0074] Specifically, the first image file and the second image file can be verified respectively according to a preset method to obtain a first verification result; the first partition of the preset logical flash memory and the second partition of the preset logical flash memory can be verified respectively to obtain a second verification result; and whether the verification results of the first image file and the second image file are abnormal can be determined based on the first verification result and the second verification result.
[0075] The preset method here can be to use the system's built-in tools to calculate the hash values for the first image file and the second image file. Specifically, you can enter the directory where the image file is located by entering the cmd command. Next, use the certutil command provided by the system to verify the hash value of the specified file. The obtained hash value is a unique string, which is used to verify the integrity of the file by comparing the hash values of the first image file and the second image file with the official standard hash value. When the hash value of the first image file is consistent with the standard first hash value and the hash value of the second image file is consistent with the standard second hash value, it means that the image file has not been tampered with, otherwise the image file may be damaged or incomplete.
[0076] In addition, the detection of image files is not limited to hash value verification, but also includes checking the file format, size, and whether it contains viruses or malware. Ensuring the security and integrity of the file is a necessary step before using the image file, especially when performing critical operations such as system installation or data recovery.
[0077] After verifying the first image file and the second image file according to the preset method, the first partition and the second partition of the preset logical flash memory are verified, and the verification here can be to determine whether the storage devices corresponding to the first partition and the second partition can operate normally, and whether the available storage space of the first partition and the second partition can accommodate the first image file and the second image file. When the first verification result and the second verification result are both normal, it is determined that there is no abnormality in the verification results of the first image file and the second image file.
[0078] The accuracy of system update and maintenance can be improved by first verifying the file contents of the first image file and the second image file by calculating hash values, and verifying the first partition and the second partition of the preset logical flash memory.
[0079] In a feasible implementation manner, a data signature and a public key corresponding to the target image file can be obtained, and the digital signature and the public key are used to perform signature verification on the target image file, an image file that has not been refreshed is obtained, and a hash value corresponding to the image file that has not been refreshed is calculated as the digital signature. The public key is used to calculate the hash value of the target image file to obtain the hash value corresponding to the target image file, and the digital signature and the hash value corresponding to the target image file are compared. If the digital signature is consistent with the hash value corresponding to the target image file, the target image file passes the signature verification; if the hash value corresponding to the target image file is inconsistent with the digital signature, it is determined that the hash value corresponding to the target image file has not passed the verification.
[0080] By comparing the digital signature and the hash value corresponding to the target image file, it is determined whether the digital signature and the hash value corresponding to the target image file are consistent. If they are consistent, a secure boot is performed. If they are inconsistent, it is considered that the target image file has been tampered with and the server is prohibited from starting. This can ensure the security of server startup and reduce the cost of security verification of the target image file.
[0081] In one embodiment, if the verification result of the first image file and / or the second image file is determined to be abnormal, the read start offset, data segment size and data value corresponding to the first image file and the second image file are obtained, and the data value of the data segment size is written to the starting offset position in the underlying memory of the basic management controller. The baseboard manager parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
[0082] Among them, the bottom memory is EEPROM (electrically erasable programmable read-only memory), and a modification file of EEPROM data is provided. The baseboard management controller is directly allowed to modify the bottom memory. The version number can be added at the same time to facilitate the compatibility of the BMC (baseboard management controller) parsing software. When the verification results of the first image file and the second image file are abnormal, the read start offset, data segment size and data value corresponding to the first image file and the second image file can be written, and the data value of the data segment size can be written to the starting offset position in the bottom memory of the basic management controller. In this way, the image file parsing can be started according to the data value of the data segment size written to the starting offset position in the bottom memory, and the image file can be refreshed according to the parsing result.
[0083] The refresh mechanism is a key part of the BMC firmware update. Through the web interface, administrators can easily upload the target image file. After the upload is completed, the BMC will verify the signature of the uploaded target image file to ensure its security and integrity. After the signature verification is passed, the BMC will unpack the target image file and distribute it to two independent upgrade processes for image refresh operations. This dual-process design is designed to increase the upgrade speed and shorten the upgrade time, thereby ensuring the continuous and stable operation of the system.
[0084] In a specific implementation, taking the commonly used 64M Nand Flash as an example, if the required image space is 256M, during the flashing process, the first 64M of data (the first image file) will be written into the Nand Flash (the first partition) according to the sector blocks; and the remaining 192M of data will be efficiently written into the storage area of the eMMC (the second partition) in the form of a folder.
[0085] In the prior art, when the storage area of a non-volatile memory is not enough to store the target image file, it is usually to establish multiple non-volatile memories, expand the capacity by setting multiple non-volatile memories, establish the corresponding relationship between multiple non-volatile memories, store the target image file in multiple non-volatile memories with mapping relationships, and when refreshing the image, find the non-volatile memories with the same target image file and have a mapping relationship, and refresh the image file to these non-volatile memories. Or in the prior art, if the storage area of a non-volatile memory is not enough, a part of the area will be divided from another non-volatile memory to store the excess part of a non-volatile memory, and there is a form of storage crossover. The logical non-volatile memory designed in this application is to achieve capacity expansion through the storage area in the non-volatile memory and the eMMC, and by forming a logical non-volatile memory, there is no need to establish a mapping relationship between different devices. And in the subsequent refreshing of the image file by area according to the type of the image file, it can facilitate the subsequent system data update and management.
[0086] In one implementation, the first image file and the second image file may be concatenated to generate a target image file, and the target image file may be verified.
[0087] Specifically, the starting address position and the ending address position of the first partition of the preset logical flash memory corresponding to the first image file can be obtained; the starting address position and the ending address position of the second partition of the preset logical flash memory corresponding to the second image file can be obtained; the first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
[0088] In one embodiment, invalid data and valid data corresponding to the first image file and the second image file can be extracted, and the valid data corresponding to the first image file and the second image file can be compressed to generate a first compressed image file and a second compressed image file. The first compressed image file and the second compressed image file are spliced to obtain a target image file to reduce the size of the target image file.
[0089] The above starting address position is the starting address number of the storage area; the ending address position is the ending address number of the storage area; valid data refers to the data saved by the partition that is important for system startup, parameter configuration and other operations; invalid data refers to the data filled in the partition to make up for the gaps in valid data, usually filled with the number 0.
[0090] After it is determined that the target image file is successfully verified, the target image file is unpacked to obtain a first image file and a second image file, and refresh operations are performed on the first image file and the second image file respectively.
[0091] The present application has multiple preset logical flash memories, and the multiple preset logical flash memories are used to store multiple target image files; wherein the multiple preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the multiple target image files include a main target image file and a backup target image file; the main target image file is refreshed to the first preset logical flash memory, and the backup target image file is refreshed to the second preset logical flash memory.
[0092] It is understandable that each of the multiple preset logical flash memories in the present application includes a first partition and a second partition. The first preset logical flash memory can be used to store the main target backup file, and the second preset logical flash memory can be used to store the backup target image file. The main target image file and the backup target image file are a redundancy mechanism. When the main target image file is used to perform the baseboard management controller startup or image refresh operation, the backup target image file can be switched to re-execute the operation.
[0093] After completing the image upgrade in this application, the BMC will restart the firmware system and start from the backup image. At this time, the backup target image file will become the new primary target image file. In order to facilitate data management and correspondence, a fixed correspondence method is adopted between the non-volatile memory (first partition) and the eMMC storage area (second partition). In addition, the eMMC can also be designed to realize decoupling operation from the non-volatile memory with a master-slave switching architecture. The first priority can be to start from the logical non-volatile memory 0, or it can be started from the logical non-volatile memory 1 at the first priority. Assuming that the logical non-volatile memory 0 is now started to refresh, and the logical non-volatile memory 1 is refreshed, the next time it is started from the logical non-volatile memory 1, the logical non-volatile memory 1 will become the primary image at the next startup. Then the logical non-volatile memory 0 becomes the backup image, so that the architecture of the master-slave switching can be realized and the non-volatile memory can be decoupled.
[0094] In one embodiment, the present application also includes: real-time monitoring of whether the main target image file has changed; if the main target image file has changed, triggering a change setting item; when the change setting item is triggered, obtaining the to-be-synchronized information of the main target image file; updating the backup target image file according to the to-be-synchronized information to achieve information synchronization between the main target image file and the backup target image file.
[0095] When the primary target image file is changed, the information to be synchronized and its location information in the primary target image file are obtained, and the backup target image file is updated according to the information to be synchronized and its location information in the primary target image file.
[0096] To ensure data integrity and consistency, the baseboard management controller uses a dual-image synchronization mechanism during operation. Since the Linux system may change the configuration file due to automatic adjustment or user settings, the configuration refresh function needs to be retained in many application scenarios. At the same time, the consistency of the configuration file also needs to be maintained during dual-image failover. To achieve this goal, the BMC runs two logical non-volatile memories, each containing two pairs of logical non-volatile memory storage partitions (i.e., non-volatile memory and eMMC storage area). The file architecture of these two logical non-volatile memory partitions is decoupled, that is, the file contents are not cross-stored. When synchronizing the target image file, the rsync image synchronization process will be run between the non-volatile memories to ensure data consistency; among them, rsync is a data image backup tool under the Linux system. Remote synchronization can be used with the fast incremental backup tool Remote Sync, which supports local replication or synchronization with other SSH and rsync hosts. At the same time, a similar rsync image synchronization process will be run between the eMMC storage areas. It is worth noting that the buffer of the non-volatile memory rsync process is placed in the memory of the BMC to increase the data exchange speed; while the buffer of the eMMC storage area rsync process is placed in the eMMC file system to take advantage of its high performance and large capacity.
[0097] In one embodiment, the present application also includes a configuration for the failover of the logical non-volatile memory, wherein, when the server is started, the boot program started by the baseboard management controller can call the main target image file to start the baseboard management controller; the number of times the boot program calls the main target image file is obtained, and when the number of times the boot program calls the main target image file is greater than the preset number of calls, the boot program is guided to call the backup target image file. When the time for starting the baseboard management controller using the main target image file exceeds the first time length and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller.
[0098] After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, the backup target image file is used to start the baseboard management controller. If the baseboard management controller is not started when the time length for starting the baseboard management controller using the main target image file exceeds a second time length, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0099] The BMC image consists of three parts: U-boot, kernel, and file system. U-boot is the image boot program. When it starts to boot normally, the watchdog timing function will be turned on. The function of watchdog is a time countdown counter. For example, if the watchdog timeout is 60 seconds, U-boot starts to boot the image program and starts timing. If the kernel information is not successfully booted within 60 seconds, the watchdog will not be closed and will time out. By setting the watchdog timeout action, the spi interface can be switched to the backup Flash information, that is, continue to boot from the backup Flash, thus realizing the dual image switching logic. In addition, if U-boot successfully boots the kernel information, the kernel startup program will re-update the watchdog timeout, that is, set the kernel startup process timeout to avoid kernel panic and other information during the kernel startup process, which causes the startup process to be stuck and the image cannot be switched. Through the timeout mechanism restrictions of the two processes of U-boot and kernel, it is ensured that if any step in the image startup process is abnormal, the image switching mechanism can be triggered.
[0100] At startup, the BMC first loads the kernel through u-boot. If u-boot fails, the SoC's watchdog is responsible for detecting abnormal conditions and starting the system from the backup image to ensure continuous operation. When the backup image is started, it detects the currently active Flash chip and mounts the corresponding eMMC storage area and non-volatile memory when the kernel starts to ensure data continuity and integrity. If u-boot starts successfully but the kernel fails to start, u-boot will remain active and load the kernel in the backup image for startup; at the same time, the kernel in the backup image will also load the eMMC storage area corresponding to the backup non-volatile memory to ensure the normal operation of the system. Once the BMC is successfully started as a whole, the dual-image synchronization mechanism will be immediately executed to ensure that the firmware information in the two logical non-volatile memories remains highly consistent and synchronized; this mechanism greatly improves the reliability and data security of the system, and provides a strong guarantee for the stable operation of the BMC.
[0101] If the second information is received before the timing duration of the watchdog monitoring system meets the preset duration, it indicates that the BIOS (Basic Input Output System) is loaded normally and the CPU is started normally according to the current Flash chip.
[0102] By setting the second time length to be shorter than the first time length, the present application can ensure that when the primary image is abnormal, the baseboard management controller can be started using the backup image and can be restored immediately, thereby avoiding the mirror switching mechanism being triggered again at the next startup, which would cause the startup time to be too long.
[0103] In a specific implementation, the present application forms a preset logical flash memory (logical non-volatile memory) by regularizing storage areas such as non-volatile memory and storage partitions (storage area 0, storage area 1) in eMMC. The important scenarios of logical non-volatile memory in use are described: image startup, image generation, image refresh, dual image synchronization, dual Flash fault switching and other important scenarios. Set BMC startup and image management mechanism: During the startup process of BMC, the Soc processor first loads the u-boot boot program. When u-boot boots the kernel, it mounts the corresponding storage area in the eMMC to the Linux file system of BMC to form a logical non-volatile memory. The generation of the image involves a combination of binary format and file format. By optimizing the storage structure and management method, fast access and update of the image are achieved. Set BMC refresh mechanism: Upload the new firmware image through the web interface, and BMC will automatically perform signature verification, unpacking, distribution and flashing operations. The data will be written to the non-volatile memory and eMMC respectively during the refresh process, realizing a smooth upgrade of the firmware. After the upgrade is completed, the BMC will start from the backup image to achieve smooth switching between the primary and backup images, ensuring the continuous and stable operation of the system. Set up a dual-image synchronization and fault switching mechanism: In order to improve the reliability and stability of the system, the present invention designs a dual-image synchronization and fault switching mechanism. During BMC operation, the two logical non-volatile memory partitions maintain data consistency between the non-volatile memory and the eMMC storage area through the rsync mirror synchronization process. When a fault is detected, the system will switch to the backup image to ensure data continuity and integrity. This mechanism significantly improves the fault tolerance and stability of the system.
[0104] In one embodiment, the preset logical flash memory in the present application also includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes: after the information to be synchronized is detected, the information to be synchronized is stored in the third partition of the preset logical flash memory, and the third partition is a shared partition of the main target image file and the backup target image file.
[0105] Specifically, before the server is started, the volume of the information to be synchronized can be obtained; the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory can be obtained; the remaining space size here refers to the size of the available space remaining after the primary target image file / backup target image file is stored. According to the size of the information to be synchronized, the space of the size of the information to be synchronized is allocated from the second partition of the first preset logical flash memory and the second partition of the second preset logical flash memory to store the information to be synchronized. Please continue to refer to Figure 2 ,from Figure 2 It can be known that the second partition of any preset logical flash memory in this application is a storage area divided from the eMMC device, and a third space can be divided in the eMMC storage space outside this storage area. The eMMC storage space can be designed specifically according to the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory and the volume of the above-mentioned information to be synchronized, so that the eMMC storage space can be fully utilized, and the space of the eMMC storage space can be dynamically adjusted according to the volume of information to be synchronized of different sizes to meet the upgrade of different system files. This method can make full use of the eMMC storage space, and dynamically adjust the space of the eMMC storage space according to the upgrade mirror data to meet the upgrade of different system files, and can ensure the normal operation of the system.
[0106] It should be understood that although Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0107] In one embodiment, Figure 4 As shown, an image processing device is provided, comprising: an acquisition module 20, a verification module 21 and a refresh module 22, wherein:
[0108] An acquisition module 20 is used to acquire a first image file and a second image file, the first image file is a binary image file, and the second image file is a folder image file;
[0109] A verification module 21, used for verifying the first image file and the second image file;
[0110] The refresh module 22 is used to refresh the first image file that has been verified successfully to the first partition of the preset logical flash memory, and refresh the second image file that has been verified successfully to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is the flash memory partition, and the second partition of the preset logical flash memory is the embedded memory partition.
[0111] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0112] Obtaining the first image file and the second image file includes:
[0113] Acquire information of a first storage area corresponding to a first partition of a preset logical flash memory;
[0114] Acquire information of a second storage area corresponding to a second partition of a preset logical flash memory;
[0115] Determine whether the first partition and the second partition are readable and writable according to the information of the first storage area and the information of the second storage area;
[0116] If the first partition and the second partition are readable and writable, export the file system path;
[0117] Mounting a first storage area corresponding to the first partition to the file system based on the file system path;
[0118] The second storage area corresponding to the second partition is mounted to the file system based on the file system path.
[0119] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0120] The method also includes:
[0121] Obtaining a starting address position and an ending address position of a first partition of a preset logical flash memory corresponding to the first image file;
[0122] Obtaining a starting address position and an ending address position of a second partition of a preset logical flash memory corresponding to the second image file;
[0123] The first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
[0124] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0125] Verifying the first image file and the second image file includes:
[0126] Verify the first image file and the second image file respectively according to a preset method to obtain a first verification result;
[0127] Verifying the first partition of the preset logical flash memory and the second partition of the preset logical flash memory respectively to obtain a second verification result;
[0128] Whether the verification results of the first image file and the second image file are abnormal is determined according to the first verification result and the second verification result.
[0129] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0130] The method also includes:
[0131] If the verification results of the first image file and the second image file are abnormal, obtaining the read start offset, data segment size and data value corresponding to the first image file and the second image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the basic management controller;
[0132] The baseboard management controller parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
[0133] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0134] The method also includes:
[0135] Setting a plurality of preset logical flash memories, wherein the plurality of preset logical flash memories are used to store a plurality of target image files;
[0136] The plurality of preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the plurality of target image files include a primary target image file and a backup target image file;
[0137] The main target image file is refreshed into the first preset logical flash memory, and the backup target image file is refreshed into the second preset logical flash memory.
[0138] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0139] The method also includes:
[0140] Real-time monitoring of whether the main target image file has changed;
[0141] If the main target image file changes, the setting item will be changed;
[0142] When the setting change item is triggered, the information to be synchronized of the main target image file is obtained;
[0143] The backup target image file is updated according to the information to be synchronized, so as to achieve information synchronization between the main target image file and the backup target image file.
[0144] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0145] Updating the backup target image file according to the information to be synchronized includes:
[0146] In response to a change in the primary target image file, obtaining information to be synchronized and location information of the information to be synchronized in the primary target image file;
[0147] The backup target image file is updated according to the information to be synchronized and the location information of the information to be synchronized in the primary target image file.
[0148] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0149] The method also includes:
[0150] The boot program started by the baseboard management controller calls the main target image file to start the baseboard management controller;
[0151] The number of times the boot program calls the main target image file is obtained. When the number of times the boot program calls the main target image file is greater than the preset number of calls, the boot program is directed to call the backup target image file.
[0152] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0153] The method also includes:
[0154] When the time for starting the baseboard management controller by using the main target image file exceeds the first time period and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller;
[0155] After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, the backup target image file is used to start the baseboard management controller. If the baseboard management controller is not started when the time length for starting the baseboard management controller using the main target image file exceeds a second time length, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0156] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0157] The preset logical flash memory further includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes:
[0158] After the information to be synchronized is detected, the information to be synchronized is stored in a third partition of a preset logical flash memory, where the third partition is a shared partition for the primary target image file and the backup target image file.
[0159] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0160] The method also includes:
[0161] Get the volume of information to be synchronized;
[0162] Obtaining the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory;
[0163] The third partition of the preset logical flash memory is divided according to the volume of the upgrade data corresponding to the target image file and the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory.
[0164] For the specific definition of the image processing device, please refer to the definition of the image processing method above, which will not be repeated here. Each module in the above-mentioned image processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0165] In one embodiment, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the image processing methods provided by the above methods.
[0166] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a mirror processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0167] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0168] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0169] Step 101, obtaining a first image file and a second image file, wherein the first image file is a binary image file, and the second image file is a folder image file.
[0170] Step 102: verify the first image file and the second image file.
[0171] Step 103, refresh the first image file that has been verified successfully to the first partition of the preset logical flash memory, and refresh the second image file that has been verified successfully to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is the flash memory partition, and the second partition of the preset logical flash memory is the embedded memory partition.
[0172] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0173] Obtaining the first image file and the second image file includes:
[0174] Acquire information of a first storage area corresponding to a first partition of a preset logical flash memory;
[0175] Acquire information of a second storage area corresponding to a second partition of a preset logical flash memory;
[0176] Determine whether the first partition and the second partition are readable and writable according to the information of the first storage area and the information of the second storage area;
[0177] If the first partition and the second partition are readable and writable, export the file system path;
[0178] Mounting a first storage area corresponding to the first partition to the file system based on the file system path;
[0179] The second storage area corresponding to the second partition is mounted to the file system based on the file system path.
[0180] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0181] The method also includes:
[0182] Obtaining a starting address position and an ending address position of a first partition of a preset logical flash memory corresponding to the first image file;
[0183] Obtaining a starting address position and an ending address position of a second partition of a preset logical flash memory corresponding to the second image file;
[0184] The first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
[0185] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0186] Verifying the first image file and the second image file includes:
[0187] Verify the first image file and the second image file respectively according to a preset method to obtain a first verification result;
[0188] Verifying the first partition of the preset logical flash memory and the second partition of the preset logical flash memory respectively to obtain a second verification result;
[0189] Whether the verification results of the first image file and the second image file are abnormal is determined according to the first verification result and the second verification result.
[0190] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0191] The method also includes:
[0192] If the verification results of the first image file and the second image file are abnormal, obtaining the read start offset, data segment size and data value corresponding to the first image file and the second image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the basic management controller;
[0193] The baseboard management controller parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
[0194] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0195] The method also includes:
[0196] Setting a plurality of preset logical flash memories, wherein the plurality of preset logical flash memories are used to store a plurality of target image files;
[0197] The plurality of preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the plurality of target image files include a primary target image file and a backup target image file;
[0198] The main target image file is refreshed into the first preset logical flash memory, and the backup target image file is refreshed into the second preset logical flash memory.
[0199] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0200] The method also includes:
[0201] Real-time monitoring of whether the main target image file has changed;
[0202] If the main target image file changes, the setting item will be changed;
[0203] When the setting change item is triggered, the information to be synchronized of the main target image file is obtained;
[0204] The backup target image file is updated according to the information to be synchronized, so as to achieve information synchronization between the main target image file and the backup target image file.
[0205] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0206] Updating the backup target image file according to the information to be synchronized includes:
[0207] In response to a change in the primary target image file, obtaining information to be synchronized and location information of the information to be synchronized in the primary target image file;
[0208] The backup target image file is updated according to the information to be synchronized and the location information of the information to be synchronized in the primary target image file.
[0209] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0210] The method also includes:
[0211] The boot program started by the baseboard management controller calls the main target image file to start the baseboard management controller;
[0212] The number of times the boot program calls the main target image file is obtained. When the number of times the boot program calls the main target image file is greater than the preset number of calls, the boot program is directed to call the backup target image file.
[0213] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0214] The method also includes:
[0215] When the time for starting the baseboard management controller by using the main target image file exceeds the first time period and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller;
[0216] After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, the backup target image file is used to start the baseboard management controller. If the baseboard management controller is not started when the time length for starting the baseboard management controller using the main target image file exceeds a second time length, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0217] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0218] The preset logical flash memory further includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes:
[0219] After the information to be synchronized is detected, the information to be synchronized is stored in a third partition of a preset logical flash memory, where the third partition is a shared partition for the primary target image file and the backup target image file.
[0220] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0221] The method also includes:
[0222] Get the volume of information to be synchronized;
[0223] Obtaining the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory;
[0224] The third partition of the preset logical flash memory is divided according to the volume of the upgrade data corresponding to the target image file and the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory.
[0225] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0226] Step 101, obtaining a first image file and a second image file, wherein the first image file is a binary image file, and the second image file is a folder image file.
[0227] Step 102: verify the first image file and the second image file.
[0228] Step 103, refresh the first image file that has been verified successfully to the first partition of the preset logical flash memory, and refresh the second image file that has been verified successfully to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is the flash memory partition, and the second partition of the preset logical flash memory is the embedded memory partition.
[0229] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0230] Obtaining the first image file and the second image file includes:
[0231] Acquire information of a first storage area corresponding to a first partition of a preset logical flash memory;
[0232] Acquire information of a second storage area corresponding to a second partition of a preset logical flash memory;
[0233] Determine whether the first partition and the second partition are readable and writable according to the information of the first storage area and the information of the second storage area;
[0234] If the first partition and the second partition are readable and writable, export the file system path;
[0235] Mounting a first storage area corresponding to the first partition to the file system based on the file system path;
[0236] The second storage area corresponding to the second partition is mounted to the file system based on the file system path.
[0237] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0238] The method also includes:
[0239] Obtaining a starting address position and an ending address position of a first partition of a preset logical flash memory corresponding to the first image file;
[0240] Obtaining a starting address position and an ending address position of a second partition of a preset logical flash memory corresponding to the second image file;
[0241] The first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
[0242] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0243] Verifying the first image file and the second image file includes:
[0244] Verify the first image file and the second image file respectively according to a preset method to obtain a first verification result;
[0245] Verifying the first partition of the preset logical flash memory and the second partition of the preset logical flash memory respectively to obtain a second verification result;
[0246] Whether the verification results of the first image file and the second image file are abnormal is determined according to the first verification result and the second verification result.
[0247] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0248] The method also includes:
[0249] If the verification results of the first image file and the second image file are abnormal, obtaining the read start offset, data segment size and data value corresponding to the first image file and the second image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the basic management controller;
[0250] The baseboard management controller parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
[0251] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0252] The method also includes:
[0253] Setting a plurality of preset logical flash memories, wherein the plurality of preset logical flash memories are used to store a plurality of target image files;
[0254] The plurality of preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the plurality of target image files include a primary target image file and a backup target image file;
[0255] The main target image file is refreshed into the first preset logical flash memory, and the backup target image file is refreshed into the second preset logical flash memory.
[0256] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0257] The method also includes:
[0258] Real-time monitoring of whether the main target image file has changed;
[0259] If the main target image file changes, the setting item will be changed;
[0260] When the setting change item is triggered, the information to be synchronized of the main target image file is obtained;
[0261] The backup target image file is updated according to the information to be synchronized, so as to achieve information synchronization between the main target image file and the backup target image file.
[0262] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0263] Updating the backup target image file according to the information to be synchronized includes:
[0264] In response to a change in the primary target image file, obtaining information to be synchronized and location information of the information to be synchronized in the primary target image file;
[0265] The backup target image file is updated according to the information to be synchronized and the location information of the information to be synchronized in the primary target image file.
[0266] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0267] The method also includes:
[0268] The boot program started by the baseboard management controller calls the main target image file to start the baseboard management controller;
[0269] The number of times the boot program calls the main target image file is obtained. When the number of times the boot program calls the main target image file is greater than the preset number of calls, the boot program is directed to call the backup target image file.
[0270] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0271] The method also includes:
[0272] When the time for starting the baseboard management controller by using the main target image file exceeds the first time period and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller;
[0273] After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, the backup target image file is used to start the baseboard management controller. If the baseboard management controller is not started when the time length for starting the baseboard management controller using the main target image file exceeds a second time length, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0274] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0275] The preset logical flash memory further includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes:
[0276] After the information to be synchronized is detected, the information to be synchronized is stored in a third partition of a preset logical flash memory, where the third partition is a shared partition for the primary target image file and the backup target image file.
[0277] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0278] The method also includes:
[0279] Get the volume of information to be synchronized;
[0280] Obtaining the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory;
[0281] The third partition of the preset logical flash memory is divided according to the volume of the upgrade data corresponding to the target image file and the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0282] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0283] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A mirror processing method, characterized in that: include: Obtain a first image file and a second image file, wherein the first image file is a binary image file, and the second image file is a folder image file; Verifying the first image file and the second image file; Refresh the first image file that has been successfully verified to the first partition of the preset logical flash memory, and refresh the second image file that has been successfully verified to the second partition of the preset logical flash memory, wherein the first partition of the preset logical flash memory is a flash memory partition, and the second partition of the preset logical flash memory is an embedded memory partition; The first image file refreshed to the first partition of the preset logical flash memory and the second image file refreshed to the second partition of the preset logical flash memory are spliced to obtain a target image file, and the target image file is processed.
2. The method according to claim 1, characterized in that The obtaining of the first image file and the second image file comprises: Acquire information of a first storage area corresponding to a first partition of a preset logical flash memory; Acquire information of a second storage area corresponding to a second partition of a preset logical flash memory; Determining whether the first partition and the second partition are readable and writable according to the information of the first storage area and the information of the second storage area; If the first partition and the second partition are readable and writable, export the file system path; Mounting a first storage area corresponding to the first partition to the file system based on the file system path; The second storage area corresponding to the second partition is mounted to the file system based on the file system path.
3. The method according to claim 1, characterized in that: The first image file refreshed to the first partition of the preset logical flash memory and the second image file refreshed to the second partition of the preset logical flash memory are spliced to obtain the target image file, which includes: Obtaining a starting address position and an ending address position of a first partition of a preset logical flash memory corresponding to the first image file; Obtaining a starting address position and an ending address position of a second partition of a preset logical flash memory corresponding to the second image file; The first image file is filled according to the starting address position and the ending address of the first partition of the preset logical flash memory, and the second image file is filled according to the starting address position and the ending address of the second partition of the preset logical flash memory to obtain the target image file.
4. The method according to claim 1, characterized in that: The verifying the first image file and the second image file comprises: Verify the first image file and the second image file respectively according to a preset method to obtain a first verification result; Verifying the first partition of the preset logical flash memory and the second partition of the preset logical flash memory respectively to obtain a second verification result; Whether the verification results of the first image file and the second image file are abnormal is determined according to the first verification result and the second verification result.
5. The method according to claim 4, characterized in that The method further comprises: If the verification results of the first image file and the second image file are abnormal, obtaining the read start offset, data segment size and data value corresponding to the first image file and the second image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the basic management controller; The baseboard management controller parses the first image file and the second image file according to the data value of the data segment size, and refreshes the first image file and the second image file according to the parsed image files.
6. The method according to claim 3, characterized in that: The method further comprises: Setting a plurality of preset logical flash memories, wherein the plurality of preset logical flash memories are used to store a plurality of target image files; The plurality of preset logical flash memories include a first preset logical flash memory and a second preset logical flash memory, and the plurality of target image files include a primary target image file and a backup target image file; The primary target image file is refreshed into a first preset logical flash memory, and the backup target image file is refreshed into a second preset logical flash memory.
7. The method according to claim 6, characterized in that The method further comprises: Real-time monitoring of whether the main target image file has changed; If the main target image file is changed, the setting item is changed; When the setting change item is triggered, obtaining the to-be-synchronized information of the primary target image file; The backup target image file is updated according to the information to be synchronized, so as to achieve information synchronization between the primary target image file and the backup target image file.
8. The method according to claim 7, characterized in that The updating of the standby target image file according to the information to be synchronized includes: In response to a change in the primary target image file, obtaining information to be synchronized and location information of the information to be synchronized in the primary target image file; The backup target image file is updated according to the information to be synchronized and the location information of the information to be synchronized in the primary target image file.
9. The method according to claim 1, characterized in that: The method further comprises: The boot program started by the baseboard management controller calls the main target image file to start the baseboard management controller; The number of times the boot program calls the main target image file is obtained, and when the number of times the boot program calls the main target image file is greater than a preset number of times, the boot program is guided to call the backup target image file.
10. The method according to claim 9, characterized in that The method further comprises: When the time for starting the baseboard management controller by using the main target image file exceeds the first time period and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller; After the backup target image file is used to start the baseboard management controller, it is checked whether the main target image file is abnormal. If the main target image file is abnormal, when the time length for starting the baseboard management controller by using the main target image file exceeds a second time length and the baseboard management controller is not started, the backup target image file is used to start the baseboard management controller, wherein the second time length is less than the first time length.
11. The method according to claim 1, characterized in that: The preset logical flash memory further includes a third partition of the preset logical flash memory, and the third partition of the preset logical flash memory is used to store information to be synchronized. The method includes: After the information to be synchronized is detected, the information to be synchronized is stored in a third partition of a preset logical flash memory, where the third partition is a shared partition of the primary target image file and the backup target image file.
12. The method according to claim 11, characterized in that The method further comprises: Get the volume of information to be synchronized; Obtaining the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory; The third partition of the preset logical flash memory is divided according to the volume of the upgrade data corresponding to the target image file and the size of the remaining space of the first preset logical flash memory and the second preset logical flash memory.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
14. A computer 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 according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
System backup and recovery method and device
CN106598780A
Design method and apparatus for sharing conf partition file by double mirror images
CN108345477A
Method and device for starting Linux embedded system and storage medium
CN113342425A
Embedded system, control method and device thereof and storage medium
CN113485764A
Method and device for recovering kernel and file system mirror image, base station and storage medium
CN117389947A
