CN102945179A - Software upgrading method and device based on memory technology device (MTD) partition - Google Patents

Software upgrading method and device based on memory technology device (MTD) partition Download PDF

Info

Publication number
CN102945179A
CN102945179A CN2012104923261A CN201210492326A CN102945179A CN 102945179 A CN102945179 A CN 102945179A CN 2012104923261 A CN2012104923261 A CN 2012104923261A CN 201210492326 A CN201210492326 A CN 201210492326A CN 102945179 A CN102945179 A CN 102945179A
Authority
CN
China
Prior art keywords
mtd
description information
upgrading
divisional description
sub
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.)
Granted
Application number
CN2012104923261A
Other languages
Chinese (zh)
Other versions
CN102945179B (en
Inventor
李铁柱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Broadband Multimedia Technology Co Ltd
Original Assignee
Hisense Broadband Multimedia Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hisense Broadband Multimedia Technology Co Ltd filed Critical Hisense Broadband Multimedia Technology Co Ltd
Priority to CN201210492326.1A priority Critical patent/CN102945179B/en
Publication of CN102945179A publication Critical patent/CN102945179A/en
Application granted granted Critical
Publication of CN102945179B publication Critical patent/CN102945179B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a software upgrading method and device based on a memory technology device (MTD) partition. The method includes: adding description information and upgrading data of the MTD partition to be upgraded in a software upgrading file; reading the software upgrading file in an upgrading process, and analyzing the description information and the upgrading data of the MTD partition to be upgraded; writing the description information and the upgrading data of the MTD partition to be upgraded in corresponding storage positions in sequence according to MTD partition corresponding relation in description information of an original MTD partition and the description information of the MTD partition to be upgraded; and starting a system uboot, reading the description information of the MTD partition to be upgraded in a memory, assembling MTD partition description information writing parameters, and writing in a system kernel. The method can upgrade the description information of the MTD partition in the upgrading process, and adjustability and using flexibility of the MTD partition of the memory are improved.

Description

Method for upgrading software and device based on the MTD subregion
Technical field
The present invention relates to the software upgrading technology, specifically, relate to a kind of method for upgrading software based on the MTD subregion and device.
Background technology
MTD (memory technology device memory techniques equipment) is the subsystem for the linux system of reference-to storage equipment (such as Rom), must read and write by MTD the storeies such as ROM in the linux system.
In the products such as set-top box based on the linux system, as the modal ROM of the flash(of storer) all be divided into several MTD subregions, each subregion takies a part of flash space, is used for depositing independently program, finishes specific function.The concrete subregion situation of flash, partition number, subregion start address, partition size that comprises each subregion etc. described by MTD divisional description information.Determined by the system physical characteristic, under the linux system, can only read and write data by the MTD operation, and can not directly access flash.
Take the set-top box product as example, at present, based on the set-top box of linux system, its escalation process can't be finished the upgrading of MTD divisional description information usually, and reason is:
On the one hand, the MTD partition data is written in the kernel by special parameter by uboot when starting, and at whole program run duration, the MTD subregion can not be adjusted.If the change special parameter must be changed a partition holding at this parameter place, and owing to this subregion in the prior art all is not back up, will have risk to its upgrading, unsuccessfully can cause whole system to start if upgrade.
On the other hand, the data of carrying out under the linux system upgrade more that new capital is based on the MTD subregion, and can only read and write by MTD, and it wipes subregion and data writing all must operate in specified partition.If it is inconsistent to carry out certain MTD subregion and original MTD subregion of data upgradings, using separately can not the software upgrade requirement based on the instruction of MTD.
Owing to can't MTD divisional description information be upgraded, thereby can not adjust the MTD subregion of flash, cause the memory partition dirigibility relatively poor, the upgrading practicality is not strong, is unfavorable for the flexible upgrading of product and the reduction of production life cycle maintenance cost.
Summary of the invention
The MTD divisional description information in the prior art of the present invention is directed to can not be upgraded and the above-mentioned shortcoming that exists provides a kind of method for upgrading software based on the MTD subregion and device, using the method can upgrade to MTD divisional description information in escalation process, thereby has improved the adjustability of storer MTD subregion and used dirigibility.
For achieving the above object, upgrade method provided by the invention adopts following technical proposals to be achieved:
A kind of method for upgrading software based on the MTD subregion sets in advance at least two subregions in the storer based on the MTD subregion, store respectively identical content, the upgrading before former MTD divisional description information, described upgrade method comprises the steps:
A1, the upgrade data in each the MTD subregion after upgrade in advance MTD divisional description information and the upgrading is added in the software upgrading file, include at least two MTD subregions that are used for storing pre-upgrading MTD divisional description information in the MTD subregion after upgrading corresponding to the MTD divisional description information of upgrading in advance;
Reading software upgrade file in a2, the escalation process parses pre-upgrading MTD divisional description information and upgrade data;
The former MTD divisional description information of a3, read memory writes to respective memory locations successively according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information;
The uboot of a4, start-up system reads the pre-upgrading MTD divisional description information that is stored in the storer, assembling MTD divisional description information write parameters, and with this parameter read-in in system kernel.
Aforesaid method, described former MTD divisional description information preferably is stored in the storer with the XML document form, and described pre-upgrading divisional description information is preferably added in the software upgrading file with the XML document form.
Aforesaid method for reducing the taking of memory storage area, sets in advance the subregions of two described former MTD divisional description information of storage in the storer based on the MTD subregion; Include two MTD subregions that are used for storing pre-upgrading MTD divisional description information in the MTD subregion after upgrading corresponding to described pre-upgrading divisional description information.
Aforesaid method is reduced data ablation process, raising updating speed, and described step a3 specifically comprises following substep:
A31, the MTD divisional description information of will upgrading in advance and upgrade data are divided into respectively several sub-blocks of specifying size;
The start address of the position calculation sub-block in the MTD subregion start address in a32, the pre-upgrading of the basis MTD divisional description information and all sub-blocks of the current sub-block that will write pre-upgrade MTD divisional description information or upgrade data under it;
A33, read described former MTD divisional description information, obtain start address and the offset address of the corresponding former MTD subregion of this sub-block according to the start address of this former MTD divisional description information and sub-block;
A34, wipe and the equal-sized storage area of sub-block according to start address and the offset address of former MTD subregion;
A35, the data of sub-block are written in the storage area after wiping.
Aforesaid method, the equal and opposite in direction of an erase operation unit of the preferred and described storer based on the MTD subregion of the size of described sub-block.
Aforesaid method, be the reduced data structure, be convenient to data transfer and correct the parsing, described software upgrading file includes the pre-upgrading MTD divisional description information checking field of successively storage, in advance upgrade MTD divisional description message length field, in advance upgrade the upgrade data check field in each MTD subregion after MTD divisional description information, the upgrading, length field and the upgrade data of upgrade data.
Preferably, described pre-upgrading MTD divisional description information checking field and described upgrade data check field are the CRC check field.
For realizing aforementioned goal of the invention, update device provided by the invention adopts following technical proposals to realize:
A kind of software updating apparatus based on the MTD subregion, this device comprises:
Former MTD divisional description information memory cell is used for storing former MTD divisional description information;
At least one former MTD divisional description information back-up storage unit, as redundant memory cell, the former MTD divisional description information of storage and former MTD divisional description information memory cell identical content;
The software upgrading file receives and storage unit, is used for receiving software upgrading file and the storage of external transmission;
Pre-upgrading MTD divisional description information analysis unit is connected with storage unit with the reception of software upgrading file, is used for parsing from the software upgrading file pre-upgrading MTD divisional description information;
The upgrade data resolution unit receives with the software upgrading file and to be connected with storage unit, is used for parsing from the software upgrading file upgrade data in each the MTD subregion after the upgrading;
Data write unit, be connected with former MTD divisional description information back-up storage unit with pre-upgrading MTD divisional description information analysis unit, upgrade data resolution unit and former MTD divisional description information memory cell, be used for writing to successively respective memory locations according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information;
The uboot processing unit is used for carrying out the uboot Related Work, and the write parameters of will being correlated with is written in the system kernel;
The write parameters module units is connected with the uboot processing unit with pre-upgrading MTD divisional description information analysis unit, is used for assembling MTD divisional description information write parameters, and this parameter is transferred to the uboot processing unit.
Aforesaid device, in described former MTD divisional description information memory cell and the described former MTD divisional description information back-up storage unit preferably with XML document form store M TD divisional description information; Described pre-upgrading MTD divisional description information preferably is stored in the described software upgrading file with the XML document form.
Aforesaid device, for simplifying the upgrade data ablation process, improving updating speed, described data write unit comprises following subelement:
Sub-block is cut apart subelement, is used for upgrade in advance MTD divisional description information and upgrade data are divided into respectively the sub-block that several specify size;
The sub-block start address is determined subelement, cut apart subelement with described pre-upgrading MTD divisional description information analysis unit with sub-block and be connected, be used for start address according to the position calculation sub-block in all sub-blocks of the MTD subregion start address in the pre-upgrading MTD divisional description information and the current sub-block that will write pre-upgrading MTD divisional description information or upgrade data under it;
The sub-block mapping address is determined subelement, determine that with the sub-block start address subelement is connected with described former MTD divisional description information memory cell and former MTD divisional description information back-up storage unit, obtain start address and the offset address of the corresponding former MTD subregion of this sub-block according to the start address of former MTD divisional description information and sub-block, as the mapping address of sub-block;
The data erase subelement determines that with the sub-block mapping address subelement is connected, be used for according to the start address of former MTD subregion and offset address wipe with the equal-sized storage area of sub-block in data;
The sub-block data write subelement, determine that with the sub-block mapping address subelement and sub-block cut apart subelement and be connected, and are used for data with sub-block to be written in the storage area after wiping.
Compared with prior art, advantage of the present invention and good effect are:
1, by in storer, selecting two MTD divisional description information that subregion is stored respectively identical content, form effective backup of descriptor, then in the software upgrading escalation process, write the MTD divisional description information of pre-upgrading in the upgrading mode, when the uboot of lower subsystem starts, re-assemblying write parameters according to the MTD divisional description information of reserving subregion is written in the system kernel, realize the upgrading of MTD divisional description information, improved the adjustability of storer MTD subregion and used dirigibility.And, owing to there being backup information to exist, even outage can obliterated data yet in the escalation process, guaranteed the security of upgrading MTD divisional description information in software upgrade process.
When 2, in to the MTD subregion after the upgrading, writing upgrade data and pre-upgrading MTD divisional description information, be divided into a plurality of sub-blocks by the data that will write, then sub-block is mapped in the former MTD subregion and writes successively, guarantee that the sub-block data write in same former subregion, the phenomenon of former subregion can not occur crossing over, improve accuracy and writing speed that data write.
After reading the specific embodiment of the present invention by reference to the accompanying drawings, other characteristics of the present invention and advantage will become clearer.
Description of drawings
Fig. 1 is the main flow chart that the present invention is based on an embodiment of method for upgrading software of MTD subregion;
Fig. 2 is the process flow diagram that writes upgrade data among Fig. 1 embodiment according to the MTD subregion after the upgrading;
Fig. 3 is the structured flowchart that the present invention is based on an embodiment of software updating apparatus of MTD subregion.
Embodiment
Below in conjunction with the drawings and specific embodiments technical scheme of the present invention is described in further detail.
Please refer to the process flow diagram of an embodiment of the method for upgrading software that the present invention is based on the MTD subregion illustrated in figures 1 and 2, wherein, Fig. 1 is the main flow chart of this embodiment, and Fig. 2 is the process flow diagram that writes upgrade data according to the MTD subregion after the upgrading.
This embodiment upgrades to example with the set-top box product software with linux operating system, the flash storer of set-top box is divided into a plurality of MTD subregions, except store M TD divisional description information and functional software program, also have some reservations, undefined MTD subregion.When the method for using this embodiment is carried out software upgrading to set-top box, except the upgrade data upgrading that can carry out conventional functional software program, can also in escalation process, realize the upgrading to MTD divisional description information.
Please refer to Fig. 1, this embodiment realizes that simultaneously the detailed process of upgrade data and the upgrading of MTD divisional description information is as follows:
Step 101: flow process begins.
Step 102: in based on the flash storer of MTD subregion, select two and reserve subregion.Reserving subregion for these two will be with the former MTD divisional description information before the XML document form storage upgrading.And these two to reserve the file content of storing in the subregion identical, also namely has one to be the backup subregion, to realize effective backup of MTD divisional description information.
Former MTD divisional description information has generally comprised the field contents such as partition number, subregion start address and partition size.
Step 103: the MTD divisional description information of upgrading is in advance added in the software upgrading file with document form, consist of the software upgrading file with upgrade data.
Pre-upgrading MTD divisional description information is used for describing pre-upgrading MTD partition information also with XML document form editor, includes the information such as partition number, subregion start address, partition size of the MTD subregion of pre-upgrading.Upgrade data in each MTD subregion after upgrading MTD divisional description information and the upgrading is assembled according to certain data layout in advance, forms the software upgrading file.
For instance, the MTD divisional description message file of upgrading in advance can be put into the foremost, so that get access to easily.Concrete organized formats is: the MTD divisional description information checking field of will upgrading in advance, in advance upgrade MTD divisional description message length field, the upgrade upgrade data check field in each MTD subregion after MTD divisional description information, the upgrading, length field and the upgrade data of upgrade data starts anew to assemble successively in advance.If a plurality of upgrade datas are arranged, then assemble first check field, length field and the upgrade data of first upgrade data, and then assemble check field, length field and the upgrade data of other upgrade datas.After this specific data layout formation software upgrading file, software upgrade procedure can get access to described each upgrade data of required MTD divisional description message file and this document easily from the software upgrading file.
Wherein, check field and the described upgrade data check field of the MTD divisional description message file of pre-upgrading all adopt the CRC check field.
And, corresponding with the back-up storage of former MTD divisional description information before the upgrading in the step 102, include two MTD subregions that are used for storing pre-upgrading MTD divisional description information in the MTD subregion after upgrading corresponding to the MTD divisional description information of upgrading in advance.
Step 104: set-top box linux system enters software upgrade process, the reading software upgrade file.
The specific implementation of this process is prior art, is not specifically addressed at this.
Step 105: from the software upgrading file that reads, parse pre-upgrading MTD divisional description information and upgrade data.
Step 106: the MTD divisional description information of will upgrading in advance is written to the MTD subregion after the upgrading.
Step 107: upgrade data is written in the MTD subregion after the upgrading.
Pre-upgrading MTD divisional description information will be as upgrade data a kind of, be written to the storer respective memory locations with other software upgrade datas etc.Write fashionable, with the former MTD divisional description information of read memory, write to successively respective memory locations according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information.
Upgrade data can be written to by in the MTD subregion after the corresponding upgrading of MTD divisional description information of pre-upgrading by the MTD order.A concrete implementation procedure please refer to Fig. 2 and following description to Fig. 2.
In this embodiment, the MTD divisional description information of upgrading in advance can be written in two subregions in the storer successively, and a subregion just is then written to another subregion after writing.Therefore, even in ablation process, cut off the power supply, also can guarantee to have at least to store complete MTD divisional description message file in the subregion.No matter this complete MTD divisional description information is information or upgrading information afterwards before the upgrading, can guarantee that all operating system can normally start, guaranteed the upgrading reliability.
Need to prove, the step 107 that writes the step 106 of pre-upgrading MTD divisional description message file and write upgrade data is not necessarily according to first step 106 order of step 107 again, also can be to write first upgrade data, write MTD divisional description information again, be again step 106 of first step 107, perhaps two parts intersection writes.
Step 108: the uboot of starter motor set-top box system, read the pre-upgrading MTD divisional description information that is stored in the storer, form MTD divisional description information write parameters.
Because MTD divisional description information is written in the kernel by write parameters when the uboot of set top box operations system starts and goes, so, after in the MTD subregion after the MTD divisional description information of will upgrading in advance is written to corresponding upgrading, if do not restart set-top box, system MTD divisional description information can't be upgraded.By the time escalation process finishes, and restarts after the uboot of set-top box, reads first the pre-upgrading MTD divisional description information that has been stored in the storer, the also MTD divisional description information after the i.e. upgrading; Then, utilize MTD divisional description information after the upgrading, re-assembly MTD divisional description information write parameters according to the form of write parameters.
Certainly, if MTD divisional description information is not upgraded, after then uboot started, what read was the former MTD divisional description information of reserving in the subregion, still according to former divisional description information storer is carried out the MTD subregion.
Step 109:uboot is written to write parameters in the system kernel.
Because write parameters is by the MTD divisional description information structure after the upgrading, therefore, has realized the upgrading to MTD divisional description information.After the upgrading, the MTD number of partitions of flash storer and large young pathbreaker divide according to new divisional description information, thereby have improved the adjustability of storer MTD subregion and used dirigibility.
And, after the upgrading of finishing MTD divisional description information, the MTD divisional description information of upgrading in advance will become former MTD divisional description information and in storer back-up storage.
As mentioned above, because MTD subregion number and size after the former MTD subregion number before upgrading, size and the upgrading may be not identical, a MTD subregion after the upgrading may be crossed over original a plurality of MTD subregions.In the software upgrade process before set-top box uboot is restarted, require upgrade data (comprising pre-upgrading MTD divisional description information) to write storage according to the MTD subregion after the upgrading.But because actual MTD subregion also do not change, therefore, the start address of the subregion after that upgrade data will write, the upgrading and end address are not necessarily in original some subregions.And owing to being again the read-write operation that carries out data according to subregion based on the flash of MTD subregion, so, will more complicated if directly use the MTD order to finish writing of upgrade data, cause updating speed slower.
For addressing this problem, this embodiment is with piece (block in conjunction with the flash storer, be generally 256K byte) as the erase operation unit and the size of MTD subregion must be integral multiple, the subregion start address of flash piece is the present situation of the start address of certain piece of flash, the upgrade data wiring method that has adopted the upgrade data that to store to cut apart according to the block size of flash erase operation unit, must be in a fixing former MTD subregion with the data after guaranteeing to cut apart, can not occur striding the situation that former subregion writes, improve writing speed.The specific implementation process please refer to shown in Figure 2.
As shown in Figure 2, the process that adopts MTD subregion and Data Segmentation realization upgrade data to write is as follows:
Step 21: begin upgrading.
Step 22: from the software upgrading file, parse pre-upgrading MTD divisional description information.
Specifically, be to parse MTD divisional description information in the MTD divisional description message file from the software upgrading file.
Step 23: according to the MTD subregion Y of pre-upgrading MTD divisional description acquisition of information after the upgrading 0To Y mBe total to m MTD subregion, and from the software upgrading file, obtain the corresponding upgrade data of each subregion.A variable M is set, and initialize is 0.
Step 24: to Y MSubregion carries out the data upgrading.
Here, with Y MRepresentative is from Y 0To Y mA subregion, M=0,1 ... m.Also namely from subregion Y 0Beginning is carried out the data upgrading to m MTD subregion successively.Concrete escalation process is step 241 to the 2. shown in the part flow process of step 244.
Step 25: judge whether all MTD subregions all upgrade complete.If, execution in step 26; If not, variable M is added 1, go to again step 24, next subregion is carried out the data upgrading.
In this embodiment, because the complete subregion of the every upgrading of variable M, all can automatically add 1, so, judge all MTD subregions complete foundation of all upgrading is whether variable M equals m.If illustrate that all m subregion all upgrades complete; If M, illustrates that subregion is not upgraded in addition less than m, then continue to carry out escalation process.
Step 26: after all subregion upgradings are complete, finish the flow process that writes of upgrade data.
With subregion Y MBe example, the process that this subregion data writing, realization data are upgraded is:
Step 241: with Y MThe Data Segmentation that will store in the subregion becomes size to be x sub-block Y of 256K byte M-0To Y M-x
Wherein, 256K size that byte is an erase operation unit of flash storer.Then, a variable X is set, initialize is 0.
Step 242: process Y M-XThe data upgrading of sub-block.
Here, with Y M-XRepresentative is from Y M-0To Y M-xIn a sub-block, wherein, X=0,1 ... x.Also namely from Y M-0The upgrading that writes of data is carried out respectively in beginning successively to x sub-block.The process of the concrete data writing of each sub-block referring to step 2421 to 3. shown in the part flow process of step 2426.
Step 243: judge Y MIt is complete whether each sub-block that will store in the subregion all upgrades.If, execution in step 244; Otherwise, X is added 1, go to step 242, continue the next sub-block data of upgrading, until all sub-block data are all upgraded complete.
In this embodiment, because the complete sub-block of every upgrading, variable X all can add 1 automatically, so, judge all sub-blocks complete foundation of all upgrading is whether variable X equals x.If illustrate that all x sub-block all upgrades complete; If X, illustrates that sub-block is not written in the subregion in addition less than x, then continue to carry out the ablation process of sub-block data.
Step 244: at MTD subregion Y MIn all sub-blocks all be written in the corresponding subregion after, Y MThe partition data upgrading is finished.
Finish sub-block Y in the step 242 M-XThe concrete steps of data upgrading are as follows:
Step 2421: calculate sub-block Y M-XStart address.
In this embodiment, because with MTD subregion Y MIn all upgrade datas be divided into the sub-block that x size is the 256KB size, so, X sub-block Y M-XStart address in whole subregion and subregion Y MStart address and this sub-block position in all sub-blocks in this subregion relation is arranged.Specifically, current X sub-block Y M-XStart address should be (subregion Y MStart address+256K ﹡ X).Wherein, subregion Y MStart address can from MTD divisional description information, obtain, therefore, sub-block Y M-XStart address can know.
Step 2422: according to reserving the MTD divisional description acquisition of information current sub-block Y before the upgrading in the subregion M-XStart address and the offset address of corresponding raw partition.
As previously mentioned, because the sub-block Y that will write M-XData be the upgrading after MTD subregion Y MIn data, and before system restarts, the MTD divisional description information of current flash remains the former MTD divisional description information before the upgrading, if adopt the MTD instruction to write the sub-block data, the start address in the instruction and offset address remain the address in the former MTD divisional description information.Therefore, for easily and accurately upgrade data being written to the MTD subregion Y after the upgrading MIn, need to be to the MTD subregion Y after the upgrading MDo the address mapping with the former MTD divisional description information before the upgrading.Specifically, be according to the sub-block Y that obtains in the step 2421 M-XStart address, find start address and the offset address of corresponding raw partition in the former MTD divisional description information of this start address before upgrading.After finding corresponding start address and offset address, just can directly adopt the MTD instruction to wipe and write operation.
Step 2423: the data of wiping respective memory regions according to former subregion start address and offset address.
And, the size of the MTD subregion of wiping and sub-block Y to be written M-XSize of data equate.
Step 2424: read sub-block Y M-XCorresponding upgrade data.
Step 2425: the sub-block data are written in the storage area after wiping.
Step 2426:Y M-XSub-block writes to be finished.
By adopting step 2421 to the sub-block data writing process of step 2426, can guarantee that it all is operations of carrying out in the same MTD subregion before the upgrading that subregion is wiped with data writing process, and the sub-block data that write are again after upgrading within the corresponding upgrading MTD subregion, and that has effectively taken into account data writes accuracy and updating speed.
Please refer to Fig. 3, this Figure 3 shows that the structured flowchart of an embodiment of software updating apparatus who the present invention is based on the MTD subregion.This embodiment upgrades to example with the set-top box product software with linux operating system, realizes comprising based on the software updating apparatus of MTD subregion each cell mesh of following mutual collaborative work:
The software upgrading file receives and storage unit 301, is used for receiving software upgrading file and the storage of outside (equipment of transmission upgrade file) transmission.
Pre-upgrading MTD divisional description information analysis unit 302 is connected with storage unit 301 with the reception of software upgrading file, is used for parsing from the software upgrading file of storage the pre-upgrading MTD divisional description information that document form exists.
Upgrade data resolution unit 303 receives with the software upgrading file and to be connected with storage unit 301, is used for parsing from the software upgrading file upgrade data in each the MTD subregion after the upgrading.
Former MTD divisional description information memory cell 304 is used for storing the former MTD divisional description information that exists with document form.
Former MTD divisional description information back-up storage unit 305, as redundant memory cell, the former MTD divisional description information of storage and former MTD divisional description information memory cell 304 same form and content.
In this embodiment, former MTD divisional description information memory cell 304 adopts two different reservation MTD subregions in the flash storage of set top box to realize with former MTD divisional description information back-up storage unit 305, to realize effective backup of MTD divisional description information.
Data write unit 306, be connected with former MTD divisional description information back-up storage unit 305 with pre-upgrading MTD divisional description information analysis unit 302, upgrade data resolution unit 303 and former MTD divisional description information memory cell 304, be used for writing to successively respective memory locations according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information.
Uboot processing unit 308 is used for carrying out the uboot Related Work, and the write parameters of will being correlated with is written in the linux system kernel 309.
Write parameters module units 307, be connected with uboot processing unit 308 with pre-upgrading MTD divisional description information analysis unit 302, be used for re-assemblying MTD divisional description information write parameters according to pre-upgrading MTD divisional description information, and this parameter is transferred to uboot processing unit 306.
 
Software upgrading for the MTD divisional description information of upgrading simultaneously, data after the upgrading are to store according to the corresponding MTD subregion of MTD divisional description information of upgrading, and the MTD divisional description information of upgrading in advance also needs to be written in the MTD respective partition after the upgrading.Shine upon for the address of the MTD subregion after the realization upgrading and the MTD subregion before the upgrading, guarantee accurate, the safety upgrade of upgrade data, data write unit can adopt following structure to realize, specifically comprises following subelement:
Sub-block is cut apart subelement, is used for upgrade in advance MTD divisional description information and upgrade data are divided into respectively the sub-block that several specify size;
The sub-block start address is determined subelement, cut apart subelement with described pre-upgrading MTD divisional description information analysis unit with sub-block and be connected, be used for start address according to the position calculation sub-block in all sub-blocks of the MTD subregion start address in the pre-upgrading MTD divisional description information and the current sub-block that will write pre-upgrading MTD divisional description information or upgrade data under it;
The sub-block mapping address is determined subelement, determine that with the sub-block start address subelement is connected with described former MTD divisional description information memory cell and former MTD divisional description information back-up storage unit, obtain start address and the offset address of the corresponding former MTD subregion of this sub-block according to the start address of former MTD divisional description information and sub-block, as the mapping address of sub-block;
The data erase subelement determines that with the sub-block mapping address subelement is connected, be used for according to the start address of former MTD subregion and offset address wipe with the equal-sized storage area of sub-block in data;
The sub-block data write subelement, determine that with the sub-block mapping address subelement and sub-block cut apart subelement and be connected, and are used for data with sub-block to be written in the storage area after wiping.
Each cell mesh collaborative work in the software updating apparatus of this embodiment, under the cooperation of relevant software program, upgrading when realizing fast and accurately MTD divisional description information and data according to the method flow of Fig. 1 and Fig. 2.
Above embodiment is only in order to illustrating technical scheme of the present invention, but not limits it; Although with reference to previous embodiment the present invention is had been described in detail, for the person of ordinary skill of the art, still can make amendment to the technical scheme that previous embodiment is put down in writing, perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of the present invention's technical scheme required for protection.

Claims (10)

1. method for upgrading software based on the MTD subregion, it is characterized in that, in the storer based on the MTD subregion, set in advance at least two subregions, store respectively identical content, the upgrading before former MTD divisional description information, described upgrade method comprises the steps:
A1, the upgrade data in each the MTD subregion after upgrade in advance MTD divisional description information and the upgrading is added in the software upgrading file, include at least two MTD subregions that are used for storing pre-upgrading MTD divisional description information in the MTD subregion after upgrading corresponding to the MTD divisional description information of upgrading in advance;
Reading software upgrade file in a2, the escalation process parses pre-upgrading MTD divisional description information and upgrade data;
The former MTD divisional description information of a3, read memory writes to respective memory locations successively according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information;
The uboot of a4, start-up system reads the pre-upgrading MTD divisional description information that is stored in the storer, assembling MTD divisional description information write parameters, and with this parameter read-in in system kernel.
2. method according to claim 1 is characterized in that, described former MTD divisional description information is stored in the storer with the XML document form, and described pre-upgrading divisional description information is added in the software upgrading file with the XML document form.
3. method according to claim 1 is characterized in that, sets in advance the subregion of two described former MTD divisional description information of storage in the storer based on the MTD subregion; Include two MTD subregions that are used for storing pre-upgrading MTD divisional description information in the MTD subregion after upgrading corresponding to described pre-upgrading divisional description information.
4. each described method in 3 according to claim 1 is characterized in that, described step a3 comprises following substep:
A31, the MTD divisional description information of will upgrading in advance and upgrade data are divided into respectively several sub-blocks of specifying size;
The start address of the position calculation sub-block in the MTD subregion start address in a32, the pre-upgrading of the basis MTD divisional description information and all sub-blocks of the current sub-block that will write pre-upgrade MTD divisional description information or upgrade data under it;
A33, read described former MTD divisional description information, obtain start address and the offset address of the corresponding former MTD subregion of this sub-block according to the start address of this former MTD divisional description information and sub-block;
A34, wipe and the equal-sized storage area of sub-block according to start address and the offset address of former MTD subregion;
A35, the data of sub-block are written in the storage area after wiping.
5. method according to claim 4 is characterized in that, the equal and opposite in direction of an erase operation unit of the size of described sub-block and described storer based on the MTD subregion.
6. each described method in 3 according to claim 1, it is characterized in that, described software upgrading file includes successively the pre-upgrading MTD divisional description information checking field of storage, in advance upgrade MTD divisional description message length field, in advance upgrade the upgrade data check field in each MTD subregion after MTD divisional description information, the upgrading, length field and the upgrade data of upgrade data.
7. method according to claim 6 is characterized in that, described pre-upgrading MTD divisional description information checking field and described upgrade data check field are the CRC check field.
8. the software updating apparatus based on the MTD subregion is characterized in that, described device comprises:
Former MTD divisional description information memory cell is used for storing former MTD divisional description information;
At least one former MTD divisional description information back-up storage unit, as redundant memory cell, the former MTD divisional description information of storage and former MTD divisional description information memory cell identical content;
The software upgrading file receives and storage unit, is used for receiving software upgrading file and the storage of external transmission;
Pre-upgrading MTD divisional description information analysis unit is connected with storage unit with the reception of software upgrading file, is used for parsing from the software upgrading file pre-upgrading MTD divisional description information;
The upgrade data resolution unit receives with the software upgrading file and to be connected with storage unit, is used for parsing from the software upgrading file upgrade data in each the MTD subregion after the upgrading;
Data write unit, be connected with former MTD divisional description information back-up storage unit with pre-upgrading MTD divisional description information analysis unit, upgrade data resolution unit and former MTD divisional description information memory cell, be used for writing to successively respective memory locations according to will upgrade in advance MTD divisional description information and upgrade data of the MTD subregion corresponding relation in former MTD divisional description information and the pre-upgrading MTD divisional description information;
The uboot processing unit is used for carrying out the uboot Related Work, and the write parameters of will being correlated with is written in the system kernel;
The write parameters module units is connected with the uboot processing unit with pre-upgrading MTD divisional description information analysis unit, is used for assembling MTD divisional description information write parameters, and this parameter is transferred to the uboot processing unit.
9. device according to claim 8 is characterized in that, in described former MTD divisional description information memory cell and the described former MTD divisional description information back-up storage unit with XML document form store M TD divisional description information; Described pre-upgrading MTD divisional description information is stored in the described software upgrading file with the XML document form.
10. according to claim 8 or 9 described devices, it is characterized in that, described data write unit comprises following subelement:
Sub-block is cut apart subelement, is used for upgrade in advance MTD divisional description information and upgrade data are divided into respectively the sub-block that several specify size;
The sub-block start address is determined subelement, cut apart subelement with described pre-upgrading MTD divisional description information analysis unit with sub-block and be connected, be used for start address according to the position calculation sub-block in all sub-blocks of the MTD subregion start address in the pre-upgrading MTD divisional description information and the current sub-block that will write pre-upgrading MTD divisional description information or upgrade data under it;
The sub-block mapping address is determined subelement, determine that with the sub-block start address subelement is connected with described former MTD divisional description information memory cell and former MTD divisional description information back-up storage unit, obtain start address and the offset address of the corresponding former MTD subregion of this sub-block according to the start address of former MTD divisional description information and sub-block, as the mapping address of sub-block;
The data erase subelement determines that with the sub-block mapping address subelement is connected, be used for according to the start address of former MTD subregion and offset address wipe with the equal-sized storage area of sub-block in data;
The sub-block data write subelement, determine that with the sub-block mapping address subelement and sub-block cut apart subelement and be connected, and are used for data with sub-block to be written in the storage area after wiping.
CN201210492326.1A 2012-11-28 2012-11-28 Method for upgrading software and device based on MTD subregion Active CN102945179B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210492326.1A CN102945179B (en) 2012-11-28 2012-11-28 Method for upgrading software and device based on MTD subregion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210492326.1A CN102945179B (en) 2012-11-28 2012-11-28 Method for upgrading software and device based on MTD subregion

Publications (2)

Publication Number Publication Date
CN102945179A true CN102945179A (en) 2013-02-27
CN102945179B CN102945179B (en) 2016-06-29

Family

ID=47728128

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210492326.1A Active CN102945179B (en) 2012-11-28 2012-11-28 Method for upgrading software and device based on MTD subregion

Country Status (1)

Country Link
CN (1) CN102945179B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014206024A1 (en) * 2013-06-27 2014-12-31 中兴通讯股份有限公司 Method and device for realizing embedded application, and computer storage medium
CN105094913A (en) * 2015-07-31 2015-11-25 广东欧珀移动通信有限公司 System, base band fastener and system application upgrading method and device
CN105468393A (en) * 2014-09-10 2016-04-06 启碁科技股份有限公司 Module version upgrading method and terminal apparatus
CN105653333A (en) * 2015-12-31 2016-06-08 深圳市汇川控制技术有限公司 Programmable logic controller user program online modifying system and method
CN106502750A (en) * 2016-10-28 2017-03-15 青岛海信电器股份有限公司 OTA upgrade methods and Bluetooth chip
WO2017071646A1 (en) * 2015-10-28 2017-05-04 中兴通讯股份有限公司 Method and apparatus for delivering device partition information
CN107025121A (en) * 2017-03-31 2017-08-08 广东欧珀移动通信有限公司 Method for upgrading software, device and electronic installation
CN107562572A (en) * 2017-08-18 2018-01-09 上海斐讯数据通信技术有限公司 File downloading device and system software managing device
CN107608699A (en) * 2017-10-17 2018-01-19 安徽皖通邮电股份有限公司 A kind of fine granularity method for upgrading software version based on magic subregion
CN107943504A (en) * 2017-12-07 2018-04-20 中国航空工业集团公司西安航空计算技术研究所 The dynamic update method of software module in a kind of embedded system
CN108196870A (en) * 2017-12-29 2018-06-22 北京臻迪科技股份有限公司 Upgrade method and device
CN113687855A (en) * 2021-07-22 2021-11-23 荣耀终端有限公司 Electronic equipment, system upgrading package manufacturing method and system upgrading method thereof
CN113691845A (en) * 2021-08-19 2021-11-23 杭州国芯科技股份有限公司 Power-off protection method for partition upgrading of digital set-top box

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080126672A1 (en) * 2004-03-10 2008-05-29 Sony Ericsson Mobile Communications Ab Automatic Backup Store In Firmware Upgrades
CN101520734A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method for upgrading data in flash memory, network TV and interactive set-top box thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080126672A1 (en) * 2004-03-10 2008-05-29 Sony Ericsson Mobile Communications Ab Automatic Backup Store In Firmware Upgrades
CN101520734A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method for upgrading data in flash memory, network TV and interactive set-top box thereof

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘加明 等: "《学习使用中文Windows95(高级)》", 31 July 1997, 人民邮电出版社 *
韦东山: "《嵌入式Linux应用开发完全手册》", 31 August 2008 *

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014206024A1 (en) * 2013-06-27 2014-12-31 中兴通讯股份有限公司 Method and device for realizing embedded application, and computer storage medium
CN105468393A (en) * 2014-09-10 2016-04-06 启碁科技股份有限公司 Module version upgrading method and terminal apparatus
CN105468393B (en) * 2014-09-10 2019-06-14 启碁科技股份有限公司 Module release upgrade method and terminal installation
CN105094913A (en) * 2015-07-31 2015-11-25 广东欧珀移动通信有限公司 System, base band fastener and system application upgrading method and device
CN105094913B (en) * 2015-07-31 2018-06-15 广东欧珀移动通信有限公司 System, base band firmware and system application upgrade method and device
WO2017071646A1 (en) * 2015-10-28 2017-05-04 中兴通讯股份有限公司 Method and apparatus for delivering device partition information
CN105653333A (en) * 2015-12-31 2016-06-08 深圳市汇川控制技术有限公司 Programmable logic controller user program online modifying system and method
CN106502750A (en) * 2016-10-28 2017-03-15 青岛海信电器股份有限公司 OTA upgrade methods and Bluetooth chip
CN106502750B (en) * 2016-10-28 2019-09-10 青岛海信电器股份有限公司 OTA upgrade method and Bluetooth chip
CN107025121B (en) * 2017-03-31 2020-10-09 Oppo广东移动通信有限公司 Software upgrading method and device and electronic device
CN107025121A (en) * 2017-03-31 2017-08-08 广东欧珀移动通信有限公司 Method for upgrading software, device and electronic installation
CN107562572A (en) * 2017-08-18 2018-01-09 上海斐讯数据通信技术有限公司 File downloading device and system software managing device
CN107608699A (en) * 2017-10-17 2018-01-19 安徽皖通邮电股份有限公司 A kind of fine granularity method for upgrading software version based on magic subregion
CN107608699B (en) * 2017-10-17 2020-09-08 安徽皖通邮电股份有限公司 Fine-grained software version upgrading method based on magic partition
CN107943504A (en) * 2017-12-07 2018-04-20 中国航空工业集团公司西安航空计算技术研究所 The dynamic update method of software module in a kind of embedded system
CN107943504B (en) * 2017-12-07 2021-03-26 中国航空工业集团公司西安航空计算技术研究所 Dynamic upgrading method for software module in embedded system
CN108196870A (en) * 2017-12-29 2018-06-22 北京臻迪科技股份有限公司 Upgrade method and device
CN113687855A (en) * 2021-07-22 2021-11-23 荣耀终端有限公司 Electronic equipment, system upgrading package manufacturing method and system upgrading method thereof
CN113691845A (en) * 2021-08-19 2021-11-23 杭州国芯科技股份有限公司 Power-off protection method for partition upgrading of digital set-top box
CN113691845B (en) * 2021-08-19 2023-08-18 杭州国芯科技股份有限公司 Power-off protection method for digital set top box partition upgrade

Also Published As

Publication number Publication date
CN102945179B (en) 2016-06-29

Similar Documents

Publication Publication Date Title
CN102945179A (en) Software upgrading method and device based on memory technology device (MTD) partition
CN101388110B (en) Data rapidly-reading method and apparatus
CN102024502B (en) Flash device testing method and device as well as board and network equipment
CN103744694B (en) Dynamic partition searcher and its method based on Nand flash memories
CN101551780B (en) Television and data storage method and device thereof
KR100843543B1 (en) System comprising flash memory device and data recovery method thereof
CN102012831B (en) Over-the-air technology (OTA) upgrading method based on Linux platform
CN101923516A (en) Block-based flash memory and its operation method
CN102214113B (en) Method, device and terminal for upgrading operating system
CN109426619A (en) Method for accessing flash memory module, related flash memory controller and electronic device
CN101520734A (en) Method for upgrading data in flash memory, network TV and interactive set-top box thereof
CN103793238A (en) Rack and method for simultaneously updating multiple basic input output systems thereof
CN103365676B (en) The method for upgrading software of communication equipment and device
CN108829347A (en) A kind of hardware control, control method and the liquid crystal display of Nand equipment
CN103577574A (en) High-reliability linear file system based on nand flash
CN102163155A (en) Upgrade controlling device and method for upgrading memory device
CN102104750B (en) Method for automatically upgrading network television
CN101872306B (en) Embedded system for realizing software updating and software backup and implementation method thereof
US11474805B2 (en) System capable of upgrading firmware in background and method for upgrading firmware in background
CN104021089A (en) Flash memory control chip, storage device and flash memory control method
CN100549959C (en) Bootstrap on-line upgrading method
CN101000580A (en) NAND flash information extraction method and NAND flash automatic identification method
CN106528441B (en) Data processing method and device for simulating EEPROM (electrically erasable programmable read-Only memory) and electronic equipment
CN102662688A (en) An update method and apparatus for Nor flash
CN101727361B (en) Method for storing edition of terminal product and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant