The content of the invention
In view of this, the present invention provides a kind of system backup suitable for on-chip system and recovery device and its method.
A kind of system backup and recovery device suitable for on-chip system, it include on-chip system chip, first memory,
Peripheral hardware that is to be backed up and/or recovering;
First memory, peripheral hardware electrically connect with on-chip system chip;First memory be used for store BIOS data and
System mirror data;
On-chip system chip includes processor, second memory, peripheral interface module;Processor is used for from first memory
Middle reading system mirror data, and system mirror data is write into peripheral hardware;Second memory is used for storage system mirror back-up control
File processed;Peripheral interface module is used to control on-chip system chip and the communication of first memory, peripheral hardware, serial ports.
The system backup and recovery device of the present invention suitable for on-chip system, it also includes serial ports, upper
Machine;
Host computer is connected by serial ports with on-chip system chip;Host computer is used to control on-chip system chip to carry out peripheral hardware
The backup of system mirror data;Second memory is additionally operable to store serial port service file;Peripheral interface module is additionally operable to control sheet
The communication that upper System on Chip/SoC passes through serial ports and host computer.
A kind of system backup method suitable for on-chip system, its by the above-mentioned system backup suitable for on-chip system with
Recovery device is realized, is comprised the following steps:
S1, host computer are communicated with on-chip system chip by serial ports;And on-chip system chip is kept to be in power-off shape
State;
S2, host computer initialization serial ports, selection needs the system image file backed up, and sets first memory to treat programming
Offset address;
S3, host computer send the request of connection on-chip system chip, are constantly sent and held to on-chip system chip by serial ports
Hand control word;
S4, to electric in on-chip system chip, start on-chip system chip, and in the control of shaking hands for receiving host computer transmission
After word, response control word is sent to host computer;
S5, host computer are after response control word is received, first memory of the control on-chip system chip in step S2
Treat the offset address of programming, wipe corresponding block in first memory as the storage address of system mirror data and according to first
Memory treats that system mirror data is write corresponding address in first memory by the offset address of programming.
A kind of system recovery method suitable for on-chip system, its by the above-mentioned system backup suitable for on-chip system with
Recovery device realizes that it comprises the following steps:
BIOS in S01, startup first memory, before running the hard disk guiding operating system into peripheral hardware;
S02, the request for receiving default recovery system for transmission;
S03, by running the BIOS in first memory, the system backup data in first memory are write into peripheral hardware
In hard drive space.
System backup provided by the invention suitable for on-chip system and recovery device and its method, have the following advantages that:
(1) hard disk of the data backup procedure without peripheral hardware to be backed up, it is not required that the interface such as CD-ROM drive, floppy drive, network interface, USB.(2) system
During recovery, without dismantling hard disk, it is not required that the interface such as serial ports, CD-ROM drive, floppy drive, USB.(3) when system is recovered, using system mirror
As the direct programming of data, compared to the backup method based on file is played, the speed of backup is fast.
Embodiment
As shown in figure 1, a kind of system backup and recovery device suitable for on-chip system, it includes on-chip system chip
10th, first memory 20, peripheral hardware 30 to be backed up and/or recovery.
Alternatively, wherein first memory 20 can be nonvolatile memory.Further, nonvolatile storage can be with
It is flash memory (Flash) chip.The invention is not restricted to this.
First memory 20, peripheral hardware 30 electrically connect with on-chip system chip 10;First memory 20 is used to store BIOS
Data and system mirror data.
On-chip system chip 10 includes processor 11, second memory 12, peripheral interface module 13;Processor 11 be used for from
System mirror data is read in first memory 20, and system mirror data is write into peripheral hardware 30;Second memory 12 is used to deposit
Storage system mirror back-up controls file;Peripheral interface module 13 is used to controlling on-chip system chip 10 and first memory 20, outer
If the 30th, communication of serial ports 40.Second memory 12 can be ROM in piece.
Alternatively, system mirror data, the main boot fan of operating system mirror image, in addition to DISK to Image is not only included
Area, partitions of file table, partition content etc. are all normally to start related data message to hard disk operation system.Usually, it is limited
In capacity, system image file, which is stored in nonvolatile storage, needs interception and compression processing, and form and this hair is embodied in it
It is bright unrelated.
Alternatively, the system backup and recovery device suitable for on-chip system can also include serial ports 40, host computer 50.On
Position machine 50 can be common PC, and the invention is not restricted to this.
Host computer 50 is connected by serial ports 40 with on-chip system chip 10;Host computer 50 is used to control on-chip system chip 10
The backup of system mirror data is carried out to peripheral hardware 30;Second memory 12 is additionally operable to store the service document of serial ports 40;Peripheral Interface
Module 13 is additionally operable to the communication for controlling on-chip system chip 10 by serial ports 40 and host computer 50.
Wherein system mirror data can be made in advance, and be stored in host computer 50.
Can store the program code in piece in ROM in second memory 12, this section of program code be used to receive it is upper
The serial ports 40 of machine 50 is ordered, and judges whether to need to write system mirror data in first memory 20.
As shown in Fig. 2 the embodiment of the present invention also provides a kind of system backup method suitable for on-chip system, it passes through upper
State the system backup suitable for on-chip system described in any one embodiment to realize with recovery device, comprise the following steps:
S1, host computer 50 are communicated with on-chip system chip 10 by serial ports 40;And keep at on-chip system chip 10
In off-position.
S2, host computer 50 initialize serial ports 40, and selection needs the system image file backed up, and sets first memory 20
Treat the offset address of programming;
S3, host computer 50 send the request of connection on-chip system chip 10, constantly by serial ports 40 to on-chip system chip
10 send control word of shaking hands.
S4, to electric in on-chip system chip 10, start on-chip system chip 10, and receiving holding for the transmission of host computer 50
After hand control word, response control word is sent to host computer 50.Handshake request control word is received, represents that the software of host computer 50 wishes standby
Part mirror image.
S5, host computer 50 are after response control word is received, control on-chip system chip 10 first depositing in step S2
Reservoir 20 treats the offset address of programming, wipe corresponding block in first memory 20 as system mirror data storage address simultaneously
System mirror data is write corresponding address in first memory 20 by the offset address for treating programming according to first memory 20.
Alternatively, as shown in figure 3, the step S5 includes:
S51, host computer 50 send erasing control word to on-chip system chip 10 and wait to wipe after response control word is received
The block address removed;On-chip system chip 10 receives erasing control word and block address to be erased, and according to be erased
Corresponding block in block address erasing first memory 20, and the response word wiped is sent to host computer 50;
S52, host computer 50 judge whether all blocks are wiped in first memory 20 after the response word of erasing is received
Except finishing, step S53 is jumped to if all wiping;Step S51 is jumped to if without all wiping, and is repeated
Step S51, step S52 is until block all in first memory 20 is wiped and finished, and jumps to step S53;
S53, host computer 50 send to on-chip system chip 10 after the response word of erasing is received and write control word and write ground
Location, write data;On-chip system chip 10 receives and writes control word and write address, writes data, and is write data into according to write address
In step S51 in first memory 20 in corresponding block, and the response word write is sent to host computer 50;
S54, host computer 50 judge whether all system mirror data deposit by write-in first after the response word of write-in is received
In reservoir 20 in corresponding block, control word, on-chip system chip are sent completely to on-chip system chip 10 if all writing
10 receive complete control word after normally start;Step S53 is jumped to if without all writing, and repeats step
S53, step S54 are until system mirror data is all write in first memory 20 in corresponding block.
As shown in figure 4, the embodiment of the present invention also provides a kind of system recovery method suitable for on-chip system, it passes through upper
State the system backup suitable for on-chip system described in any one embodiment and realize that it comprises the following steps with recovery device:
BIOS in S01, startup first memory 20, run to the hard disk guiding operating system in peripheral hardware 30;
S02, the request for receiving default recovery system for transmission;
S03, by running the BIOS in first memory 20, the system backup data in first memory 20 are write outer
If in 30 hard drive space.In this step, the image file writes hard drive space successively, and wiring method can be by hard disk
CHS (cylinder, head, sector) address writes successively.
Alternatively, the step S02 also includes:
Trust authentication is carried out by request of the bios program to recovery system,
When being proved to be successful, redirect and perform step S03;In authentication failed, this flow is terminated.By implementing this implementation
Example, improve the security of system recovery.The implementation of the trust authentication, it can be but be not limited only to password confirming.
Directly it can be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processor
Capable software module, or the two combination are implemented.Software module can be placed in random access memory, internal memory, read-only storage,
Institute is public in electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field
In the storage medium for any other forms known.
It is understood that for the person of ordinary skill of the art, it can be conceived with the technique according to the invention and done
Go out other various corresponding changes and deformation, and all these changes and deformation should all belong to the protection model of the claims in the present invention
Enclose.