The content of the invention
The problem of in correlation technique, the present invention propose a kind of upgrade method of embedded system, solve existing skill
In art, escalation process needs manually to participate in and upgrade personnel and needs to have certain professional knowledge, and escalation process influences current
The problem of operation.
The technical proposal of the invention is realized in this way:
According to an aspect of the invention, there is provided a kind of upgrade method of embedded system, this method include:
The mirror image header of mirror image in storage device is read, the system for determining mirror image according to the mirror image header of reading starts
Partition number;
Subregion to be upgraded is determined according to system boot partition number;
Read the partition information of subregion to be upgraded, the version number of the subregion mirror image according to corresponding to subregion to be upgraded with
The version number of the upgrade image prestored in peripheral hardware, it is determined whether upgrade to the subregion mirror image in storage device;
It is determined that result is the specified location that in the case of being, upgrade image is synchronized in subregion to be upgraded.
Wherein, when determining whether to upgrade the subregion mirror image in storage device, can be prestored in peripheral hardware
Upgrade image version number be more than subregion mirror image to be upgraded corresponding to image release number in the case of, it is determined that need to depositing
Subregion mirror image in storage equipment is upgraded.
In addition, after the specified location that upgrade image is synchronized in subregion to be upgraded, can also be according to synchronization after
Mirror image is updated to the partition information corresponding to the subregion after upgrading;
System boot partition number in mirror image header is updated to the partition number for the subregion being this time upgraded.
, wherein it is desired to the partition information of renewal includes at least one of:
Regeneration block version number, regeneration block identifying code, the size of regeneration block mirror image.
In addition, after being updated to partition information, storage device is restarted, wherein, include the step of restarting:
The mirror image header of the mirror image after the completion of upgrading is read, obtains the system boot partition number after renewal, and read and be
The partition information of subregion, the subregion identifying code in the partition information enter to the mirror image of the subregion corresponding to system boot partition number
Row verification;
In the case of exception is verified, reset this upgrading after the completion of mirror image mirror image header, by system start point
Area code is updated to the partition number corresponding to former boot partition, and starts storage device by former boot partition.
According to another aspect of the present invention, there is provided a kind of update device of embedded system, the device include:
Read module, for reading the mirror image header of mirror image in storage device, it is additionally operable to read subregion to be upgraded
Partition information;
First determining module, for determining the system boot partition number of mirror image according to the mirror image header of reading, and according to
System boot partition number determines subregion to be upgraded;
Second determining module, for advance in the version number of the subregion mirror image according to corresponding to subregion to be upgraded and peripheral hardware
The version number of the upgrade image of storage, it is determined whether upgrade to the mirror image in storage device;
Upgraded module, in the case of it is determined that result is to be, upgrade image being synchronized in subregion to be upgraded
Specified location.
Wherein, the device further comprises:
Update module, for after the specified location that upgrade image is synchronized in subregion to be upgraded, after synchronization
Mirror image the partition information corresponding to the subregion after upgrading is updated;
System boot partition number in mirror image header is updated to the partition number for the subregion being this time upgraded.
Wherein, the information of update module renewal, including at least one of:
Regeneration block version number, regeneration block identifying code, the size of regeneration block mirror image.
Wherein, the device further comprises:
Equipment starting module, for after being updated to partition information, restarting storage device, wherein read module
It is further used in restarting procedure, reads the mirror image header of the mirror image after the completion of upgrading, obtains the system after renewal
Boot partition number, and read the partition information of subregion corresponding to system boot partition number;
Authentication module, the mirror image of the subregion is entered for the subregion identifying code of subregion according to corresponding to system boot partition number
Row verification.
Wherein, the device further comprises:
Module is reset, in the case of verification exception, resetting the mirror image header of this mirror image after the completion of upgrading,
System boot partition number is updated to the partition number corresponding to former boot partition, and storage device is started by former boot partition.
It is required when the present invention is by reading the mirror image header of mirror image in storage device to determine that system starts to use
Subregion and the subregion that upgrades of needs, it is independent of each other between subregion, escalation process does not influence system normal operation, and rises
Level process participates in simple and convenient manually without user, enhances Consumer's Experience, improves the stability and reliability of system.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, the every other embodiment that those of ordinary skill in the art are obtained, belong to what the present invention protected
Scope.
Firstly the need of explanation, every kind of mirror image all includes a mirror image header, and Fig. 1 shows the information knot of mirror image head
Structure, it includes:
System boot partition number, for identifying subregion used in system start-up phase.For example system boot partition number is
Subregion one, then need to read mirror image from subregion is a kind of when system starts;Second subregion is partition number to be upgraded.
The information of subregion, for identifying the essential information of the subregion.
As shown in Fig. 2 the information of subregion comprises at least at least one of:
The title of subregion mirror image, subregion version number, subregion check code, subregion mirror image original position and subregion mirror image it is big
It is small.
According to an embodiment of the invention, there is provided a kind of upgrade method of embedded system.
As shown in figure 3, the upgrade method of embedded system according to embodiments of the present invention includes:
Step S301, the mirror image header of mirror image in storage device is read, mirror image is determined according to the mirror image header of reading
System boot partition number;
Step S303, subregion to be upgraded is determined according to system boot partition number;
Step S305, the partition information of subregion to be upgraded is read, the subregion mirror image according to corresponding to subregion to be upgraded
Version number and peripheral hardware in the version number of upgrade image that prestores, it is determined whether the subregion mirror image in storage device is carried out
Upgrading;
Step S307, in the case of it is determined that result is to be, upgrade image is synchronized to specifying in subregion to be upgraded
Position.
Wherein, when determining whether to upgrade the subregion mirror image in storage device, can be prestored in peripheral hardware
Upgrade image version number be more than subregion mirror image to be upgraded corresponding to image release number in the case of, it is determined that need to depositing
Subregion mirror image in storage equipment is upgraded.
In addition, after the specified location that upgrade image is synchronized in subregion to be upgraded, can also be according to synchronization after
Mirror image is updated to the partition information corresponding to the subregion after upgrading;System boot partition number in mirror image header is updated
For the partition number of this subregion being upgraded.
So, mirror image will be automatically selected when lower secondary device starts for newest version to be started.
, wherein it is desired to the partition information of renewal includes at least one of:
Regeneration block version number, regeneration block identifying code, the size of regeneration block mirror image.
In addition, after being updated to partition information, storage device can be restarted, wherein, the step of restarting
Including:
The mirror image header of the mirror image after the completion of upgrading is read, obtains the system boot partition number after renewal, and read and be
The partition information of subregion, the subregion identifying code in the partition information enter to the mirror image of the subregion corresponding to system boot partition number
Row verification;
In the case of exception is verified, reset this upgrading after the completion of mirror image mirror image header, by system start point
Area code is updated to the partition number corresponding to former boot partition, and starts storage device by former boot partition.
So, emergency situations occur in escalation process causes upgrading to fail, and also will not when starting next time
The normal operation of influence system, and whether upgraded successfully by checking system, in the case where verifying exception, system is using former
Boot partition carries out the startup of current system, and can continue to upgrade the subregion that former needs upgrade, and can't influence to work as
The operation conditions of preceding system, improve the stability and reliability of system.
In addition, the upgrade method of embedded system provided by the present invention can not only carry out in system start-up phase but also can
To carry out at the system operation stage, for convenience of explanation and understand, in the following embodiments, peripheral hardware is said by taking SD card as an example
It is bright, but it should be recognized that the peripheral hardware in the present invention is not limited only to SD card, can also be other external memory devices.
The flow of the upgrade method of embedded system is shown when Fig. 4 shows system start-up phase according to embodiments of the present invention
It is intended to, the system upgrade process is as follows:
1st, whether detection SD card is inserted, if be not inserted into, into normal Booting sequence;
If the 2, SD card is inserted, upgrade script is read from SD card, if this document is not present, enters normal start and flows
Journey;
3rd, from upgrade script obtain mirror image version number information and whether upgrade command, may customize by upgrade command
Escalation process;
The 4th, if the version number of mirror image is less than the version number of mirror image built in equipment, into normal Booting sequence;
If the 5, the version number of mirror image is more than the version number of mirror image built in equipment, enter upgrading flow;
6th, upgrading flow is first read the mirror image in SD card in internal memory by the upgrade command in upgrade script, then by
In the storage device built in mirror image synchronization to equipment deposited, the green flicker that this process passes through indicator lamp identifies;
7th, upgrade successfully, indicator lamp green Chang Liang, system is restarted automatically, and indicator lamp goes out.
The flow of the upgrade method of embedded system is shown when Fig. 5 shows the system operation stage according to embodiments of the present invention
It is intended to, the system upgrade process is as follows:
System normal operation:
1st, backstage monitor process detects whether SD card is inserted by the signal pins in place of SD card, if be not inserted into,
Then system normal operation;
If the 2, SD card is inserted, upgrade script is read from SD card, if this document is not present, enters normal start and flows
Journey;
3rd, the version number information and upgrade command of mirror image are obtained from upgrade script, passes through the customizable upgrading of upgrade command
Process;
If the 4, the version number of mirror image is less than the version number of mirror image built in equipment, upgrading flow is exited, system is normally transported
OK;
If the 5, the version number of mirror image is more than the version number of mirror image built in equipment, enter upgrading flow;
6th, upgrading flow adjusts the Operation class of system first, into safety upgrade pattern, then by upgrade script
Upgrade command the mirror image in SD card is read in internal memory, then the storage device built in by the mirror image synchronization to equipment in internal memory
In, the green flicker that this process passes through indicator lamp identifies;
7th, upgrade successfully, indicator lamp green Chang Liang, system is restarted automatically, and indicator lamp goes out.
The process that the upgrade image that will be preserved in SD card is copied in subregion to be upgraded is described in detail below, its idiographic flow
It is as follows:
1st, the mirror image header of the mirror image is read, the system boot partition number in mirror image header is obtained, is opened according to system
Dynamic partition number can obtain partition number to be upgraded;
2nd, the partition information corresponding to partition number to be upgraded is read, obtains the original position of subregion mirror image;
The 3rd, mirror image is updated to the opening position specified in itself;
4th, the partition information corresponding to partition number to be upgraded is updated, refreshes subregion version number, subregion check code, subregion mirror
The information such as the size of picture;
5th, the system boot partition number in mirror image header is updated to the partition number being this time upgraded.
The process restarted after system upgrade is as shown in fig. 6, its process is as follows:
1st, the mirror image header of the mirror image is read, obtains system boot partition number;
2nd, the partition information corresponding to system boot partition number is read, obtains the original position and subregion mirror of subregion mirror image
The information such as the size of picture;
3rd, from mirror image corresponding to specified location reading;
4th, the subregion check code in partition information verifies to mirror image;
If the 5, verification is normal, started using newest mirror image, escalation process terminates;
If the 6, verification is abnormal, the mirror image header of the mirror image is reset, system boot partition number is updated into former start divides
The partition number in area, and started using the mirror image of the subregion;
In addition, the flow of restarting after system image upgrading can also be by configuring selection Starting mode, default configuration is to make
Started with the mirror image of system boot partition, can also be dynamically configured as being started using either partition.
According to an embodiment of the invention, a kind of update device of embedded system is additionally provided.
As shown in fig. 7, the update device of embedded system according to embodiments of the present invention includes:
Read module 71, for reading the mirror image header of mirror image in storage device, it is additionally operable to read subregion to be upgraded
Partition information;
First determining module 72, for determining the system boot partition number of mirror image, and root according to the mirror image header of reading
Subregion to be upgraded is determined according to system boot partition number;
Second determining module 73, for pre- in the version number of the subregion mirror image according to corresponding to subregion to be upgraded and peripheral hardware
The version number of the upgrade image first stored, it is determined whether upgrade to the mirror image in storage device;
Upgraded module 74, in the case of it is determined that result is to be, upgrade image being synchronized in subregion to be upgraded
Specified location.
Wherein, the device also includes:
Update module (not shown), for after the specified location that upgrade image is synchronized in subregion to be upgraded, root
The partition information corresponding to the subregion after upgrading is updated according to the mirror image after synchronization;
System boot partition number in mirror image header is updated to the partition number for the subregion being this time upgraded.
Wherein, the information of update module renewal, including at least one of:
Regeneration block version number, regeneration block identifying code, the size of regeneration block mirror image.
Wherein, the device further comprises:
Equipment starting module (not shown), for after being updated to partition information, restarting storage device, wherein
Read module 71 is further used in restarting procedure, reads the mirror image header of the mirror image after the completion of upgrading, and obtains more
System boot partition number after new, and read the partition information of subregion corresponding to system boot partition number;
Authentication module (not shown), the subregion identifying code for the subregion according to corresponding to system boot partition number is to the subregion
Mirror image verified.
Wherein, the device further comprises:
Module (not shown) is reset, in the case of verification exception, resetting the mirror of this mirror image after the completion of upgrading
As header, system boot partition number is updated to the partition number corresponding to former boot partition, and start by former boot partition
Storage device.
In summary, by means of the above-mentioned technical proposal of the present invention, believed by the mirror image head for reading mirror image in storage device
The subregion that the required subregion used and upgrading need during determining that system starts is ceased, is independent of each other, upgraded between subregion
Journey does not influence system normal operation, also, after by the position of the newest mirror image synchronization of version to the subregion being upgraded, it is right
The mirror image being upgraded is updated, and when restarting automatically so that guarantee is next, system is newest image release by operation, and
And in restarting process, verification process, in the case that exception occurs in checking, system are carried out by the mirror image completed to new upgrading
It will be started using original subregion mirror image, so that system can start the use for not interfering with user as usual, and also it is whole
Individual escalation process is simple and convenient, and escalation process participates in manually without user, enhances Consumer's Experience, stability and reliability are significantly
Improve.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
God any modification, equivalent substitution and improvements made etc., should be included in the scope of the protection with principle.