A kind of file corresponds to the upgrade method of multi-embedding formula equipment
Technical field
The present invention relates to a kind of device updating methods, and the upgrading side of multi-embedding formula equipment is corresponded to more particularly, to a kind of file
Method.
Background technology
Currently, embedded system consists of two parts substantially:Bootstrap, operating system.
Bootstrap:Device for initializing CPU and periphery, main purpose are guiding operating system normal operations.
Operating system:The core of embedded system is mainly used for managing the scheduling of multitask;Managing internal memory and periphery are set
It is standby to wait some fundamental operations.
Further accordance with different application scenarios, certain embedded systems also include some configuration files, these configuration files
The interior parameter etc. containing needed for facility information and the operation of each components of system as directed.
During actual production development, in order to reach the purpose of shortening the development time and saving production cost, usually
Same development teams can select to be applied to multiple embedded products with a CPU.Using the equipment with a CPU, can run
Same bootstrap and operating system, and different configuration informations is loaded, to realize different functions.Different CPU but by
In the differences such as framework and compiling rule, same bootstrap and operating system program cannot be shared.
It is actual by with a CPU develop and include configuration file the upgrade maintenance of embedded device in, due to embedding
Enter the factors such as formula equipment is wide in variety, distribution is miscellaneous.Frequently encounter problems with:One, upgrade file is more, is unfavorable for plant maintenance personnel
To upgrade file management, file is easy to obscure, and influences device upgrade efficiency;Two, plant maintenance personnel accidentally use alternative document liter
Grade, causes equipment to be unable to operate normally, or even can not start;Three, when device upgrade is safeguarded, leakage upgrading part system file is led
Cause equipment work abnormal etc..
Invention content
It is an object of the invention to:In view of the problems of the existing technology, a kind of file is provided and corresponds to multi-embedding formula equipment
Upgrade method, solve it is existing by with a CPU develop and include configuration file embedded device upgrade maintenance very not
Convenient problem.
The goal of the invention of the present invention is achieved through the following technical solutions:
A kind of file corresponds to the upgrade method of multi-embedding formula equipment, which is characterized in that this approach includes the following steps:
(1) Instb packets are downloaded in the memory of equipment to be upgraded, and parses the header information of Instb packets;
(2) confirm whether the file downloaded is Instb packets, if it is carry out step (3), otherwise exit upgrading;
(3) integrality of effect Instb packets, if completely, carrying out step (4), otherwise exiting upgrading;
(4) facility information inside equipment to be upgraded is read in, and is matched one by one with the equipment list in Instb packets, such as
Fruit has and the facility information is matched, then carries out step (5), otherwise exit upgrading;
(5) according to the subfile information table in Instb packets, included subfile is extracted from Instb packets one by one, such as
The subfile of fruit extraction is device configuration file, then reads the facility information in the configuration file, if the facility information and waited for
Facility information inside updating apparatus is consistent, then is upgraded to configuration file and continue to read next subfile.
Preferably, the Instb packets are made of header information, equipment list, subfile information table and subfile, the head
It is the magic numbers of Instb packets, the file effect information for verifying file integrality that information, which includes for marking this document, described
The facility information of all devices of Instb packets support is set out in equipment list, and the subfile includes bootstrap file, operation system
The configuration file of system file and plurality of devices.
Preferably, described to confirm that the step of whether file downloaded is Instb packets includes:Judge this document magic number and
Whether the magic number that Instb is defined is consistent, is Instb packets if consistent.
Preferably, the method for the integrality of the effect Instb packets includes:According to the content of the header information of Instb packets
Check value calculating is carried out to Instb packets, the file effect information after the completion of calculating and in Instb packets is compared, if the two
Unanimously, then illustrate that Instb packets are complete.
Preferably, facility information is equipped in the equipment to be upgraded, the facility information in different equipment to be upgraded is different.
Preferably, the step (5) further includes step:If the subfile of extraction is not device configuration file, directly
It treats updating apparatus to be upgraded, and continues to read next subfile.
Compared with prior art, the present invention has the following advantages:
1, multiple upgrade files of plurality of devices are merged into a file, then plurality of devices is risen with this document
Grade, greatly reduced the quantity of upgrade file, be conducive to improve device upgrade efficiency;
2, the correctness and integrality for first examining upgrade file can be avoided effectively using caused by illegal document upgrading
The problem of equipment can not start, wherein illegal file refer to the upgrade file being destroyed in non-upgrade file or data transmission procedure;
3, matching unit information is carried out, effectively avoids and is upgraded using the upgrade file of non-equipment, and is caused
Equipment work abnormal or equipment the problem of can not starting;
4, program automatically selects upgrading, reduces manual operation link, at the same also avoid maintenance personnel leak upgrading and again
The problem of upgrading again, and greatly shorten update time.
Description of the drawings
Fig. 1 is the data structure diagram of Instb packets;
Fig. 2 is the flow chart of effect Instb packet integralities of the present invention;
Fig. 3 is that the present invention carries out the matched flow chart of equipment support to be upgraded;
Fig. 4 present invention carries out Instb subfiles and upgrades flow chart.
Specific implementation mode
The present invention is described in detail with specific embodiment below in conjunction with the accompanying drawings.
Embodiment
Present invention is mainly used for the upgrade maintenances of the embedded device by developing and including configuration file with a CPU.This
The principle of invention is:Each embedded device to be upgraded is given to distribute a special facility information (such as device number) first, this
Information is not identical with other equipment, and this information is stored in the specific configuration file of equipment, when manufacture write-in set
Standby Flash, is no longer changed after manufacture.Then the bootstrap file these embedded devices to be upgraded shared and behaviour
Make system file and one file packet of configuration file boil down to of each equipment, this file packet is named as Instb packets here.
Finally, by Instb packets to each device upgrade.
Instb packets consist of the following components (as shown in Figure 1):Header information, equipment list, subfile information table and Ziwen
Part.Wherein header information includes magic number, file verification information etc.;The effect of magic number is that label this document is Instb packets;Text
Part check information includes Instb length and the check value of Instb, for verifying the integrality of file;Equipment list is for enumerating
Go out the information of the supported all equipment of the Instb packets;Subfile can be bootstrap file, operating system file and more
The configuration file etc. of kind equipment.These files are compressed by specific compress mode, and are sequentially arranged in the end of file.And by this
All information of a little files are stored in subfile information table, decompression, extraction when for upgrading.
When being upgraded to equipment using Instb packets, key step is as follows:
The first step downloads to Instb packets in the memory of equipment to be upgraded, and parses the header information of Instb packets.
Second step, as shown in Fig. 2, first confiring that whether the file of download is Instb packets, specific confirmation method is to judge
Whether the magic number of this document and the magic number of Instb package definitions are consistent, carry out next step operation if consistent, otherwise exit
Upgrading, and prompt customer upgrade file incorrect;Then the integrality of Instb packets is checked, specific method is, according to Instb packets
Header information content to Instb packets carry out check value calculating, after the completion of calculating and Instb packets in original checksums value ratio
Compared with if the two is consistent, illustrating that Instb packets are complete, otherwise exit upgrading, and it is wrong to promote customer upgrade file.
Third walks, as shown in figure 3, read in the facility information inside equipment to be upgraded, and one by one with the equipment in Instb packets
Table is matched.If there is matched with the facility information to be upgraded, then next step updating operation is carried out, upgrading is otherwise exited,
And user's upgrade file is prompted not support this equipment.
4th step extracts institute from Instb packets one by one as shown in figure 4, according to the subfile information table in Instb packets
Including subfile.If the subfile of extraction is configuration file, the facility information in the configuration file is read, if this sets
Standby information is consistent with the facility information preserved in equipment to be upgraded, then upgrades to configuration file, otherwise ignores this configuration text
Part.If this document is not configuration file, directly upgraded.Upgrading until completing all subfiles.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, it is noted that all
All any modification, equivalent and improvement made by within the spirit and principles in the present invention etc. should be included in the guarantor of the present invention
Within the scope of shield.