CN106325912B - The starting method and device of embedded OS - Google Patents
The starting method and device of embedded OS Download PDFInfo
- Publication number
- CN106325912B CN106325912B CN201510383213.1A CN201510383213A CN106325912B CN 106325912 B CN106325912 B CN 106325912B CN 201510383213 A CN201510383213 A CN 201510383213A CN 106325912 B CN106325912 B CN 106325912B
- Authority
- CN
- China
- Prior art keywords
- file
- version
- edition
- content
- embedded
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of starting method and devices of embedded OS, this method comprises: detecting the value of the environmental variance in storage region in starting of embedded operation system;If the value of environmental variance is non-zero, it is determined that the starting code of embedded OS has logic error;Second edition file is repaired using third version file, first version file is repaired using the second edition file after the completion of reparation;When first version file reparation is completed, the non-zero value of environmental variance is removed, restarts embedded OS.By setting in storage region in advance, and judge whether the starting code of embedded OS has logic error according to environmental variance, in the starting code, there are when logic error, first version file is repaired by the file of other versions being stored in advance in storage region backed up, using the first version file start embedded OS after the completion of reparation, embedded OS clean boot has been ensured.
Description
Technical field
The present invention relates to embedded system technology fields, and in particular to the starting method and device of embedded OS.
Background technique
In embedded OS, bootload (BootLoader) is run before operating system.It can be with
Initialization hardware device establishes memory headroom mapping graph, thus take the hardware environment of system to a proper states, so as to
Correct environment is got out for final call operation system.In embedded systems, usually there is no as basic input and output
Firmware program as system (Basic Input Output System, referred to as: BIOS), therefore the load of whole system is opened
Dynamic task is just completed by BootLoader completely.In embedded systems, system is when powering on or resetting usually all from address
Start to execute at 0x00000000, and at this address is usually exactly the BootLoader program of system.
Generally after device power, from the 0x00000000 of address execute, BootLoader is by operation system image
It is loaded into memory, and operation system image is verified, jump to the memory address where operating system after verification is correct
Space, start-up operation system.If verification occur mistake, BootLoader will not start-up operation system, and by serial ports it is defeated
Type information out prompts user's updating software release at startup item (boot).
The step of general updating software release, is: version is downloaded in memory by network -> wipe storage region
(flash) flash is written in software version in -> the software version downloaded in memory.When user's normal use, in web
When lower upgrade-system software version, it is possible that the failure of power-off.If after wiping flash software version, there are no write-ins
It is powered off when completion is not written in new software version after the opportunity of new version, or erasing flash software version, that
The system version that will cause in flash is destroyed, and when leading to starting version next time, cannot be normally entered operating system, be stopped
In BootLoader, and prompt user's upgraded version at boot.
Also, the common networking situation of user is as follows: user terminal is connected by cable and manages multiple devices.When a certain
When the failure of upgrading power down described above occurs in equipment, which can rest in boot after being again started up, and cannot be introduced into behaviour
Make system, user can not manage the equipment by network at this time, can only be by upgrading the version of the equipment at boot.And
Upgrading is needed through serial ports under boot, and the equipment is probably in the place very remote apart from user terminal, uses at this time
Family needs to carry laptop computer and Serial Port Line at the equipment, repairs the equipment by upgraded version under boot, very inconvenient.
In addition, it includes two software version files that there are also some systems in flash, and if version 1 breaks down, boot
Can attempt from version 2 start, if version 2 be it is intact, system can start from version 2.In this case, flash
In version 1 be still damage, need user to remove upgraded version 1 manually.And if user does not have found the damage of version 1,
And the damage of version 2 is caused in escalation process, it still will appear situation above.
Summary of the invention
For the defects in the prior art, the present invention provides a kind of starting method and device of embedded OS,
So that the first version file in the storage region of embedded OS is when the error occurs, other version files pair can be used
First version file is repaired, and using the first version file start embedded OS after repairing, has ensured insertion
The starting of formula operating system security.
In a first aspect, the present invention provides a kind of starting method of embedded OS, comprising:
In starting of embedded operation system, the value of the environmental variance in storage region is detected;
If the value of the environmental variance is non-zero, it is determined that the starting code of the embedded OS has logic error;
Second edition file is repaired using third version file, and using the second edition file reparation after the completion of repairing
First version file;
When the first version file reparation is completed, the non-zero value of the environmental variance is removed, and restart described embedding
Enter formula operating system;
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, being used for
Repair the second edition file of the first version file and for repairing the second edition file and without erasable movement
Third version file.
Optionally, after the value of the environmental variance in the detection storage region, the method also includes:
If the value of the environmental variance is 0, it is determined that the starting code of the embedded OS is without logic error;
According to the first check code of the first version file judge the first version file content whether mistake;
If the content inerrancy of the first version file, starts the embedded OS;
Wherein, first check code is in the image file according to the first version file loaded into memory
Hold the check code generated.
Optionally, first check code according to the first version file judges the content of the first version file
Whether mistake after, the method also includes:
If there are mistakes for the content of the first version file, institute is judged according to the second check code of second edition file
State second edition file content whether mistake;
If the content inerrancy of the second edition file, the first version is repaired using the second edition file
File;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance;
Wherein, second check code is in the image file according to the second edition file loaded into memory
Hold the check code generated.
Optionally, second check code according to second edition file judge the second edition file content whether
After mistake, the method also includes:
If there are mistakes for the content of the second edition file, the second edition is repaired herein using third version file
Part, and the first version file is repaired using the second edition file after the completion of repairing;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance.
Optionally, first check code according to the first version file judges the content of the first version file
Whether mistake, comprising:
The image file of first version file in the storage region is loaded into memory;
First check code is generated according to the content of the image file in the memory;
First check code is compared with third check code, the third check code is previously according to the storage
What the content of the first version file in region generated;
According to comparison result, judge the content in the first version file with the presence or absence of mistake.
Optionally, second check code according to second edition file judge the second edition file content whether
Mistake, comprising:
The image file of second edition file in the storage region is loaded into memory;
Second check code is generated according to the content of the image file in the memory;
Second check code is compared with the 4th check code, the 4th check code is previously according to the storage
What the content of the second edition file in region generated;
According to comparison result, judge the content in the second edition file with the presence or absence of mistake.
Optionally, the first version file further include: the first version positioned at first version top of file region
Number information;
The second edition file further include: the second edition information positioned at second edition top of file region;
Correspondingly, if the second edition file is by the third version file reparation, in second edition file reparation
When completion, by the second edition information update of the second edition file;
If the first version file is by the second edition file reparation, when first version file reparation is completed,
By the first version information update of the first version file.
Optionally, the method also includes:
If the detection first version information in the content inerrancy of the first version file, then preset time period
It is whether consistent with the second edition information;
If the first version information and the second edition information are inconsistent, the first version number letter is chosen
It is corresponding to cease the small version number of version file update numerical value corresponding with the big version number of numerical value in the second edition information
Version file.
Optionally, the method also includes:
In the starting of embedded operation system, start timer;
When the timer exceeds default timing and the embedded OS starts not successfully, restarting
The embedded OS;
Alternatively,
When the timer is without departing from default timing and the embedded OS successfully starts up, timeing closing
Device and the non-zero value for removing the environmental variance.
Second aspect, the present invention also provides a kind of starters of embedded OS, comprising:
Detection module, for detecting the value of the environmental variance in storage region in starting of embedded operation system;
Determining module when the value for detecting the environmental variance in detection module is non-zero, determines the embedded operation system
The starting code of system has logic error;
File repair module, for using third version file repair second edition file, and using repair after the completion of
Second edition file repair first version file;
Starting module, for removing the non-zero value of the environmental variance when the first version file reparation is completed, and
Restart the embedded OS;
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, being used for
Repair the second edition file of the first version file and for repairing the second edition file and without erasable movement
Third version file.
As shown from the above technical solution, the invention proposes a kind of starting method and devices of embedded OS, lead to
Set in storage region after in advance, and according to environmental variance judge embedded OS starting code whether
There is logic error, in the starting code there are when logic error, passes through other being stored in advance in storage region backed up
The file of version repairs first version file, and utilizes the first version file start embedded operation system after repairing
System, has ensured embedded OS clean boot.
Detailed description of the invention
Fig. 1 is the flow diagram of the starting method for the embedded OS that one embodiment of the invention provides;
Fig. 2 be another embodiment of the present invention provides embedded OS starting method flow diagram;
Fig. 3 is the structural schematic diagram of the starter for the embedded OS that one embodiment of the invention provides.
Specific embodiment
With reference to the accompanying drawing, the specific embodiment of invention is further described.Following embodiment is only used for more clear
Illustrate to Chu technical solution of the present invention, and not intended to limit the protection scope of the present invention.
Embedded OS can be divided into universal embedded OS and tailored version embedded operation from using angle
System.Common universal embedded OS has Linux, VxWorks, Windows CE.net etc..Common tailored version
Embedded OS has Smart Phone, Pocket PC, Symbian etc..Two classes can be divided by real-time: real-time embedded
Operating system is mainly directed towards the fields such as control, communication.As the VxWorks of WindRiver company, pSOS, QNX system of ISI are soft
The Nucleus etc. of QNX, ATI of part company.Non real-time embedded OS is mainly directed towards consumer electronics product.This kind of production
Product include PDA, mobile phone, set-top box, e-book, WebPhone etc..The Smart Phone behaviour applied such as Microsoft towards mobile phone
Make system.
The clean boot for how guaranteeing embedded OS is mainly proposed in the embodiment of the present invention, in embedded operation
When system can not normally start, damaging occur in general bootload BootLoader program namely start-up loading file, and one
As the damage of this document mainly include two kinds of situations: a kind of situation is the physical damage of the content in storage region flash, also
A kind of situation is the starting code of embedded OS there are logic error, and the present embodiment is mentioned aiming at above-mentioned two situations
A kind of starting method of embedded OS is gone out.
Fig. 1 shows the flow diagram of the starting method of the embedded OS of one embodiment of the invention offer, such as
Shown in Fig. 1, method includes the following steps:
101, in starting of embedded operation system, the value of the environmental variance in storage region is detected.
It should be noted that the equipment where above-mentioned embedded OS is after the power-up, bootload BootLoader
Program can complete the task of the start-up loading of entire embedded OS, this implementation before embedded OS operation
It is previously provided with environmental variance flag in the storage region flash of embedded OS in example, passes through the environmental variance
The label place value of flag judges the starting code of file with the presence or absence of logic error.
If 102, the value of the environmental variance is non-zero, it is determined that the starting code of the embedded OS has logic wrong
Accidentally.
It will be appreciated that the value of environmental variance can be cleared to 0 when successfully starting up every time by embedded OS,
Certain embedded OS is in failed starting namely the value of environmental variance is 1, wherein becomes in the present embodiment in environment
When the value of amount is 0, representative can normally start, and when the value of environmental variance is 1, represents start-up course and failure occur, can also be with
There is logic error in the starting code for being interpreted as embedded OS.
103, second edition file is repaired using third version file, and using the second edition file after the completion of repairing
Repair first version file.
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, being used for
Repair the second edition file of the first version file and for repairing the second edition file and without erasable movement
Third version file.
104, when the first version file reparation is completed, the non-zero value of the environmental variance is removed, and restart institute
State embedded OS.
The above method judges embedded operation according to environmental variance by setting in storage region in advance
Whether the starting code of system has logic error, in the starting code there are when logic error, is stored in advance by what is backed up
The file of other versions in storage region repairs first version file, and utilizes the first version file after repairing
Start embedded OS, ensures embedded OS clean boot.
Fig. 2 shows another embodiment of the present invention provides embedded OS starting method flow diagram,
As shown in Fig. 2, method includes the following steps:
201, in starting of embedded operation system, start timer.
Timer in above-mentioned steps 201 can be understood as WatchDog Timer.
202, it detects whether the value of the environmental variance in storage region is 0, if non-zero, thens follow the steps 203, otherwise, execute
Step 208.
It will be appreciated that embedded OS, in initial start-up, the value of general environment variable is 0, in embedded behaviour
Make system it is subsequent have failed starting when, then the value of environmental variance be 1, wherein in the present embodiment the value of environmental variance be 0
When, representative can normally start, and when the value of environmental variance is non-zero (such as: being 1), represents start-up course and failure occur, can also
There is logic error to be interpreted as the starting code of embedded OS.
If 203, the value of the environmental variance detected in step 202 is non-zero, it is determined that the starting generation of the embedded OS
Code has logic error.
204, second edition file is repaired using third version file.
205, first version file is repaired using the second edition file after the completion of reparation.
First version file, second edition file and the third edition in above-mentioned steps 204-205, in above-mentioned storage region
For this document it is to be understood that first version file is file needed for starting of embedded operation system, second edition file is the
The backup file of one version file, in order to be repaired to first version file in first version file corruption, third version
File is the file of the equipment basic version of burning when leaving the factory where the embedded OS, the third version file with
It is not have erasable move during starting of embedded operation system unlike first version file and second edition file
Make, ensure that because the third edition can be passed through herein when surprisingly first version file and second edition file being caused all to damage
Part repairs first version file and second edition file, repairs first version file and second by third version file
The process of version file is the content of reading third version file into memory, and the content of the third version file in memory
Be written region in flash of first version file and second edition file, whole process will not erasable third version file
Region only can read the content in the region of third version file, this ensure that the content of third version file never by
It destroys, so that equipment normally start-up operation system, user can enhance the stalwartness of whole system by network management to equipment
Property.
If 206, the first version file reparation is completed, 207 are thened follow the steps.
207, after the completion of the first version file in above-mentioned steps 206 is repaired, the non-zero value of the environmental variance is removed,
And restart the embedded OS.
If 208, the value of the environmental variance in abovementioned steps 202 is 0, it is determined that the embedded OS opens
Code is moved without logic error.
209, judge whether the content of the first version file is wrong according to the first check code of the first version file
Accidentally, if mistake is not present in the content of first version file, 210 are thened follow the steps, otherwise, executes step 211.
The first check code in above-mentioned steps 209 is the mirror image text according to the first version file loaded into memory
The check code that the content of part generates.Above-mentioned steps 209 further include following steps:
2091, the image file of the first version file in the storage region is loaded into memory;
2092, first check code is generated according to the content of the image file in the memory;
2093, first check code is compared with third check code, the third check code is previously according to institute
State the content generation of the first version file of storage region;
2094, according to the comparison result in step 2093, judge the content of the first version file with the presence or absence of mistake.
It will be appreciated that mentioned in above-mentioned steps 2094 when the first check code is consistent with third check code, then illustrate
The content of first version file is not damaged, and mistake is not present in the content in first version file;Opposite, in the first check code
When inconsistent with third check code, then illustrate that the content of first version file has been damaged, such as: the damage may be to add in mirror image
It is damaged when being downloaded to memory, the present embodiment is not being defined of how damaging to first version file, is only used for illustrating.
The first check code and third check code in the present embodiment are respectively by first edition this paper loaded into memory
The sum that part generates is by the first version file generated in storage region, and the generating process is according to loaded into memory first
The content of first version in the content and storage region of version file passes through cyclic redundancy check code (Cyclic
Redundancy Check, abbreviation crc) algorithm that generates of generator or crc check code generates the first check code and third school
Code is tested, especially by which kind of algorithm or which kind of generator the present embodiment without limiting in detail, such as can be by existing
Method generates.
If 210, the content inerrancy of the first version file, starts the embedded OS.
If 211, there are mistakes for the content of the first version file, sentenced according to the second check code of second edition file
Break the second edition file content whether mistake, if the content inerrancy of the second edition file, thens follow the steps
Otherwise 205-207 executes step 204-207.
It should be noted that step 205-207 is executed, wherein walking in the above-mentioned content inerrancy in second edition file
It is exactly the content reparation first version of the second edition file after the completion of the verification in rapid 205, that is to say, that originally step 205
In be by third version file repair after second edition file, certainly, in above-mentioned steps 211 in second edition file
Hold there is no when mistake, then rear version file has not been inspected by the second edition file after the reparation of third version
The faultless second edition file of content.
Second check code is raw according to the content of the image file of the second edition file loaded into memory
At check code.
Above-mentioned steps 211 further include following steps:
2111, the image file of the second edition file in the storage region is loaded into memory;
2112, second check code is generated according to the content of the image file in the memory;
2113, second check code is compared with the 4th check code, the 4th check code is previously according to institute
State the content generation of the second edition file of storage region;
2114, according to the comparison result of step 2113, judge the content in the second edition file with the presence or absence of mistake.
It will be appreciated that then illustrating the second edition when judging that the second check code is consistent with the 4th check code in above-mentioned steps 211
The content of this document is not damaged, and mistake is not present in the content in second edition file;Opposite, in the second check code and the 4th
When check code is inconsistent, then illustrate that the content of second edition file has been damaged, such as: the damage may be in mirror image is loaded into
It is damaged when depositing, the present embodiment is not being defined of how damaging to second edition file, is only used for illustrating.
The second check code and the 4th check code in the present embodiment are respectively by second edition this paper loaded into memory
The sum that part generates passes through the second edition file generated in storage region, wherein the second edition file in storage region
Second edition file for original version file, or after being repaired by third version file, the generating process is according to being loaded into
The content of the second edition in the content and storage region of second edition file in memory by crc verify code generator or
The algorithm that crc check code generates generates the second check code and the 4th check code, especially by which kind of algorithm or which kind of generator
The present embodiment without limiting in detail, such as can be generated by existing method.
In above-mentioned steps 201-211, it can be understood as be additionally provided with hardware watchdog electricity in the embedded OS
Road, WatchDog Timer, can be in the open state when embedded OS starts not successfully, it will be understood that, if above-mentioned
The timing of timer has exceeded default timing, then directly restarts the insertion according to above-mentioned steps 201-211
Formula operating system;If the timing of above-mentioned timer starts described embedded without departing from preset time in above-mentioned steps 210
After operating system, the above method further includes following steps:
212, judge whether the embedded OS starts success, if so, thening follow the steps 213, otherwise, execute step
Rapid 201.
It will be understood that if judging in above-mentioned steps 212, embedded OS to successfully start up, needs timeing closing
Device, and opening timing device carries out reclocking again, prevents when the embedded OS just starts, timer is beyond pre-
If then the time restarts embedded OS again.
213, Off Timer and the non-zero value of the environmental variance is removed.
In above-mentioned steps 201-213, in order to make the version of first version file and second edition file in storage region
Unanimously, the second edition file in above-mentioned steps has the function of automatically updating, wherein first version file further include: be located at
The first version information in first version top of file region;The second edition file further include: be located at described second
The second edition information of version file head zone.
Above-mentioned first version file and second edition file can be understood as including head zone and code region;Wherein
Head zone is stored with the information such as version number information and check code;Code region is stored with the corresponding content of the version file,
That is the check code in head zone is according to the version text after reparation when version file is repaired or is updated
Part generate, the version number in corresponding version number information can execute plus 1 operation;And the version file stored in code region
Content can update accordingly, old edition this document or vicious version file originally can be erasable.It should be noted that
The file of third version will not be erasable.
Above-mentioned first version information and second edition information may include first version file and second edition this paper
The version number of part can specifically include following update:
If the second edition file is by the third version file reparation, when second edition file reparation is completed,
By the second edition information update of the second edition file;
If the first version file is by the second edition file reparation, when first version file reparation is completed,
By the first version information update of the first version file.
Then above-mentioned steps 210 determine first version file content inerrancy after, the above method further include in figure not
The following steps shown:
If 214, determining the content inerrancy of the first version file according to step 210, examine within a preset period of time
It surveys the first version information and whether the second edition information is consistent, if unanimously, thening follow the steps 215;Otherwise, then
First version file or second edition file are not updated.
Above-mentioned preset time period can be understood as time interval, which is generally less than starting of embedded operation system
Just to the successful period is started, it is also understood that just arriving the successful period detection two of starting for starting of embedded operation system
It is secondary or three times, such as: it can be 10s, 20s etc., the present embodiment is not to detecting the first version file and second edition file
The specific time interval of version number be defined.
If 215, the first version information and the second edition information are inconsistent, the first version is chosen
The corresponding version file of the big version number of numerical value updates the small version number pair of numerical value in number information and the second edition information
The version file answered.
The above method first version file has been carried out with second edition file it is synchronous, such as avoid the first edition herein
When part is higher and first version file can not start embedded OS, when being repaired with second edition file, repair
It is the file of lowest version, causes also to need to upgrade the version file after reparation when starting embedded OS,
Lead to the problem that the starting of embedded operation system time is slower.
Certainly, above-mentioned steps 214-215 can also start successfully in step 213 in embedded system, and Off Timer is simultaneously
It removes and executes after the non-zero value of the environmental variance, the present embodiment is not to above-mentioned first version file and second edition file
Update opportunity is defined.
Fig. 3 shows a kind of structural schematic diagram of the starter of embedded OS provided in an embodiment of the present invention,
As shown in figure 3, the starter includes:
Detection module 31, for detecting the value of the environmental variance in storage region in starting of embedded operation system;
It should be noted that the equipment where above-mentioned embedded OS is after the power-up, bootload BootLoader
Program can complete the task of the start-up loading of entire embedded OS, this implementation before embedded OS operation
It is previously provided with environmental variance flag in the storage region flash of embedded OS in example, passes through the environmental variance
The label place value of flag judges the starting code of file with the presence or absence of logic error.
In general, if the equipment where above-mentioned embedded OS is 0 by detection discovery flag after the power-up,
Can then determining the starting code of file, there are logic errors, can not carry out subsequent starting work.
The value of environmental variance in the present embodiment can be understood as preset in advance, that is to say, that equipment is being embedded in powering on
Formula operating system successfully starts up after the completion of rear or starting embedded OS first version file is repaired, which becomes
The value of amount is 0, when first version file is wrong to cause embedded OS not start normally, the value of the environmental variance
For non-zero (such as: setting the value of marker bit as 1).
Determining module 32 when the value for detecting the environmental variance in detection module is non-zero, determines the embedded operation
The starting code of system has logic error;
File repair module 33, for being completed using third version file reparation second edition file, and using repairing
Second edition file afterwards repairs first version file;
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, being used for
Repair the second edition file of the first version file and for repairing the second edition file and without erasable movement
Third version file.
Starting module 34, for removing the non-zero value of the environmental variance when the first version file reparation is completed,
And restart the embedded OS.
Above system detects the environmental variance by detection module by setting in storage region in advance
Value, then determine that the starting code of embedded OS has logic error according to the value of environmental variance by determining module
When, by file repair module by the file of other versions being stored in advance in storage region backed up to first edition this paper
Part is repaired, and using the first version file start embedded OS after repairing, has ensured embedded OS
Clean boot.
In one preferred embodiment, the determining module 32 is also used to detect storage region in detection module 31
In environmental variance value be 0 when, determine the starting code of the embedded OS without logic error;
Correspondingly, above-mentioned apparatus further includes unshowned in Fig. 3: first judgment module;
First judgment module, for judging the first version file according to the first check code of the first version file
Content whether mistake;
The starting module 34 is also used in the content inerrancy of the first version file, is started described embedded
Operating system;
Wherein, first check code is in the image file according to the first version file loaded into memory
Hold the check code generated.
Correspondingly, above-mentioned apparatus further includes unshowned in Fig. 3: the second judgment module;
Second judgment module, when for judging that the content of the first version file has mistake in first judgment module,
According to the second check code of second edition file judge the second edition file content whether mistake;
File repair module 33 is also used in the content inerrancy of the second edition file, using the second edition
This document repairs the first version file;
Starting module 34, for when the first version file reparation is completed, executing the removing environmental variance
Non-zero value the step of;
Wherein, second check code is in the image file according to the second edition file loaded into memory
Hold the check code generated.
File repair module is also used to when the content of the second edition file has mistake, herein using the third edition
Part repairs the second edition file, and repairs the first version file using the second edition file after the completion of repairing;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance.
First judgment module is specifically used for:
Content mirrors processing to the first version file in the storage region, and image file loads after mirror image processing
Into memory;
First check code is generated according to the content of the image file in the memory;
First check code is compared with third check code, the third check code is previously according to the storage
What the content of the first version file in region generated;
According to comparison result, judge the content of the first version file with the presence or absence of mistake.
Second judgment module, is specifically used for:
The content mirrors of second edition file in the storage region are handled, and image file loads after mirror image processing
Into memory;
Second check code is generated according to the content of the image file in the memory;
Second check code is compared with the 4th check code, the 4th check code is previously according to the storage
What the content of the second edition file in region generated;
According to comparison result, judge the content in the second edition file with the presence or absence of mistake.
In one preferred embodiment, the first version file further include: be located at the first version file header
The first version information in portion region;
The second edition file further include: the second edition information positioned at second edition top of file region;
Correspondingly, file repair module 33 is also used in the second edition file by the third version file reparation
When, when second edition file reparation is completed, by the second edition information update of the second edition file;
When the first version file is repaired by the second edition file, when first version file reparation is completed,
By the first version information update of the first version file.
Above-mentioned apparatus further includes unshowned in Fig. 3: update module;
Detection module is also used to the content inerrancy of the first version file, then within a preset period of time described in detection
Whether first version information and the second edition information are consistent;
Update module, for choosing institute in the first version information and the inconsistent second edition information
It is small to state the corresponding version file update numerical value of version number that numerical value is big in first version information and the second edition information
The corresponding version file of version number.
Above-mentioned apparatus further includes unshowned in Fig. 3: timing module;
Timing module, for starting timer in the starting of embedded operation system;
Starting module, for exceeding default timing in the timer and the embedded OS opens not successfully
When dynamic, the embedded OS is restarted;
Alternatively,
Starting module is also used in the timer without departing from default timing and embedded OS success
When starting, Off Timer and the non-zero value for removing the environmental variance.
It will be appreciated that above-mentioned starter and the starting method of above-mentioned embedded OS are correspondingly, originally
Embodiment is no longer described in detail above-mentioned starter.
Each embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned
Invention is explained in detail for each embodiment, those skilled in the art should understand that: it still can be to preceding
It states technical solution documented by each embodiment to modify, or some or all of the technical features is equally replaced
It changes;And these are modified or replaceed, the model for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution
It encloses.
Claims (7)
1. a kind of starting method of embedded OS characterized by comprising
In starting of embedded operation system, the value of the environmental variance in storage region is detected;
If the value of the environmental variance is non-zero, it is determined that the starting code of the embedded OS has logic error;
Second edition file is repaired using third version file, and repairs first using the second edition file after the completion of repairing
Version file;
When the first version file reparation is completed, the non-zero value of the environmental variance is removed, and restart described embedded
Operating system;
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, for repairing
The second edition file of the first version file and for repairing the second edition file and the third without erasable movement
Version file;
After the value of environmental variance in the detection storage region, the method also includes:
If the value of the environmental variance is 0, it is determined that the starting code of the embedded OS is without logic error;
According to the first check code of the first version file judge the first version file content whether mistake;
If the content inerrancy of the first version file, starts the embedded OS;
Wherein, first check code is raw according to the content of the image file of the first version file loaded into memory
At check code;
First check code according to the first version file judge the first version file content whether mistake
Afterwards, the method also includes:
If there are mistakes for the content of the first version file, described is judged according to the second check code of second edition file
The content of two version files whether mistake;
If the content inerrancy of the second edition file, the first edition is repaired herein using the second edition file
Part;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance;
Wherein, second check code is raw according to the content of the image file of the second edition file loaded into memory
At check code;
After second check code according to second edition file judges whether the content of the second edition file is wrong, institute
State method further include:
If there are mistakes for the content of the second edition file, the second edition file is repaired using third version file,
And the first version file is repaired using the second edition file after the completion of repairing;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance;
Wherein, the second edition file is the backup file of the first version file, and the third version file is
The file of the basic version of burning when factory.
2. the method according to claim 1, wherein first check code according to the first version file
Judge the first version file content whether mistake, comprising:
The image file of first version file in the storage region is loaded into memory;
First check code is generated according to the content of the image file in the memory;
First check code is compared with third check code, the third check code is previously according to the storage region
First version file content generate;
According to comparison result, judge the content of the first version file with the presence or absence of mistake.
3. the method according to claim 1, wherein described judge according to the second check code of second edition file
The content of the second edition file whether mistake, comprising:
The image file of second edition file in the storage region is loaded into memory;
Second check code is generated according to the content of the image file in the memory;
Second check code is compared with the 4th check code, the 4th check code is previously according to the storage region
Second edition file content generate;
According to comparison result, judge the content in the second edition file with the presence or absence of mistake.
4. method according to any one of claim 1-3, which is characterized in that the first version file further include: position
First version information in first version top of file region;
The second edition file further include: the second edition information positioned at second edition top of file region;
Correspondingly, if the second edition file is completed by the third version file reparation in second edition file reparation
When, by the second edition information update of the second edition file;
If the first version file is by the second edition file reparation, when first version file reparation is completed, by institute
State the first version information update of first version file.
5. according to the method described in claim 4, it is characterized in that, the method also includes:
If the content inerrancy of the first version file detects the first version information and institute within a preset period of time
Whether consistent state second edition information;
If the first version information and the second edition information are inconsistent, choose the first version information and
The corresponding version file of the big version number of numerical value updates the small corresponding version of version number of numerical value in the second edition information
File.
6. the method according to claim 1, wherein the method also includes:
In the starting of embedded operation system, start timer;
When the timer exceeds default timing and the embedded OS starts not successfully, described in restarting
Embedded OS;
Alternatively,
When the timer is without departing from default timing and the embedded OS successfully starts up, Off Timer is simultaneously
Remove the non-zero value of the environmental variance.
7. a kind of starter of embedded OS characterized by comprising
Detection module, for detecting the value of the environmental variance in storage region in starting of embedded operation system;
Determining module when the value for detecting the environmental variance in detection module is non-zero, determines the embedded OS
Starting code has logic error;
File repair module, for repairing second edition file using third version file, and using the after the completion of repairing
Two version files repair first version file;
Starting module, for removing the non-zero value of the environmental variance, and again when the first version file reparation is completed
Start the embedded OS;
Wherein, the storage region is stored with, for starting the first version file of the embedded OS, for repairing
The second edition file of the first version file and for repairing the second edition file and the third without erasable movement
Version file;
After the value of environmental variance in the detection storage region, described device is also used to:
If the value of the environmental variance is 0, it is determined that the starting code of the embedded OS is without logic error;
According to the first check code of the first version file judge the first version file content whether mistake;
If the content inerrancy of the first version file, starts the embedded OS;
Wherein, first check code is raw according to the content of the image file of the first version file loaded into memory
At check code;
First check code according to the first version file judge the first version file content whether mistake
Afterwards, described device is also used to:
If there are mistakes for the content of the first version file, described is judged according to the second check code of second edition file
The content of two version files whether mistake;
If the content inerrancy of the second edition file, the first edition is repaired herein using the second edition file
Part;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance;
Wherein, second check code is raw according to the content of the image file of the second edition file loaded into memory
At check code;
After second check code according to second edition file judges whether the content of the second edition file is wrong, institute
Device is stated to be also used to:
If there are mistakes for the content of the second edition file, the second edition file is repaired using third version file,
And the first version file is repaired using the second edition file after the completion of repairing;
When the first version file reparation is completed, the step of executing the non-zero value for removing the environmental variance;
Wherein, the second edition file is the backup file of the first version file, and the third version file is
The file of the basic version of burning when factory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510383213.1A CN106325912B (en) | 2015-07-02 | 2015-07-02 | The starting method and device of embedded OS |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510383213.1A CN106325912B (en) | 2015-07-02 | 2015-07-02 | The starting method and device of embedded OS |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106325912A CN106325912A (en) | 2017-01-11 |
CN106325912B true CN106325912B (en) | 2019-11-08 |
Family
ID=57726341
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510383213.1A Active CN106325912B (en) | 2015-07-02 | 2015-07-02 | The starting method and device of embedded OS |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106325912B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110162429B (en) * | 2019-05-27 | 2021-09-24 | 深圳市网心科技有限公司 | System repair method, server and storage medium |
CN110347532A (en) * | 2019-07-11 | 2019-10-18 | 陕西瑞迅电子信息技术有限公司 | Multi-partitioned systems backup method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101556547A (en) * | 2009-05-25 | 2009-10-14 | 芯通科技(成都)有限公司 | Safe method and system used for remotely upgrading embedded Linux kernel |
CN102033790A (en) * | 2010-12-15 | 2011-04-27 | 中兴通讯股份有限公司 | Method and device for upgrading embedded-type system BOOTROM |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201102924A (en) * | 2009-07-03 | 2011-01-16 | Inventec Appliances Corp | Embedded electronic device and method for updating firmware thereof |
-
2015
- 2015-07-02 CN CN201510383213.1A patent/CN106325912B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101556547A (en) * | 2009-05-25 | 2009-10-14 | 芯通科技(成都)有限公司 | Safe method and system used for remotely upgrading embedded Linux kernel |
CN102033790A (en) * | 2010-12-15 | 2011-04-27 | 中兴通讯股份有限公司 | Method and device for upgrading embedded-type system BOOTROM |
Also Published As
Publication number | Publication date |
---|---|
CN106325912A (en) | 2017-01-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106775610B (en) | Electronic equipment starting method and electronic equipment | |
CN101719072A (en) | Embedded type terminal equipment software upgrading method and upgrading device | |
CN103970564A (en) | Automatic repairing and upgrading method of embedded operating system and embedded operating system with automatic repairing and upgrading functions | |
CN107783776B (en) | Processing method and device of firmware upgrade package and electronic equipment | |
CN102799499B (en) | Method and vehicle-mounted Android equipment that vehicle-mounted Android device systems recovers | |
CN102184111B (en) | The equipment of operating system online upgrading method and tape operation system | |
CN106775674B (en) | Equipment based on universal boot loader and starting method thereof | |
CN108345464A (en) | A kind of the startup method and Android vehicle device of Android system | |
CN105607972A (en) | Abnormity remedying method and device | |
CN106325912B (en) | The starting method and device of embedded OS | |
CN101196839A (en) | Data renovation and synchronization process of double-flash read-only memory | |
JP4789958B2 (en) | Component information restoration method, component information management method, and electronic apparatus | |
CN111273928B (en) | Bootloader design method for self-upgrading | |
CN102122258A (en) | Method for repairing damaged embedded equipment file system | |
CN113032183A (en) | System management method, device, computer equipment and storage medium | |
CN104102505A (en) | Computer power-on method | |
CN103731301A (en) | Dual backup achieving method of remote network system | |
JP2005284902A (en) | Terminal device, control method and control program thereof, host device, control method and control program thereof, and method, system, and program for remote updating | |
CN112395130A (en) | System backup method and device | |
US9529581B2 (en) | Circuit and method for writing program codes of basic input/output system | |
JP2011053984A (en) | Firmware protection apparatus and program thereof | |
CN104216797B (en) | Embedded system setting value initialization system, method and electronic installation | |
CN110502367A (en) | A kind of control method and electronic equipment | |
CN111897583A (en) | Equipment starting method and embedded equipment | |
CN105278993A (en) | Linux system based drive module upgrading method and apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |