CN109298873A - A kind of method for upgrading system and device - Google Patents

A kind of method for upgrading system and device Download PDF

Info

Publication number
CN109298873A
CN109298873A CN201710584511.6A CN201710584511A CN109298873A CN 109298873 A CN109298873 A CN 109298873A CN 201710584511 A CN201710584511 A CN 201710584511A CN 109298873 A CN109298873 A CN 109298873A
Authority
CN
China
Prior art keywords
subregion
partition table
data
address
upgrading
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
CN201710584511.6A
Other languages
Chinese (zh)
Other versions
CN109298873B (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201710584511.6A priority Critical patent/CN109298873B/en
Publication of CN109298873A publication Critical patent/CN109298873A/en
Application granted granted Critical
Publication of CN109298873B publication Critical patent/CN109298873B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Abstract

The embodiment of the present invention provides a kind of method for upgrading system and device, passes through and obtains upgrade package;Upgrading sequence when upgrading to the data of each subregion is parsed from upgrade package, upgrading sequence changes affiliated type according to partition table and determines, upgrading sequence includes positive sequence and inverted order;According to upgrading sequence, moved to after the data in source partition table are handled according to preset rules in new partition table;Using the above scheme, by inverted order or positive sequence it is mobile in the way of realize the conversion of source partition table, new partition table data, it is not necessary that data are backed up totally, reduce the requirement to spatial cache in moving process, so that the data for not upgrading or not moving are not destroyed, and processed data are occupied in time, take full advantage of limited space, the efficiency of Backup and Restore is also improved, duration needed for reducing escalation process improves success rate for upgrading.

Description

A kind of method for upgrading system and device
Technical field
The present invention relates to the communications field more particularly to a kind of method for upgrading system and device.
Background technique
Currently, during Project-developing, since the application of office side or the increase of google (Google) patch can make system (system) remaining space is smaller and smaller, at this moment just needs to modify partition table, for example, increasing system subregion or newly-increased subregion Deng.
Subregion change necessarily refers to the problem of how user data retains, and it is all that existing variable partition scheme mentions backup Data re-write after new partition table has divided, and when user data is very big, need using External memory equipment, escalation process It is long, and probability of failure is big.
Summary of the invention
The embodiment of the present invention mainly solving the technical problems that, a kind of method for upgrading system and device are provided, solved existing In technology, the problem that escalation process caused by subregion is long, probability of failure is big is modified.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of method for upgrading system, comprising:
Obtain upgrade package;
Upgrading sequence when upgrading to the data of each subregion is parsed from upgrade package, upgrading sequence is according to subregion Table changes affiliated type and determines, upgrading sequence includes positive sequence and inverted order;
According to upgrading sequence, moved to after the data in source partition table are handled according to preset rules in new partition table.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of system upgrade device, comprising:
Module is obtained, for obtaining upgrade package;
Parsing module, upgrading sequence when upgrading for parsing from upgrade package to the data of each subregion, rises Grade sequence changes affiliated type according to partition table and determines, upgrading sequence includes positive sequence and inverted order;
Upgraded module, for being moved to after the data in source partition table are handled according to preset rules according to upgrading sequence In new partition table.
In order to solve the above technical problems, the embodiment of the present invention also provides a kind of computer storage medium, computer storage is situated between Computer executable instructions are stored in matter, computer executable instructions are for executing method for upgrading system above-mentioned.
The beneficial effects of the present invention are:
A kind of method for upgrading system and device provided according to embodiments of the present invention, passes through and obtains upgrade package;From upgrade package In parse when upgrading to the data of each subregion upgrading sequence, upgrading sequence according to partition table change belonging to type it is true Fixed, upgrading sequence includes positive sequence and inverted order;According to upgrading sequence, moved after the data in source partition table are handled according to preset rules It moves on in new partition table;Using the above scheme, according to partition table change belonging to the data to each subregion determined of type into Upgrading sequence when row upgrading, upgrading sequence includes positive sequence and inverted order, according to this upgrading sequence to the data in source partition table into Row upgrading, by inverted order or positive sequence it is mobile in the way of realize the conversion of source partition table, new partition table data, it is not necessary that data are complete Disk backup, reduces the requirement to spatial cache in moving process, so that the data for not upgrading or not moving are not destroyed, It is occupied in time through processed data, limited space is taken full advantage of, the efficiency of Backup and Restore is also improved, reduces liter Duration needed for grade process improves success rate for upgrading.
Detailed description of the invention
Fig. 1 is a kind of flow chart for method for upgrading system that the embodiment of the present invention one provides;
The schematic diagram of the absolute address variation of data in a kind of each subregion that Fig. 2 provides for each embodiment of the present invention;
The signal of the relative address variation of data in a kind of userdata subregion that Fig. 3 provides for each embodiment of the present invention Figure;
The signal of the relative address variation of data in a kind of system subregion that Fig. 4 provides for each embodiment of the present invention Figure;
Fig. 5 is a kind of schematic diagram of system upgrade device provided by Embodiment 2 of the present invention.
Specific embodiment
The embodiment of the present invention is described in further detail below by specific embodiment combination attached drawing.
Embodiment one
The present embodiment provides a kind of method for upgrading system, and referring to Figure 1, Fig. 1 is a kind of system liter provided in this embodiment The flow chart of grade method, method includes the following steps:
S101: upgrade package is obtained;
S102: upgrading sequence when upgrading to the data of each subregion, upgrading sequence root are parsed from upgrade package It changes affiliated type according to partition table to determine, upgrading sequence includes positive sequence and inverted order;
Different project subregion numbers is different, but major divisions and their put in order all are consistent, for example, being System comprising sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz subregion, system subregion, Userdata (user data) subregion and by this sequence arrange.At this point, positive sequence upgrading be according to sequencing successively to Lower subregion is upgraded: sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz subregion, system Subregion, userdata subregion.Inverted order upgrading is successively to upgrade to following subregion according to sequencing: userdata points Area, system subregion, tz subregion, recovery subregion, boot subregion, modem subregion, rpm subregion, sbl1 subregion.
It includes that newly-increased subregion, the expansion of system subregion and system subregion reduce that partition table, which changes affiliated type,;
The case where for newly-increased subregion, further relates to system subregion first address other than the variation of userdata partition size Variation;
The case where reducing with system subregion, is expanded for system subregion, need to only consider that userdata partition size changes User data afterwards saves problem;
S103: according to upgrading sequence, new partition table is moved to after the data in source partition table are handled according to preset rules In.
In one embodiment, it when it is newly-increased subregion that partition table, which changes affiliated type, is inserted before system subregion Enter newly-increased subregion, the first address of system subregion is changed, and system subregion integrally deviates backward, the contracting of userdata subregion Small, upgrading sequence is inverted order;
S103 is moved in new partition table according to upgrading sequence after handling the data in source partition table according to preset rules Include:
According to the first default sub-rule by the Data Migration in source partition table in userdata subregion to new partition table In userdata subregion;
According still further to the data in the second default sub-rule upgrading system subregion, and the system subregion of new partition table is written In;
Corresponding data in source partition table is written in the newly-increased subregion of new partition table again;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table;
Other subregions are upgraded, since these subregion first address are constant, escalation process is similar with original procedure, other Subregion upgrading is consistent with existing way.
It such as include sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz in source partition table It subregion, system subregion, userdata subregion and arranges, is inserted into before system subregion in new partition table new by this sequence Increase subregion, then inverted order upgrade when, successively handle source partition table in userdata subregion, system subregion, tz subregion, Recovery subregion, boot subregion, modem subregion, rpm subregion, the data in sbl1 subregion.
In one embodiment, when it is that System subregion expands that partition table, which changes affiliated type, userdata subregion It reduces, userdata partition address deviates backward, and upgrading sequence is inverted order;
System subregion is expanded, then userdata subregion reduces, and userdata subregion first address increases, monolith data Area moves backward, and core still utilizes the inverted order of deblocking to be written, and guarantee does not destroy the data not moved;
S103 is moved in new partition table according to upgrading sequence after handling the data in source partition table according to preset rules Include:
According to the first default sub-rule by the Data Migration in source partition table in userdata subregion to new partition table In userdata subregion;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table;
After by the Data Migration in userdata subregion, the subregion before system subregion and system subregion is carried out Upgrading, since these subregion first address are constant, escalation process is similar with original procedure, and system subregion and subregion before upgrade It is consistent with existing way.
Wherein, according to the first default sub-rule by the Data Migration in source partition table in userdata subregion to new partition table Userdata subregion in include:
Obtain each deblocking of userdata subregion in upgrade package;Deblocking is according to the residue of userdata subregion Space is divided, and is that each deblocking is successively numbered from 0 to M, the first address of userdata subregion and source in new partition table The first address difference of userdata subregion is a in partition table, and it is first that each deblocking is based on userdata subregion in new partition table The offset of address is 0+a to M*c+a, wherein c is the size of each deblocking, and M is greater than 0;
Inverted order is specifically included in the userdata subregion of the Data Migration of each deblocking to new partition table: being obtained The data for the deblocking that number is M, are backuped to the free space of userdata subregion, and the process of backup is to prevent from upgrading Data can not be restored after interruption;Since present project all supports the encryption of userdata, the last 16K for saving code key guarantees not Movement does not cover;Again by the data of the deblocking be written in new partition table userdata subregion first address be M*c+a, tail Location is the memory block of (M+1) * c+a;The data for the deblocking that number is M-1 are obtained again, repeat above step, until completing will The Data Migration for the deblocking that number is 0 is into the userdata subregion of new partition table.
Wherein, deblocking is mainly the space hold situation for obtaining userdata subregion, true according to space hold situation Deblocking size is determined, such as remaining space is greater than 1.5G, using 1G as size piecemeal, if remaining space is less than 1.5G, with residue Space 50% is that size carries out piecemeal and deblocking table is written, which can be upgraded routine access in escalation process.
Illustratively, referring to fig. 2, Fig. 2 is the absolute address variation of data in a kind of each subregion provided in this embodiment Schematic diagram;In Fig. 2, the first address of sbl1 subregion is 0 in source partition table, and tail address is 100;Other subregions in source partition table First address is 100, and tail address is 200;The first address of tz subregion is 200 in source partition table, and tail address is 300;In source partition table The first address of system subregion is 300, and tail address is 500;The first address of userdata subregion is 500 in source partition table;
Increase a subregion newpartition newly before system subregion, the first address of sbl1 subregion is in new partition table 0, tail address is 100;The first address of other subregions is 100 in new partition table, and tail address is 200;Tz subregion in new partition table First address is 200, and tail address is 300;The first address of newpartition subregion is 300 in new partition table, and tail address is 400; The first address of system subregion is 400 in new partition table, and tail address is 600;The first address of userdata subregion in new partition table It is 600.
Referring to Fig. 3, Fig. 3 is the signal of the relative address variation of data in a kind of userdata subregion provided in this embodiment Figure;In Fig. 3, userdata subregion includes the deblocking that number is 0 in source partition table, and first address 0, tail address is c;Also The deblocking for being 1 comprising number, first address c, tail address are 2c;The deblocking for being also 2 comprising number, first address For 2c, tail address is 3c;It also include free space (free space), first address 3c;
The first address difference of the first address and userdata subregion in source partition table of userdata subregion is in new partition table A, wherein a=100;The deblocking for being 0 comprising number in new partition table, first address a, tail address are c+a;Also include The deblocking that number is 1, first address c+a, tail address are 2c+a;The deblocking for being also 2 comprising number, first address For 2c+a, tail address is 3c+a;It also include free space (free space), first address 3c+a.
Wherein, according to the data in the second default sub-rule upgrading system subregion, and the system of new partition table is written Include: in subregion
Obtain each deblocking of system subregion in upgrade package;It is successively numbered from 1 to P for each deblocking, newly The first address difference of the first address of system subregion and system subregion in source partition table is e in partition table, wherein P is greater than 1;
The first address A and tail address B for obtaining the last one deblocking number of system subregion P, are incorporated into the number for patch It is written on the position A+e to B+e of system subregion in new partition table according to piecemeal, and by the data of the deblocking after being incorporated into; First address and the tail address of a upper deblocking of system partition number P are obtained again, repeats above step, until completing will The data for the deblocking that number is 1 are written in the system subregion of new partition table.
Referring to fig. 4, Fig. 4 is the signal of the relative address variation of data in a kind of system subregion provided in this embodiment Figure;In Fig. 4, system subregion includes the deblocking of deblocking and free space that number is 1,2,3 in source partition table, The deblocking first address that number is 1 is 0;The tail address for the deblocking that number is 2 is A;The head for the deblocking that number is 3 Address is A, and tail address is B;The first address of free space deblocking is B;
The first address difference of system subregion is e in the first address and source partition table of system subregion in new partition table, In, e=100;The deblocking for being 1 comprising number in new partition table, first address e;The data point for being also 2 comprising number Block, tail address are A+e;The deblocking for being also 3 comprising number, first address A+e, tail address are B+e;It also include free Space (free space), first address B+e.
In the same project, a=e.
The case where for newly-increased subregion, needs using existing block upgrade technique, and block technology is no longer based on file File in system, but difference upgrading is carried out using the occupied space of file, it is that address A is arrived as a file takes up space Address B, when upgrading, directly read the data between address A to address B, data are write back address A to address B after patch installing.Difference Point process is exactly to compare to these address spaces, the patch data of generation, while generating the corresponding address space column of patch Table system.transfer.list supports block upgrading project that can carry system.map text in the version that compiling generates Part, the corresponding address space of record system subregion All Files.
In the present solution, being pressed when doing upgrade package to the content ordering of system.map and system.transfer.list It arranges, that is, finally successively to upgrade forward by from subregion according to the mode of first address from big to small, make not upgrade and do not deviate Data retained.If the first address difference of the first address and source partition table system subregion of new partition table system subregion is E first has to tail address A to the first end-of-file address according to second file of system.map file acquisition in escalation process Data (address space of two files is not necessarily continuous) between B, if the ground of first patch of system.transfer.list Patch is incorporated into the data block between A and B, then by location, and data block is written between A+e to B+e, if first patch address Patch installing step is then skipped less than A, copies into A+e to B+e, successively executes above step, finally by the number comprising subregion head information E is moved back according to block.
In one embodiment, when it is that System subregion reduces that partition table, which changes affiliated type, userdata subregion Increase, userdata partition address biased forwards, upgrading sequence is positive sequence;
S103 is moved in new partition table according to upgrading sequence after handling the data in source partition table according to preset rules Include:
Positive sequence upgrades the data in other subregions, and is accordingly written in the correspondence subregion of new partition table;
Sub-rule is preset by the Data Migration in source partition table in userdata subregion to new partition table according still further to third In userdata subregion.
Wherein, sub-rule is preset by the Data Migration in source partition table in userdata subregion to new partition table according to third Userdata subregion in include:
Obtain each deblocking of userdata subregion in upgrade package;Deblocking is according to the residue of userdata subregion Space is divided, and is that each deblocking is successively numbered from 0 to N, the first address of userdata subregion and source in new partition table The first address difference of userdata subregion is-d in partition table, and it is first that each deblocking is based on userdata subregion in new partition table The offset of address is 0-d to N*b-d, wherein b is the size of each deblocking, and N is greater than 0;
Positive sequence is specifically included in the userdata subregion of the Data Migration of each deblocking to new partition table: being obtained The data for the deblocking that number is 0, are backuped to the free space of userdata subregion, then by the data of the deblocking Be written to userdata subregion first address in new partition table be 0-d, the memory block that tail address is 1*b-d;Obtaining number again is 1 The data of deblocking repeat above step, until completing to number the Data Migration of deblocking for N to new partition table In userdata subregion.
Below by taking newly-increased subregion as an example, newly-increased subregion is inserted into before system subregion, system subregion deviates backward, Userdata subregion reduces;
Preparation before upgrading includes doing packet and userdata partition data piecemeal two parts:
The upgrading sequence of upgrade script is adjusted when wrapping, upgrading sequence specifically includes the migration userdata number of partitions first According to, secondly inverted order upgrades system subregion, and newly-increased partition content is then written, finally upgrades other subregions according to original mode, And the partition table of upgrading front and back is put into upgrade package;
Deblocking is mainly the space hold situation for obtaining userdata subregion, determines data according to space hold situation Piecemeal size, such as remaining space are greater than 1.5G, using 1G as size piecemeal, if remaining space is less than 1.5G, with remaining space 50% carries out piecemeal for size and deblocking table is written, which can be upgraded routine access in escalation process.
Specific escalation process is as follows:
Step 1: judge whether userdata subregion has remaining space, if so, record remaining space, if having taken User's Free up Memory is prompted, otherwise can not be upgraded;
Step 2: being counted in the case where userdata subregion has remaining space to the data in userdata subregion According to piecemeal;
Start to upgrade step 3: rebooting into recovery, first the data in migration userdata subregion;
Step 4: according to system.map and system.transfer.list and first address offset to system number According to being upgraded, and the data after upgrading are written to the new address in new partition table;
Step 5: the content of newly-increased subregion is written;
Step 6: upgrading other subregions.
By the implementation of the present embodiment, the data to each subregion that affiliated type is determined are changed according to partition table to carry out Upgrading sequence when upgrading, upgrading sequence include positive sequence and inverted order, are carried out according to this upgrading sequence to the data in source partition table Upgrading, by inverted order or positive sequence it is mobile in the way of realize the conversion of source partition table, new partition table data, it is not necessary that data are overall Backup, reduces the requirement to spatial cache in moving process, so that the data for not upgrading or not moving are not destroyed, and Processed data are occupied in time, take full advantage of limited space, also improve the efficiency of Backup and Restore, reduce upgrading Duration needed for process improves success rate for upgrading.
Embodiment two
The present embodiment provides a kind of system upgrade devices, refer to Fig. 5, and Fig. 5 is a kind of system liter provided in this embodiment The schematic diagram of stage arrangement, the system upgrade device include: to obtain module 501, parsing module 502 and upgraded module 503, wherein
Module 501 is obtained, for obtaining upgrade package;
Parsing module 502, upgrading sequence when upgrading for being parsed from upgrade package to the data of each subregion, Upgrading sequence changes affiliated type according to partition table and determines, upgrading sequence includes positive sequence and inverted order;
Different project subregion numbers is different, but major divisions and their put in order all are consistent, for example, being System comprising sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz subregion, system subregion, Userdata (user data) subregion and by this sequence arrange.At this point, positive sequence upgrading be according to sequencing successively to Lower subregion is upgraded: sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz subregion, system Subregion, userdata subregion.Inverted order upgrading is successively to upgrade to following subregion according to sequencing: userdata points Area, system subregion, tz subregion, recovery subregion, boot subregion, modem subregion, rpm subregion, sbl1 subregion.
It includes that newly-increased subregion, the expansion of system subregion and system subregion reduce that partition table, which changes affiliated type,;
The case where for newly-increased subregion, further relates to system subregion first address other than the variation of userdata partition size Variation;
The case where reducing with system subregion, is expanded for system subregion, need to only consider that userdata partition size changes User data afterwards saves problem;
Upgraded module 503, for being migrated after the data in source partition table are handled according to preset rules according to upgrading sequence Into new partition table.
In one embodiment, it when it is newly-increased subregion that partition table, which changes affiliated type, is inserted before system subregion Enter newly-increased subregion, the first address of system subregion is changed, and system subregion integrally deviates backward, the contracting of userdata subregion Small, upgrading sequence is inverted order;
Upgraded module 503 is used for the Data Migration in source partition table in userdata subregion according to the first default sub-rule Into the userdata subregion of new partition table;
According still further to the data in the second default sub-rule upgrading system subregion, and the system subregion of new partition table is written In;
Corresponding data in source partition table is written in the newly-increased subregion of new partition table again;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table;
Other subregions are upgraded, since these subregion first address are constant, escalation process is similar with original procedure, other Subregion upgrading is consistent with existing way.
It such as include sbl1 subregion, rpm subregion, modem subregion, boot subregion, recovery subregion, tz in source partition table It subregion, system subregion, userdata subregion and arranges, is inserted into before system subregion in new partition table new by this sequence Increase subregion, then inverted order upgrade when, successively handle source partition table in userdata subregion, system subregion, tz subregion, Recovery subregion, boot subregion, modem subregion, rpm subregion, the data in sbl1 subregion.
In one embodiment, when it is that System subregion expands that partition table, which changes affiliated type, userdata subregion It reduces, userdata partition address deviates backward, and upgrading sequence is inverted order;
System subregion is expanded, then userdata subregion reduces, and userdata subregion first address increases, monolith data Area moves backward, and core still utilizes the inverted order of deblocking to be written, and guarantee does not destroy the data not moved;
Upgraded module 503 is used for the Data Migration in source partition table in userdata subregion according to the first default sub-rule Into the userdata subregion of new partition table;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table;
After by the Data Migration in userdata subregion, the subregion before system subregion and system subregion is carried out Upgrading, since these subregion first address are constant, escalation process is similar with original procedure, and system subregion and subregion before upgrade It is consistent with existing way.
Wherein, upgraded module 503 moves the data in source partition table in user data subregion according to the first default sub-rule It moves on in the user data subregion of new partition table and includes:
Obtain each deblocking of userdata subregion in upgrade package;Deblocking is according to the residue of userdata subregion Space is divided, and is that each deblocking is successively numbered from 0 to M, the first address of userdata subregion and source in new partition table The first address difference of userdata subregion is a in partition table, and it is first that each deblocking is based on userdata subregion in new partition table The offset of address is 0+a to M*c+a, wherein c is the size of each deblocking, and M is greater than 0;
Inverted order is specifically included in the userdata subregion of the Data Migration of each deblocking to new partition table: being obtained The data for the deblocking that number is M, are backuped to the free space of userdata subregion, and the process of backup is to prevent from upgrading Data can not be restored after interruption;Since present project all supports the encryption of userdata, the last 16K for saving code key guarantees not Movement does not cover;Again by the data of the deblocking be written in new partition table userdata subregion first address be M*c+a, tail Location is the memory block of (M+1) * c+a;The data for the deblocking that number is M-1 are obtained again, repeat above step, until completing will The Data Migration for the deblocking that number is 0 is into the userdata subregion of new partition table.
Wherein, deblocking is mainly the space hold situation for obtaining userdata subregion, true according to space hold situation Deblocking size is determined, such as remaining space is greater than 1.5G, using 1G as size piecemeal, if remaining space is less than 1.5G, with residue Space 50% is that size carries out piecemeal and deblocking table is written, which can be upgraded routine access in escalation process.
Illustratively, referring to fig. 2, Fig. 2 is the absolute address variation of data in a kind of each subregion provided in this embodiment Schematic diagram;In Fig. 2, the first address of sbl1 subregion is 0 in source partition table, and tail address is 100;Other subregions in source partition table First address is 100, and tail address is 200;The first address of tz subregion is 200 in source partition table, and tail address is 300;In source partition table The first address of system subregion is 300, and tail address is 500;The first address of userdata subregion is 500 in source partition table;
Increase a subregion newpartition newly before system subregion, the first address of sbl1 subregion is in new partition table 0, tail address is 100;The first address of other subregions is 100 in new partition table, and tail address is 200;Tz subregion in new partition table First address is 200, and tail address is 300;The first address of newpartition subregion is 300 in new partition table, and tail address is 400; The first address of system subregion is 400 in new partition table, and tail address is 600;The first address of userdata subregion in new partition table It is 600.
Referring to Fig. 3, Fig. 3 is the signal of the relative address variation of data in a kind of userdata subregion provided in this embodiment Figure;In Fig. 3, userdata subregion includes the deblocking that number is 0 in source partition table, and first address 0, tail address is c;Also The deblocking for being 1 comprising number, first address c, tail address are 2c;The deblocking for being also 2 comprising number, first address For 2c, tail address is 3c;It also include free space (free space), first address 3c;
The first address difference of the first address and userdata subregion in source partition table of userdata subregion is in new partition table A, wherein a=100;The deblocking for being 0 comprising number in new partition table, first address a, tail address are c+a;Also include The deblocking that number is 1, first address c+a, tail address are 2c+a;The deblocking for being also 2 comprising number, first address For 2c+a, tail address is 3c+a;It also include free space (free space), first address 3c+a.
Wherein, upgraded module 503 is according to the data in the second default sub-rule upgrading system subregion, and new subregion is written Include: in the system subregion of table
Obtain each deblocking of system subregion in upgrade package;It is successively numbered from 1 to P for each deblocking, newly The first address difference of the first address of system subregion and system subregion in source partition table is e in partition table, wherein P is greater than 1;
The first address A and tail address B for obtaining the last one deblocking number of system subregion P, are incorporated into the number for patch It is written on the position A+e to B+e of system subregion in new partition table according to piecemeal, and by the data of the deblocking after being incorporated into; First address and the tail address of a upper deblocking of system partition number P are obtained again, repeats above step, until completing will The data for the deblocking that number is 1 are written in the system subregion of new partition table.
Referring to fig. 4, Fig. 4 is the signal of the relative address variation of data in a kind of system subregion provided in this embodiment Figure;In Fig. 4, system subregion includes the deblocking of deblocking and free space that number is 1,2,3 in source partition table, The deblocking first address that number is 1 is 0;The tail address for the deblocking that number is 2 is A;The head for the deblocking that number is 3 Address is A, and tail address is B;The first address of free space deblocking is B;
The first address difference of system subregion is e in the first address and source partition table of system subregion in new partition table, In, e=100;The deblocking for being 1 comprising number in new partition table, first address e;The data point for being also 2 comprising number Block, tail address are A+e;The deblocking for being also 3 comprising number, first address A+e, tail address are B+e;It also include free Space (free space), first address B+e.
In the same project, a=e.
The case where for newly-increased subregion, needs using existing block upgrade technique, and block technology is no longer based on file File in system, but difference upgrading is carried out using the occupied space of file, it is that address A is arrived as a file takes up space Address B, when upgrading, directly read the data between address A to address B, data are write back address A to address B after patch installing.Difference Point process is exactly to compare to these address spaces, the patch data of generation, while generating the corresponding address space column of patch Table system.transfer.list supports block upgrading project that can carry system.map text in the version that compiling generates Part, the corresponding address space of record system subregion All Files.
In the present solution, being pressed when doing upgrade package to the content ordering of system.map and system.transfer.list It arranges, that is, finally successively to upgrade forward by from subregion according to the mode of first address from big to small, make not upgrade and do not deviate Data retained.If the first address difference of the first address and source partition table system subregion of new partition table system subregion is E first has to tail address A to the first end-of-file address according to second file of system.map file acquisition in escalation process Data (address space of two files is not necessarily continuous) between B, if the ground of first patch of system.transfer.list Patch is incorporated into the data block between A and B, then by location, and data block is written between A+e to B+e, if first patch address Patch installing step is then skipped less than A, copies into A+e to B+e, successively executes above step, finally by the number comprising subregion head information E is moved back according to block.
In one embodiment, when it is that System subregion reduces that partition table, which changes affiliated type, userdata subregion Increase, userdata partition address biased forwards, upgrading sequence is positive sequence;
Upgraded module 503 upgrades the data in other subregions for positive sequence, and the correspondence subregion of new partition table is accordingly written In;
Sub-rule is preset by the Data Migration in source partition table in userdata subregion to new partition table according still further to third In userdata subregion.
Wherein, sub-rule is preset by the Data Migration in source partition table in userdata subregion to new partition table according to third Userdata subregion in include:
Obtain each deblocking of userdata subregion in upgrade package;Deblocking is according to the residue of userdata subregion Space is divided, and is that each deblocking is successively numbered from 0 to N, the first address of userdata subregion and source in new partition table The first address difference of userdata subregion is-d in partition table, and it is first that each deblocking is based on userdata subregion in new partition table The offset of address is 0-d to N*b-d, wherein b is the size of each deblocking, and N is greater than 0;
Positive sequence is specifically included in the userdata subregion of the Data Migration of each deblocking to new partition table: being obtained The data for the deblocking that number is 0, are backuped to the free space of userdata subregion, then by the data of the deblocking Be written to userdata subregion first address in new partition table be 0-d, the memory block that tail address is 1*b-d;Obtaining number again is 1 The data of deblocking repeat above step, until completing to number the Data Migration of deblocking for N to new partition table In userdata subregion.
Below by taking newly-increased subregion as an example, newly-increased subregion is inserted into before system subregion, system subregion deviates backward, Userdata subregion reduces;
Preparation before upgrading includes doing packet and userdata partition data piecemeal two parts:
The upgrading sequence of upgrade script is adjusted when wrapping, upgrading sequence specifically includes the migration userdata number of partitions first According to, secondly inverted order upgrades system subregion, and newly-increased partition content is then written, finally upgrades other subregions according to original mode, And the partition table of upgrading front and back is put into upgrade package;
Deblocking is mainly the space hold situation for obtaining userdata subregion, determines data according to space hold situation Piecemeal size, such as remaining space are greater than 1.5G, using 1G as size piecemeal, if remaining space is less than 1.5G, with remaining space 50% carries out piecemeal for size and deblocking table is written, which can be upgraded routine access in escalation process.
Specific escalation process is as follows:
Step 1: judge whether userdata subregion has remaining space, if so, record remaining space, if having taken User's Free up Memory is prompted, otherwise can not be upgraded;
Step 2: being counted in the case where userdata subregion has remaining space to the data in userdata subregion According to piecemeal;
Start to upgrade step 3: rebooting into recovery, first the data in migration userdata subregion;
Step 4: according to system.map and system.transfer.list and first address offset to system number According to being upgraded, and the data after upgrading are written to the new address in new partition table;
Step 5: the content of newly-increased subregion is written;
Step 6: upgrading other subregions.
By the implementation of the present embodiment, the data to each subregion that affiliated type is determined are changed according to partition table to carry out Upgrading sequence when upgrading, upgrading sequence include positive sequence and inverted order, are carried out according to this upgrading sequence to the data in source partition table Upgrading, by inverted order or positive sequence it is mobile in the way of realize the conversion of source partition table, new partition table data, it is not necessary that data are overall Backup, reduces the requirement to spatial cache in moving process, so that the data for not upgrading or not moving are not destroyed, and Processed data are occupied in time, take full advantage of limited space, also improve the efficiency of Backup and Restore, reduce upgrading Duration needed for process improves success rate for upgrading.
Obviously, those skilled in the art should be understood that each module of the embodiments of the present invention or each step can be used General computing device realizes that they can be concentrated on a single computing device, or be distributed in multiple computing device institutes On the network of composition, optionally, they can be realized with the program code that computing device can perform, it is thus possible to by them It is stored in storage medium (ROM/RAM, magnetic disk, CD) and is performed by computing device, and in some cases, it can be with not The sequence being same as herein executes shown or described step, or they are fabricated to each integrated circuit modules, or Person makes multiple modules or steps in them to single integrated circuit module to realize.So the present invention is not limited to appoint What specific hardware and software combines.
The above content is combining specific embodiment to be further described to made by the embodiment of the present invention, cannot recognize Fixed specific implementation of the invention is only limited to these instructions.For those of ordinary skill in the art to which the present invention belongs, Without departing from the inventive concept of the premise, a number of simple deductions or replacements can also be made, all shall be regarded as belonging to the present invention Protection scope.

Claims (10)

1. a kind of method for upgrading system, comprising:
Obtain upgrade package;
Parsed from the upgrade package when upgrading to the data of each subregion upgrading sequence, the upgrading sequence according to Partition table changes affiliated type and determines, the upgrading sequence includes positive sequence and inverted order;
According to the upgrading sequence, moved to after the data in source partition table are handled according to preset rules in new partition table.
2. the system as claimed in claim 1 upgrade method, which is characterized in that type belonging to changing when the partition table is newly-increased When subregion, newly-increased subregion is inserted into before system partitioning, system partitioning deviates backward, and user data subregion reduces, the upgrading Sequence is inverted order;
According to the upgrading sequence, moves to after the data in source partition table are handled according to preset rules and wrapped in new partition table It includes:
According to the first default sub-rule by the Data Migration in source partition table in user data subregion to the number of users of new partition table According in subregion;
According still further to the data in the second default sub-rule upgrade-system subregion, and be written in the system partitioning of new partition table;
Corresponding data in source partition table is written in the newly-increased subregion of new partition table again;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table.
3. the system as claimed in claim 1 upgrade method, which is characterized in that type belonging to changing when the partition table is system When subregion expands, user data subregion reduces, and user data partition address deviates backward, and the upgrading sequence is inverted order;
According to the upgrading sequence, moves to after the data in source partition table are handled according to preset rules and wrapped in new partition table It includes:
According to the first default sub-rule by the Data Migration in source partition table in user data subregion to the number of users of new partition table According in subregion;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table.
4. the system as claimed in claim 1 upgrade method, which is characterized in that type belonging to changing when the partition table is system When subregion reduces, user data subregion increases, user data partition address biased forwards, and the upgrading sequence is positive sequence;
According to the upgrading sequence, moves to after the data in source partition table are handled according to preset rules and wrapped in new partition table It includes:
Positive sequence upgrades the data in other subregions, and is accordingly written in the correspondence subregion of new partition table;
User of the sub-rule by the Data Migration in source partition table in user data subregion to new partition table is preset according still further to third In data subregion.
5. method for upgrading system as claimed in claim 2 or claim 3, which is characterized in that it is described according to the first default sub-rule by source Data Migration in partition table in user data subregion includes: into the user data subregion of new partition table
Obtain each deblocking of user data subregion in the upgrade package;The deblocking is according to the user data point The remaining space in area is divided, and is that each deblocking is successively numbered from 0 to M, the head of user data subregion in new partition table The first address difference of user data subregion is a in address and source partition table, and each deblocking is based on number of users in new partition table Offset according to subregion first address is 0+a to M*c+a, wherein c is the size of each deblocking, and M is greater than 0;
Inverted order is specifically included in the user data subregion of the Data Migration of each deblocking to new partition table: obtaining number For the data of the deblocking of M, the free space of user data subregion is backuped to, then the data of the deblocking are written The memory block that user data subregion first address is M*c+a into new partition table, tail address is (M+1) * c+a;Obtaining number again is The data of the deblocking of M-1 repeat above step, until completing the Data Migration for the deblocking for being 0 by number to new point In the user data subregion of area's table.
6. method for upgrading system as claimed in claim 2, which is characterized in that described according to the second default sub-rule upgrade-system Data in subregion, and be written in the system partitioning of new partition table and include:
Obtain each deblocking of system partitioning in the upgrade package;It is successively numbered from 1 to P for each deblocking, new point The first address difference of the first address of system partitioning and system partitioning in source partition table is e in area's table, wherein P is greater than 1;
The first address A and tail address B for obtaining the last one deblocking number of system partitioning P, are incorporated into the deblocking for patch, And the data of the deblocking after being incorporated into are written on the position A+e to B+e of system partitioning in new partition table;System is obtained again The first address of a upper deblocking of partition number P and tail address repeat above step, until completing the number for being 1 by number It is written according to the data of piecemeal in the system partitioning of new partition table.
7. a kind of system upgrade device, comprising:
Module is obtained, for obtaining upgrade package;
Parsing module, upgrading sequence when upgrading for being parsed from the upgrade package to the data of each subregion, institute It states upgrading sequence to be determined according to type belonging to partition table change, the upgrading sequence includes positive sequence and inverted order;
Upgraded module, for being moved to after the data in source partition table are handled according to preset rules according to the upgrading sequence In new partition table.
8. system upgrade device as claimed in claim 7, which is characterized in that type belonging to changing when the partition table is newly-increased When subregion, newly-increased subregion is inserted into before system partitioning, system partitioning deviates backward, and user data subregion reduces, the upgrading Sequence is inverted order;
The upgraded module is for arriving the Data Migration in source partition table in user data subregion according to the first default sub-rule In the user data subregion of new partition table;
According still further to the data in the second default sub-rule upgrade-system subregion, and be written in the system partitioning of new partition table;
Corresponding data in source partition table is written in the newly-increased subregion of new partition table again;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table.
9. system upgrade device as claimed in claim 7, which is characterized in that type belonging to changing when the partition table is system When subregion expands, user data subregion reduces, and user data partition address deviates backward, and the upgrading sequence is inverted order;
The upgraded module is for arriving the Data Migration in source partition table in user data subregion according to the first default sub-rule In the user data subregion of new partition table;
Inverted order upgrades the data in other subregions again, and is accordingly written in the correspondence subregion of new partition table.
10. system upgrade device as claimed in claim 7, which is characterized in that type belonging to changing when the partition table is to be When subregion of uniting reduces, user data subregion increases, user data partition address biased forwards, and the upgrading sequence is positive sequence;
The upgraded module upgrades the data in other subregions for positive sequence, and is accordingly written in the correspondence subregion of new partition table;
User of the sub-rule by the Data Migration in source partition table in user data subregion to new partition table is preset according still further to third In data subregion.
CN201710584511.6A 2017-07-18 2017-07-18 System upgrading method and device Active CN109298873B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710584511.6A CN109298873B (en) 2017-07-18 2017-07-18 System upgrading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710584511.6A CN109298873B (en) 2017-07-18 2017-07-18 System upgrading method and device

Publications (2)

Publication Number Publication Date
CN109298873A true CN109298873A (en) 2019-02-01
CN109298873B CN109298873B (en) 2023-05-09

Family

ID=65167348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710584511.6A Active CN109298873B (en) 2017-07-18 2017-07-18 System upgrading method and device

Country Status (1)

Country Link
CN (1) CN109298873B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569058A (en) * 2019-09-09 2019-12-13 Oppo(重庆)智能科技有限公司 System upgrading method, device, terminal and computer readable storage medium
CN110781030A (en) * 2019-09-09 2020-02-11 晶晨半导体(深圳)有限公司 Backup method for user data in android system upgrading process
CN111124451A (en) * 2019-12-24 2020-05-08 山东有人信息技术有限公司 Distributed backup upgrading method
CN112162773A (en) * 2020-10-10 2021-01-01 北京紫光展锐通信技术有限公司 Differential upgrading method and device, storage medium and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5555371A (en) * 1992-12-17 1996-09-10 International Business Machines Corporation Data backup copying with delayed directory updating and reduced numbers of DASD accesses at a back up site using a log structured array data storage
CN103473099A (en) * 2013-09-13 2013-12-25 惠州Tcl移动通信有限公司 Software upgrading method and system for mobile terminal
CN104932909A (en) * 2014-03-17 2015-09-23 中兴通讯股份有限公司 Terminal software upgrading method and device
CN106445616A (en) * 2016-10-12 2017-02-22 北京元心科技有限公司 Method and device for upgrading terminal equipment from multiple systems to single system
CN106484448A (en) * 2015-08-28 2017-03-08 青岛海信移动通信技术股份有限公司 A kind of method for upgrading software and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5555371A (en) * 1992-12-17 1996-09-10 International Business Machines Corporation Data backup copying with delayed directory updating and reduced numbers of DASD accesses at a back up site using a log structured array data storage
CN103473099A (en) * 2013-09-13 2013-12-25 惠州Tcl移动通信有限公司 Software upgrading method and system for mobile terminal
CN104932909A (en) * 2014-03-17 2015-09-23 中兴通讯股份有限公司 Terminal software upgrading method and device
CN106484448A (en) * 2015-08-28 2017-03-08 青岛海信移动通信技术股份有限公司 A kind of method for upgrading software and device
CN106445616A (en) * 2016-10-12 2017-02-22 北京元心科技有限公司 Method and device for upgrading terminal equipment from multiple systems to single system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIFUXIANOA: "《Android Recovery系统分析2----升级包目录结构分析》", 《HTTPS://BLOG.CSDN.NET/LIFUXIANOA/ARTICLE/DETAILS/8729929》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569058A (en) * 2019-09-09 2019-12-13 Oppo(重庆)智能科技有限公司 System upgrading method, device, terminal and computer readable storage medium
CN110781030A (en) * 2019-09-09 2020-02-11 晶晨半导体(深圳)有限公司 Backup method for user data in android system upgrading process
CN111124451A (en) * 2019-12-24 2020-05-08 山东有人信息技术有限公司 Distributed backup upgrading method
CN112162773A (en) * 2020-10-10 2021-01-01 北京紫光展锐通信技术有限公司 Differential upgrading method and device, storage medium and terminal
CN112162773B (en) * 2020-10-10 2022-09-02 北京紫光展锐通信技术有限公司 Differential upgrading method and device, storage medium and terminal

Also Published As

Publication number Publication date
CN109298873B (en) 2023-05-09

Similar Documents

Publication Publication Date Title
CN103473067B (en) Built-in Linux subregion and data restoration method, system and system development method
CN109298873A (en) A kind of method for upgrading system and device
CN102650947B (en) Continuous increment over-the-air upgrade method of Android handheld equipment
US20170262276A1 (en) Minimizing Image Copying During Partition Updates
CN103229144B (en) Preheating software is installed
CN102722386B (en) Generate the method and apparatus of radio firmware AKU
CN102750317B (en) Method and device for data persistence processing and data base system
CN106155915B (en) Data storage processing method and device
CN101582092B (en) Method and device for realizing the store of date in memory
CN103780638A (en) Data synchronization method and system
JP2018511132A (en) Application loading method and apparatus
CN107632828A (en) More dts files support method, compilation device and embedded device
CN109086078A (en) Android system upgrade method, device, server and mobile terminal
CN106033362A (en) Method and device for processing flash memory partition
CN107526608A (en) A kind of OTA AKUs upgrade method and equipment
CN110083379A (en) A kind of server component upgrade method and relevant apparatus
CN110209420A (en) A kind of method and device updating bootstrap loader
CN104268097B (en) A kind of metadata processing method and system
CN104052626A (en) Method, device and system for configuring network element data
CN114860654A (en) Method and system for dynamically changing Iceberg table Schema based on Flink data stream
CN110597568A (en) Plug-in deployment method, system and terminal
WO2016188200A1 (en) Method and device for implementing partition switching
CN116302328A (en) Intelligent contract data processing method and system
CN109271194A (en) Branch's access method and device based on distributed version control system
CN114860378A (en) File system migration method, device, system and medium thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant