Make up the method for multiple boot storage organization and backup
Technical field
The present invention relates to a kind of multiple boot storage organization and backup of the method that makes up multisystem reboot storage organization and backup, particularly vehicle-mounted computer system.
Background technology
Along with the widespread use of embedded technology in various vehicle electronics products, data storage and safety in the embedded system have become an important research topic.MLC(Multi Level Cell, the multiple field storage) NAND Flash is with high density, large capacity, high data memory rate, and the characteristics such as more erasing times, become gradually the main flow that the embedded memory device of large capacity is used, be mainly used in storage system program and data.But its intrinsic memory mechanism and have this deadly defect of bad piece becomes its major obstacle in application, and all flash devices all are subjected to the puzzlement of position exchange phenomenon, and MLC NAND is especially serious.This problem is not fatal for MLC NAND storage multimedia messages the time.But; if when coming storage operating system, configuration file or other sensitive informations with local memory device; this slight hitch may cause system-down; though can use the ECC system to guarantee reliability; but the error correcting capability of ECC is limited, so can not guarantee Systems balanth.In addition, the structure of system all is only to be divided into two parts (boot and system) now, after system powered on, CPU can remove to read boot, and the size of boot is generally about 1M, but CPU only is responsible for reading, no matter whether accurate the data of reading are, well-known, the flash device all is subjected to the puzzlement of position exchange phenomenon, in case data are made mistakes like this, system has just collapsed.Vehicle-mounted computer system particularly, this equipment is different from other digital products, and maintenance is inconvenient.Think the stability that guarantees vehicle-mounted computer system, we have proposed the multiple boot structure of system, and how to store and back up this invention.
Summary of the invention
The method that the purpose of this invention is to provide a kind of constructing system multiple boot storage organization and backup, the automatic repair ability of the method energy realization system guarantees Systems balanth, is specially adapted to vehicle-mounted computer system.
The present invention realizes by the following technical solutions: the method for a kind of constructing system multiple boot storage organization and backup, it is characterized in that: system is divided into: one-level boot, second level bootloader and system program, described one-level boot is directly called after being started by system, and the storage mode of employing individual layer is stored in the starting position of first piece of NANDFlash; Described second level bootloader comprises secondary guiding master routine and secondary guiding copy program, and described system program comprises system's master routine and system's copy program; When the upper level boot found that the next stage program is made mistakes, boot was called copy data, repaired master routine.
The present invention utilizes boot by setting up the copy program, when system's master routine is made mistakes, calls the copy program and repairs, and can effectively guarantee to be skillfully constructed Systems balanth, has preferably use value.
Description of drawings
Fig. 1 is system architecture schematic diagram of the present invention.
Embodiment
The present invention will be further described below in conjunction with drawings and Examples.
As shown in Figure 1, the invention provides the method for a kind of constructing system multiple boot storage organization and backup, it is characterized in that: system is divided into: the one-level boot, second level bootloader and system program, described one-level boot is directly called after being started by system, (annotate: the storage unit of MLC nand flash is divided into two-layer the storage mode of employing individual layer, equal like this MLC NAND is stored in as SLC NAND (Single Level Cell is the single-layer type storage, and the stability of SLC NAND is higher than MLC NAND) starting position of first piece of NANDFlash; Described second level bootloader comprises secondary guiding master routine and secondary guiding copy program, and described system program comprises system's master routine and system's copy program; When the upper level boot found that the next stage program is made mistakes, boot was called copy data, repaired master routine.
In preferred embodiment of the present invention, described one-level boot size is no more than 4KB, and like this, the program that CPU only need to read less than 4KB just can start, and greatly reduces risk.
Copy program of the present invention can be entered with master routine together burning in production programming program process, mark specially a zone and be used for storing described secondary guiding copy program and system's copy program in NANDFlash, this zone is not affected by later stage robot system upgrading.So, the stability of the data in this copy zone is just guaranteed.
It is worth mentioning that, in the present embodiment, when the upper level boot found that the next stage program is made mistakes, then the Page that at first makes mistakes by ECC verification locking read corresponding Page and copies over from the copy program.
The present invention is specially adapted to vehicle-mounted computer system.The above only is preferred embodiment of the present invention, and all equalizations of doing according to the present patent application claim change and modify, and all should belong to covering scope of the present invention.