CN102945179B - Method for upgrading software and device based on MTD subregion - Google Patents

Method for upgrading software and device based on MTD subregion Download PDF

Info

Publication number
CN102945179B
CN102945179B CN201210492326.1A CN201210492326A CN102945179B CN 102945179 B CN102945179 B CN 102945179B CN 201210492326 A CN201210492326 A CN 201210492326A CN 102945179 B CN102945179 B CN 102945179B
Authority
CN
China
Prior art keywords
mtd
description information
upgrade
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.)
Active
Application number
CN201210492326.1A
Other languages
Chinese (zh)
Other versions
CN102945179A (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

Landscapes

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

Abstract

The invention discloses a kind of method for upgrading software based on MTD subregion and device.Described method comprises the steps: to add in software upgrading file pre-upgrade MTD divisional description information and upgrade data to;Escalation process reads software upgrading file, parses pre-upgrade MTD divisional description information and upgrade data;According to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information, pre-upgrade MTD divisional description information and upgrade data are write successively to respective memory locations;Startup system uboot, reads storage pre-upgrade MTD divisional description information in memory, assembles MTD divisional description information writes parameters, and be written in system kernel.MTD divisional description information can be upgraded by the method for the application present invention in escalation process, improves the adjustability of memorizer MTD subregion and uses motility.

Description

Method for upgrading software and device based on MTD subregion
Technical field
The present invention relates to software upgrading technology, specifically, relate to a kind of method for upgrading software based on MTD subregion and device.
Background technology
MTD (memorytechnologydevice memory techniques equipment) is the subsystem of the linux system for accessing memory devices (such as Rom), must flow through MTD to read and write the memorizeies such as ROM in Linux system.
In the products such as the Set Top Box based on Linux system, as the modal ROM of flash(of memorizer) it is divided into several MTD subregions, each subregion takies a part of flash space, is used for depositing independent program, completes specific function.The concrete partitioning scenario of flash, is described by MTD divisional description information including the partition number of each subregion, subregion initial address, partition size etc..Determined by system physical characteristic, under Linux system, only by MTD operation read-write data, and can not directly be accessed flash.
For set-top box product, at present, based on the Set Top Box of Linux system, its escalation process generally cannot complete the upgrading of MTD divisional description information, and reason is in that:
On the one hand, MTD partition data is written in kernel by uboot by special parameter when starting, and at whole program run duration, MTD subregion can not adjust.If changing special parameter, it is necessary to change a partition holding at this parameter place, and due in prior art this subregion all do not back up, will being there is risk in its upgrading, unsuccessfully can cause that whole system cannot start if upgraded.
On the other hand, the data upgrading carried out under Linux system updates and is all based on MTD subregion, and is written and read only by MTD, and its erasing subregion and write data all must operate in specified partition.If certain the MTD subregion and the original MTD subregion that carry out data upgrading are inconsistent, it are used alone the instruction based on MTD and can not complete software upgrade requirement.
Owing to cannot MTD divisional description information be upgraded, thus the MTD subregion of flash can not being adjusted, cause memory partition motility poor, upgrading practicality is not strong, is unfavorable for the reduction of upgrading and the production life cycle maintenance cost flexibly of product.
Summary of the invention
The disadvantages mentioned above that the MTD divisional description information in prior art that the present invention is directed to can not be upgraded and be existed provides a kind of method for upgrading software based on MTD subregion and device, MTD divisional description information can be upgraded by application the method in escalation process, thus improve the adjustability of memorizer MTD subregion and using motility.
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 MTD subregion, pre-sets at least two subregion in the memorizer based on MTD subregion, stores the former MTD divisional description information before identical content, upgrading respectively, and described upgrade method comprises the steps:
A1, by pre-upgrade MTD divisional description information and upgrading after each MTD subregion in upgrade data add in software upgrading file, the MTD subregion after the upgrading that pre-upgrade MTD divisional description information is corresponding includes at least two for storing the MTD subregion of pre-upgrade MTD divisional description information;
A2, escalation process read software upgrading file, parses pre-upgrade MTD divisional description information and upgrade data;
A3, read memorizer former MTD divisional description information, according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information, pre-upgrade MTD divisional description information and upgrade data are write successively to respective memory locations;
A4, start the uboot of system, read storage pre-upgrade MTD divisional description information in memory, assemble MTD divisional description information writes parameters, and by this parameter read-in to system kernel.
Method as above, described former MTD divisional description information preferably stores in memory with XML file form, and described pre-upgrade divisional description information is preferably added in software upgrading file with XML file form.
Method as above, for reducing taking memory storage area, is previously provided with two subregions storing described former MTD divisional description information in the memorizer based on MTD subregion;MTD subregion after the upgrading that described pre-upgrade divisional description information is corresponding includes two MTD subregions for storing pre-upgrade MTD divisional description information.
Method as above, for simplifying data writing process, improving updating speed, described step a3 specifically includes following sub-step:
A31, pre-upgrade MTD divisional description information and upgrade data are divided into respectively several specify sizes sub-block;
A32, initial address according to the position calculation sub-block in the MTD subregion initial address in pre-upgrade MTD divisional description information and the sub-block all sub-blocks of pre-upgrade MTD divisional description information or upgrade data belonging to it that currently to write;
A33, read described former MTD divisional description information, obtain initial address and the offset address of former MTD subregion corresponding to this sub-block according to the initial address of this former MTD divisional description information and sub-block;
A34, according to the initial address of former MTD subregion and offset address erasing and the equal-sized memory area of sub-block;
A35, the data of sub-block are written in the memory area after erasing.
Method as above, the size of described sub-block preferably wipes the equal in magnitude of operating unit with the one of the described memorizer based on MTD subregion.
Method as above, for simplifying data structure, being easy to the transmission of data and correct resolve, described software upgrading file includes the pre-upgrade MTD divisional description information checking field, pre-upgrade MTD divisional description message length field, pre-upgrade MTD divisional description information, upgrade data check field in each MTD subregion after upgrading, the length field of upgrade data and the upgrade data that store successively.
Preferably, described pre-upgrade MTD divisional description information checking field and described upgrade data check field are CRC check field.
For realizing aforementioned invention purpose, update device provided by the invention adopts following technical proposals to realize:
A kind of software updating apparatus based on MTD subregion, this device includes:
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 memory element, as redundant memory cell, the former MTD divisional description information of storage and former MTD divisional description information memory cell identical content;
Software upgrading file reception and memory element, be used for receiving the software upgrading file of external transmission and storing;
Pre-upgrade MTD divisional description information analysis unit, is connected with software upgrading file reception and memory element, is used for parsing pre-upgrade MTD divisional description information from software upgrading file;
Upgrade data resolution unit, is connected with software upgrading file reception and memory element, is used for the upgrade data in each MTD subregion after parsing upgrading from software upgrading file;
Data write unit, it is connected with pre-upgrade MTD divisional description information analysis unit, upgrade data resolution unit and former MTD divisional description information memory cell and former MTD divisional description information back-up memory element, is used for writing pre-upgrade MTD divisional description information and upgrade data to respective memory locations successively according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information;
Uboot processing unit, is used for performing the relevant work of uboot, and is written in system kernel by relevant write parameters;
Write parameters module units, is connected with pre-upgrade MTD divisional description information analysis unit and uboot processing unit, is used for assembling MTD divisional description information writes parameters, and by this parameter transmission to uboot processing unit.
Device as above, described former MTD divisional description information memory cell and preferably store MTD divisional description information with XML file form in described former MTD divisional description information back-up memory element;Described pre-upgrade MTD divisional description information is preferably stored in described software upgrading file with XML file form.
Device as above, for simplifying upgrade data ablation process, improving updating speed, described data write unit includes following subelement:
Sub-block segmentation subelement, is used for pre-upgrade MTD divisional description information and upgrade data are divided into several specify the sub-block of size respectively;
Sub-block initial address determines subelement, split subelement with described pre-upgrade MTD divisional description information analysis unit and sub-block to be connected, be used for the initial address according to the position calculation sub-block in the MTD subregion initial address in pre-upgrade MTD divisional description information and the sub-block all sub-blocks of pre-upgrade MTD divisional description information or upgrade data belonging to it that currently to write;
Sub-block mapping address determines subelement, determine that with sub-block initial address subelement and described former MTD divisional description information memory cell and former MTD divisional description information back-up memory element are connected, initial address according to former MTD divisional description information and sub-block obtains initial address and the offset address of the former MTD subregion corresponding to this sub-block, as the mapping address of sub-block;
With sub-block mapping address, data erasing subelement, determines that subelement is connected, be used for the initial address according to former MTD subregion and offset address erasing and the data in the equal-sized memory area of sub-block;
Sub-block data write subelement, determines that with sub-block mapping address subelement and sub-block segmentation subelement are connected, is used in the memory area after the data of sub-block are written to erasing.
Compared with prior art, advantages of the present invention and having the benefit effect that
1, by selecting two subregions to store the MTD divisional description information of identical content respectively in memory, form effective backup of description information, then in software upgrading escalation process, the MTD divisional description information of pre-upgrade is write in upgrading mode, when the uboot of lower subsystem starts, MTD divisional description information according to reserved subregion re-assemblies write parameters and is written in system kernel, realize the upgrading of MTD divisional description information, improve the adjustability of memorizer MTD subregion and use motility.It is additionally, since backup information to exist, even if power-off is without losing data in escalation process, it is ensured that the safety of MTD divisional description information of upgrading in software upgrade process.
2, write upgrade data and during pre-upgrade MTD divisional description information in the MTD subregion after upgrading, it is divided into multiple sub-block by the data that will write, then sub-block is mapped in former MTD subregion and writes successively, guarantee that sub-block data writes in same former subregion, do not have the phenomenon crossing over former subregion, improve accuracy and the writing speed of data write.
After reading in conjunction with the accompanying the specific embodiment of the present invention, the other features and advantages of the invention will become clearer from.
Accompanying drawing explanation
Fig. 1 is the present invention main flow chart based on one embodiment of method for upgrading software of MTD subregion;
Fig. 2 is the flow chart in Fig. 1 embodiment according to the MTD subregion write upgrade data after upgrading;
Fig. 3 is the present invention structured flowchart based on one embodiment of software updating apparatus of MTD subregion.
Detailed description of the invention
Below in conjunction with the drawings and specific embodiments, technical scheme is described in further detail.
Refer to the flow chart based on one embodiment of method for upgrading software of MTD subregion of the present invention shown in Fig. 1 and Fig. 2, wherein, Fig. 1 is the main flow chart of this embodiment, and Fig. 2 is the flow chart according to the MTD subregion write upgrade data after upgrading.
The set-top box product software upgrading to have linux operating system of this embodiment, the flash memory of Set Top Box is divided into multiple MTD subregion, except storage MTD divisional description information and functional software program, also have some reserved, undefined MTD subregions.Apply the method for this embodiment when Set Top Box is carried out software upgrading, except the upgrade data upgrading that can carry out the functional software program of routine, it is also possible to realize the upgrading to MTD divisional description information in escalation process.
Refer to Fig. 1, the detailed process that this embodiment realizes upgrade data and the upgrading of MTD divisional description information simultaneously is as follows:
Step 101: flow process starts.
Step 102: select two reserved subregions in the flash memory based on MTD subregion.The reserved subregion of the two is by with the former MTD divisional description information before the storage upgrading of XML file form.And the file content of storage is identical in the reserved subregion of the two, namely there is one for 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 initial address and partition size.
Step 103: add in software upgrading file with document form by pre-upgrade MTD divisional description information, constitutes software upgrading file with upgrade data.
Pre-upgrade MTD divisional description information, also with XML file form editor, is used for describing pre-upgrade MTD partition information, includes the information such as the partition number of MTD subregion of pre-upgrade, subregion initial address, partition size.The upgrade data in each MTD subregion after this pre-upgrade MTD divisional description information and upgrading assembles according to certain data form, forms software upgrading file.
For example, it is possible to pre-upgrade MTD divisional description message file is put into foremost, in order to get easily.Concrete organized formats is: start anew to assemble successively by the upgrade data check field in each MTD subregion after pre-upgrade MTD divisional description information checking field, pre-upgrade MTD divisional description message length field, pre-upgrade MTD divisional description information, upgrading, the length field of upgrade data and upgrade data.If there being multiple upgrade data, then first assemble the check field of first upgrade data, length field and upgrade data, then assemble the check field of other upgrade datas, length field and upgrade data again.After forming software upgrading file according to this specific data form, software upgrade procedure can get each upgrade data described by required MTD divisional description message file and this document easily from software upgrading file.
Wherein, the check field of the MTD divisional description message file of pre-upgrade and described upgrade data check field all adopt CRC check field.
And, corresponding with the former MTD divisional description information backup storage before upgrading in step 102, the MTD subregion after the upgrading that pre-upgrade MTD divisional description information is corresponding includes two MTD subregions for storing pre-upgrade MTD divisional description information.
Step 104: Set Top Box Linux system enters software upgrade process, reads software upgrading file.
This process be implemented as prior art, be not specifically addressed at this.
Step 105: parse pre-upgrade MTD divisional description information and upgrade data from the software upgrading file read.
Step 106: pre-upgrade MTD divisional description information is written to the MTD subregion after upgrading.
Step 107: upgrade data is written in the MTD subregion after upgrading.
Pre-upgrade MTD divisional description information, using the one as upgrade data, is written to memorizer respective memory locations together with other software upgrade datas etc..When write, by reading the former MTD divisional description information of memorizer, according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information, pre-upgrade MTD divisional description information and upgrade data are write successively to respective memory locations.
Upgrade data can pass through in the MTD subregion after MTD order is written to the upgrading corresponding to the MTD divisional description information of pre-upgrade.Concrete one realizes process and refer to Fig. 2 and the following description to Fig. 2.
In this embodiment, pre-upgrade MTD divisional description information can be written in two subregions in memorizer successively, and a subregion write after be just then written to another subregion.Therefore, even if power-off in ablation process, also can ensure have at least a partitioned storage to contain complete MTD divisional description message file.No matter this complete MTD divisional description information is the information before upgrading or the information after upgrading, all can ensure that operating system can normally start, it is ensured that upgrading reliability.
It should be noted that, the step 106 of write pre-upgrade MTD divisional description message file and the step 107 of write upgrade data are not necessarily according to the order of first step 106 step 107 again, can also be first write upgrade data, write MTD divisional description information again, the intersection write of i.e. first step 107 step 106 again, or two parts.
Step 108: the uboot of starter motor set-top box system, reads the pre-upgrade MTD divisional description information having stored in memorizer, forms MTD divisional description information writes parameters.
Owing to MTD divisional description information is written in kernel when set top box operations system uboot starts by write parameters, so, after in MTD subregion after pre-upgrade MTD divisional description information is written to corresponding upgrading, without restarting Set Top Box, system MTD divisional description information can't be upgraded.By the time escalation process terminates, and after restarting the uboot of Set Top Box, first reads the MTD divisional description information after the pre-upgrade MTD divisional description information having stored in memorizer namely upgrading;Then, utilize the MTD divisional description information after upgrading, re-assembly MTD divisional description information writes parameters according to the form of write parameters.
Certainly, if MTD divisional description information is not upgraded, then after uboot starts, reading is the former MTD divisional description information in reserved subregion, still according to former divisional description information, memorizer is carried out MTD subregion.
Write parameters is written in system kernel by step 109:uboot.
Owing to write parameters is by the MTD divisional description information structure after upgrading, it is thereby achieved that the upgrading to MTD divisional description information.After upgrading, the MTD number of partitions of flash memory and size will divide according to new divisional description information, thus improve the adjustability of memorizer MTD subregion and using motility.
And, after completing the upgrading of MTD divisional description information, pre-upgrade MTD divisional description information will become former MTD divisional description information and back up storage in memory.
MTD subregion number and size after being as noted previously, as the former MTD subregion number before upgrading, size and upgrading are likely to be different from, and a MTD subregion after upgrading may span across original multiple MTD subregions.In software upgrade process before Set Top Box uboot is restarted, it is desirable to upgrade data (includes pre-upgrade MTD divisional description information) and reads storage according to the MTD subregion after upgrading.But owing to actual MTD subregion is but without change, therefore, the initial address of subregion after that upgrade data to write, upgrading and end address are not necessarily in some subregion original.And owing to being again the read-write operation carrying out data according to subregion based on the flash of MTD subregion, so, will be more complicated if directly using MTD order to complete the write of upgrade data, cause that updating speed is slower.
For solving this problem, this embodiment is with block (block in conjunction with flash memory, it is generally 256K byte) present situation of the initial address of the size of MTD subregion must to be the integral multiple of flash block, subregion initial address be certain block of flash as erasing operating unit, have employed the upgrade data wiring method that the upgrade data that will store carries out splitting according to the size of the block of flash erasing operating unit, must be in a fixing former MTD subregion to ensure the data after segmentation, do not have situation about writing across former subregion, improve writing speed.The process of implementing refer to shown in Fig. 2.
As in figure 2 it is shown, it is as follows to adopt MTD subregion and data to split the process realizing upgrade data write:
Step 21: start upgrading.
Step 22: parse pre-upgrade MTD divisional description information from software upgrading file.
Specifically, it is that MTD divisional description message file from software upgrading file parses MTD divisional description information.
Step 23: according to the MTD subregion Y after pre-upgrade MTD divisional description acquisition of information to upgrading0To YmM MTD subregion altogether, and from software upgrading file, obtain the upgrade data corresponding to each subregion.Arranging a variable M, composing initial value is 0.
Step 24: to YMSubregion carries out data upgrading.
Here, with YMRepresent from Y0To YmA subregion, M=0,1 ... m.Namely from subregion Y0Start, successively m MTD subregion is carried out data upgrading.Concrete escalation process is step 241 to 2. shown in part flow process of step 244.
Step 25: judge whether all MTD subregions all upgrade complete.If so, step 26 is performed;If it is not, variable M is added 1, then go to step 24, next subregion is carried out data upgrading.
In this embodiment, owing to variable M has often upgraded a subregion, all automatically can add 1, so, it is judged that all MTD subregions are all upgraded complete according to being whether variable M is equal to m.If so, illustrate that all m subregions are all upgraded complete;If M is less than m, illustrate that also subregion is not upgraded, then continue executing with escalation process.
Step 26: after all subregions are upgraded, terminates the write flow process of upgrade data.
With subregion YMFor example, to this subregion write data, the process that realizes data upgrading it is:
Step 241: by YMThe data stored in subregion are divided into x the sub-block Y being sized to 256K byteM-0To YM-x
Wherein, 256K byte is the size that flash memory one wipes operating unit.Then, arranging a variable X, composing initial value is 0.
Step 242: process YM-XThe data upgrading of sub-block.
Here, with YM-XRepresent from YM-0To YM-xIn a sub-block, wherein, X=0,1 ... x.Namely from YM-0Start, successively x sub-block is carried out respectively the write upgrading of data.The process of the concrete write data of each sub-block is referring to 3. shown in part flow process of step 2421 to step 2426.
Step 243: judge YMIt is complete whether each sub-block stored in subregion all upgrades.If so, step 244 is performed;Otherwise, X is added 1, go to step 242, continue the next sub-block data of upgrading, until all of sub-block data is all upgraded complete.
In this embodiment, due to a sub-block of often having upgraded, variable X all can add 1 automatically, so, it is judged that all sub-blocks are all upgraded complete according to being whether variable X is equal to x.If so, illustrate that all x sub-blocks are all upgraded complete;If X is less than x, illustrate that also sub-block is not written in subregion, then continue executing with the ablation process of sub-block data.
Step 244: at MTD subregion YMIn all sub-blocks be all written in corresponding subregion after, YMPartition data has been upgraded.
Step 242 completes sub-block YM-XSpecifically comprising the following steps that of data upgrading
Step 2421: calculate sub-block YM-XInitial address.
In this embodiment, due to by MTD subregion YMIn all upgrade datas be divided into x size to be the sub-block of 256KB size, so, the X sub-block YM-XInitial address in whole subregion and subregion YMInitial address and this sub-block position in all sub-blocks in this subregion have relation.Specifically, current the X sub-block YM-XInitial address should be (subregion YMInitial address+256K X).Wherein, subregion YMInitial address can obtain from MTD divisional description information, therefore, sub-block YM-XInitial address can know.
Step 2422: according to the MTD divisional description acquisition of information current sub-block Y before upgrading in reserved subregionM-XThe initial address of corresponding raw partition and offset address.
As previously described, because the sub-block Y to writeM-XData be upgrading after MTD subregion YMIn data, and before system reboot, the MTD divisional description information of current flash remains the former MTD divisional description information before upgrading, if adopting MTD instruction write sub-block data, initial address and offset address in instruction remain the address in former MTD divisional description information.Therefore, for convenience, exactly upgrade data is written to the MTD subregion Y after upgradingMIn, it is necessary to the MTD subregion Y after upgradingMMake address with the former MTD divisional description information before upgrading to map.Specifically, it is according to the sub-block Y obtained in step 2421M-XInitial address, find initial address and the offset address of raw partition corresponding in this initial address former MTD divisional description information before upgrading.After finding corresponding initial address and offset address, it is possible to directly adopt MTD instruction to carry out wiping and write operation.
Step 2423: wipe the data of respective memory regions according to former subregion initial address and offset address.
And, the size of the MTD subregion wiped and sub-block Y to be writtenM-XSize of data be equal.
Step 2424: read sub-block YM-XCorresponding upgrade data.
Step 2425: sub-block data is written in the memory area after erasing.
Step 2426:YM-XSub-block has write.
Sub-block data ablation process by employing step 2421 to step 2426, both can guarantee that subregion erasing and data writing process were all for the operation carried out in the same MTD subregion before upgrading, and the sub-block data of write is again, within corresponding after the upgrade upgrading MTD subregion, effectively taken into account write accuracy and the updating speed of data.
Refer to Fig. 3, this Fig. 3 show the present invention structured flowchart based on one embodiment of software updating apparatus of MTD subregion.This embodiment set-top box product software upgrading to have linux operating system, it is achieved include each unit part of following collaborative work mutually based on the software updating apparatus of MTD subregion:
Software upgrading file reception and memory element 301, be used for receiving the software upgrading file transmitted outside (equipment of transmission upgrade file) and storing.
Pre-upgrade MTD divisional description information analysis unit 302, is connected with software upgrading file reception and memory element 301, is used for parsing from the software upgrading file of storage the pre-upgrade MTD divisional description information that document form exists.
Upgrade data resolution unit 303, is connected with software upgrading file reception and memory element 301, is used for the upgrade data in each MTD subregion after parsing upgrading from software upgrading file.
Former MTD divisional description information memory cell 304, is used for storing the former MTD divisional description information existed with document form.
Former MTD divisional description information back-up memory element 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 in flash storage of set top box different reserved MTD subregions to realize with former MTD divisional description information back-up memory element 305, to realize effective backup of MTD divisional description information.
Data write unit 306, it is connected with pre-upgrade MTD divisional description information analysis unit 302, upgrade data resolution unit 303 and former MTD divisional description information memory cell 304 and former MTD divisional description information back-up memory element 305, is used for writing pre-upgrade MTD divisional description information and upgrade data to respective memory locations successively according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information.
Uboot processing unit 308, is used for performing the relevant work of uboot, and is written in Linux system kernel 309 by relevant write parameters.
Write parameters module units 307, it is connected with pre-upgrade MTD divisional description information analysis unit 302 and uboot processing unit 308, it is used for re-assemblying MTD divisional description information writes parameters according to pre-upgrade MTD divisional description information, and by this parameter transmission to uboot processing unit 306.
Software upgrading for MTD divisional description information of upgrading simultaneously, the MTD subregion that data after upgrading are corresponding to the MTD divisional description information according to upgrading stores, and pre-upgrade MTD divisional description information is also required in the MTD respective partition after being written to upgrading.Address for the MTD subregion after realizing upgrading and the MTD subregion before upgrading maps, it is ensured that accurate, the safety upgrade of upgrade data, and data write unit can adopt following structure to realize, and specifically includes following subelement:
Sub-block segmentation subelement, is used for pre-upgrade MTD divisional description information and upgrade data are divided into several specify the sub-block of size respectively;
Sub-block initial address determines subelement, split subelement with described pre-upgrade MTD divisional description information analysis unit and sub-block to be connected, be used for the initial address according to the position calculation sub-block in the MTD subregion initial address in pre-upgrade MTD divisional description information and the sub-block all sub-blocks of pre-upgrade MTD divisional description information or upgrade data belonging to it that currently to write;
Sub-block mapping address determines subelement, determine that with sub-block initial address subelement and described former MTD divisional description information memory cell and former MTD divisional description information back-up memory element are connected, initial address according to former MTD divisional description information and sub-block obtains initial address and the offset address of the former MTD subregion corresponding to this sub-block, as the mapping address of sub-block;
With sub-block mapping address, data erasing subelement, determines that subelement is connected, be used for the initial address according to former MTD subregion and offset address erasing and the data in the equal-sized memory area of sub-block;
Sub-block data write subelement, determines that with sub-block mapping address subelement and sub-block segmentation subelement are connected, is used in the memory area after the data of sub-block are written to erasing.
Each unit part collaborative work in the software updating apparatus of this embodiment, under the cooperation about software program, realizes upgrading while MTD divisional description information and data fast and accurately according to the method flow of Fig. 1 and Fig. 2.
Above example is only in order to illustrate technical scheme, but not is limited;Although the present invention being described in detail with reference to previous embodiment, for the person of ordinary skill of the art, still the technical scheme described in previous embodiment can be modified, or wherein portion of techniques feature is carried out equivalent replacement;And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of present invention technical scheme required for protection.

Claims (8)

1. the method for upgrading software based on MTD subregion, it is characterised in that pre-set at least two subregion in the memorizer based on MTD subregion, stores the former MTD divisional description information before identical content, upgrading respectively, and upgrade method comprises the steps:
A1, by pre-upgrade MTD divisional description information and upgrading after each MTD subregion in upgrade data add in software upgrading file, the MTD subregion after the upgrading that pre-upgrade MTD divisional description information is corresponding includes at least two for storing the MTD subregion of pre-upgrade MTD divisional description information;
A2, escalation process read software upgrading file, parses pre-upgrade MTD divisional description information and upgrade data;
A3, read memorizer former MTD divisional description information, according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information, pre-upgrade MTD divisional description information and upgrade data are write successively to respective memory locations;
A4, start the uboot of system, read storage pre-upgrade MTD divisional description information in memory, assemble MTD divisional description information writes parameters and be also written in system kernel;
Described a3 includes following sub-step:
A31, pre-upgrade MTD divisional description information and upgrade data are divided into respectively several specify sizes sub-block;
A32, initial address according to the position calculation sub-block in the MTD subregion initial address in pre-upgrade MTD divisional description information and the sub-block all sub-blocks of pre-upgrade MTD divisional description information or upgrade data belonging to it that currently to write;
A33, read described former MTD divisional description information, obtain initial address and the offset address of former MTD subregion corresponding to this sub-block according to the initial address of this former MTD divisional description information and sub-block;
A34, according to the initial address of former MTD subregion and offset address erasing and the equal-sized memory area of sub-block;
A35, the data of sub-block are written in the memory area after erasing.
2. method according to claim 1, it is characterised in that described former MTD divisional description information stores in memory with XML file form, and described pre-upgrade MTD divisional description information is added in software upgrading file with XML file form.
3. method according to claim 1, it is characterised in that be previously provided with two subregions storing described former MTD divisional description information in the memorizer based on MTD subregion;MTD subregion after the upgrading that described pre-upgrade MTD divisional description information is corresponding includes two MTD subregions for storing pre-upgrade MTD divisional description information.
4. method according to claim 1, it is characterised in that the size of described sub-block is equal in magnitude with one of the described memorizer based on MTD subregion erasing operating unit.
5. according to the method in any one of claims 1 to 3, it is characterized in that, described software upgrading file includes the pre-upgrade MTD divisional description information checking field, pre-upgrade MTD divisional description message length field, pre-upgrade MTD divisional description information, upgrade data check field in each MTD subregion after upgrading, the length field of upgrade data and the upgrade data that store successively.
6. method according to claim 5, it is characterised in that described pre-upgrade MTD divisional description information checking field and described upgrade data check field are CRC check field.
7. the software updating apparatus based on MTD subregion, it is characterised in that described device includes:
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 memory element, as redundant memory cell, the former MTD divisional description information of storage and former MTD divisional description information memory cell identical content;
Software upgrading file reception and memory element, be used for receiving the software upgrading file of external transmission and storing;
Pre-upgrade MTD divisional description information analysis unit, is connected with software upgrading file reception and memory element, is used for parsing pre-upgrade MTD divisional description information from software upgrading file;
Upgrade data resolution unit, is connected with software upgrading file reception and memory element, is used for the upgrade data in each MTD subregion after parsing upgrading from software upgrading file;
Data write unit, it is connected with pre-upgrade MTD divisional description information analysis unit, upgrade data resolution unit and former MTD divisional description information memory cell and former MTD divisional description information back-up memory element, is used for writing pre-upgrade MTD divisional description information and upgrade data to respective memory locations successively according to the MTD subregion corresponding relation in former MTD divisional description information and pre-upgrade MTD divisional description information;
Uboot processing unit, is used for performing the relevant work of uboot, and is written in system kernel by relevant write parameters;
Write parameters module units, is connected with pre-upgrade MTD divisional description information analysis unit and uboot processing unit, is used for assembling MTD divisional description information writes parameters and transmitting to uboot processing unit;
Described data write unit includes following subelement:
Sub-block segmentation subelement, is used for pre-upgrade MTD divisional description information and upgrade data are divided into several specify the sub-block of size respectively;
Sub-block initial address determines subelement, split subelement with described pre-upgrade MTD divisional description information analysis unit and sub-block to be connected, be used for the initial address according to the position calculation sub-block in the MTD subregion initial address in pre-upgrade MTD divisional description information and the sub-block all sub-blocks of pre-upgrade MTD divisional description information or upgrade data belonging to it that currently to write;
Sub-block mapping address determines subelement, determine that with sub-block initial address subelement and described former MTD divisional description information memory cell and former MTD divisional description information back-up memory element are connected, initial address according to former MTD divisional description information and sub-block obtains initial address and the offset address of the former MTD subregion corresponding to this sub-block, as the mapping address of sub-block;
With sub-block mapping address, data erasing subelement, determines that subelement is connected, be used for the initial address according to former MTD subregion and offset address erasing and the data in the equal-sized memory area of sub-block;
Sub-block data write subelement, determines that with sub-block mapping address subelement and sub-block segmentation subelement are connected, is used in the memory area after the data of sub-block are written to erasing.
8. device according to claim 7, it is characterised in that described former MTD divisional description information memory cell and in described former MTD divisional description information back-up memory element with XML file form store MTD divisional description information;Described pre-upgrade MTD divisional description information is stored in described software upgrading file with XML file form.
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 CN102945179A (en) 2013-02-27
CN102945179B true 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)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252342B (en) * 2013-06-27 2021-06-18 中兴通讯股份有限公司 Embedded application implementation method and device capable of configuring parameters
CN105468393B (en) * 2014-09-10 2019-06-14 启碁科技股份有限公司 Module release upgrade method and terminal installation
CN105094913B (en) * 2015-07-31 2018-06-15 广东欧珀移动通信有限公司 System, base band firmware and system application upgrade method and device
CN106648441A (en) * 2015-10-28 2017-05-10 中兴通讯股份有限公司 Method and device for transferring equipment partition information
CN105653333B (en) * 2015-12-31 2020-04-14 深圳市汇川控制技术有限公司 Programmable logic controller user program online modification system and method
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
CN107562572A (en) * 2017-08-18 2018-01-09 上海斐讯数据通信技术有限公司 File downloading device and system software managing device
CN107608699B (en) * 2017-10-17 2020-09-08 安徽皖通邮电股份有限公司 Fine-grained software version upgrading method based on magic partition
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
CN113687855B (en) * 2021-07-22 2022-07-12 荣耀终端有限公司 Electronic equipment, system upgrading package manufacturing method and system upgrading method thereof
CN113691845B (en) * 2021-08-19 2023-08-18 杭州国芯科技股份有限公司 Power-off protection method for digital set top box partition upgrade

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101520734A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method for upgrading data in flash memory, network TV and interactive set-top box thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE602004013120T2 (en) * 2004-03-10 2009-05-14 Sony Ericsson Mobile Communications Ab Automated backup storage in firmware upgrades

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101520734A (en) * 2008-12-17 2009-09-02 康佳集团股份有限公司 Method for upgrading data in flash memory, network TV and interactive set-top box thereof

