The upgrade method of the corresponding multi-embedding formula equipment of a kind of file
Technical field
The present invention relates to a kind of device updating method, especially relate to the upgrade method of the corresponding multi-embedding formula equipment of a kind of file.
Background technology
At present, embedded system is made up of two parts substantially: boot, operating system.
Boot: for the device of initialization CPU and periphery, fundamental purpose guides operating system normally to run.
Operating system: the core of embedded system, is mainly used in the scheduling managing multitask; Some fundamental operations such as managing internal memory and peripherals.
Another according to different application scenarioss, some embedded system also includes some configuration files, the parameter etc. needed for running containing facility information and each components of system as directed in these configuration files.
In the production development process of reality, shorten the development time to reach and save the objects such as production cost, usual same development teams can be selected to be applied to multiple embedded product with a CPU.Use the equipment with a CPU, same boot and operating system can be run, and load different configuration informations, to realize different functions.Different CPU but due to differences such as framework and compiling rules, can not share same boot and operating system program.
In reality by developing with a CPU and comprising in the upgrade maintenance of the embedded device of configuration file, due to factors such as embedded device are wide in variety, distribution is assorted.Often run into following problem: one, upgrade file is many, be unfavorable for that plant maintenance personnel manage upgrade file, file is easily obscured, and affects device upgrade efficiency; Two, plant maintenance personnel use alternative document upgrading by mistake, cause equipment normally to run, even cannot start; Three, when device upgrade is safeguarded, leak upgrading part system file, cause equipment work abnormal.
Summary of the invention
The object of the invention is to: for prior art Problems existing, the upgrade method of the corresponding multi-embedding formula equipment of a kind of file is provided, solve existing by developing with a CPU and comprising the very inconvenient problem of the upgrade maintenance of the embedded device of configuration file.
Goal of the invention of the present invention is achieved through the following technical solutions:
A upgrade method for the corresponding multi-embedding formula equipment of file, it is characterized in that, the method comprises the following steps:
(1) Instb bag is downloaded in the internal memory of equipment to be upgraded, and resolve the header information of Instb bag;
(2) whether the file that confirmation is downloaded is Instb bag, if it is carries out step (3), otherwise exits upgrading;
(3) integrality of effect Instb bag, if complete, then carry out step (4), otherwise exits upgrading;
(4) read in the facility information of device interior to be upgraded, and one by one with Instb bag in equipment list mate, if having and this facility information coupling, then carry out step (5), otherwise exit upgrading;
(5) according to the son file information table in Instb bag, comprised son file is extracted one by one from Instb bag, if the son file extracted is device configuration file, then read the facility information in this configuration file, if this facility information is consistent with the facility information of device interior to be upgraded, then configuration file is upgraded and continue to read next son file.
Preferably, described Instb bag is made up of header information, equipment list, son file information table and son file, it is the magic number of Instb bag, the file effect information for authenticating documents integrality that described header information comprises for marking this file, described equipment list enumerates out the facility information of all devices that Instb bag is supported, described son file comprises the configuration file of boot file, operating system file and plurality of devices.
Preferably, whether the described file confirming to download is that the step that Instb wraps comprises: judge that whether the magic number of this file is consistent with the magic number that Instb defines, if consistent, is Instb bag.
Preferably, the method of the integrality of described effect Instb bag comprises: the content according to the header information of Instb bag carries out proof test value calculating to Instb bag, file effect information after having calculated and in Instb bag compares, if both are consistent, then illustrates that Instb bag is complete.
Preferably, be provided with facility information in described equipment to be upgraded, the facility information in different equipment to be upgraded is different.
Preferably, described step (5) also comprises step: if the son file extracted is not device configuration file, then directly treats updating apparatus and upgrade, and continues to read next son file.
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 with this file, plurality of devices are upgraded, greatly reducing the quantity of upgrade file, be conducive to improving device upgrade efficiency;
2, first check correctness and the integrality of upgrade file, effectively can avoid the problem that the equipment using illegal document upgrading to cause cannot start, wherein illegal file refers to upgrade file destroyed in non-upgrade file or data transmission procedure;
3, carry out matching unit information, effectively avoid and use the upgrade file of non-equipment to upgrade, and the problem that the equipment work caused is abnormal or equipment cannot start;
4, program selects upgrading automatically, decreases manual operation link, it also avoid the problem that maintainer leaks upgrading and repeatedly upgrading simultaneously, and greatly shortens update time.
Accompanying drawing explanation
Fig. 1 is the data structure diagram of Instb bag;
Fig. 2 is the process flow diagram of effect Instb bag integrality of the present invention;
Fig. 3 is the process flow diagram that the present invention carries out equipment support to be upgraded coupling;
Fig. 4 the present invention carries out Instb son file upgrading process flow diagram.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Embodiment
The present invention is mainly used in by developing with a CPU and comprising the upgrade maintenance of the embedded device of configuration file.Principle of the present invention is: distribute a special facility information (as device number) first to each embedded device to be upgraded, identical not with other equipment of this information, and by this information, be kept in the specific configuration file of equipment, when dispatching from the factory, the Flash of write device, no longer changes after dispatching from the factory.Then by these embedded devices to be upgraded configuration file boil down to file bag of the boot file that shares and operating system file and each equipment, here this file bag called after Instb is wrapped.Finally, wrapped to each device upgrade by Instb.
Instb bag consists of the following components (as shown in Figure 1): header information, equipment list, son file information table and son file.Wherein header information comprises magic number, file verification information etc.; The effect of magic number is this file of mark is Instb bag; File verification packets of information, containing the proof test value of Instb length and Instb, is used for the integrality of authenticating documents; Equipment list wraps the information of supported all equipment for enumerating out this Instb; Son file can be the configuration file etc. of boot file, operating system file and plurality of devices.These files by specific compress mode compression, and are sequentially arranged in the end of file.And all information of these files are left in son file information table, for decompress(ion), extraction during upgrading.
When using Instb bag to upgrade to equipment, key step is as follows:
The first step, downloads to Instb bag in the internal memory of equipment to be upgraded, and resolves the header information of Instb bag.
Second step, as shown in Figure 2, first confirms whether the file downloaded is Instb bag, concrete confirmation method is, judges that whether the magic number of this file is consistent with the magic number of Instb package definition, if consistent, carries out next step operation, otherwise exit upgrading, and point out customer upgrade file incorrect; Then the integrality of Instb bag is checked, concrete grammar is, content according to the header information of Instb bag carries out proof test value calculating to Instb bag, original checksums value after having calculated and in Instb bag compares, if both are consistent, then illustrate that Instb bag is complete, otherwise exit upgrading, and it is wrong to promote customer upgrade file.
3rd step, as shown in Figure 3, reads in the facility information of device interior to be upgraded, and mates with the equipment list in Instb bag one by one.If had and this facility information to be upgraded coupling, then carry out next step updating operation, otherwise exit upgrading, and point out this upgrade file of user not support this equipment.
4th step, as shown in Figure 4, according to the son file information table in Instb bag, extracts comprised son file one by one from Instb bag.If the son file extracted is configuration file, then read the facility information in this configuration file, if this facility information is consistent with the facility information preserved in equipment to be upgraded, then configuration file is upgraded, otherwise ignore this configuration file.If this file is not configuration file, then directly upgrade.Until complete the upgrading of all son files.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, it should be pointed out that all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.