Write-in method, system and device for firmware storage double mirror images, server and medium
By using a combination of primary and non-flash memory and backup and non-flash memory in the server, and using the second-stage program loader image file to write the image file synchronously, the problems of traditional dual-mirror redundancy costs and the inability to start the system are solved. Cost reduction and system reliability improvement are achieved.
Patent Information
- Application Number
- CN202410864813.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-08-30
AI Technical Summary
The cost of traditional dual-mirror redundancy increases due to the use of Nor Flash chips in hardware storage, as well as the problem that the boot program cannot run when using non-flash chips, causing the system to fail to start and run smoothly.
Using a combination of primary and non-flash memory and backup and non-flash memory, the hardware is initialized through the second-stage program loader image file, and the image file is synchronously written according to the system configuration information to ensure that the system uses a smaller memory during startup and operation. The storage capacity of NOR Flash stores the boot program to reduce costs. At the same time, the high data storage density of NAND Flash is used for dual mirror redundancy to ensure system reliability and continuity.
It reduces server costs, ensures smooth startup and operation of the system, improves system reliability and reliability, maintains stable operation of the system during the upgrade iteration process through the dual-mirror redundancy mechanism, reduces the number of controllers, and reduces system costs.
Smart Images

Figure CN118567571A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, system, device, server and medium for writing dual images of firmware storage. Background Art
[0002] A baseboard management controller (BMC) is a management unit on a server that is responsible for monitoring and controlling the status of the server, including hardware health status, system startup, remote control, etc. A BMC usually has independent hardware and software components and can perform management tasks when the operating system is not running.
[0003] Dual-image redundancy is a technology to improve system reliability, which involves maintaining two identical copies of data or applications in two physical locations or devices. In hardware redundancy, two storage chips are set up. Traditionally, Nor Flash chips are used for dual-image redundancy, which is more expensive than other Flash chips (such as NAND Flash). If other Flash chips are used, the second-stage program loader (SPL) image file cannot be stored, resulting in the inability to run the boot program (uboot), which may cause the system to fail to start and run smoothly.
[0004] Therefore, how to save server costs while ensuring smooth startup and operation of the system is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] The purpose of the present invention is to provide a method, system, device, server and medium for writing dual images of firmware storage, so as to solve the technical problems that the conventional dual-image redundancy adopts Nor Flash chips in hardware storage redundancy, which leads to increased costs, and the use of Nor Flash chips cannot guide the program to run, resulting in the system being unable to start and run smoothly.
[0006] In order to solve the above technical problems, the present invention provides a method for writing dual images of firmware storage, which is applied to a firmware storage system, wherein the firmware storage system includes a main NAND flash memory, a backup NAND flash memory and an NAND flash memory for storing only a second-stage program loader image file; the NAND flash memory is connected to a controller; the main NAND flash memory and the backup NAND flash memory are connected, and both are connected to the controller; the controller is respectively connected to a non-volatile storage chip and a memory; the writing method includes:
[0007] The second-stage program loader image file is called from the non-volatile storage chip, and the second-stage program loader image file is guided and stored in the OR non-flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR non-flash memory and the file size of the second-stage program loader image file meets the preset requirement;
[0008] Loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system;
[0009] According to the system configuration information and the dual-image mechanism corresponding to the second-stage program loader image file, the image file of the primary and non-flash memory is synchronously written to the backup and non-flash memory.
[0010] On the one hand, according to the system configuration information corresponding to the second-stage program loader image file, the boot program file and the image file are loaded from the main and non-flash memory into the memory to start the system, including:
[0011] After the system is powered on, the system configuration information corresponding to the second-stage program loader image file is obtained from the non-volatile storage chip; wherein the system configuration information at least includes a primary-backup and non-flash memory flag bit and an image backup flag bit;
[0012] When the master-slave and non-flash memory flag bit is 1, it is determined to load the boot program file from the master and non-flash memory into the memory;
[0013] Directing the boot program file to load environment variables;
[0014] The kernel program is loaded from the main and non-flash memory to the memory according to the environment variables to complete the boot system startup and file system mounting.
[0015] On the other hand, according to the system configuration information and the dual-image mechanism corresponding to the second-stage program loader image file, the image file of the primary and non-flash memory is synchronously written to the backup and non-flash memory, including:
[0016] Determine whether to start the image backup process according to the image backup flag;
[0017] If started, the process proceeds to the step of synchronously writing the mirror files of the primary and non-flash memories to the backup and non-flash memories;
[0018] Correspondingly, determining whether to start the image backup process according to the image backup flag bit includes:
[0019] Recording the current startup times of the main non-flash memory and the corresponding startup results;
[0020] If the startup result corresponding to the current startup number is failure, retry the startup and increase the current startup number by 1;
[0021] When the current number of startup times reaches the preset number of startup times and the main non-flash memory fails to start, the modification mechanism of the image backup flag is triggered;
[0022] Modify the image backup flag to flag information corresponding to the image backup operation required, so as to implement a dual-image mechanism;
[0023] Correspondingly, synchronously writing the mirror file of the primary non-flash memory to the backup non-flash memory includes:
[0024] When the system is iterated, the backup and non-flash memory image files are updated;
[0025] After the upgrade is completed, booting the updated backup and non-flash memory image files;
[0026] Determine whether the system is running normally after the upgrade;
[0027] If it runs normally, the updated standby non-flash memory is changed to a main non-flash memory;
[0028] and copying the image files corresponding to the changed primary and non-flash memories to the changed backup and non-flash memories;
[0029] If it does not run normally, the main and non-flash memory image files before the upgrade are used for booting. After the system runs normally, the main and non-flash memory image files before the upgrade are used to overwrite the backup and non-flash memory image files.
[0030] On the other hand, after loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system, the method further includes:
[0031] Feed the dog according to the preset time;
[0032] Correspondingly, in the case that the system fails to boot the boot program file, the system further includes:
[0033] Update triggers the modification mechanism of the master-slave and non-flash memory flag bits; wherein the modification mechanism is to modify the boot flag bits of the master and non-flash memory of the master-slave and non-flash memory flag bits to the boot flag bits of the backup and non-flash memory;
[0034] The boot program file is booted according to the modified primary / standby and non-flash memory flags.
[0035] To solve the above technical problems, the present invention also provides a firmware storage system, the firmware storage system comprising a main NAND flash memory, a backup NAND flash memory and a NAND flash memory for storing only the second stage program loader image file;
[0036] The said non-OR flash memory is connected with the controller;
[0037] The main NAND flash memory and the standby NAND flash memory are connected, and both are connected to the controller;
[0038] The controller is connected to the non-volatile storage chip and the memory respectively;
[0039] The controller is used to call the second-stage program loader image file from the non-volatile storage chip, and boot and store the second-stage program loader image file to the OR non-flash memory to complete hardware initialization; load the boot program file and the image file from the main and non-flash memory to the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system; according to the system configuration information and the dual-mirror mechanism corresponding to the second-stage program loader image file, synchronously write the image file of the main and non-flash memory to the backup and non-flash memory; wherein the difference between the storage space size of the OR non-flash memory and the file size of the second-stage program loader image file meets the preset requirements.
[0040] On the one hand, if there are multiple standby and non-flash memories, the chip select signal terminals of the standby and non-flash memories are connected in series to present a daisy chain connection mode, and are connected to the chip select signal terminal of the main and non-flash memories; the chip select signal terminal of the main and non-flash memories is connected to the chip select signal terminal of the controller;
[0041] The clock signal ends of the standby and non-flash memories are connected in series to each other in a daisy chain connection mode, and are connected to the clock signal end of the master and non-flash memories; the clock signal end of the master and non-flash memories is connected to the clock signal end of the controller;
[0042] The data output terminal of the controller is connected to the data output terminal of the master NAND flash memory;
[0043] The data input terminal of the Nth backup and non-flash memory is connected to the data output terminal of the N+1th backup and non-flash memory; wherein, the data output terminal of the first backup and non-flash memory is connected to the data input terminal of the main and non-flash memory; and the data input terminal of the last backup and non-flash memory is connected to the data input terminal of the main and non-flash memory.
[0044] On the other hand, the main NAND flash memory and the backup NAND flash memory are both packaged in a wafer level packaging form or a ball grid array packaging form.
[0045] In order to solve the above technical problems, the present invention also provides a writing device for firmware storage dual images, which is applied to a firmware storage system, wherein the firmware storage system includes a main NAND flash memory, a backup NAND flash memory and an NAND flash memory for storing only a second-stage program loader image file; the NAND flash memory is connected to a controller; the main NAND flash memory and the backup NAND flash memory are connected, and are both connected to the controller; the controller is respectively connected to a non-volatile storage chip and a memory; the writing device includes:
[0046] A calling module, used to call the second-stage program loader image file from the non-volatile storage chip, and guide the second-stage program loader image file to be stored in the OR non-flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR non-flash memory and the file size of the second-stage program loader image file meets the preset requirements;
[0047] A loading boot module, used for loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file, so as to start the system;
[0048] A writing module is used to synchronously write the image files of the primary and non-flash memory into the backup and non-flash memory according to the system configuration information and the dual-image mechanism corresponding to the image file of the second-stage program loader.
[0049] In order to solve the above technical problems, the present invention further provides a server, comprising:
[0050] Memory for storing computer programs;
[0051] The processor is used to implement the steps of the method for writing dual images of firmware storage as described above when executing the computer program.
[0052] 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 method for writing dual images of firmware storage as described above are implemented.
[0053] The invention provides a writing method for dual-image firmware storage, which is applied to a firmware storage system. The firmware storage system comprises a main non-AND flash memory, a backup non-AND flash memory and an OR flash memory used for storing only a second-stage program loader image file; the OR flash memory is connected to a controller; the main non-AND flash memory and the backup non-AND flash memory are connected and are both connected to the controller; the controller is respectively connected to a non-volatile storage chip and a memory; the writing method comprises: calling a second-stage program loader image file from the non-volatile storage chip, and booting and storing the second-stage program loader image file to the OR flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR flash memory and the file size of the second-stage program loader image file meets a preset requirement; loading a boot program file and an image file from the main non-AND flash memory to the memory according to system configuration information corresponding to the second-stage program loader image file to start the system; and synchronously writing the image file of the main non-AND flash memory to the backup non-AND flash memory according to the system configuration information corresponding to the second-stage program loader image file and a dual-image mechanism.
[0054] The beneficial effect of the present invention is that the NOR flash chip is changed to a dual-mirror redundancy with a non-flash chip. The data storage density of NAND Flash is higher than that of NOR Flash, and the stored data is more. Therefore, the present invention only stores the boot program in NOR Flash. When the NOR Flash storage data requirement is not large, a NOR Flash with a smaller storage capacity is used, and the corresponding cost is reduced. At the same time, the cost of the dual-mirror redundant NAND Flash is reduced to a certain extent compared with the original dual-mirror redundant NOR Flash. In this way, while the cost is reduced, the boot program is stored in a NOR Flash with a smaller storage capacity, which ensures the sequential startup and operation of the system.
[0055] Secondly, the boot system startup process realizes system startup through data transmission and loading between the main and non-flash memory and the memory, so that data can be written between the main and standby and non-flash memory using the dual-mirror redundancy mechanism. The dual-mirror redundancy backup process ensures the stable operation of the system during the upgrade and iteration process, ensures the continuity of the system operation, and improves the reliability of the system. The watchdog mechanism ensures that the data is started normally, and in the event of a system startup failure, prevents the watchdog timeout interruption, and uses the standby and non-flash memory to boot the system to improve the reliability of the system startup. The daisy chain connection method connects the main and standby and non-flash memory, which can reduce the number of controllers. Only one controller can be used to achieve series control of multiple standby and non-flash memories, reducing system costs.
[0056] In addition, the present invention also provides a firmware storage system, a firmware storage dual-image writing device, a server and a medium, which have the same beneficial effects as the above-mentioned firmware storage dual-image writing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] 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.
[0058] Figure 1 A flowchart of a method for writing dual images of firmware storage provided by an embodiment of the present invention;
[0059] Figure 2 A flowchart of another firmware storage dual-image writing method provided by an embodiment of the present invention;
[0060] Figure 3 A structural diagram of a firmware storage system provided by an embodiment of the present invention;
[0061] Figure 4 A structural diagram of a firmware storage dual-image writing device provided by an embodiment of the present invention;
[0062] Figure 5 A structural diagram of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] 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.
[0064] The core of the present invention is to provide a method, system, device, server and medium for writing dual images of firmware storage, so as to solve the technical problems that the traditional dual-image redundancy uses Nor Flash chips in hardware storage redundancy, resulting in increased costs and the use of Nor Flash chips cannot guide the program to run, resulting in the system being unable to start and run smoothly.
[0065] 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.
[0066] In the era of diversified computing power, large-scale heterogeneous server equipment faces the challenges of systematic design with multiple processor architectures, multiple device protocols, and compatibility with different management chips, and management firmware is also ushering in new changes. BMC is the core component of Internet Technology (IT) equipment for centralized operation and maintenance management of user data centers such as the Internet, communications, and finance. It is crucial for the safe and reliable operation, remote centralized management, and control deployment of servers. BMC firmware builds a powerful embedded operating system based on the Linux kernel to achieve various operation and maintenance management functions such as remote control, fault diagnosis, configuration deployment, and firmware upgrades. The data center management platform uses the Intelligent Platform Management Interface (IPMI), Simple Network Management Protocol (SNMP), and other application program interfaces (APIs) provided by the BMC firmware to achieve remote centralized operation and maintenance management and batch deployment of massive services. Powerful software functions also put forward higher requirements on the hardware components of BMC. Taking Nor FLASH that stores BMC firmware as an example, 64M storage space is already somewhat stretched. In addition, in order to ensure the stability of BMC system operation, the existing BMC firmware basically adopts a dual-mirror redundancy solution, that is, there are two Flash images in the BMC system, the main Flash image and the backup Flash image. Therefore, upgrading the storage Flash with larger storage capacity will inevitably lead to a further increase in server costs.
[0067] As two different non-volatile storage technologies, NOR Flash and NAND Flash are widely used in the field of embedded systems. Because they both support SPI communication, they are usually referred to as SPI Flash. However, they have significant differences in read and write performance, capacity, cost, interface, reliability and application scenarios, as follows:
[0068] 1. Read and write performance. NOR Flash usually reads faster than NAND Flash because it allows random access to data, while NAND Flash needs to be read sequentially, so the read time is relatively long; NAND Flash writes and erases much faster than NOR Flash because it erases / writes in 8-32KB blocks, so it can be completed within 4ms, while NOR Flash erases / writes in 64-128KB blocks, so it takes 5S to perform the same operation.
[0069] 2. Capacity and cost. NAND Flash has a higher data storage density, so it usually has a larger capacity and is suitable for storing large amounts of data, such as USB flash drives, audio compression technology (Moving Picture Experts Group AudioLayer III, MP3) players, and solid-state drives; NOR Flash has a relatively low storage density and is suitable for storing small amounts of code, such as firmware and boot programs.
[0070] The firmware storage dual-image writing method provided by the present invention can solve the above-mentioned technical problems.
[0071] Figure 1 A flowchart of a method for writing a dual-image firmware storage provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, it is applied to a firmware storage system, the firmware storage system includes a main NAND flash memory, a backup NAND flash memory and a NAND flash memory for storing only the second-stage program loader image file; the NAND flash memory is connected to the controller; the main NAND flash memory and the backup NAND flash memory are connected, and are both connected to the controller; the controller is respectively connected to the non-volatile storage chip and the memory; the writing method includes:
[0072] S11: calling the second-stage program loader image file from the non-volatile storage chip, and booting and storing the second-stage program loader image file into the NOR flash memory to complete hardware initialization;
[0073] Wherein, the difference between the storage space size of the non-flash memory and the file size of the second-stage program loader image file meets the preset requirement;
[0074] S12: Loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system;
[0075] S13: According to the system configuration information and the dual-mirror mechanism corresponding to the second-stage program loader mirror file, the mirror files of the primary and non-flash memories are synchronously written into the backup and non-flash memories.
[0076] Specifically, after the system is powered on, the system configuration and the Secondary Program Loader (SPL) image file need to be obtained from the non-volatile storage chip. The SPL image is a stage in the uboot startup process, responsible for initializing the chip and moving the U-Boot main image to the system memory. The SPL was created because of different user needs and the size of the boot media cannot be determined. Many chip manufacturers choose to read only a small amount of data for chip initialization and reading media data into memory.
[0077] The NOR Flash in this embodiment is used to store the SPL image. It is responsible for completing the basic hardware initialization operation by utilizing the characteristics of NOR Flash that it can quickly read and directly run the firmware program. Another important task of SPL is to load the uboot image from Nand Flash into the dual-channel synchronous dynamic random access memory (Double Data Rate Synchronous Dynamic Random Access Memory, DDR) memory and guide the uboot to run. Basic hardware initialization operations ensure that the hardware device can be correctly identified and used by the operating system, such as bus interface initialization, memory detection, peripheral detection, central processing unit (Central Processing Unit, CPU) initialization, basic input and output system (Basic Input Output System, BIOS) initialization, storage device initialization, etc. The difference between the storage space size of the NOR storage in this embodiment and the file size of the SPL image meets the preset requirements. The preset requirements here tend to make the storage space size of the NOR storage close to the file size of the SPL image, so that the difference is getting smaller and smaller, and the ideal state is 0. This embodiment only stores the SPL image through the NOR flash memory, so that the corresponding NOR flash memory storage space is small, and the cost is also low.
[0078] In the system startup process in step S12, before the system is started for the first time, the program corresponding to the image file needs to be burned to the main and non-flash memory chips, and the configuration process in the non-volatile memory chip adopts the default configuration information of the system initialization. The configuration information here is the system configuration information, which at least includes the main standby and non-flash memory flag (Run Flash Flag) and the image backup flag (Roll Back Flag), and the system configuration information is stored in the form of a structure. After the system is powered on, the SPL program in the non-flash memory chip will first initialize the basic hardware. After the initialization is completed, the SPL program will load the boot program file (uboot) from the main and non-flash memory into the memory. The memory here can be a DDR off-chip memory or other memory, which is not limited here. Here it is mainly to guide the uboot program to complete the initialization of more hardware and load environment variables.
[0079] In some embodiments, loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second stage program loader image file to start the system includes:
[0080] After the system is powered on, the system configuration information corresponding to the second-stage program loader image file is obtained from the non-volatile storage chip; wherein the system configuration information at least includes a primary-backup and non-flash memory flag bit and an image backup flag bit;
[0081] When the master / slave and non-flash memory flag bits are 1, it is determined that the boot program file is loaded from the master / slave and non-flash memory into the memory;
[0082] Boot the boot program file to load environment variables;
[0083] The kernel program is loaded from the main and non-flash memory to the memory according to the environment variables to complete the boot system startup and file system mounting.
[0084] Specifically, the system configuration information is stored in the form of a structure, and its structure format is as follows:
[0085] typedef struct {
[0086] uint8_t Run Flash Flag;
[0087] uint8_t Roll Back Flag;
[0088] }FlashFlag_T;
[0089] The main and standby and non-flash flag (Run Flash Flag) here has a value range of 0-1, and the default value is 0. 0 means that after the system is powered on, the uboot program needs to be loaded from the main Flash to the DDR memory to complete the system initialization and boot kernel startup. 1 means that after the system is powered on, the uboot program needs to be loaded from the standby Flash to the DDR memory to complete the system initialization and boot kernel startup.
[0090] Image backup flag (Roll Back Flag), range 0-1, default value 1, rollback flag, 0 means that the system does not need image backup operation after normal operation, 1 means that the system needs image backup operation after normal operation, that is, synchronize the image in the main Nand Flash to the backup Nand Flash.
[0091] After the uboot program is booted to initialize more hardware and load environment variables, it is also necessary to load the kernel program from the main and non-storage to the memory to boot the system startup and file system mounting according to the environment variables to complete the system startup.
[0092] The boot system startup process provided in this embodiment realizes system startup through data transmission and loading between the primary and non-flash memory and the memory, so as to facilitate subsequent writing of data between the primary and backup and non-flash memory using a dual mirror redundancy mechanism.
[0093] In step S13, based on the system configuration information and the dual-mirror mechanism, the mirror files of the main and non-flash memory are synchronously written to the backup and non-flash memory. Mirror redundancy is a protective measure taken to ensure the continuity of system operation. It is customary to call the mirror that the system is running the main mirror, and the other is called the backup mirror. In the case that the main and non-flash memory mirror fails to start, it is necessary to automatically switch to the backup and non-flash memory mirror for booting. After the system is powered on for the first time and runs normally, the main and non-flash memory mirror will be synchronized to the backup and non-flash memory chip. At this time, the same mirror files are stored in the main and backup and non-flash memory chips.
[0094] The embodiment of the present invention provides a writing method for dual-image firmware storage, which is applied to a firmware storage system. The firmware storage system includes a main non-AND flash memory, a backup non-AND flash memory and an OR flash memory for storing only a second-stage program loader image file; the OR flash memory is connected to a controller; the main non-AND flash memory and the backup non-AND flash memory are connected and are both connected to the controller; the controller is respectively connected to a non-volatile storage chip and a memory; the writing method includes: calling a second-stage program loader image file from the non-volatile storage chip, and booting and storing the second-stage program loader image file to the OR flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR flash memory and the file size of the second-stage program loader image file meets a preset requirement; loading a boot program file and an image file from the main non-AND flash memory to the memory according to system configuration information corresponding to the second-stage program loader image file to start the system; and synchronously writing the image file of the main non-AND flash memory to the backup non-AND flash memory according to the system configuration information corresponding to the second-stage program loader image file and a dual-image mechanism. When changing from a non-flash memory chip to a dual-mirror redundancy with a non-flash memory chip, the data storage density of NAND Flash is higher than that of NOR Flash, and more data is stored. Therefore, the present invention only stores the boot program in NOR Flash. When the NOR Flash storage data requirement is not large, a NOR Flash with a smaller storage capacity is used, and the corresponding cost is reduced. At the same time, the cost of using a dual-mirror redundant NAND Flash is reduced to a certain extent compared with the original dual-mirror redundant NOR Flash. In this way, while reducing the cost, the system is also guaranteed to start and run in sequence by using a NOR Flash with a smaller storage capacity to store the boot program.
[0095] In some embodiments, according to the system configuration information and the dual-image mechanism corresponding to the second-stage program loader image file, the image files of the primary and non-flash memory are synchronously written to the backup and non-flash memory, including:
[0096] Determine whether to start the image backup process according to the image backup flag;
[0097] If it is started, the process proceeds to the step of synchronously writing the mirror files of the primary and non-flash memory to the backup and non-flash memory;
[0098] Correspondingly, determining whether to start the image backup process according to the image backup flag bit includes:
[0099] Record the current startup times of the main non-flash memory and the corresponding startup results;
[0100] If the startup result corresponding to the current startup number is failure, retry the startup and increase the current startup number by 1;
[0101] When the current number of boot times reaches the preset number of boot times and the main non-flash memory boot fails, the modification mechanism of the image backup flag is triggered;
[0102] Modify the image backup flag to the flag information corresponding to the image backup operation required to implement the dual-image mechanism;
[0103] Correspondingly, the mirror files of the primary and non-flash memory are synchronously written to the backup and non-flash memory, including:
[0104] When the system is iterated, the backup and non-flash image files are updated;
[0105] After the upgrade is completed, the updated backup and non-flash image files are booted;
[0106] Determine whether the system is running normally after the upgrade;
[0107] If it is running normally, the updated standby non-flash memory will be changed to the main non-flash memory;
[0108] and copying the image files corresponding to the changed primary and non-flash memories to the changed backup and non-flash memories;
[0109] If it does not operate normally, the main and non-flash image files before the upgrade are used for booting. After the system operates normally, the main and non-flash image files before the upgrade are used to overwrite the backup and non-flash image files.
[0110] It is understandable that the synchronous writing process of the image file needs to check whether the image backup flag (Roll BackFlag) starts the image backup process. If it is started, it means that the image backup flag is used as a trigger information to synchronously write the image files of the main and non-flash memory to the backup and non-flash memory.
[0111] Specifically, whether to start the image backup process is determined according to the image backup flag, mainly recording the current startup times and corresponding startup results of the current main non-flash memory. If the startup result corresponding to the current startup times fails, it is necessary to restart, and the current startup times are increased by 1. Until the current startup times reach the preset startup times, and the main non-flash memory fails to start, the modification mechanism of the image backup flag is triggered, that is, the image backup flag is modified to the flag information corresponding to the need for the image backup operation, so as to perform the dual-image mechanism, such as 0 means that the image backup operation is not required after the system is running normally, and 1 means that the image backup operation is required after the system is running normally, and the backup flag needs to be changed from 0 to 1.
[0112] In the process of synchronously writing the image file of the main and non-flash memory to the backup and non-flash memory, in order to ensure the stable operation of the system, in the upgrade and iteration process, the image file of the backup and non-flash memory will be updated, and it is specified that the startup boot will be performed from the backup and non-flash memory chip after the upgrade is completed. Here, the upgrade process of the image file is taken into consideration. If the upgrade process is not considered, the image file of the main and non-flash memory is directly written to the backup and non-flash memory synchronously. In the upgrade process, it is determined whether the system after the upgrade is normal. If so, it is necessary to swap the original main and backup and non-flash memory, that is, to complete a switch, that is, the backup and non-flash memory before the upgrade is upgraded to the main and non-flash memory, and the image file corresponding to the changed main and non-flash memory is copied to the backup and non-flash memory after the change. For example, Flash1 is the main and non-flash memory, and Flash2 is the backup and non-flash memory. During the upgrade iteration, the image file of Flash2 is updated. After the upgrade is completed and the system runs normally after the upgrade, Flash2 is upgraded to the main and non-flash memory, and Flash1 is downgraded to the backup and non-flash memory. At the same time, the image file of Flash2 is copied to Flash1.
[0113] If the system does not run normally after the upgrade, it is determined that the current backup and non-flash memory system fails to start, which means that the backup and non-flash memory system fails to start. The system will automatically switch to the main and non-flash memory, and start booting from the main and non-flash memory image files. After the system runs normally, the backup and non-flash memory images will be overwritten.
[0114] The dual-mirror redundant backup process provided in this embodiment ensures the stable operation of the system during the upgrade and iteration process, ensures the continuity of the system operation, and improves the reliability of the system.
[0115] In some embodiments, after loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system, the method further includes:
[0116] Feed the dog according to the preset time;
[0117] Correspondingly, in the case where the system boot program file fails to boot, the method further includes:
[0118] Update triggering the modification mechanism of the master / slave and non-flash memory flag bits; wherein the modification mechanism is modified from the master / slave and non-flash memory boot flag bits of the master / slave and non-flash memory flag bits to the backup and non-flash memory boot flag bits;
[0119] The boot program file is booted according to the modified master / slave and non-flash memory flags.
[0120] Specifically, after the system starts normally, the watchdog will be fed at a certain interval (preset time) to prevent the watchdog from restarting. In addition, if the system fails to boot the boot program file, the watchdog operation timeout interrupt will be triggered, and the modification mechanism of the main and standby and non-flash memory flag (Run Flash Flag) will be updated and triggered, and the boot flag of the main and non-flash memory will be changed to the boot flag of the standby and non-flash memory, so that the system will be booted from the standby and non-flash memory after restarting.
[0121] The watchdog mechanism provided in this embodiment ensures normal data startup and prevents watchdog timeout interruption when system startup fails. The backup and non-flash memory boot system is adopted to improve the reliability of system startup.
[0122] In some embodiments, writing the image file of the primary NAND flash memory to the backup NAND flash memory includes:
[0123] Determine whether the current working status of the standby and non-flash memory is a status for participating in system upgrade according to the specified time;
[0124] If it is in the system upgrade state, the writing process of the image files of the main and non-flash memory is suspended;
[0125] And return to the step of judging whether the current working state of the spare and non-flash memory is a state of participating in the system upgrade according to the preset time, until the current working state is an idle state, then write the mirror files of the main and non-flash memory into the spare and non-flash memory.
[0126] Specifically, it is determined whether the working state of the spare and non-flash memory chips is in the state of participating in the system upgrade according to the specified time. If it is, and when the image files of the main and non-flash memory are being written, it is necessary to suspend the writing process of the image files of the main and non-flash memory to ensure that only one task of the image file is executed, and to ensure that the system upgrade iteration process of the spare and non-flash memory proceeds smoothly. Until the current working state is the idle state, the image files of the main and non-flash memory continue to be written to the spare and non-flash memory.
[0127] This embodiment provides that during the writing process of writing the mirror file of the main non-flash memory to the backup non-flash memory, the current working status of the backup non-flash memory is judged to ensure that the mirror file writing process and the system upgrade iteration process do not conflict, thereby ensuring the normal operation of the system.
[0128] Further, Figure 2 A flowchart of another firmware storage dual-image writing method provided by an embodiment of the present invention, such as Figure 2 As shown, including:
[0129] S21: System power on;
[0130] S22: The program of the second stage program loader image file in the boot or non-flash memory chip completes the basic hardware initialization;
[0131] S23: Reading the initial configuration in the non-volatile memory chip;
[0132] S24: Determine whether the master / slave and non-flash memory flags are 0, if yes, proceed to step S25, if no, proceed to step S26;
[0133] S25: Start system initialization from the boot program file in the main and non-flash memory chip;
[0134] S26: Start system initialization from the boot program file in the spare and non-flash memory chip;
[0135] S27: Determine whether the boot program file is started normally; if so, proceed to step S28; if not, proceed to step S29;
[0136] S28: boot kernel program to start;
[0137] S29: watchdog timeout interrupt;
[0138] S30: Determine whether the operating system kernel is started normally; if so, proceed to step S31, if not, return to step S29;
[0139] S31: Mount the file system;
[0140] After the watchdog timeout interrupt in step S29, S32: update the main standby and non-flash memory flags, and the standby and non-flash memory image files are started;
[0141] S33: Set the image backup flag to 1;
[0142] S34: The watchdog restarts the device and returns to step S21;
[0143] After the file system is mounted in step S31, S35: determine whether the image backup flag is 1; if so, proceed to step S36; if not, proceed to step S37;
[0144] S36: image backup completed;
[0145] S37: Feed the dog and end.
[0146] The operating system kernel in step S30 is Kernel, which is a real-time operating system used to manage memory, files, peripherals and system resources, usually runs processes, and provides communication between processes.
[0147] For an introduction to a firmware storage dual-image writing method provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above firmware storage dual-image writing method.
[0148] Furthermore, the present invention also provides a firmware storage system, Figure 3 A structural diagram of a firmware storage system provided by an embodiment of the present invention, such as Figure 3 As shown, the firmware storage system includes a main NAND flash memory 1, a backup NAND flash memory 2, and a NAND flash memory 3 for storing only the second stage program loader image file;
[0149] The NOR flash memory 3 is connected to the controller 4;
[0150] The main non-flash memory 1 and the backup non-flash memory 2 are connected, and both are connected to the controller 4;
[0151] The controller 4 is connected to the non-volatile storage chip 5 and the memory 6 respectively;
[0152] The controller 4 is used to call the second-stage program loader image file from the non-volatile storage chip 5, and boot and store the second-stage program loader image file to the non-flash memory 3 to complete the hardware initialization; according to the system configuration information corresponding to the second-stage program loader image file, load the boot program file and the image file from the main non-flash memory 1 to the memory 6 to start the system; according to the system configuration information and the dual-mirror mechanism corresponding to the second-stage program loader image file, synchronously write the image file of the main non-flash memory 1 to the backup non-flash memory 2; wherein the difference between the storage space size of the non-flash memory 3 and the file size of the second-stage program loader image file meets the preset requirements.
[0153] Specifically, Figure 3 As shown, the present invention only uses two NAND Flashes as the main, standby and non-flash memories. In actual application, the number of standby and non-flash memories is not limited and can be set according to actual conditions.
[0154] For example, the two traditional 64M NOR Flash chips are replaced with a 1M NOR Flash chip and two 128M NAND Flash chips. The 1M NOR Flash chip is used to store the SPL image. It uses the characteristics of NOR Flash that can quickly read and directly run the firmware program to complete basic hardware initialization operations, such as initializing the watchdog. Another important task of SPL is to load the uboot image from NAND Flash to the DDR memory and guide the uboot to run. The two 128M NAND Flash chips are used to store the complete primary and backup images. The characteristics of NAND Flash chips that can quickly erase / write and have a large capacity are used to further improve the upgrade and backup speed of the image.
[0155] The embodiment of the present invention provides a firmware storage system, which includes a main NAND flash memory, a backup NAND flash memory and an OR flash memory used to store only a second-stage program loader image file; the OR flash memory is connected to a controller; the main NAND flash memory and the backup NAND flash memory are connected and are both connected to the controller; the controller is respectively connected to a non-volatile storage chip and a memory; a writing method includes: calling a second-stage program loader image file from the non-volatile storage chip, and booting and storing the second-stage program loader image file to the OR flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR flash memory and the file size of the second-stage program loader image file meets a preset requirement; loading a boot program file and an image file from the main NAND flash memory to the memory according to system configuration information corresponding to the second-stage program loader image file to start the system; and synchronously writing the image file of the main NAND flash memory to the backup NAND flash memory according to the system configuration information corresponding to the second-stage program loader image file and a dual-mirror mechanism. When changing from a non-OR flash memory chip to a dual-mirror redundancy with a non-flash memory chip, the data storage density of NAND Flash is higher than that of NOR Flash, and more data is stored. Therefore, the present invention only stores the boot program in NOR Flash. When the NOR Flash storage data requirement is not large, a NOR Flash with a smaller storage capacity is used, and the corresponding cost is reduced. At the same time, the cost of using a dual-mirror redundant NAND Flash is reduced to a certain extent compared with the original dual-mirror redundant NOR Flash. In this way, while reducing the cost, the system is also guaranteed to start and run in sequence by using a NOR Flash with a smaller storage capacity to store the boot program.
[0156] In some embodiments, the traditional SPI one master and multiple slaves mode increases the SPI controller, connects one controller to each NAND Flash, and selects a master controller with multiple chip select signals to communicate with multiple slaves. Both of the above methods occupy the space of the motherboard and have more hard-wired connections.
[0157] If there are multiple spare and non-flash memories, the chip select signal terminals of the spare and non-flash memories are connected in series to form a daisy chain connection, and are connected to the chip select signal terminal of the main and non-flash memories; the chip select signal terminal of the main and non-flash memories is connected to the chip select signal terminal of the controller;
[0158] The clock signal terminals of the standby and non-flash memories are connected in series to form a daisy chain connection, and are connected to the clock signal terminals of the master and non-flash memories; the clock signal terminals of the master and non-flash memories are connected to the clock signal terminals of the controller;
[0159] The data output terminal of the controller is connected to the data output terminal of the main and non-flash memory;
[0160] The data input terminal of the Nth spare and non-flash memory is connected to the data output terminal of the N+1th spare and non-flash memory; wherein, the data output terminal of the first spare and non-flash memory is connected to the data input terminal of the main and non-flash memory; and the data input terminal of the last spare and non-flash memory is connected to the data input terminal of the main and non-flash memory.
[0161] Specifically, N is a positive integer greater than and equal to 1. The SPI one-master-multiple-slave mode in daisy chain mode connects the slave Flash chips in series, so that the master chip only needs to control all the slave Flash chips on the network through three signals: the clock signal (Serial Clock, SCK), the data output signal (Master Out Slave In, MOSI), and the chip select signal (Slave Select, SS). The following conditions must be met for the SPI daisy chain to operate normally:
[0162] 1. The chip select signal lines (CS) of all devices are connected to the chip select signal line (SS) of the main controller;
[0163] 2. The SCK signal lines of all devices are connected to the SCK signal line of the master controller, that is, all slave devices receive the same clock signal;
[0164] 3. Only the first slave device in the chain receives commands directly from the microcontroller, and all other devices obtain data from the data input signal (Master In Slave Out, MISO) port of the previous device in the chain;
[0165] 4. Each slave device must be able to read the command from the MOSI pin within a given command cycle (defined as the number of clocks required for each command) and output the same command from the MISO pin in the next command cycle, so there will be a command cycle delay from MOSI to MISO;
[0166] 5. All slave devices can only execute write commands on the rising edge of the CS signal, which means that as long as SS remains low, the slave device will not execute the command and will output the command through the MISO pin in the next command cycle;
[0167] 6. If CS goes high after a given command cycle, all slave devices will immediately execute the command written to the MOSI pin. At the same time, if CS goes high, data will not be output from MISO;
[0168] The above conditions can enable each slave device in the chain to execute different commands.
[0169] like Figure 3 As shown, the chip select signal terminal of the standby and non-flash memory is connected to the chip select signal terminal of the main and non-flash memory; the chip select signal terminal of the main and non-flash memory is connected to the chip select signal terminal of the controller;
[0170] The clock signal end of the standby non-flash memory is connected to the clock signal end of the master non-flash memory; the clock signal end of the master non-flash memory is connected to the clock signal end of the controller;
[0171] The data output terminal of the controller is connected to the data output terminal of the main and non-flash memory;
[0172] The data output terminals of the standby and non-flash memory are connected to the data input terminals of the main and non-flash memory; the data input terminals of the standby and non-flash memory are connected to the data input terminals of the main and non-flash memory.
[0173] The daisy chain connection provided in this embodiment connects the primary, standby and non-flash memories, which can reduce the number of controllers. Only one controller can be used to implement series control of multiple standby and non-flash memories, thereby reducing system costs.
[0174] In some embodiments, the main NAND flash memory and the backup NAND flash memory are packaged in a wafer level packaging form or a ball grid array packaging form.
[0175] Specifically, the packaging form of SPI NAND Flash adopts wafer-level packaging (WSON) or thin fine-pitch ball grid array (TFBGA), which is much smaller than the traditional NAND Flash TSOP packaging, fully saving the space of the printed circuit board (PCB). The smaller number of pins can reduce the size and number of layers of the PCB, which not only meets the market demand for miniaturization but also reduces the cost of the product.
[0176] The above describes in detail various embodiments corresponding to the method for writing a firmware storage dual image. On this basis, the present invention also discloses a device for writing a firmware storage dual image corresponding to the above method. Figure 4 The structure diagram of a firmware storage dual-image writing device provided by an embodiment of the present invention. Figure 4 As shown, the writing device for firmware storage dual images is applied to a firmware storage system, the firmware storage system includes a main NAND flash memory, a backup NAND flash memory and an NAND flash memory for storing only the second-stage program loader image file; the NAND flash memory is connected to the controller; the main NAND flash memory and the backup NAND flash memory are connected, and are both connected to the controller; the controller is respectively connected to the non-volatile storage chip and the memory; the writing device includes:
[0177] The calling module 11 is used to call the second-stage program loader image file from the non-volatile storage chip, and guide the second-stage program loader image file to be stored in the non-flash memory to complete the hardware initialization; wherein the difference between the storage space size of the non-flash memory and the file size of the second-stage program loader image file meets the preset requirements;
[0178] A loading boot module 12, used to load the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file, so as to start the system;
[0179] The writing module 13 is used to synchronously write the image files of the primary and non-flash memories into the backup and non-flash memories according to the system configuration information and the dual-image mechanism corresponding to the image file of the second-stage program loader.
[0180] In some embodiments, after loading the boot module 12, the method further includes:
[0181] The operation submodule is used to feed the dog according to the preset time;
[0182] Correspondingly, in the case where the system boot program file fails to boot, the method further includes:
[0183] An update submodule is used to update the modification mechanism for triggering the master-slave and non-flash memory flag bits; wherein the modification mechanism is modified from the master-slave and non-flash memory boot flag bits of the master-slave and non-flash memory flag bits to the backup and non-flash memory boot flag bits;
[0184] The boot submodule is used to boot the boot program file according to the modified primary / standby and non-flash memory flags.
[0185] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.
[0186] For an introduction to a firmware storage dual-image writing device provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above firmware storage dual-image writing method.
[0187] Figure 5 A structural diagram of a server provided in an embodiment of the present invention, such as Figure 5 As shown, including:
[0188] A memory 21, used for storing computer programs;
[0189] The processor 22 is used to implement the steps of the method for writing the dual-image firmware storage when executing the computer program.
[0190] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 may 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 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0191] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 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 21 is at least used to store the following computer program 211, wherein, after the computer program is loaded and executed by the processor 22, the relevant steps of the firmware storage dual mirror writing method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 212 may include Windows, Unix, Linux, etc. Data 213 may include but is not limited to data involved in the firmware storage dual mirror writing method, etc.
[0192] In some embodiments, the server may further include a display screen 23 , an input / output interface 24 , a communication interface 25 , a power supply 26 , and a communication bus 27 .
[0193] Those skilled in the art can understand that Figure 5 The structure shown in the figure does not constitute a limitation on the server, and may include more or fewer components than shown in the figure.
[0194] The processor 22 calls the instructions stored in the memory 21 to implement the firmware storage dual-image writing method provided in any of the above embodiments.
[0195] For an introduction to a server provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. The server has the same beneficial effects as the above firmware storage dual-image writing method.
[0196] Furthermore, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor 22, the steps of the method for writing dual images of firmware storage are implemented as described above.
[0197] 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 is essentially 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 methods of 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 and other media that can store program codes.
[0198] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. The present invention has the same beneficial effects as the above firmware storage dual-image writing method.
[0199] Furthermore, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the method for writing a dual-image firmware storage when the computer program / instruction is executed by a processor.
[0200] For an introduction to a computer program product provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. It has the same beneficial effects as the above firmware storage dual-image writing method.
[0201] The above is a detailed introduction to a firmware storage dual-image writing method, system, device, server 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 referred 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.
[0202] It should also be noted that, in this specification, relational terms such as first and second, etc. are used only 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 "comprises", "comprising" 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 sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for writing a dual-image firmware storage, characterized in that: Applied to a firmware storage system, the firmware storage system comprises a main NAND flash memory, a backup NAND flash memory and an NAND flash memory for storing only a second-stage program loader image file; the NAND flash memory is connected to a controller; the main NAND flash memory and the backup NAND flash memory are connected, and both are connected to the controller; The controller is connected to the non-volatile storage chip and the memory respectively; the writing method includes: The second-stage program loader image file is called from the non-volatile storage chip, and the second-stage program loader image file is guided and stored in the OR non-flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR non-flash memory and the file size of the second-stage program loader image file meets the preset requirement; Loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system; According to the system configuration information and the dual-image mechanism corresponding to the second-stage program loader image file, the image file of the primary and non-flash memory is synchronously written to the backup and non-flash memory.
2. The method for writing dual images of firmware storage according to claim 1, characterized in that: According to the system configuration information corresponding to the second-stage program loader image file, the boot program file and the image file are loaded from the main and non-flash memory into the memory to start the system, including: After the system is powered on, the system configuration information corresponding to the second-stage program loader image file is obtained from the non-volatile storage chip; wherein the system configuration information at least includes a primary-backup and non-flash memory flag bit and an image backup flag bit; When the master-slave and non-flash memory flag bit is 1, it is determined to load the boot program file from the master and non-flash memory into the memory; Directing the boot program file to load environment variables; The kernel program is loaded from the main and non-flash memory to the memory according to the environment variables to complete the boot system startup and file system mounting.
3. The method for writing a dual-image firmware storage according to claim 2, characterized in that: According to the system configuration information and the dual-image mechanism corresponding to the second-stage program loader image file, the image file of the primary and non-flash memory is synchronously written to the backup and non-flash memory, including: Determine whether to start the image backup process according to the image backup flag; If started, the process proceeds to the step of synchronously writing the mirror files of the primary and non-flash memories to the backup and non-flash memories; Correspondingly, determining whether to start the image backup process according to the image backup flag bit includes: Recording the current startup times of the main non-flash memory and the corresponding startup results; If the startup result corresponding to the current startup number is failure, retry the startup and increase the current startup number by 1; When the current number of startup times reaches the preset number of startup times and the main non-flash memory fails to start, the modification mechanism of the image backup flag is triggered; Modify the image backup flag to flag information corresponding to the image backup operation required, so as to implement a dual-image mechanism; Correspondingly, synchronously writing the mirror file of the primary non-flash memory to the backup non-flash memory includes: When the system is iterated, the backup and non-flash memory image files are updated; After the upgrade is completed, booting the updated backup and non-flash memory image files; Determine whether the system is running normally after the upgrade; If it runs normally, the updated standby non-flash memory is changed to a main non-flash memory; and copying the image files corresponding to the changed primary and non-flash memories to the changed backup and non-flash memories; If it does not run normally, the main and non-flash memory image files before the upgrade are used for booting. After the system runs normally, the main and non-flash memory image files before the upgrade are used to overwrite the backup and non-flash memory image files.
4. The method for writing a firmware storage dual image according to claim 2, characterized in that: After loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system, the method further includes: Feed the dog according to the preset time; Correspondingly, in the case that the system fails to boot the boot program file, the system further includes: Update triggers the modification mechanism of the master-slave and non-flash memory flag bits; wherein the modification mechanism is to modify the boot flag bits of the master and non-flash memory of the master-slave and non-flash memory flag bits to the boot flag bits of the backup and non-flash memory; The boot program file is booted according to the modified primary / standby and non-flash memory flags.
5. A firmware storage system, characterized in that: The firmware storage system includes a main NAND flash memory, a backup NAND flash memory, and a NAND flash memory for storing only the second-stage program loader image file; The NOR flash memory is connected to the controller; The main NAND flash memory and the standby NAND flash memory are connected, and both are connected to the controller; The controller is connected to the non-volatile storage chip and the memory respectively; The controller is used to call the second-stage program loader image file from the non-volatile storage chip, and guide the second-stage program loader image file to be stored in the non-flash memory to complete hardware initialization; Loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file to start the system; According to the system configuration information and dual mirror mechanism corresponding to the second-stage program loader image file, the image file of the main and non-flash memory is synchronously written to the backup and non-flash memory; wherein the difference between the storage space size of the or non-flash memory and the file size of the second-stage program loader image file meets the preset requirements.
6. The firmware storage system according to claim 5, characterized in that: If there are multiple standby and non-flash memories, the chip select signal terminals of the standby and non-flash memories are connected in series to present a daisy chain connection mode, and are connected to the chip select signal terminal of the main and non-flash memories; the chip select signal terminal of the main and non-flash memories is connected to the chip select signal terminal of the controller; The clock signal ends of the standby and non-flash memories are connected in series to each other in a daisy chain connection mode, and are connected to the clock signal end of the master and non-flash memories; the clock signal end of the master and non-flash memories is connected to the clock signal end of the controller; The data output terminal of the controller is connected to the data output terminal of the master NAND flash memory; The data input terminal of the Nth backup and non-flash memory is connected to the data output terminal of the N+1th backup and non-flash memory; wherein, the data output terminal of the first backup and non-flash memory is connected to the data input terminal of the main and non-flash memory; and the data input terminal of the last backup and non-flash memory is connected to the data input terminal of the main and non-flash memory.
7. The firmware storage system according to claim 5 or 6, characterized in that: The main NAND flash memory and the backup NAND flash memory are both packaged in a wafer level packaging form or a ball grid array packaging form.
8. A firmware storage dual-image writing device, characterized in that: Applied to a firmware storage system, the firmware storage system comprises a main NAND flash memory, a backup NAND flash memory and an NAND flash memory for storing only a second-stage program loader image file; the NAND flash memory is connected to a controller; the main NAND flash memory and the backup NAND flash memory are connected, and both are connected to the controller; The controller is connected to the non-volatile storage chip and the memory respectively; the writing device includes: A calling module, used to call the second-stage program loader image file from the non-volatile storage chip, and guide the second-stage program loader image file to be stored in the OR non-flash memory to complete hardware initialization; wherein the difference between the storage space size of the OR non-flash memory and the file size of the second-stage program loader image file meets the preset requirements; A loading boot module, used for loading the boot program file and the image file from the main and non-flash memory into the memory according to the system configuration information corresponding to the second-stage program loader image file, so as to start the system; A writing module is used to synchronously write the image files of the primary and non-flash memory into the backup and non-flash memory according to the system configuration information and the dual-image mechanism corresponding to the image file of the second-stage program loader.
9. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for writing dual images of firmware storage as described in any one of claims 1 to 4 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 method for writing a dual-image firmware storage according to any one of claims 1 to 4 are implemented.
Citation Information
Cited By
Method, device and equipment for sharing dual nonvolatile memories of BMC (Baseboard Management Controller) system and storage medium
CN119938410A
Chip starting method, chip, electronic equipment and storage medium
CN119987874A