Also Published As

Publication number Publication date
CN102945179A (en) 2013-02-27

Similar Documents

Publication Publication Date Title
CN102945179B (en) Method for upgrading software and device based on MTD subregion
CN106095620B (en) A kind of development approach of built-in Linux partition holding
US10002054B2 (en) Method and system for performing automatic system recovery
CN102024502B (en) Flash device testing method and device as well as board and network equipment
CN106708543B (en) OTA (over the air) upgrading method and device of operating system
CN109426619A (en) Method for accessing flash memory module, related flash memory controller and electronic device
CN101551780B (en) Television and data storage method and device thereof
CN103365676B (en) The method for upgrading software of communication equipment and device
CN109032632A (en) A kind of FOTA upgrade method, wireless communication terminal and storage medium
CN101819543A (en) Snapshot data processing method, system and storage device
US11474805B2 (en) System capable of upgrading firmware in background and method for upgrading firmware in background
CN102141921A (en) Method for upgrading system of terminal equipment and terminal equipment
CN106909352A (en) A kind of firmware upgrade method of embedded device
CN108829347A (en) A kind of hardware control, control method and the liquid crystal display of Nand equipment
WO2017000567A1 (en) Bootrom upgrading method and device
CN104021089A (en) Flash memory control chip, storage device and flash memory control method
CN105320529A (en) Boot method and device based on NAND-Flash double-boot guidance
CN102722408B (en) Method and apparatus for communication equipment software update
CN115357262A (en) Method for upgrading driver firmware in batch
CN102902630A (en) Method and device for accessing local file
CN105335166A (en) System of embedded device and remote upgrading method of embedded device
US9535796B2 (en) Method, apparatus and computer for data operation
JP2005316632A (en) Cache control, data processing system and processing program therefor
CN113660123B (en) Virtual switch upgrading method, device, electronic equipment and storage medium
CN107168650B (en) Method and device for processing data in memory of BIOS

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