WO2015139381A1 - 一种终端软件升级方法及装置 - Google Patents

一种终端软件升级方法及装置 Download PDF

Info

Publication number
WO2015139381A1
WO2015139381A1 PCT/CN2014/081013 CN2014081013W WO2015139381A1 WO 2015139381 A1 WO2015139381 A1 WO 2015139381A1 CN 2014081013 W CN2014081013 W CN 2014081013W WO 2015139381 A1 WO2015139381 A1 WO 2015139381A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
software
differential
version software
source version
Prior art date
Application number
PCT/CN2014/081013
Other languages
English (en)
French (fr)
Inventor
张翀
陈禧
双建平
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2015139381A1 publication Critical patent/WO2015139381A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Definitions

  • the present invention relates to a differential upgrade technology, and in particular, to a differential partition upgrade scheme for a device with a small memory space.
  • BACKGROUND OF THE INVENTION Many terminal devices need to perform corresponding firmware upgrades, but due to storage space limitations, it is not possible to accommodate a complete version of data for upgrade. Therefore, it is necessary to create a differential upgrade package according to the difference between the two versions to reduce storage space. s expenses.
  • the current mainstream differential solution providers are not open source, and the open source differential solution does not actually solve the excessive memory space overhead. Actual communication devices such as data cards and uFi devices are used for cost reasons.
  • the flash space for placing version data is relatively small.
  • a terminal software upgrade method including: acquiring a differential packet for upgrading a source version software by a terminal holding a source version software; and obtaining a plurality of control commands by parsing the differential packet The difference information set consisting of elements; in accordance with the order of each element in the difference information set and the respective control commands, sequentially updating the data of the corresponding area in the source version software, thereby upgrading the source version software to the target version software .
  • the step of acquiring, by the terminal holding the source version software, the differential package for upgrading the source version software comprises: downloading, by the terminal from the network side, the differential package for upgrading the source version software, and downloading the differential package Read to memory.
  • the control command includes a control command for indicating data copying and a control command for indicating data replacement, wherein the order according to each element in the difference information set and the respective control command are sequentially
  • the step of updating the data of the corresponding area in the source version software includes: the terminal uses the control command of the current element to indicate data replacement, and obtains the target version software data used to replace the specified area data in the source version software, and The target version software data overlay is written to the specified area; after the target version software data overlay is written to the specified area, the terminal specifies the area data for the next element according to the element order in the difference information set.
  • the method further includes the step of generating, by the network side, the differential packet, comprising: separately processing binary data of the source version software and the target version software, to obtain a source version multiple element set and a target version multiple element set having multiple attribute elements And calculating, according to an upgrade order of each element in the source version multiple element set, difference information of each corresponding element between the source version multiple element set and the target version multiple element set; according to the source version multiple element set and target version The differential information of each corresponding element between the multiple element sets generates a differential package for terminal software upgrade.
  • the step of generating a differential packet for terminal software upgrade according to the difference information of each corresponding element between the source version multiple element set and the target version multiple element set comprises: using the source version multiple element
  • the difference information of each corresponding element between the set and the target version multiple element set generates a corresponding control command; and the generated control command and the difference information are encapsulated and compressed according to a predetermined format to form a differential packet output.
  • the difference information is used to identify a matching area or a non-matching area between the source version software and the target version software.
  • a control command for indicating data copying is generated.
  • a terminal software upgrading apparatus including: a differential packet obtaining module, configured to acquire a differential packet used to upgrade a terminal source version software; and a differential packet parsing module, configured to parse the difference a packet, a differential information set composed of a plurality of elements having control commands; a software upgrade module, configured to sequentially perform corresponding regions in the source version software according to the order of each element in the difference information set and the respective control commands The data is updated to upgrade the source version software to the target version software.
  • FIG. 1 is a block diagram of a terminal software upgrade method provided by the present invention
  • FIG. 2 is a block diagram of a terminal software upgrade apparatus provided by the present invention
  • FIG. 1 is a block diagram of a terminal software upgrade method provided by the present invention
  • FIG. 2 is a block diagram of a terminal software upgrade apparatus provided by the present invention
  • FIG. 3 is a schematic diagram of a divide and conquer difference algorithm provided by an embodiment of the present invention
  • FIG. 5 is a block diagram of a differential scheme provided by an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a control region in metadata according to an embodiment of the present invention
  • FIG. 8 is a flowchart of a terminal updating a software version by using a differential packet according to an embodiment of the present invention
  • FIG. 9 is a schematic diagram of a terminal updating a version data element by using differential data according to an embodiment of the present invention
  • 10 is a structural diagram of a control command structure according to an embodiment of the present invention
  • FIG. 11 is a schematic diagram showing the meaning of each value of the buffer of the setPointerCache as a buffer of the command provided by the embodiment of the present invention;
  • a schematic diagram of the index values of the caches used by the SET_PTR_DELTA_COMMAND control command is provided.
  • FIG. 13 is a schematic diagram of command code values corresponding to several Set commands used in the embodiment of the present invention;
  • FIG. 14 is a view of all the embodiments of the present invention.
  • the length of the data is implemented by optimizing the encoded data length, that is, the data length required for encoding the values; and
  • FIG. 15 is the data value of the representative length in the control command provided by the embodiment of the present invention.
  • the structure of the data constitutes a schematic diagram.
  • Step S101 A terminal holding a source version software acquires a differential packet for upgrading a source version software; in the step S101 The terminal downloads the differential packet for upgrading the source version software from the network side, and reads the differential packet into the memory.
  • Step S102 Obtain a difference information set composed of a plurality of elements having control commands by parsing the difference packet; Step S103: sequentially, according to an order of each element in the difference information set and a control command respectively The data of the corresponding area in the version software is updated, so that the source version software is upgraded to the target version software.
  • the control command includes a control command for indicating data copying and a control command for indicating data replacement
  • the terminal uses the control command used by the current element to indicate data replacement, and is used to replace Specifying target version software data of the area data in the source version software, and writing the target version software data overlay to the specified area; after the target version software data coverage is written to the designated area, the terminal follows the The order of the elements in the difference information set updates the data of the specified area of the next element. Further, when the current element has a control command for indicating data copying, the data of the next element specified area is updated directly according to the order of the elements in the difference information set.
  • the foregoing differential packet is generated on the network side, and the specific steps include: separately processing the binary data of the source version software and the target version software to obtain a source version multiple element set and a target version multiple element set having multiple attribute elements; An order of upgrading the elements in the set of elements, sequentially calculating difference information of each corresponding element between the source version multiple element set and the target version multiple element set; according to the source version multiple element set and the target version multiple element set.
  • the differential information of each corresponding element generates a differential packet for terminal software upgrade.
  • generating by using difference information of each corresponding element between the source version multiple element set and the target version multiple element set, generating a corresponding control command; and encapsulating the generated control command and the difference information according to a predetermined format And compressed, formed into a differential packet output.
  • the difference information is used to identify a matching area or a non-matching area between the source version software and the target version software.
  • a control command for indicating data copying is generated.
  • a control command is generated to indicate data replacement.
  • the method includes a differential packet acquisition module, a differential packet analysis module, and a software upgrade module, where the differential packet acquisition module obtains a difference used to upgrade the terminal source version software.
  • the differential packet parsing module obtains a difference information set composed of a plurality of elements having control commands by parsing the difference packet
  • the software upgrade module has an order of each element in the difference information set and each has a
  • the control command updates the data of the corresponding area in the source version software in turn, so that the source version software is upgraded to the target version software.
  • the invention provides a divide and conquer difference algorithm specifically for version compilation files, and provides an algorithm scheme specifically for differential upgrade of devices with limited flash space. Need to get two versions of the binary file, old and new version data (where old is the source version data, new is the target version data, then the two will be used alternately), then the source version data and the target version data are processed, and then Analyze the difference information between the original version and the target version, and finally generate a differential upgrade package.
  • the goal of the algorithm is to record the control area corresponding to the control command in a tabular manner, and the control commands are divided into two categories: SetCommand and CopyCommand. These two types of names have a common data structure layout, which needs to be carefully coded by SetCommand, which is divided into SET_COMMA D_BASE, SET_PTR DELT A-COMMAND, SET PTR PAIR COMMAND and SET PTR COMMAND.
  • each of the above elements old a is actually a set of binary data, these binary data is the internal data of an element, called metadata, first need to make the internal metadata of these elements also ordered, designed with a
  • the difference information analysis algorithm of the caching mechanism The metadata of each element is sorted by the idea of multiplication method. First, the metadata with the same rank value is classified into a tuple (meta_group) by one iteration, and the current record is recorded.
  • each tuple in the iteration (which represents the ranking of all metadata in this group) and the number of metadata contained in the tuple (also known as the length of the tuple;), used in the next iteration
  • the length of the tuple is 1, then the tuple is marked as sorted, that is, it has been found to be suitable.
  • the next iteration metadata same meta_gr 0U p uses optimized quick sort method sorts Sort by key using a ranking of metadata subsequent to the current tuple each metadata secondary key is current element
  • the ranking of the group if the comparison length of the comparison iteration of the previous round is H-order, then this round of comparison iteration is a comparison of 2H-order, so it is multiplied.
  • the binary search is performed on the basis of the already ordered metadata, which is also the core of the efficient algorithm. Use existing data as much as possible to reduce the number of searches.
  • the searched optimal match we found the absolute match area, but actually found in the study of the binary compiled file, in fact, a modification of the code will cause the entire compiled file to be modified everywhere, so if it is within a certain threshold range Inside, the area still roughly matches, then in fact this is not the result of the code modification. Match area.
  • the algorithm will extend the absolute matching area until the threshold is outside the range. This area is called the fuzzy matching area. After research and verification, this improvement is necessary and feasible.
  • the divide and conquer difference algorithm used in the present invention includes, as shown in FIG. 3, first obtaining two versions of data, called a source version and a target version, and converting them into elements in a mathematical model.
  • the so-called difference information is actually Find the corresponding matching area and non-matching area, replace the information generated by the data itself with the corresponding control command, and finally integrate the differential information of each element into a differential data structure in a predefined format for output, and the compression module will output
  • the data stream is compressed and optimized, and finally output to a differential file to finally generate a differential packet.
  • Step 1 Get two versions of the data, called the source and target versions of the binary data (that is, the binary data of old and new). Turn it into an element in the mathematical model.
  • Step 2 Pre-process the elements in the source and target versions to establish the order relationship between the elements.
  • Step 3 The order of the elements outputted in step 2 is used as the processing order, and the difference information is calculated element by element to obtain the difference information of the internal metadata of the element. The so-called difference information actually finds the corresponding matching area and the non-matching area.
  • Step 4 Replace the information generated by the data itself with the corresponding control commands.
  • Step 5 Finally, the differential information of each element is integrated into a differential data structure in a predefined format for output.
  • Step 6 The compression module compresses and optimizes the output data stream.
  • Step 7 Finally output to the difference file, and finally generate a differential package.
  • the overall concept of the difference and the description of the operating environment are shown in Figure 4.
  • the source file and the object file are passed as input to the difference module, and the difference package from the source version to the target version is obtained via the self-developed difference algorithm, and then the source file is held.
  • the device is upgraded and restored, that is, the data of the target file is obtained by calculating the source file and the incoming differential packet data.
  • the overall process of the differential scheme depicted in Figure 4 is as follows: Step 1: The source and destination files are passed as input to the differential module.
  • Step 2 Obtain the differential package from the source version to the target version via the self-developed difference algorithm.
  • Step 3 Perform upgrade and restore on the device holding the source file, that is, calculate the data of the target file by calculating the source file and the incoming differential packet data.
  • the above 3 steps describe how to make a differential package from the source version to the target version and then use it on the device.
  • the block diagram of the difference scheme is shown in Figure 5.
  • First, two versions of the data are obtained, called the source version and the target version. Loaded into memory via the Loader module and then converted to elements in the mathematical model, 01dFile ⁇ old i: old ei ...old en ,...old di ...old dn ,...old ai ⁇ and
  • NewFile ⁇ new,: new p ...new p ,...new d ...new, ,...new a ⁇
  • the processing is performed by the preprocessing algorithm module (PreProcessAlgorithm), which is roughly divided into five steps: First, establish the partial order relationship of the set of elements, and then use the BFS (broadness first search) module to optimize this partial order (by calculating the dependent weights and aggregating the elements with significant dependencies;), and then find out the direction corresponding to the partial order relationship.
  • the strongly connected components of the graph group the strongly connected components and use the topological ordering to establish the ordered relationship of the set of elements, and use this as the processing order to calculate the difference information element by element.
  • This part of the calculation is given to the DiffAlgorithm module. It uses the Sort module to sort the internal metadata of the Old element (this sorting action is crucial for the efficiency and matching length of the search matching area later, and the longer the matching length, the better the difference effect;), where the element Data means:
  • Each element above is actually a set of binary data. This binary data is the data inside an element, called metadata.
  • Then use the Search module to search for the intersection of new and old data to obtain the difference information of the source data to the target data.
  • the so-called difference information is to find the corresponding matching area and non-matching area, and replace the information generated by the data itself with the corresponding control command.
  • the control commands are generated by the Command module.
  • Step 1 First, obtain two versions of data, called source version and target version. Loaded into memory via the Loader module.
  • Step 3 Calculate the elements through the preprocessing algorithm module (PreProcessAlgorithm), which is roughly divided into five steps: Step 3.1: Establish a partial order relationship of the set of elements. Step 3.2: Use the BFS (Growth First Search) module to optimize this partial order (by calculating the dependent weights and aggregating the elements with significant dependencies). Step 3.3: Find the strong connected component of the directed graph corresponding to the partial order relationship. Step 3.4: Group the strongly connected components. Step 3.5: Use topological sorting to establish an ordered relationship of the set of elements.
  • PreProcessAlgorithm the preprocessing algorithm module
  • Step 4 The order of the elements in step 3 is used as the processing order, and the difference information is calculated on an element-by-element basis. This part of the calculation is given to the DiffAlgorithm module.
  • Step 4.1 Use the Sort module to sort the internal metadata of the Old element (this sorting action is crucial for the efficiency and matching length of the search matching area later, and the longer the matching length, the better the difference effect), above
  • Each element, old is actually a set of binary data. This binary data is the data inside an element, called metadata.
  • Step 4.2 Using the Search module to perform cross search of new and old data to obtain differential information of the source data to the target data.
  • the so-called difference information is to find the corresponding matching area and non-matching area, and replace the data generated by the corresponding control command.
  • Information, control commands are generated by the Command module.
  • Step 5 Generate a control command from the Command module.
  • Step 6 Finally, the differential information of each element is passed to the Compress module for compression optimization.
  • Step 7 The output data stream is then passed to the Packager module and integrated into a differential data structure in a predefined format for output.
  • Step 8 Finally output to the difference file, and finally generate a differential package.
  • the above 8 steps describe how each module makes a differential packet from the source version to the target version.
  • the steps of preprocessing the source file and the object file are as follows: The following describes the algorithm process with an example, but the use of the algorithm is not limited to this example.
  • the source file and the target file are processed by the divide and conquer idea. First, the data of the source file and the target file are modeled, the file data is converted into a corresponding set, and then each element in the set is dual (old , , new,) differential information.
  • the created collection is generally a multiple collection, that is, a collection with multiple elements of the same attribute, which can be expressed as:
  • OldFile ⁇ old,: old ei ...old en , old di ...old dn , old ai ...old 3n ⁇
  • NewFile ⁇ new,: new p ...new p ,new d ...new d ,new a ...new a ⁇
  • each element is not a simple data but a composite data, including attributes such as position, value, and so on.
  • a separate differential upgrade is performed in an in-place upgrade manner, that is, the old, ⁇ neWl operation is performed.
  • the so-called in-place upgrade is to directly update the source data of the same area to the target data, specifically,
  • the differential scheme described in the present invention is specifically for this type of device with a small flash space, and adopts an upgrade method of in-situ upgrade.
  • the so-called in-place upgrade is to sequentially update the version data on an address range on the device, and then The new data of the corresponding target version is directly overwritten into this address range.
  • the source data is overwritten in advance, and sometimes the source data of this block is needed when updating the next element data, so in order to avoid this, it is necessary to sort each element in advance.
  • the element set is preprocessed to find the partial order relationship of the set. In fact, it is the dependency relationship between the elements. According to the partial order relationship, the directed graph between the elements is established, and then used.
  • NewFile ⁇ new SCCi , new SCC2 ,...new scc ' ,new scc ' +i ,... ⁇
  • old ⁇ ⁇ old 1 : d k ⁇ i ⁇ dj ⁇ .
  • d k , dj] refers to the element index range corresponding to a strongly connected component i.
  • the strong connected components are grouped, and then the strongly connected components between the groups are topologically ordered to establish an ordered relationship of multiple sets: old e ⁇ ... ⁇ old e ⁇ old d ⁇ ... ⁇ old d ⁇ Old a ... ⁇ old a .
  • each element old a a kl is a data structure with member data, which is actually a set of binary data, which is the data inside an element, called For metadata.
  • the metadata inside these elements needs to be ordered, and a sorting algorithm with a caching mechanism is designed. The purpose of sorting is to provide a matching standard for the matching regions and non-matching regions in the later stage for searching.
  • a first iteration through the (normalized metadata is about the same rank value to a tuple (meta_gr 0U p)) is a data packet, to record the current iteration
  • the rank of each tuple (which represents the ranking of all metadata in this group;) and the number of metadata contained in the tuple (also known as the length of the tuple;), to use the next iteration
  • the tuple is marked as sorted, that is, it has been found to be suitable.
  • the next iteration metadata same meta_gr 0U p uses optimized quick sort method sorts Sort by key using a ranking of metadata subsequent to the current tuple of each metadata (the length of the note data must If the length represented by this group, so as to achieve the purpose of multiplication), the secondary key is the current tuple's ranking. If the comparison length of the previous round of comparison iteration is H-order, then this round of comparison iteration is 2H-ord er The comparison, so it is multiplied. By analogy until the comparison length is equal to the length of the internal data of the element, the internal comparison of the element ends, and the algorithm complexity is obviously O(logn), which ensures the order of the internal data of the element.
  • the orderly records produced by the above process will be serialized into a file in a specific format, and the file name must be unique. So that the next time you use this write order data, you don't need to do it again, but use it directly from the file to deserialize it, so that the process of generating intermediate temporary data is skipped to improve the actual execution efficiency of the algorithm.
  • the optimization point has 2 points, which are: Eliminate tail recursion and reduce the call stack depth of the function.
  • the pseudo code is as follows:
  • each sub-segment to be sorted is at least halved, and the call stack depth is closely related to the length of the sub-interval, because each layer of the call tree is decremented by at least half of the sub-interval.
  • the call ends when the leaf node of the call tree is reached, and the maximum depth of the call tree is recorded as 0 (logn), so the call stack depth is 0 (logn) in the worst case, where n is the interval length of [left, right] .
  • sorting is to provide quantitative indicators for future searches (that is, by what criteria), and the sorted data is convenient for finding the matching and non-matching areas using the binary search to find the same data.
  • the matching area and the non-matching area are built as follows: In the process of searching for the optimal matching of binary data, we perform binary search on the basis of the already ordered data, which is also the core of the efficient algorithm. Using the searched optimal match, find the absolute match area, but actually found in the study of the binary compiled file, in fact, a modification of the code will cause the entire compiled file to be modified everywhere, so if it is within a certain threshold range, If the area still roughly matches, then in fact this is not a non-matching area caused by code modification. area. Thus the algorithm will extend the absolute matching area until it is outside the threshold range. This area is called the fuzzy matching area. After research and verification, this improvement is necessary and feasible.
  • the structure of the control area on the metadata is shown in Figure 6, where:
  • the Equal area is the absolute match area
  • the Diff area is the absolute non-match area
  • the brackets are the fuzzy match areas.
  • the arrow of the area represents the expandable direction of the absolute matching area, and the forward expansion will be started from the last fuzzy matching area, and the backward expansion will be started from the absolute matching area of the time. If the area is found in the extended area, the area is satisfied. For the fuzzy matching condition, the extended area is marked as a fuzzy matching area and merged into the last matching control area, which requires dynamic adjustment of the previous control command. Otherwise a new control command is used to record the new control match area.
  • Control commands are divided into two categories: SetCommand and CopyCommand.
  • SetCommand represents non-matching part of the data, this part of the data can not find matching data in the old data, can only be replaced;
  • CopyCommand represents the matching area part of the data, this part of the data can find the corresponding data on the old source file, so only need Marking can be skipped later, and the efficiency of the difference is mainly reflected in the number of CopyCommand.
  • the structure of the control command is divided into four parts, the composition is shown in Figure 10: Type: indicates the type of the command, the type details are as described above;
  • LengthData Length data, which refers to the length of the data represented. This value will be carefully coded and optimized; data: CopyCommand does not need this part to occupy the position in the data stream, and SetCommand needs this part to indicate that it needs to be inserted. Data content.
  • the invention can also optimize the encoding of SetCommand, wherein the SetCommand command is divided into: SET COMMA D BASE , SET PTR DELTA COMMA D ,
  • SET PTR PAIR COMMAND SET PTR COMMAND, where: SET COMMA DB ASE: The most common SetCommand, find the matching Delta Value in the Cache, and then update to get the new New Data with Old value + Delta value;
  • SET_PTR_DELTA_COMMAND Find the matching index value in the Cache and get the New Data directly;
  • SET_PTR_PAIR_COMMAND Temporarily reserved, not used yet;
  • SET_PTR_COMMAND When the Cache is empty or the corresponding New Data and Delta Data are not searched, the corresponding location data is directly set and inserted into the Cache.
  • the insertion method is based on the MRU (Most Recently Used) algorithm. It is guaranteed that the item existing in the Cache must be the most frequently used matching item recently. This is a heuristic insertion method that follows the principle of proximity in the computer.
  • the algorithm optimizes SetCommand, the core of which is to use the cache.
  • the cache can only store a command with a length of 4 (but it is enough).
  • the cache is named setPointerCache. The meaning of each value is shown in Figure 11.
  • UA ENCODING SET PTR PAIR COMMAND BASE refers to the Command (set pair command 0x90-0x94) that matches Old Data
  • Case4 UA ENCODING SET COMMA D BASE is the case for all the rest of the SetCommand.
  • using the cached SetCommand lookup table can avoid recording duplicate SetCommand control commands in the differential package, reducing the size of the differential package.
  • the data stream is optimized as follows: Optimize the encoding of all data representing the length, and return the encoded data length.
  • the purpose of encoding is to compress the data length. For integers less than 0, they are not encoded because they are illegal data. The longest codeable data is up to 5 bytes long, but this is a very rare big data, and it's generally not so big.
  • the first byte of the encoded data represents the sum of the data OxFB and the subsequent data length N, and the data of the last N bytes is spliced to obtain the data before encoding.
  • the length of the data used for each value is shown in Figure 14. It requires at least 1 byte and requires at most 5 bytes. However, it takes 5 bytes of data to be very rare.
  • the encoded data structure is shown in Figure 15, where Count is the length of the byte of the original value after subtracting the OxFB.
  • the number of bytes used in the encoded control command is greatly reduced compared to the previous control command, so that the number of bytes of the control command finally recorded in the differential packet is greatly reduced, and the size of the differential packet is optimized. But in the worst case, the number of bytes has increased, but this situation is extremely rare.
  • This binary data is the internal data of an element. It is called metadata.
  • metadata the metadata inside these elements needs to be ordered, and a cache mechanism is designed.
  • the difference information analysis algorithm For each element's internal metadata, use the idea of multiplication method to sort. First, the metadata with the same rank value is classified into a tuple (meta_group) through one iteration, and the current iteration is recorded. The order of each tuple (which represents the ranking of all metadata in this group) and the number of metadata contained in the tuple (also known as the length of the tuple;), used in the next iteration, when When the length of the tuple is 1, then the tuple is marked as sorted, that is, it has been found to be the appropriate location.
  • the metadata in the same meta-group is sorted using the optimized quick sort method.
  • the primary key used for sorting is the ranking of the metadata after each metadata in the current tuple, and the secondary key is the current element.
  • the ranking of the group if the comparison length of the comparison iteration of the previous round is H-order, then this round of comparison iteration is the comparison of 2H-order, so it is multiplied.
  • the algorithm complexity is obviously O(logn), which guarantees the order inside the element.
  • the orderly records produced by the above process will be serialized into a file in a specific format, and the file name must be unique. So that the next time you use this write order data, you don't need to do it again, but use it directly from the file to deserialize it, so that the process of generating intermediate temporary data is skipped to improve the actual execution efficiency of the algorithm.
  • the binary search is performed on the basis of the already ordered metadata, which is also the core of the efficiency of the whole algorithm. Use existing data as much as possible to reduce the number of searches.
  • Step 1 Obtain the old and new version binary data, that is, the source version data and the target version binary data, which are loaded into the memory in the form of a byte stream. If the bytes are the same, you do not need to make a differential packet and exit directly to make the differential packet. Otherwise, go to step 2.
  • Step 2 Abstract and model the byte stream data, convert it to the elements in the model, first group the elements, and get a multiple set as shown below, which is divided into three groups of eda, because each group does not Will affect, so it doesn't matter the order:
  • Step 3 Pre-processing the elements in the group to obtain the dependencies between the elements, and building the elements in the group into a directed graph according to the relationship between the two.
  • Step 4 After constructing the directed graph, call the Taijan algorithm to obtain the strong connected component Sccs of the directed graph.
  • Step 5 topological sorting using the dependence between the strongly connected component to this, each element arranged into a linear sequence of 0 ld dki old dk2 - 0 ld dta so long as the old dki ⁇ old dk2 there d kl ⁇ d k2.
  • Step 6 Traverse all (old, , new, ) duals, and calculate differential information for each pair of duals. The process of calculating differential information has been described in key technical points, and will not be described here.
  • Step 7 Final need Optimize and compress the data stream output by the differential module. The method used is to optimize the encoding of all the data of the length, and reduce the number of bytes used in this part of the data.
  • Step 8 Obtain a differential package file from the source version to the target version.
  • the composition of the control command used in the difference algorithm is divided into four parts, and the composition is shown in Figure 10. Type: indicates the type of the command. For details, see above.
  • LengthData The length data refers to the length of the data represented. This value is carefully coded and optimized. Data: CopyCommand does not require this part to occupy a position in the data stream. SetCommand needs this part to indicate the data content that needs to be inserted.
  • the terminal software upgrade process of the present invention will be further described below with reference to FIG. 8 to FIG. 9.
  • Figure 8 depicts an approximate reduction process for a differential packet made using the present invention: Step 1: Read the differential packet into memory.
  • Step 2 Analyze the differential packet data, extract the difference information, and create a differential information set ⁇ diff ⁇ diff ⁇ . ⁇ diff, and each element diff is actually the dual shown in Figure 5 (Sorted old dti , new Dti ) is calculated, so it will also be applied to the corresponding source version data during the restoration process, and updated to the corresponding target version data, and overwritten to the same address range.
  • Step 3 Update the elements in the set one by one, and update the data according to the control commands in the element. After the update is completed, the same address range on the writing device is overwritten (as shown in FIG. 9).
  • Step 4 After all the elements are updated, the update is successful and the upgrade package is deleted. Data update using control commands: It should be noted that during the update process, the encoded data is decoded and the decoding process is performed.
  • From domain means where to start,
  • the LengthData field means the length of the control area.
  • the data field is empty and does not need to be used.
  • This command represents that the data from the source version address From is as long as LengthData is the same as the target version, so you can skip the control area of the command directly.
  • a cache table Cache Table is maintained during the entire update process (as shown in Figure 11). It needs to be used when processing the SetCommand command. The process needs to be divided into the following situations: 1.
  • SET_COMMA D_BASE command This is the most common SetCommand, when updating to a certain data, the data area corresponds to a SET_COMMA D_BASE command, first extract the LengthData field of the command, according to this item, locate a row of the Cache Table, and then according to the code value of the command ( As shown in FIG. 13 , the specific entry is located, the Delta Value in the existing entry is extracted, and then the Old value + Delta value is obtained, thereby obtaining the target version data (New Data), and then overwriting is performed. 2.
  • SET PTR DELTA COMMA D When updating to a certain data, the data area corresponds to a SET_PTR_DELTA_COMMAND command, according to the LengthData field and the Type field, you can locate an item in the Cache Table and directly obtain the Cache Table. Target version data (New Data), then overwrite writes.
  • the program When the SET PTR COMMAND command is executed, the program knows that there is no corresponding New Data or Delta Data in the Cache Table.
  • the data field data of the command is directly extracted as the target version data (New Data) for overwriting and writing.
  • the used (Old Data, New Data) is inserted into the corresponding Cache Table table entry.
  • the present invention implements version upgrade on a device with a relatively small memory space.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种终端软件升级方法及装置,涉及差分升级技术,所述方法包括:持有源版本软件的终端获取用于升级源版本软件的差分包;通过解析所述差分包,得到由多个具有控制命令的元素组成的差分信息集合;按照各元素在所述差分信息集合中的顺序和各自具有的控制命令,依次对源版本软件中相应区域的数据进行更新,从而使源版本软件升级为目标版本软件。实现在flash空间比较小的设备上进行版本升级。

Description

一种终端软件升级方法及装置 技术领域 本发明涉及差分升级技术, 特别涉及一种针对内存空间很小的设备的分治差分升 级方案。 背景技术 很多终端设备需要进行相应的固件升级, 但是由于存储空间的限制导致不能容纳 一个完整的版本数据进行升级, 所以需要根据两个版本之间的差异性, 制作差分升级 包, 以减少存储空间的开销。 但是目前主流的差分方案提供厂商并不开源, 而开源的差分方案实际上并不能解 决内存空间开销上过大, 而实际的通讯设备如数据卡、 uFi 类设备, 它们出于成本的 考虑, 用于放置版本数据的 flash 空间都比较小, 要想在这一类设备上进行版本升级, 就需要一个针对有限内存空间设备的差分算法方案。 发明内容 本发明提供了一种终端软件升级方法及装置, 能更好地解决在内存空间较小的设 备上实现软件升级的问题。 根据本发明的一个方面, 提供了一种终端软件升级方法, 包括: 持有源版本软件的终端获取用于升级源版本软件的差分包; 通过解析所述差分包, 得到由多个具有控制命令的元素组成的差分信息集合; 按照各元素在所述差分信息集合中的顺序和各自具有的控制命令, 依次对源版本 软件中相应区域的数据进行更新, 从而使源版本软件升级为目标版本软件。 优选地, 所述的持有源版本软件的终端获取用于升级源版本软件的差分包的步骤 包括: 终端从网络侧下载所述用于升级源版本软件的差分包, 并将所述差分包读取到内 存。 优选地, 所述控制命令包括用来指示数据复制的控制命令和用来指示数据替换的 控制命令, 所述的按照各元素在所述差分信息集合中的顺序和各自具有的控制命令, 依次对源版本软件中相应区域的数据进行更新的步骤包括: 终端利用当前元素所具有的用来指示数据替换的控制命令, 获取用来替换源版本 软件中指定区域数据的目标版本软件数据, 并将所述目标版本软件数据覆盖写入到所 述指定区域; 所述目标版本软件数据覆盖写入到所述指定区域后, 终端按照所述差分信息集合 中的元素顺序, 对下一个元素指定区域的数据进行更新。 优选地, 当当前元素具有用来指示数据复制的控制命令, 则直接按照所述差分信 息集合中的元素顺序, 对下一个元素指定区域的数据进行更新。 优选地, 还包括网络侧生成所述差分包的步骤, 包括: 对源版本软件和目标版本软件的二进制数据分别进行处理, 得到具有多个属性元 素的源版本多重元素集合和目标版本多重元素集合; 按照源版本多重元素集合中各元素的升级顺序, 依次计算所述源版本多重元素集 合和目标版本多重元素集合之间的各对应元素的差分信息; 根据所述源版本多重元素集合和目标版本多重元素集合之间的各对应元素的差分 信息, 生成用于终端软件升级的差分包。 优选地, 所述的根据所述源版本多重元素集合和目标版本多重元素集合之间的各 对应元素的差分信息, 生成用于终端软件升级的差分包的步骤包括: 利用所述源版本多重元素集合和目标版本多重元素集合之间的各对应元素的差分 信息, 生成相应的控制命令; 按照预定格式, 对所生成的控制命令和所述差分信息进行封装并压缩, 形成成差 分包输出。 优选地, 所述差分信息用于标识源版本软件和目标版本软件之间的匹配区域或非 匹配区域。 优选地,当所述差分信息用于标识源版本软件和目标版本软件之间的匹配区域时, 生成用来指示数据复制的控制命令。 优选地, 当所述差分信息用于标识源版本软件和目标版本软件之间的非匹配区域 时, 生成用来指示数据替换的控制命令。 根据本发明的另一方面, 提供了一种终端软件升级装置, 包括: 差分包获取模块, 用于获取用来升级终端源版本软件的差分包; 差分包解析模块, 用于通过解析所述差分包, 得到由多个具有控制命令的元素组 成的差分信息集合; 软件升级模块, 用于按照各元素在所述差分信息集合中的顺序和各自具有的控制 命令, 依次对源版本软件中相应区域的数据进行更新, 从而使源版本软件升级为目标 版本软件。 与现有技术相比较, 本发明上述实施例的有益效果在于: 本发明实施例采用分治的思路节省了内存开销, 解决了在内存空间很小的设备上 进行原地差分升级的问题, 并且利用各项优化措施在一定程度上提升了压缩效率和做 包时间, 减小了差分包尺寸, 提升了工作效率, 节约了人力成本, 使得差分升级技术 可以得到进一步推广和应用。 附图说明 图 1是本发明提供的终端软件升级方法原理框图; 图 2是本发明提供的终端软件升级装置框图; 图 3是本发明实施例提供的分治差分算法示意图; 图 4是本发明实施例提供的差分模块示意图; 图 5是本发明实施例提供的差分方案的模块示意图; 图 6是本发明实施例提供的元数据中控制区域的结构示意图; 图 7是本发明实施例提供的分治差分方案的详细过程; 图 8是本发明实施例提供的终端利用差分包更新软件版本的流程图; 图 9是本发明实施例提供的终端利用差分数据更新版本数据元素的示意图; 图 10是本发明实施例提供的控制命令结构组成图; 图 11是本发明实施例提供的 setPointerCache 作为命令的缓存器, 该缓存器的各 项值表征意义的示意图; 图 12是本发明实施例提供的 SET_PTR_DELTA_COMMAND控制命令所用到的 各项 cache的索引值示意图; 图 13是本发明实施例提供的所使用的几种 Set命令对应的命令编码值示意图; 图 14是本发明实施例提供的对所有表示长度的数据实施优化编码后的数据长度, 即对各项值编码所需要用到的数据长度的示意图; 以及 图 15 是本发明实施例提供的控制命令中代表长度的数据值在经过编码后的数据 组成结构示意图。 具体实施方式 以下结合附图对本发明的优选实施例进行详细说明, 应当理解, 以下所说明的优 选实施例仅用于说明和解释本发明, 并不用于限定本发明。 图 1是本发明提供的终端软件升级方法原理框图, 如图 1所述, 步骤包括: 步骤 S101 : 持有源版本软件的终端获取用于升级源版本软件的差分包; 在所述步骤 S101中,终端从网络侧下载所述用于升级源版本软件的差分包,并将 所述差分包读取到内存。 步骤 S102: 通过解析所述差分包, 得到由多个具有控制命令的元素组成的差分信 息集合; 步骤 S103 : 按照各元素在所述差分信息集合中的顺序和各自具有的控制命令, 依 次对源版本软件中相应区域的数据进行更新,从而使源版本软件升级为目标版本软件。 在所述步骤 S103中,所述控制命令包括用来指示数据复制的控制命令和用来指示 数据替换的控制命令, 终端利用当前元素所具有的用来指示数据替换的控制命令, 获 取用来替换源版本软件中指定区域数据的目标版本软件数据, 并将所述目标版本软件 数据覆盖写入到所述指定区域; 所述目标版本软件数据覆盖写入到所述指定区域后, 终端按照所述差分信息集合中的元素顺序, 对下一个元素指定区域的数据进行更新。 进一步地, 当当前元素具有用来指示数据复制的控制命令, 则直接按照所述差分信息 集合中的元素顺序, 对下一个元素指定区域的数据进行更新。 上述差分包在网络侧生成, 具体步骤包括: 对源版本软件和目标版本软件的二进 制数据分别进行处理, 得到具有多个属性元素的源版本多重元素集合和目标版本多重 元素集合; 按照源版本多重元素集合中各元素的升级顺序, 依次计算所述源版本多重 元素集合和目标版本多重元素集合之间的各对应元素的差分信息; 根据所述源版本多 重元素集合和目标版本多重元素集合之间的各对应元素的差分信息, 生成用于终端软 件升级的差分包。 进一步地, 利用所述源版本多重元素集合和目标版本多重元素集合 之间的各对应元素的差分信息, 生成相应的控制命令; 按照预定格式, 对所生成的控 制命令和所述差分信息进行封装并压缩, 形成成差分包输出。 其中, 所述差分信息用 于标识源版本软件和目标版本软件之间的匹配区域或非匹配区域。 当所述差分信息用 于标识源版本软件和目标版本软件之间的匹配区域时, 生成用来指示数据复制的控制 命令。 当所述差分信息用于标识源版本软件和目标版本软件之间的非匹配区域时, 生 成用来指示数据替换的控制命令。 图 2是本发明提供的终端软件升级装置框图, 如图 2所示,包括差分包获取模块、 差分包解析模块和软件升级模块, 其中, 差分包获取模块获取用来升级终端源版本软 件的差分包, 所述差分包解析模块通过解析所述差分包, 得到由多个具有控制命令的 元素组成的差分信息集合, 所述软件升级模块按照各元素在所述差分信息集合中的顺 序和各自具有的控制命令, 依次对源版本软件中相应区域的数据进行更新, 从而使源 版本软件升级为目标版本软件。 下面结合图 3至图 7, 以及图 10至图 15, 对本发明的进一步说明。 本发明提供一种专门针对版本编译文件的分治差分算法, 提供一种专门针对于 flash 空间很有限的设备的差分升级的算法方案。 需要先获取两个版本的二进制文件, old和 new版本数据 (其中 old就是源版本数据, new就是目标版本数据,之后两者会交 替使用), 然后对源版本数据和目标版本数据进行处理, 再分析计算原版本和目标版本 的差异性信息, 最后生成差分升级包。
1、 通过分治的方式分析并计算源版本和目标版本的差异性信息: 在制作版本 A 到 B 的差分升级包的过程中,会对源版本数据 A和 目标版本数据 B 的二进制数据 流进行处理,将之转为一个多重元素集合, 也即是一个有着多个相同属性元素的集合, 由于是原地升级, 所以整个元素集合就存在一种偏序关系, 这种偏序关系其实就是元 素间的一个依赖关系, Xl < 就表示元素 i必须要 在元素 j 之前被更新。然后经过数 学变换和排序将偏序嵌入到一个线性序中, 也就是把各个元素安排成一个线性序列 olda olda ...olda , 使得只要 olda < olda 则有 akl < ak2 。 这意味着所有元素被重 新安排成一条线, 使得所有箭头都指向右。
2、算法的目标是以一种表格的方式记录控制命令对应的控制区域,而控制命令又 分成 SetCommand、 CopyCommand两大类。 这两类名字有着一个共同的数据结构的 布局, 其中需要精心编码的是 SetCommand, 它又分为了 SET_COMMA D_BASE, SET—PTR DELT A—COMMAND, SET PTR PAIR COMMAND 和 SET PTR COMMAND 。
3、 上面的每一个元素 olda 其实是一组二进制数据, 这些二进制数据是一个元 素内部的数据, 称之为元数据, 首先需要使这些元素内部的元数据也有序, 设计了一 种带有缓存机制的差异性信息分析算法: 针对每一个元素内部的元数据使用倍增法的 思想来进行排序, 首先通过一轮迭代将 rank 值相同的元数据归到一个元组 (meta_group)^ , 记录当前迭代中各元组的名次 (它代表了这一组中所有元数据的名次) 和元组所含的元数据个数 (也称之为元组的长度;), 以用到下一次迭代中, 当元组的长 度为 1 时, 那么这个元组标记为已排好序的, 也就是已经找到了它合适的位置。然后 在下一次迭代时对同一个 meta_gr0Up 中的元数据使用优化过的快速排序方法进行排 序, 排序使用的主键是当前元组中每一个元数据之后的元数据的名次, 次键是当前元 组的名次, 如果上一轮的比较迭代的比较长度是 H-order, 那么这一轮比较迭代就是 2H-order的比较, 所以是倍增的。 经过一轮又一轮的比较迭代, 直到比较长度等于元 素内部元数据的长度的时候, 该元素内部的比较就结束了, 算法复杂度显而易见是 O(logn) , 这样保证了元素内部的有序性。 而上述过程所产生的有序性的记录, 会以特定格式将其序列化到文件中, 文件名 要具有唯一性。 使得下次使用这写有序性数据的时候无需再次做一次处理, 而是直接 从文件中反序列化出来加以使用, 从而略过产生中间临时数据这一过程以提升算法实 际执行效率。
4、在对二进制数据搜索最优匹配的过程中,是在已经排过序的元数据基础之上进 行二分搜索的, 这也是整个算法高效的核心所在。 会对已有的数据尽可能进行利用以 达到减少搜索次数的目的。 利用搜索到的最优匹配, 找到了绝对匹配区域, 但实际在对二进制编译文件的研 究中发现, 实际上代码的一处修改, 会导致整个编译文件的处处修改, 所以认为如果 在一定阈值范围内, 区域仍然大致匹配的话, 那么实际上这里不是代码修改导致的非 匹配区域。 因而的算法会将绝对匹配区域一直扩展下去, 直到阈值范围以外。 而这一 段区域称之为模糊匹配区域。 经过研究和验证, 这一点改进是必要且可行的。
5、最后需要对差分模块输出的数据流进行优化和压缩,采用的方法主要是对所有 表示长度的数据实施优化编码, 减少这一部分数据所使用的字节数。 本发明中使用的分治差分算法包括, 如图 3所示, 首先要获取两个版本数据, 称 之为源版本和目标版本, 将之转为数学模型中的元素。 然后预处理源版本和目标版本 的元素建立元素间的有序关系, 并以此作为处理的顺序, 逐个元素地进行差分信息的 计算, 获得元素内部元数据的差分信息, 所谓的差分信息其实就是找到对应的匹配区 域和非匹配区域, 用相应的控制命令取代数据本身生成的信息, 最后将各个元素的差 分信息以预定义的格式整合到一个差分数据结构中, 进行输出, 压缩模块会对输出的 数据流进行压缩优化, 最后输出到差分文件中, 最终生成差分包。 图 3描述的制作差 分包的大致过程如下: 步骤 1 : 获取两个版本数据, 称之为源版本和目标版本的二进制数据 (也就是 old 和 new的二进制数据) 。 将之转为数学模型中的元素。 步骤 2: 预处理源版本和目标版本中的元素, 从而建立元素间的顺序关系。 步骤 3 : 以步骤 2输出的元素顺序作为处理的顺序, 逐个元素地进行差分信息的 计算, 获得元素内部元数据的差分信息, 所谓的差分信息其实就是找到对应的匹配区 域和非匹配区域。 步骤 4: 用相应的控制命令取代数据本身生成的信息。 步骤 5 : 最后将各个元素的差分信息以预定义的格式整合到一个差分数据结构中, 进行输出。 步骤 6: 压缩模块会对输出的数据流进行压缩优化。 步骤 7: 最后输出到差分文件中, 最终生成差分包。 差分的整体概念以及运用环境的说明如图 4所示: 源文件和目标文件作为输入传 入差分模块, 经由自研差分算法得出源版本到目标版本的差分包, 然后再在持有源文 件的设备上进行升级还原, 也就是通过所持有的源文件与传入的差分包数据进行计算 后得出目标文件的数据。 图 4描述的差分方案的整体过程如下: 步骤 1 : 源文件和目标文件作为输入传入差分模块。 步骤 2: 经由自研差分算法得出源版本到目标版本的差分包。 步骤 3 : 在持有源文件的设备上进行升级还原, 也就是通过所持有的源文件与传 入的差分包数据进行计算后得出目标文件的数据。 上述 3步骤描述了如何做出从源版本到目标版本的差分包, 再在设备上进行使用 的。 差分方案的模块图如图 5所示: 首先要获取两个版本数据, 称之为源版本和目标 版本。 经由 Loader 模块加载入内存, 然后将之转为数学模型中的元素, 01dFile = {oldi: oldei ...olden ,...olddi ...olddn ,...oldai } 和
NewFile = {new,: newp ...newp ,...newd ...new, ,...newa } 然后通过预处理算法模块 (PreProcessAlgorithm)计算进行处理, 大体分为五步: 首先建立元素集合的偏序关系, 再使用 BFS (广度优先搜索)模块优化这一偏序 (通过计算依赖权重并聚合依赖权重大 的元素;), 再找出该偏序关系所对应的有向图的强连通分量, 对强连通分量进行分组并 使用拓扑排序建立元素集合的有序关系, 并以此作为处理的顺序, 逐个元素地进行差 分信息的计算, 这部分计算是交给 DiffAlgorithm模块计算, 它利用 Sort模块对 Old 元素内部元数据进行排序 (这一个排序的动作对于后期进行搜索匹配区域的效率和匹 配长度至关重要, 而匹配的长度越长则差分效果越好;), 其中元数据是指: 上面的每一 个元素 old 其实是一组二进制数据, 这些二进制数据是一个元素内部的数据, 称之 为元数据。 再利用 Search模块进行新旧数据的交叉搜索, 以获取源数据到目标数据的 差分信息, 所谓的差分信息其实就是找到对应的匹配区域和非匹配区域, 用相应的控 制命令取代数据本身生成的信息, 控制命令由 Command模块生成, 最后将各个元素 的差分信息交由 Compress模块压缩优化, 输出数据流再交给 Packager模块以预定义 的格式整合到一个差分数据结构中, 进行输出, 最后输出到差分文件中, 最终生成差 分包。 图 5表述了差分方案中各模块是如何在整个方案中起作用的, 步骤如下: 步骤 1 : 首先要获取两个版本数据, 称之为源版本和目标版本。 经由 Loader模块 加载入内存。 歩 骤 2 : 将 内 存 中 的 文 件 数 据 转 为 数 学 模 型 中 的 元 素 , 01dFile = {oldi: oldei ...olden ,...olddi ...olddn ,...oldai } 和
NewFile = {new;: new, ...new, ,...new ...new ,...newa }。 步骤 3 : 通过预处理算法模块 (PreProcessAlgorithm)对元素进行计算处理, 大体分 为五步: 步骤 3.1 : 建立元素集合的偏序关系。 步骤 3.2: 使用 BFS (广度优先搜索)模块优化这一偏序 (通过计算依赖权重并聚合 依赖权重大的元素)。 步骤 3.3 : 找出该偏序关系所对应的有向图的强连通分量。 步骤 3.4: 对强连通分量进行分组。 步骤 3.5 : 使用拓扑排序建立元素集合的有序关系。 步骤 4: 以步骤 3 的元素输出顺序作为处理的顺序, 逐个元素进行差分信息的计 算, 这部分计算将交给 DiffAlgorithm模块负责。 步骤 4.1 : 利用 Sort模块对 Old元素内部元数据进行排序 (这一个排序的动作对于 后期进行搜索匹配区域的效率和匹配长度至关重要, 而匹配的长度越长则差分效果越 好), 上面的每一个元素 old, 其实是一组二进制数据, 这些二进制数据是一个元素内 部的数据, 称之为元数据。 步骤 4.2: 利用 Search模块进行新旧数据的交叉搜索, 以获取源数据到目标数据 的差分信息, 所谓的差分信息其实就是找到对应的匹配区域和非匹配区域, 用相应的 控制命令取代数据本身生成的信息, 控制命令由 Command模块生成的。 步骤 5: 由 Command模块生成控制命令。 步骤 6: 最后将各个元素的差分信息交由 Compress模块进行压缩优化。 步骤 7: 将输出数据流再交给 Packager模块以预定义的格式整合到一个差分数据 结构中, 进行输出。 步骤 8: 最后输出到差分文件中, 最终生成差分包。 上述 8 步骤描述了各个模块是以怎样的方式做出从源版本到目标版本的差分包 的。
预处理源文件和目标文件的步骤具体如下: 下面以一个例子讲解该算法过程, 但是本算法的使用情况并不仅限于这个例子。 为了降低问题规模, 采用分治的思路处理源文件和目标文件, 首先对源文件和目 标文件的数据进行建模, 将文件数据转为相应的集合, 然后计算集合中的每一个元素 对偶 (old,, new,) 的差分信息。 建立的集合一般是一个多重集合, 也即是一个有着多个相同属性元素的集合, 可 以表示成:
OldFile = { old,: oldei ...olden , olddi ...olddn , oldai ...old3n }
NewFile = {new,: newp ...newp ,newd ...newd ,newa ...newa } 以上就是一个有 n个 e元素, n个 d元素, n个 a元素的多重集合。 而每一个元素 并不是一个简单数据而是一个复合数据, 包含了如位置, 数值等等属性。 对每一个元素以一种原地升级的方式进行单独的差分升级, 也就是进行 old, ~ neWl 操作, 所谓的原地升级就是将同一块区域的源数据直接更新成目标数 据, 具体地说, 本发明所述的差分方案就是专门针对这一类 flash 空间很小的设备的, 采用原地升级的升级方式, 所谓的原地升级就是, 依次更新设备上某一地址区间上的 版本数据, 然后将对应的目标版本的新数据直接覆盖写入这一地址区间。 这样的话就 会出现提前覆盖源数据这样的情况, 而在更新下一个元素数据的时候有时是需要用到 这一块的源数据的, 所以为了避免这种情况, 需要提前对各个元素进行一次排序。 为 了使得依赖关系尽可能的紧确, 首先会预处理一次元素集合以找到集合的偏序关系, 其实就是各元素间的依赖关系,根据这一偏序关系建立元素间的有向图,再使用 Taijan 算法找到这一有向图的所有强连通分量: OldFile = {oldSCCi,oldSCC2,...oldSCCi,oldSCCi+i,...}
NewFile = {newSCCi ,newSCC2,...newscc' ,newscc'+i ,...} 其中, old^ ={old1 :dk≤i≤dj}。 这里 [dk,dj]是指一个强连通分量 i 所对应的元 素索引范围。然后对各个强连通分量进行分组,再对组间的强连通分量进行拓扑排序, 从而建立多重集合的有序关系: olde ≤...<olde <oldd ≤...<oldd <olda ...<olda 。 也就是把各个元素安排成一个线性序列 olda olda ...olda 使得只要 olda <olda 则有 akl <ak2。这意味着所有元素被重新安排成一条线,使得所有箭头 都指向右。 使用优化的快速排序进行元数据的倍增排序, 具体如下: 每一个元素 olda akl是带有成员数据的数据结构, 其实就是一组二进制数据, 这些 二进制数据是一个元素内部的数据, 称之为元数据。 首先需要使这些元素内部的元数 据也有序, 设计了一种带有缓存机制的排序算法, 排序的目的是为了后期建立匹配区 域和非匹配区域提供量化标准,以便搜索。 因此针对每一个元素内部的元数据使用倍增 法的思想来进行排序: 首先通过一轮迭代将数据分组 (即将 rank值相同的元数据归 到一个元组 (meta_gr0Up)中) , 记录当前迭代中各元组的名次 (它代表了这一组中所有 元数据的名次;)和元组中所含的元数据个数 (也称之为元组的长度;), 以用到下一次迭代 中, 当元组的长度为 1 时, 那么这个元组标记为已排好序的, 也就是已经找到了它合 适的位置。 然后在下一次迭代时对同一个 meta_gr0Up 中的元数据使用优化过的快速 排序方法进行排序, 排序使用的主键是当前元组中每一个元数据之后的元数据的名次 (注意数据的长度一定要是这个组所代表的长度,从而达到倍增的目的) , 次键是当前 元组的名次, 如果上一轮的比较迭代的比较长度是 H-order, 那么这一轮比较迭代就是 2H-order的比较, 所以是倍增的。 以此类推直到比较长度等于元素内部数据的长度时, 该元素内部的比较就结束了, 算法复杂度显而易见是 O(logn ) , 这样能够保证了元素 内部数据的有序性。 而上述过程所产生的有序性的记录, 会以特定格式将其序列化到文件中, 文件名 要具有唯一性。 使得下次使用这写有序性数据的时候无需再次做一次处理, 而是直接 从文件中反序列化出来加以使用, 从而略过产生中间临时数据这一过程以提升算法实 际执行效率。 同时在排序过程中我们使用了优化的快速排序,优化点有 2 点,分别是: 消除尾递 归、 减少函数的调用堆栈深度。 伪代码如下所示:
消除尾递归 sfqsort(01dRank,left,right) while left< right do: sel ector=partiti on(01 dRank, left, right) sfqsort(01dRank, left, selector- 1) left=selector+l 本来算法的末尾还有一次 sfqsortCOldRank, selector+1, right) 的调用, 但是消除尾 递归以后就会去掉这次 sfqsort 的函数调用, 减少调用树的叶子节点数目。 降低最坏情况下的调用堆栈深度, 让每一次的待排序子区间至少减半, 而调用堆 栈深度是跟子区间长度紧密相关的, 因为调用树的每一层都会递减至少一半子区间的 规模, 而到达调用树的叶子节点时调用结束, 而调用树的最大深度记为 0(logn ), 所 以调用堆栈深度最坏情况下就是 0(logn ), 其中 n是 [left,right] 的区间长度。 伪代码 如下所示:
减少最坏情况下的调用堆栈深度 if right-selector <selector-l eft then sfqsort(01dRank, left, selector- 1) left=selector+l else sfqsort(01dRank, selector+1, right) right =selector-l
排序的目的是为了给将来的搜索提供量化指标 (也就是以什么样的标准来进行搜 索),同时排序以后的数据才便于使用二分搜索查找相同数据建立匹配区域和非匹配区 域。
建匹配区域和非匹配区域, 具体如下: 在对二进制数据搜索最优匹配的过程中, 我们是在已经排好序的数据基础之上进 行二分搜索的, 这也是整个算法高效的核心所在。 利用搜索到的最优匹配, 找到绝对匹配区域, 但实际在对二进制编译文件的研究 中发现, 实际上代码的一处修改, 会导致整个编译文件的处处修改, 所以如果在一定 阈值范围内, 区域仍然大致匹配的话, 那么实际上这里不是代码修改导致的非匹配区 域。 因而算法会将绝对匹配区域一直扩展下去, 直到阈值范围以外。 而这一段区域称 之为模糊匹配区域。 经过研究和验证, 这一点改进是必要且可行的。 在元数据上的控 制区域的结构示意图如图 6所示, 其中:
Equal 区域是绝对匹配区域, Diff 区域是绝对非匹配区域, 括号部分是模糊匹配 区域。 区域的箭头代表绝对匹配区域的可扩展方向, 将从上一次的模糊匹配区域开始 进行前向扩展, 同时从该次的绝对匹配区域开始进行后向扩展, 如果在扩展区域中发 现该区域满足了模糊匹配的条件, 那么将该扩展区域标记为模糊匹配区域, 并合入到 上一次的匹配控制区域, 这需要动态调整上一个控制命令。 否则以一个新的控制命令 来记录新的控制匹配区域。
计算源文件和目标文件的差分信息, 具体如下: 建立了匹配区域和非匹配区域后,将对每一个区域以一个控制命令取代,即以一种 表格的形式记录控制命令对应的控制区域,这样大量的信息就被短短几个字节所取代, 从而达到差分的目的。 控制命令分成 SetCommand、 CopyCommand 两大类。 SetCommand代表非匹配部分数据,这一部分数据在 old数据中找不到匹配的数据,只能 进行替换; CopyCommand代表匹配区域部分数据,这一部分数据可以在 old源文件上查 找到相应数据,所以只需要标记以后即可跳过,差分的效率主要体现在 CopyCommand的 个数上。 控制命令的结构分为 4部分组成, 组成如图 10所示: Type:表示该命令的类型, 类型详情见上述;
From:表示该命令所控制的区域的起始地址;
LengthData:长度数据, 是指所代表的数据的长度, 对这一个值会进行精心的编码 优化; data: CopyCommand不需要这一部分在数据流中不会占据位置,而 SetCommand 需 要这一部分表示需要插入的数据内容。 本发明还可以对 SetCommand 的编码进行优化,其中 SetCommand 命令分为: SET COMMA D BASE , SET PTR DELTA COMMA D ,
SET PTR PAIR COMMAND, SET PTR COMMAND, 其中: SET COMMA D B ASE: 最普通的 SetCommand, 查找 Cache 中匹配的 Delta Value, 然后以 Old value + Delta value, 更新获得新的 New Data;
SET_PTR_DELTA_COMMAND:查找 Cache 中匹配的索引值, 直接获取其中的 New Data; SET_PTR_PAIR_COMMAND:暂作保留,尚未使用;
SET_PTR_COMMAND:当 Cache 为空或者说搜索不到相应的 New Data 和 Delta Data 时直接进行对应位置数据的设置,并将该项插入 Cache。 插入的方式是以 MRU(Most Recently Used)算法思路进行, 保证存在于 Cache 的项一定是最近最常使 用的匹配项, 这是一种遵循计算机中的就近原则的启发式的插入方法。 本算法对 SetCommand进行的优化,其核心是使用了缓存, 该缓存最多只能存储长 度为 4的命令 (但已经足够),在图 1 1中该缓存被命名为 setPointerCache 。 各项值的意 义如图 1 1中说明所示:它的各项值代表的是每一个 PJR— D£J∑4— CO ½4 )控制 命令所用到的 cache索引值。还原模块将从该索引值对应的 cache组中找到插入值进行 还原。 如图 13所示,本发明中所使用的几种 SetCommand命令分别在以下五种情况下进 行使用, 其中 CaseO属于异常情况。
CaseO:没有在对应 cache单元中找到任何匹配项, 指定的 len超出了范围,那么返 回错误码;
Casel : UA ENCODING SET PTR COMMAND BASE是指没有在对应 cache单 元中找到任何匹配项, 需要直接添加到 cache中(>=(^94), 命令计算公式: decodedCommand=mismatchLen+UA_ENCODING_SET_PTR_COMMA D_BASE-
1;
Case2: UA ENCODING SET PTR PAIR COMMAND BASE是指在对应的 cache 单元中找到 Old Data|New Data匹配的 Command(set pair command 0x90-0x94), 只会从 cache中获取 New Data, 不会修改 cache 中 New Data的值, 命令计算公式: decodedCommand=mismatchLen+UA_ENCODING_SET_PTR_PAIR_COMMA D_ BASE-1 ; Case3: UA ENCODING SET PTR DELTA COMMA D BASE 是指在对应的 cache单元中找到 Delta Value匹配 (Ox 10-0x90), 命令计算公式: decodedCommand=decodedCacheIndex+BaseAddress;其中, decodedCachelndex 是 从 Cache 中 找 到 mismatchLen 对 应 的 Delta Value 的 索 引 ; BaseAddress=deltaBaseAddress[mismatchLen-l];
Case4: UA ENCODING SET COMMA D BASE 是剩下的所有需要用到 SetCommand的情况。 综上所述,利用缓存的 SetCommand 查表可以避免在差分包中记录重复的 SetCommand控制命令,减少了差分包的尺寸大小。
对数据流进行优化, 具体如下: 对所有表示长度的数据实施优化编码, 返回编码后的数据长度。 编码的目的是压 缩数据长度。 对于小于 0的整数不予编码, 因为它们属于不合法的数据。 最长可编码 的数据长度达到 5字节, 但是这是十分罕见的大数据了, 一般用不到这么大。 经过编 码的数据的第一个字节即表示数据 OxFB 与 随后还有的数据长度 N之和, 对后面 N个字节的数据进行拼接就得到编码前的数据了。 对各项值所用的数据长度如图 14 所示, 至少需要 1个字节, 至多需要 5个字节, 但需要 5字节的数据是十分少见的, 编码数据结构如图 15所示, 其中 count是指原本数值在减去了 OxFB后剩余数值的字 节长度。 编码伪代码:
squeezer_squeeze(buffer, value): if value<=0xFB then buffer[0]=value&0xff; size=l; else then tmp=value-0xFB; bytes [] is filled with tmp; count=caculate valid length of bytes array;
buffer[0]=OxFB+count;
for i=l to count do:
buffer[i] = bytes[i-l];
size=count+l;
return size 从可变长度的压缩流中解压出正整数值, 返回压缩编码的真实数值。 解码伪代码: squeezer_unsqueeze(buffer, count):
b = buffer[0];
count = 1; if b <= OxFB
then j=b;
else then j=0;
k=b-0xFB;
for i=0 to k-1 do:
b = buffer [count];
count++;
j |= b « (8 * i);
j+=251; return j;
这样编码后的控制命令相较于之前的控制命令所使用的字节数大大减少, 也就使 得最终记入差分包中的控制命令的字节数大大减少, 优化了差分包的尺寸大小。 但是 最坏情况下是使得字节数有所增长, 但这种情况极为少见。
分治差分方案的详细过程如图 7所示: 通过分治的方式分析并计算源版本和目标 版本的差异性信息:在制作版本 A 到 B 的差分升级包的过程中,会对源版本数据 A 和 目标版本数据 B 的二进制数据流进行处理, 将之转为一个多重元素集合, 也即是 一个有着多个相同属性元素的集合, 由于是原地升级, 所以整个元素集合就存在一种 偏序关系, 这种偏序关系其实就是元素间的一个依赖关系, X < Xj就表示元素 i必须 要 在元素 j 之前被更新。 然后经过数学变换和排序将偏序嵌入到一个线性序中, 也 就是把各个元素安排成一个线性序列 olda olda ...olda 使得只要 olda < olda 则有 akl < ak2。 在图形上来看就是所有元素被重新安排成一条线, 使得所有箭头都指向右。 算法的目标是是以一种表格的方式记录控制命令对应的控制区域, 而控制命令又 分成 SetCommand、 CopyCommand两大类。 这两类名字有着一个共同的数据结构的 布局, 其中需要精心编码的是 SetCommand, 它又分为了 SET_COMMA D_BASE, SET—PTR DELT A—COMMAND, SET PTR PAIR COMMAND 和 SET PTR COMMAND 。 上面的每一个元素 olda 其实是一组二进制数据,这些二进制数据是一个元素内 部的数据, 称之为元数据, 首先需要使这些元素内部的元数据也有序, 设计了一种带 有缓存机制的差异性信息分析算法: 针对每一个元素内部的元数据使用倍增法的思想 来进行排序, 首先通过一轮迭代将 rank值相同的元数据归到一个元组 (meta_group) 中, 记录当前迭代中各元组的名次 (它代表了这一组中所有元数据的名次)和元组所含 的元数据个数 (也称之为元组的长度;), 以用到下一次迭代中, 当元组的长度为 1 时, 那么这个元组标记为已排好序的, 也就是已经找到了它合适的位置。 然后在下一次迭 代时对同一个 meta—group 中的元数据使用优化过的快速排序方法进行排序, 排序使 用的主键是当前元组中每一个元数据之后的元数据的名次, 次键是当前元组的名次, 如果上一轮的比较迭代的比较长度是 H-order,那么这一轮比较迭代就是 2H-order的比 较, 所以是倍增的。 经过一轮又一轮的比较迭代, 直到比较长度等于元素内部元数据 的长度的时候, 该元素内部的比较就结束了, 算法复杂度显而易见是 O(logn) , 这样 保证了元素内部的有序性。 而上述过程所产生的有序性的记录, 会以特定格式将其序列化到文件中, 文件名 要具有唯一性。 使得下次使用这写有序性数据的时候无需再次做一次处理, 而是直接 从文件中反序列化出来加以使用, 从而略过产生中间临时数据这一过程以提升算法实 际执行效率。 在对二进制数据搜索最优匹配的过程中, 是在已经排过序的元数据基础之上进行 二分搜索的, 这也是整个算法高效的核心所在。 会对已有的数据尽可能进行利用以达 到减少搜索次数的目的。 利用搜索到的最优匹配, 找到了绝对匹配区域, 但实际在对二进制编译文件的研 究中发现, 实际上代码的一处修改, 会导致整个编译文件的处处修改, 所以认为如果 在一定阈值范围内, 区域仍然大致匹配的话, 那么实际上这里不是代码修改导致的非 匹配区域。 因而的算法会将绝对匹配区域一直扩展下去, 直到阈值范围以外。 而这一 段区域称之为模糊匹配区域。 经过研究和验证, 这一点改进是必要且可行的。 最后需要对差分模块输出的数据流进行优化和压缩, 采用的方法主要是对所有表 示长度的数据实施优化编码, 减少这一部分数据所使用的字节数。 图 7详细描述了本发明所涉及的分治差分方案的流程: 步骤 1 : 获取 old和 new版本二进制数据, 也就是源版本数据和目标版本二进制 数据,以字节流的形式被加载到内存,如果字节一致,则无需制作差分包,直接退出制作差 分包,否则进入步骤 2。 步骤 2: 对字节流数据进行抽象和建模,转为模型中的元素,首先对元素进行分组, 得到如下所示的一个多重集合,其中分成了 e.d.a三个组,各组之间由于不会影响,所以无 所谓顺序:
OldFile = {old,: oldei ...olden ,olddi ...olddn ..oldai } NewFile = {new;: new, ...new, ,new ...new ,...newa } 步骤 3 : 对组内元素进行预处理得到元素间的依赖关系,依据这种两两的依赖关系 将组内元素建成一个有向图。 步骤 4: 建成有向图后,调用 Taijan算法求得有向图的强连通分量 Sccs。 步骤 5: 利用强连通分量之间的依赖关系进行拓扑排序.至此, 各个元素安排成了 一个线性序列 0lddkiolddk20lddta 使得只要 olddki≤ olddk2 则有 dkl < dk2。 步骤 6: 遍历所有的 (old, , new, )对偶,对每一对对偶进行计算差分信息.计算差 分信息的过程在关键技术点中已经进行了描述,这里不再赘述. 步骤 7: 最后需要对差分模块输出的数据流进行优化和压缩, 采用的方法主要是 对所有表示长度的数据实施优化编码, 减少这一部分数据所使用的字节数。 步骤 8: 得到从源版本到目标版本的差分包文件。 差分算法中所采用的控制命令的组成结构分为 4部分, 组成如图 10所示: Type:表示该命令的类型, 类型详情见上述。
From:表示该命令所控制的区域的起始地址。
LengthData:长度数据, 是指所代表的数据的长度, 对这一个值会进行精心的编码 优化。 data:CopyCommand不需要这一部分在数据流中不会占据位置。而 SetCommand 需 要这一部分, 表示需要插入的数据内容。 下面结合图 8至图 9, 对本发明的终端软件升级流程做出进一步说明。 图 8描述了利用本发明制作的差分包的大致还原过程: 步骤 1 : 将差分包读取到内存中。 步骤 2 : 解析差分包数据,将差分信息提取出来,建立一个差分信息集合 {diff^diff^.^diff ,而其中每一个元素 diff 都实际是由图 5 所示的对偶 (Sorted olddti , newdti ) 计算而来,所以在还原过程中也将作用于对应源版本数据,使之更 新为相应目标版本数据,并覆盖写入同一地址区间。 步骤 3:对集合中元素逐个进行更新,根据元素中的控制命令进行数据更新, 更新完 成后覆盖写入设备上的同一地址区间 (如图 9所示)。 步骤 4:所有元素更新完成后,更新成功,删除升级包。 利用控制命令进行数据更新: 需要注意的是在更新过程中,对编码过的数据要进行解码,解码过程
(squeezer—unsqueeze)是编码过程 (squeezer—squeeze)的逆过程.在前文已经阐述过编码 优化的原理,这里不再赘述. 处理 CopyCommand,该命令意义如下: From域意指从何处起始, LengthData域意指 控制区域的长度, data域为空,无需使用。 该命令代表从源版本地址 From 开始有长达 LengthData这么多的数据与目标版本是相同的,所以直接跳过该命令的控制区域即可。 在整个更新过程中会维护一张缓存表 Cache Table (如图 11 所示),处理 SetCommand命令时需要用到,处理过程需要分为以下几种情况: 1.处理 SET_COMMA D_BASE命令: 这是最普通的 SetCommand, 当更新到某 一数据时,该数据区域对应的是一个 SET_COMMA D_BASE 命令时,首先要提取出 命令的 LengthData 域,依据此项定位到 Cache Table 的某一行,然后根据命令的编码 值 (如图 13所示)定位到具体表项,将存在表项中的 Delta Value提取出来, 然后以 Old value + Delta value, 从而获得目标版本数据 (New Data),而后进行覆盖写入。 2. SET PTR DELTA COMMA D : 当更新到某一数据时,该数据区域对应的是一 个 SET_PTR_DELTA_COMMAND 命令时,依据 LengthData域和 Type 域即可定位 到 Cache Table 中某一项,直接获取存于其中的目标版本数据 (New Data),而后进行覆 盖写入。
3. SET PTR P AIR COMMA D:暂作保留,尚未使用。 4. SET PTR COMMAND : 当更新到某一数据时,该数据区域对应的是一个
SET PTR COMMAND 命令时,程序即可知此时 Cache Table 中没有相应的 New Data 或 Delta Data,则直接提取出命令的 data域数据作为目标版本数据 (New Data)进行覆 盖写入,并将此次操作所用到的 (Old Data,New Data)插入对应的 Cache Table 表项中。 综上所述, 本发明实现在内存空间比较小的设备上进行版本升级。 尽管上文对本发明进行了详细说明, 但是本发明不限于此, 本技术领域技术人员 可以根据本发明的原理进行各种修改。 因此, 凡按照本发明原理所作的修改, 都应当 理解为落入本发明的保护范围。

Claims

权 利 要 求 书 、 一种终端软件升级方法, 包括: 持有源版本软件的终端获取用于升级源版本软件的差分包;
通过解析所述差分包, 得到由多个具有控制命令的元素组成的差分信息集 合. 按照各元素在所述差分信息集合中的顺序和各自具有的控制命令, 依次对 源版本软件中相应区域的数据进行更新, 从而使源版本软件升级为目标版本软 件。 、 根据权利要求 1所述的方法, 其中, 所述的持有源版本软件的终端获取用于升 级源版本软件的差分包的步骤包括:
终端从网络侧下载所述用于升级源版本软件的差分包, 并将所述差分包读 取到内存。 、 根据权利要求 1所述的方法, 其中, 所述控制命令包括用来指示数据复制的控 制命令和用来指示数据替换的控制命令, 所述的按照各元素在所述差分信息集 合中的顺序和各自具有的控制命令, 依次对源版本软件中相应区域的数据进行 更新的步骤包括:
终端利用当前元素所具有的用来指示数据替换的控制命令, 获取用来替换 源版本软件中指定区域数据的目标版本软件数据, 并将所述目标版本软件数据 覆盖写入到所述指定区域; 所述目标版本软件数据覆盖写入到所述指定区域后, 终端按照所述差分信 息集合中的元素顺序, 对下一个元素指定区域的数据进行更新。 、 根据权利要求 3所述的方法, 其中, 当当前元素具有用来指示数据复制的控制 命令, 则直接按照所述差分信息集合中的元素顺序, 对下一个元素指定区域的 数据进行更新。 、 根据权利要求 1-4任意一项所述的方法, 其中, 还包括网络侧生成所述差分包 的步骤, 包括: 对源版本软件和目标版本软件的二进制数据分别进行处理, 得到具有多个 属性元素的源版本多重元素集合和目标版本多重元素集合; 按照源版本多重元素集合中各元素的升级顺序, 依次计算所述源版本多重 元素集合和目标版本多重元素集合之间的各对应元素的差分信息; 根据所述源版本多重元素集合和目标版本多重元素集合之间的各对应元素 的差分信息, 生成用于终端软件升级的差分包。 、 根据权利要求 5所述的方法, 其中, 所述的根据所述源版本多重元素集合和目 标版本多重元素集合之间的各对应元素的差分信息, 生成用于终端软件升级的 差分包的步骤包括:
利用所述源版本多重元素集合和目标版本多重元素集合之间的各对应元素 的差分信息, 生成相应的控制命令; 按照预定格式, 对所生成的控制命令和所述差分信息进行封装并压缩, 形 成成差分包输出。 、 根据权利要求 6所述的方法, 其中, 所述差分信息用于标识源版本软件和目标 版本软件之间的匹配区域或非匹配区域。 、 根据权利要求 7所述的方法, 其中, 当所述差分信息用于标识源版本软件和目 标版本软件之间的匹配区域时, 生成用来指示数据复制的控制命令。 、 根据权利要求 7所述的方法, 其中, 当所述差分信息用于标识源版本软件和目 标版本软件之间的非匹配区域时, 生成用来指示数据替换的控制命令。 0、 一种终端软件升级装置, 包括: 差分包获取模块, 设置为获取用来升级终端源版本软件的差分包; 差分包解析模块, 设置为通过解析所述差分包, 得到由多个具有控制命令 的元素组成的差分信息集合;
软件升级模块, 设置为按照各元素在所述差分信息集合中的顺序和各自具 有的控制命令, 依次对源版本软件中相应区域的数据进行更新, 从而使源版本 软件升级为目标版本软件。
PCT/CN2014/081013 2014-03-17 2014-06-27 一种终端软件升级方法及装置 WO2015139381A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410100573.1A CN104932909A (zh) 2014-03-17 2014-03-17 一种终端软件升级方法及装置
CN201410100573.1 2014-03-17

Publications (1)

Publication Number Publication Date
WO2015139381A1 true WO2015139381A1 (zh) 2015-09-24

Family

ID=54120085

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/081013 WO2015139381A1 (zh) 2014-03-17 2014-06-27 一种终端软件升级方法及装置

Country Status (2)

Country Link
CN (1) CN104932909A (zh)
WO (1) WO2015139381A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11531535B2 (en) 2018-10-25 2022-12-20 Huawei Technologies Co., Ltd. Firmware upgrade method and apparatus, and terminal

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740132B (zh) * 2016-01-25 2018-07-06 中国人民解放军国防科学技术大学 基于修改日志的软件包来源自动分析方法
CN106843954A (zh) * 2017-01-16 2017-06-13 武汉慧联无限科技有限公司 传感器节点远程升级方法
CN107273159A (zh) * 2017-06-08 2017-10-20 深圳市华信天线技术有限公司 适于嵌入式系统的差量式补丁升级方法及装置
CN109298873B (zh) * 2017-07-18 2023-05-09 中兴通讯股份有限公司 一种系统升级方法及装置
CN108491225B (zh) * 2018-03-15 2021-10-12 维沃移动通信有限公司 一种更新包生成方法及移动终端
CN110795131A (zh) * 2018-08-01 2020-02-14 技嘉科技股份有限公司 服务器固件更新方法
CN109358872A (zh) * 2018-09-21 2019-02-19 广东美的暖通设备有限公司 远程固件升级方法、装置及计算机可读存储介质
CN111258620B (zh) * 2018-11-30 2022-02-22 中兴通讯股份有限公司 差分升级包的生成方法、装置和设备
CN111367544B (zh) * 2018-12-26 2021-09-03 美的集团股份有限公司 多外设固件升级控制方法、智能设备、固件及电子设备
CN110275728B (zh) * 2019-06-28 2023-11-07 瓴盛科技有限公司 更新固件的系统及其方法
CN112398666B (zh) * 2019-08-13 2024-04-30 中兴通讯股份有限公司 软件差分升级方法、装置、设备及存储介质
CN112068865A (zh) * 2020-09-02 2020-12-11 上海飞奥燃气设备有限公司 高效智能燃气表差分固件升级方法
CN112286565B (zh) * 2020-10-30 2023-03-10 浙江正泰中自控制工程有限公司 一种基于存储容器的嵌入式系统差分升级方法
CN113947397A (zh) * 2021-03-09 2022-01-18 同济大学 统一移动支付平台的对账方法、系统、存储介质及终端
CN113539405B (zh) * 2021-06-24 2024-03-19 北京天健源达科技股份有限公司 电子病历表格运算控件的处理方法
CN113721967B (zh) * 2021-08-30 2024-07-05 苏州磐联集成电路科技股份有限公司 差分包生成方法,差分包生成设备,及升级方法
CN114327548A (zh) * 2021-12-24 2022-04-12 广东明创软件科技有限公司 软件升级方法及相关装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383847A (zh) * 2008-08-25 2009-03-11 中兴通讯股份有限公司 一种无线数据终端的固件升级方法及装置
CN101420431A (zh) * 2008-11-28 2009-04-29 中兴通讯股份有限公司 Fota服务器、终端及其软件版本的处理方法和系统
CN102346673A (zh) * 2010-07-27 2012-02-08 比亚迪股份有限公司 一种手机系统升级的方法及装置
CN103123588A (zh) * 2013-02-05 2013-05-29 东莞宇龙通信科技有限公司 一种获取差分升级补丁的方法及系统
CN103200219A (zh) * 2013-02-05 2013-07-10 北京小米科技有限责任公司 数据包更新方法、装置、终端设备和服务器
CN103313229A (zh) * 2013-05-27 2013-09-18 华为终端有限公司 一种空中下载技术升级的方法及设备
US8554748B1 (en) * 2005-11-30 2013-10-08 Netapp, Inc. Method and apparatus for differential file based update for embedded systems

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006268172A (ja) * 2005-03-22 2006-10-05 Nec Corp サーバシステムおよびオンラインソフトウェア更新方法
JP4822062B2 (ja) * 2006-09-29 2011-11-24 アイシン・エィ・ダブリュ株式会社 データ更新システム、ナビゲーション装置、及びデータ更新方法
CN102693145B (zh) * 2012-05-31 2015-02-25 红石阳光(北京)科技有限公司 用于嵌入式系统的差分升级方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8554748B1 (en) * 2005-11-30 2013-10-08 Netapp, Inc. Method and apparatus for differential file based update for embedded systems
CN101383847A (zh) * 2008-08-25 2009-03-11 中兴通讯股份有限公司 一种无线数据终端的固件升级方法及装置
CN101420431A (zh) * 2008-11-28 2009-04-29 中兴通讯股份有限公司 Fota服务器、终端及其软件版本的处理方法和系统
CN102346673A (zh) * 2010-07-27 2012-02-08 比亚迪股份有限公司 一种手机系统升级的方法及装置
CN103123588A (zh) * 2013-02-05 2013-05-29 东莞宇龙通信科技有限公司 一种获取差分升级补丁的方法及系统
CN103200219A (zh) * 2013-02-05 2013-07-10 北京小米科技有限责任公司 数据包更新方法、装置、终端设备和服务器
CN103313229A (zh) * 2013-05-27 2013-09-18 华为终端有限公司 一种空中下载技术升级的方法及设备

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11531535B2 (en) 2018-10-25 2022-12-20 Huawei Technologies Co., Ltd. Firmware upgrade method and apparatus, and terminal

Also Published As

Publication number Publication date
CN104932909A (zh) 2015-09-23

Similar Documents

Publication Publication Date Title
WO2015139381A1 (zh) 一种终端软件升级方法及装置
TWI682274B (zh) 鍵值儲存樹
US11531535B2 (en) Firmware upgrade method and apparatus, and terminal
TWI702506B (zh) 用於合併樹廢棄項目指標之系統、機器可讀媒體及機器實施之方法
US11169978B2 (en) Distributed pipeline optimization for data preparation
US20200210399A1 (en) Signature-based cache optimization for data preparation
US9047330B2 (en) Index compression in databases
US8255398B2 (en) Compression of sorted value indexes using common prefixes
US8738572B2 (en) System and method for storing data streams in a distributed environment
CN108446376B (zh) 数据存储方法与装置
JP5886447B2 (ja) ロケーション非依存のファイル
KR102275240B1 (ko) 저장된 데이터 유닛들의 동작 관리
US20170109389A1 (en) Step editor for data preparation
CN104915270B (zh) 用于压缩与解压缩的同步历史数据的系统和方法
EP3362808B1 (en) Cache optimization for data preparation
CN111104377A (zh) 文件管理的方法、电子设备和计算机可读存储介质
US8515976B2 (en) Bit string data sorting apparatus, sorting method, and program
US20090259617A1 (en) Method And System For Data Management
US11789708B2 (en) Compression of firmware updates
CN115563116A (zh) 一种数据库表扫描方法、装置以及设备
JP5149063B2 (ja) データ比較装置およびプログラム
CN118103829A (zh) 硬件实现的管线化数据库查询处理
US8429331B2 (en) Storage optimizations by directory compaction in a fat file system
CN110990640B (zh) 一种数据判定方法、装置、设备及计算机可读存储介质
EP2164005B1 (en) Content addressable storage systems and methods employing searchable blocks

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14886218

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14886218

Country of ref document: EP

Kind code of ref document: A1