Software upgrading method, device, electronic device and computer readable storage medium
By processing the upgrade control information and data of the differential packet, the storage space utilization of the terminal device is optimized, the problem of insufficient recycling of storage resources in differential upgrades is solved, and more efficient storage space management is achieved.
Patent Information
- Application Number
- CN202111499063.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In terminal devices, the prior art fails to effectively utilize storage space during differential upgrades, resulting in insufficient recycling of storage resources.
By obtaining the upgrade control information and differential data in the differential packet, parsing the differential packet and moving and storing the differential data based on the control information, storage space utilization is optimized.
During the software upgrade process, the storage space of the terminal device is fully utilized, which improves the recycling rate of storage resources.
Smart Images

Figure CN113986311B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer and mobile communication technology. Specifically, the present application relates to a software upgrading method, device, electronic device and computer-readable storage medium. Background Art
[0002] In the mobile communications sector, device manufacturers and operators are launching new features and services at increasingly shorter intervals. At the same time, software versions are becoming increasingly numerous and complex, leading to numerous unknown issues that arise during user experience. To address these issues and provide a better user experience, manufacturers and operators typically collaborate to place differential packages corresponding to the device's system software on a server for the device to download. This differential package allows the device to upgrade the entire software version.
[0003] In the prior art, a terminal device has storage space for storing differential packets. Usually, data in the current version of the software firmware needs to be deleted when the target version of the firmware is upgraded, which is not conducive to the recycling of storage resources in the storage space. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a software upgrade method, device, electronic device and computer-readable storage medium.
[0005] In one aspect, an embodiment of the present application provides a software upgrade method, the method comprising:
[0006] In response to an upgrade request for target software, a differential package corresponding to the target software is obtained, the differential package including upgrade control information and a plurality of differential data, the upgrade control information including position indication information and translation control information, the position indication information being used to determine a storage space in a terminal device for similar data corresponding to each differential data and a storage space in the terminal device for each mobile similar data, the translation control information being used to determine a mobile storage space in the terminal device corresponding to each mobile similar data, the mobile similar data being similar data that needs to be moved among the similar data corresponding to each differential data;
[0007] Parse the differential packet to obtain multiple differential data and upgrade control information;
[0008] The target software is upgraded based on the plurality of differential data and the upgrade control information.
[0009] On the other hand, an embodiment of the present application provides a software upgrade device, which includes:
[0010] a differential package acquisition module, configured to, in response to an upgrade request for target software, acquire a differential package corresponding to the target software, the differential package including upgrade control information and a plurality of differential data, the upgrade control information including position indication information and translation control information, the position indication information being used to determine a storage space in the terminal device for similar data corresponding to each differential data and a storage space in the terminal device for each mobile similar data, the translation control information being used to determine a mobile storage space in the terminal device corresponding to each mobile similar data, the mobile similar data being similar data that needs to be moved among the similar data corresponding to each differential data;
[0011] The parsing module is used to parse the differential packet to obtain multiple differential data and upgrade control information;
[0012] The upgrade module is used to complete the upgrade of the target software based on multiple differential data and upgrade control information.
[0013] Optionally, when the upgrade module completes the upgrade of the target software based on multiple differential data and upgrade control information, it is specifically used to: perform the following operations on each differential data in turn according to the order in which the differential data are parsed: obtain the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data; determine whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space, and store the target data in the target storage space according to the determination result, or store the mobile similar data corresponding to the differential data in the target mobile storage space in the firmware storage space determined by the translation control information, wherein the firmware storage space is the space in the terminal device used to store the current version of the firmware.
[0014] Optionally, when the above-mentioned upgrade module determines whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space, it is specifically used to: determine the first storage space in the firmware storage space of the similar data corresponding to each differential data, and the second storage space in the firmware storage space of each mobile similar data according to the position indication information; for each differential data, if the first storage space corresponding to the differential data includes the second storage space, it is determined that there is mobile similar data in the target storage space; if the first storage space corresponding to the differential data does not include the second storage space, it is determined that there is no mobile similar data in the target storage space.
[0015] Optionally, for each differential data, when the upgrade module obtains the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data, it is specifically used to: if the first storage space corresponding to the differential data includes all the similar data of the differential data, obtain the target data corresponding to the differential data based on the differential data and the similar data in the first storage space; if the first storage space corresponding to the differential data includes some similar data of the differential data, obtain the some similar data corresponding to the differential data from the target mobile storage space corresponding to the differential data, and obtain the target data corresponding to the differential data based on the differential data, the data obtained from the target mobile storage space, and the data in the first storage space except the some similar data corresponding to the differential data; if the first storage space corresponding to the differential data does not include the similar data corresponding to the differential data, obtain the similar data corresponding to the differential data from the target mobile storage space corresponding to the differential data, and obtain the target data corresponding to the differential data based on the differential data and the data obtained from the target mobile storage space.
[0016] Optionally, the above-mentioned position indication information includes the first starting storage address of the first firmware in the server, the first correspondence between each differential data and its corresponding first indication information, and the second correspondence between each differential data and its corresponding second indication information, wherein the first indication information is the first storage position information of the similar data corresponding to each differential data in the server relative to the first starting storage address, and the second indication information is the second storage position information of each mobile similar data in the server relative to the first starting storage address.
[0017] Optionally, when the above-mentioned upgrade module determines the first storage space in the firmware storage space of the similar data corresponding to each differential data and the second storage space in the firmware storage space of each mobile similar data based on the position indication information, it is specifically used to: determine the first indication information of the similar data corresponding to each differential data based on the first correspondence relationship; determine the second starting storage address of the firmware storage space; for each differential data, determine the first storage space in the firmware storage space of the similar data corresponding to the differential data based on the first storage position information and the second starting storage address corresponding to the differential data; determine the second indication information corresponding to each differential data based on the second correspondence relationship; determine the second storage space of each mobile similar data based on each second storage position information and the second starting storage address.
[0018] Optionally, the above-mentioned translation control information includes a third correspondence between each mobile similar data and its corresponding third indication information, and the third indication information is the third storage position information of the mobile storage space of each mobile similar data in the server relative to the first starting storage address; for each differential data, the above-mentioned upgrade module determines the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the translation control information, which is specifically the same as: determining the third indication information of the mobile similar data corresponding to the differential data based on the third correspondence; determining the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the third storage position information and the second starting storage address corresponding to the differential data.
[0019] Optionally, the above-mentioned location indication information also includes fourth indication information of each first data, the first data is the same data in the similar data corresponding to the two target sub-data, and the fourth indication information of a first data is the fourth storage location information of the first data in the server relative to the first starting storage address. The above-mentioned target sub-data refers to data in the second firmware that has similar data in the first firmware.
[0020] Optionally, the device further includes: a third storage space determination module, configured to determine, for each first data, the third storage space of the first data in the firmware storage space based on the fourth storage location information and the second starting storage address of the first data. For each differential data, when the upgrade module obtains the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data, it is specifically configured to: if the first storage space corresponding to the differential data includes the third storage space, and the first data exists in the third storage space, store the first data in a designated storage space; obtain the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data; if the first storage space corresponding to the differential data includes the third storage space, and the first data does not exist in the third storage space, obtain the first data corresponding to the first storage space from the designated storage space, and obtain the target data corresponding to the differential data based on the differential data, the data in the first storage space, and the first data.
[0021] Optionally, the upgrade request includes identification information of the target software, the identification information including the software identification and the version identification of the current version, and the differential package is generated by the server in the following manner: based on the identification information, determining the first firmware and the second firmware of the target software; based on the first firmware and the second firmware, determining multiple target sub-data in the second firmware, and similar data corresponding to each target sub-data; determining differential data between each target sub-data and the corresponding similar data, generating first indication information for each similar data, and establishing a first corresponding relationship between each differential data and the first indication information of the corresponding similar data; Determine the second indication information of the mobile similar data corresponding to each target sub-data, and establish a second corresponding relationship between each differential data and its corresponding second indication information; determine the mobile storage space corresponding to each mobile similar data in the server, generate the third indication information corresponding to each mobile similar data, and establish a third corresponding relationship between each mobile similar data and its corresponding third indication information; determine the first data in each target sub-data, and generate the fourth indication information corresponding to each first data; obtain the first starting storage address of the first firmware in the server, and generate upgrade control information based on the first corresponding relationship, the second corresponding relationship, the third corresponding relationship, the fourth indication information and the first starting storage address; generate a differential package based on the upgrade control information and the differential data.
[0022] Optionally, when the above-mentioned server determines multiple target sub-data in the second firmware based on the first firmware and the second firmware, and similar data corresponding to each target sub-data, it is specifically used to: divide the second firmware into several sub-data according to the set space size; based on the first firmware and each sub-data, determine the target sub-data in each sub-data, and similar data corresponding to each target sub-data.
[0023] On the other hand, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the software upgrade method provided in any optional embodiment of the present application when running the computer program.
[0024] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor executes the software upgrade method provided in any optional embodiment of the present application.
[0025] In another aspect, embodiments of the present application further provide a computer program product or computer program that, when executed on a computer device, causes the computer device to perform any of the optional implementation methods provided herein. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the software upgrade method provided in any of the optional implementation methods of the present application.
[0026] The beneficial effect brought about by the technical solution provided by the present application is: the solution provided by the embodiment of the present application obtains the corresponding differential package when the target software needs to be upgraded, that is, in response to the upgrade request, and in the process of upgrading based on multiple differential data in the differential package, for each differential data obtained by parsing, the data of the first firmware in the terminal device is moved and stored based on the differential data and the upgrade control information, so that during the upgrade process, the storage space for storing the first firmware in the terminal device can be fully utilized.
[0027] Additional aspects and advantages of the present application will be given in part in the following description, which will become apparent from the following description, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.
[0029] Figure 1 A flowchart of a software upgrade method provided in an embodiment of the present application;
[0030] Figure 2 A schematic diagram of a storage location of a newly added free storage space provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of the same data provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of another embodiment of the present application providing the same data;
[0033] Figure 5 A schematic diagram of two adjacent first storage spaces including a second storage space provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of a target storage space provided in an embodiment of the present application;
[0035] Figure 7A schematic diagram of a first firmware and a second firmware provided in an embodiment of the present application;
[0036] Figure 8 A schematic diagram of a firmware storage space after similar data is moved and stored according to an embodiment of the present application;
[0037] Figure 9 A schematic diagram of a firmware storage space after storing target data a2 in a target storage space according to an embodiment of the present application;
[0038] Figure 10 A schematic diagram of a firmware storage space after storing target data a3 in a target storage space according to an embodiment of the present application;
[0039] Figure 11 A schematic diagram of a storage space corresponding to the pre-restoration sub-data c1 provided in an embodiment of the present application;
[0040] Figure 12 A schematic diagram of a storage space corresponding to the restored sub-data c1 provided in an embodiment of the present application;
[0041] Figure 13 A schematic diagram of the storage space corresponding to the pre-restoration sub-data c2 provided in an embodiment of the present application;
[0042] Figure 14 A schematic diagram of the storage space corresponding to the restored sub-data c2 provided in an embodiment of the present application;
[0043] Figure 15 A schematic diagram of the storage space corresponding to the pre-restoration sub-data c3 provided in an embodiment of the present application;
[0044] Figure 16 A schematic diagram of the storage space corresponding to the restored sub-data c3 provided in an embodiment of the present application;
[0045] Figure 17 A schematic diagram of the structure of a software upgrade device 20 provided in an embodiment of the present application;
[0046] Figure 18 This is a structural diagram of an electronic device 4000 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following describes in detail embodiments of the present application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application and are not to be construed as limiting the present invention.
[0048] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0049] In the prior art, taking the network environment operation of embedded devices as an example, due to reasons such as program fault repair and performance improvement, the device needs to be remotely upgraded, such as OTA (over the air) upgrade. Generally, online firmware updates of embedded devices are implemented in a WIFI network to provide users with a service version with a better experience. The general implementation process of the differential upgrade solution is: the target version of the firmware (new firmware) of the software to be upgraded is divided into multiple sub-data. For each sub-data, similar data corresponding to the sub-data is found in the current version of the firmware (old firmware). If similar data is found, the similar data in the current version of the firmware is subtracted from the corresponding sub-data. The difference value is mostly 0, which can make the data volume of the obtained differential packet very small. In the process of differential upgrade based on differential packets, the upgrade is performed in the order of parsing the differential data to obtain the differential data. For the differential data parsed first, if the similar data corresponding to the differential data is smaller than the differential data parsed later, the upgrade is performed. After the corresponding similar data is obtained, for any differential data, after the target data a is obtained by upgrading based on the differential data and its corresponding similar data, the similar data corresponding to the differential data is deleted to obtain a free storage space. If the free storage space is located before at least one storage space that has obtained the target data, in order to ensure that the order of the storage spaces of the obtained target data matches the order of the obtained target data, the free storage space cannot be used to store the obtained target data a. Therefore, when the storage space of the old firmware in the terminal device is limited, it is not conducive to the recycling of the storage space of the old firmware in the terminal device.
[0050] This application addresses the problem in the prior art whereby corresponding storage resources in the device to be upgraded are reused during a differential upgrade, which is detrimental to the recycling of storage resources in the device to be upgraded. This application proposes a software upgrade method to recycle existing storage resources in the device to be upgraded. This application is applicable to any scenario where the current version of software needs to be upgraded to a target version of software, and is applicable to any differential upgrade method.
[0051] Based on the application scenarios described above, the solutions provided in the embodiments of the present application can be executed by any electronic device, which can be a user terminal (hereinafter referred to as a terminal device) or a server. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed system. User terminals can include at least one of the following: a smartphone, a tablet computer, a laptop computer, a desktop computer, a smart TV, or a smart car device.
[0052] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0053] An embodiment of the present application provides a software upgrade method for upgrading a current version of software to a target version of software. For the current version of software, the storage space of a user terminal on which the software is installed includes a first storage area and a second storage area, wherein the first storage area is used to store a differential packet used to upgrade the current version of software to the target version of software, and the second storage area is used to store firmware corresponding to the current version of software.
[0054] The following combination Figure 1 A software upgrade method is shown to illustrate the present application solution. Figure 1 The flowchart of a software upgrade method provided by an embodiment of the present application is shown. The method can be executed by an electronic device, wherein the electronic device can be a terminal device or a server. Figure 1 As shown in , the method may include the following steps:
[0055] Step S110: In response to an upgrade request for the target software, a differential package corresponding to the target software is obtained. The differential package includes upgrade control information and differential data corresponding to a plurality of target sub-data. The target sub-data refers to data in the second firmware that has similar data in the first firmware. The second firmware and the first firmware are the target version and the current version of the target software, respectively. The upgrade control information includes position indication information and translation control information. The position indication information is used to determine the storage space in the terminal device for similar data corresponding to each differential data and the storage space in the terminal device for each mobile similar data. The translation control information is used to determine the mobile storage space in the terminal device corresponding to each mobile similar data. The mobile similar data is the similar data that needs to be moved among the similar data corresponding to each differential data. The mobile storage space refers to the free storage space in the firmware storage space storing the first firmware in the terminal device. The data in the first firmware, other than similar data, is non-similar data. Therefore, the mobile storage space can be the storage space corresponding to the non-similar data in the firmware storage space.
[0056] If the method is performed by a user terminal, then, in response to an upgrade request for the target software, obtaining a differential package corresponding to the target software may include the following steps: sending an upgrade request for the target software to a server, the upgrade request including identification information of the target software, and receiving a differential package sent by the server based on the identification information. If the method is performed by a server, then, in response to an upgrade request for the target software, obtaining a differential package corresponding to the target software may include the following steps: receiving an upgrade request for the target software sent by a user terminal, the upgrade request including identification information of the target software, determining a differential package corresponding to the identification information based on the identification information, and sending the differential package to the user terminal.
[0057] It is understandable that before the server sends the differential packet to the user terminal, it usually encodes the differential packet first, and then sends the encoded differential packet to the user terminal. When the user terminal receives the encoded differential packet, it first decodes it to obtain the differential packet, and then performs subsequent processing on the differential packet.
[0058] Among them, the above-mentioned target software refers to the operating system or application that needs to be upgraded. If the target software is an application, the application can be any one of the applications installed by the user terminal. When a certain application needs to be upgraded, an upgrade response can be generated based on the user's consent to the upgrade inquiry request of the target software. The upgrade inquiry request can be an upgrade inquiry request sent by the server to the user terminal that has installed the certain application according to the set rules. For example, it can be an upgrade inquiry request sent by the server to the user terminal according to the upgrade cycle. Based on this request, an option of whether to upgrade can be displayed on the client interface of the user terminal. The option includes an option to agree to the upgrade and an option to disagree to the upgrade. If the user chooses the option to agree to the upgrade, an upgrade request is generated and sent to the server; if the user chooses the option to disagree to the upgrade, no processing is performed.
[0059] The above-mentioned upgrade request includes the identification information of the target software. After receiving the upgrade request, the server will determine which software needs to be upgraded and the current version of the firmware of the target software based on the identification information, and generate a differential package based on the current version of the firmware of the target software and the target version of the firmware. Among them, the difference between the current version of the software and the target version of the software is called a differential package. After downloading the differential package on the server side, the target version of the software can be restored on the user terminal side based on the differential package. Among them, the target version is the version to which the current version is to be upgraded. For example, if the current version is version 2.0 and the target version is version 3.0, it means that based on the upgrade request, the target software is to be upgraded from version 2.0 to version 3.0. The differential package generated based on the current version of the firmware and the target version of the firmware is only used to upgrade the target software from the current version to the target version.
[0060] The identification information of the target software is used to identify the identity of the software. For example, the identification information may include the version identification of the target software's firmware. Based on the version identification, the current version of the target software, i.e., the version of the target software currently installed on the user terminal, can be determined. A server may correspond to multiple software programs. The identification information may also include the software identification of the target software. Based on the software identification, the server can determine which software among the multiple software programs corresponding to the server the target software corresponds to. The identification information may be represented by at least one of text, characters, and numbers. The specific form of the identification information is not limited in this application.
[0061] The above-mentioned location indication information includes information for indicating the storage space of similar data of each differential data in the server and information for indicating the storage location of the first firmware in the server. The base location indication information can be represented by a storage address. How to determine the storage space of similar data corresponding to the differential data in the terminal device based on the location indication information will be described in detail below and will not be repeated here.
[0062] Step S120: Parse the differential packet to obtain multiple differential data and upgrade control information. When parsing the differential packet, all differential data can be parsed at once, or one or more differential data can be parsed first. The number of differential data that can be parsed at one time is not limited in this application solution.
[0063] Step S130: completing the upgrade of the target software based on the plurality of differential data and the upgrade control information.
[0064] For each differential data, the data of the first firmware in the terminal device may be processed based on the upgrade control information, so that the obtained target data can fully utilize the firmware storage space storing the first firmware in the terminal device.
[0065] The above step S130 may specifically include: performing the following operations on each differential data in turn according to the order in which the differential data are obtained through analysis: Step S1301, obtaining target data corresponding to the differential data based on the differential data and similar data corresponding to the differential data.
[0066] Since each differential data has a one-to-one correspondence with its corresponding similar data, the similar data corresponding to each differential data can be deleted after the differential data is upgraded to free up more storage resources to store the target data. In the process of differential restoration of each differential data, the restoration process is performed sequentially in the order in which the differential data are parsed. For each differential data obtained by parsing, considering that the similar data in the first storage space corresponding to the differential data may have been removed, the following situations may be specifically included when restoring the differential data to obtain the target data:
[0067] In the first case, if the first storage space corresponding to the differential data includes all similar data to the differential data, the target data corresponding to the differential data is obtained based on the differential data and the similar data in the first storage space. If the first storage space corresponding to the differential data includes all similar data to the differential data, it means that the similar data in the first storage space corresponding to the differential data is not mobile similar data and does not need to be moved. In this case, the target data corresponding to the differential data can be directly obtained based on the differential data and the similar data in the first storage space corresponding to the differential data. In this case, deleting the similar data corresponding to the differential data specifically means deleting the data in the first storage space.
[0068] In the second case, if the first storage space corresponding to the differential data includes some similar data of the differential data, then the some similar data corresponding to the differential data is obtained from the target mobile storage space corresponding to the differential data, and the target data corresponding to the differential data is obtained based on the differential data, the data obtained from the target mobile storage space, and the data in the first storage space other than the some similar data corresponding to the differential data. If the first storage space corresponding to the differential data includes some similar data of the differential data, it means that the first storage space corresponding to the differential data only contains some similar data of the differential data, and another part of the similar data corresponding to the differential data has been moved to the target mobile storage space corresponding to the differential data. Then, based on the differential data, the removed similar data obtained from the target mobile storage space, and the remaining similar data in the first storage space, the similar data corresponding to the differential data can be obtained. In this case, deleting the similar data corresponding to the differential data specifically means deleting the data in the first storage space and the data in the target mobile storage space.
[0069] In the third case, if the first storage space corresponding to the differential data does not include similar data corresponding to the differential data, the similar data corresponding to the differential data is obtained from the target mobile storage space corresponding to the differential data, and the target data corresponding to the differential data is obtained based on the differential data and the data obtained from the target mobile storage space. If the first storage space corresponding to the differential data does not include similar data corresponding to the differential data, it means that the similar data in the first storage space corresponding to the differential data has been moved to the target mobile storage space. Based on the differential data and the similar data in the target mobile storage space, the target data corresponding to the differential data can be obtained. In this case, deleting the similar data corresponding to the differential data specifically means deleting the data in the target mobile storage space.
[0070] Step S1302, determine whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space, and based on the judgment result, store the target data in the target storage space, or store the mobile similar data corresponding to the differential data in the target mobile storage space in the firmware storage space determined by using the translation control information, wherein the firmware storage space is the space in the terminal device used to store the current version of the firmware.
[0071] The target storage space corresponding to the target data includes two situations: one is that mobile similar data exists, and the other is that it does not. If mobile similar data exists in the target storage space, if the target data is to be stored in the target storage space, the target mobile storage space in the firmware storage space corresponding to the mobile similar data of the differential data can be determined based on the translation control information, and the mobile similar data can be stored in the target mobile storage space to release the target storage space for storing the target data. If mobile similar data does not exist in the target storage space corresponding to the target data in the firmware storage space, the target data is stored in the target storage space.
[0072] The above-mentioned judgment of whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space includes: determining the first storage space in the firmware storage space of the similar data corresponding to each differential data, and the second storage space in the terminal device of each mobile similar data according to the above-mentioned position indication information; for each differential data, if the first storage space corresponding to the differential data includes the second storage space, it is determined that there is mobile similar data in the target storage space; if the first storage space corresponding to the differential data does not include the second storage space, it is determined that there is no mobile similar data in the target storage space.
[0073] Among them, for each differential data, after differential restoration is performed on the differential data to obtain the target data, the target data corresponding to the differential data needs to be stored in the target storage space of the firmware storage area of the first firmware in the order in which the target data is obtained. If there is data stored in the target storage space corresponding to the target data, the data can be called moved similar data, that is, similar data that needs to be moved so as to release the target storage space to store the target data corresponding to the differential data.
[0074] For each differential data, the data stored in the second storage space corresponding to the differential data is the moving similar data. The moving similar data can be part or all of the similar data corresponding to the differential data. As an example, for a differential data A, there is an empty storage space at the front of the target storage space of the target data corresponding to the differential data A, and the back of the target storage space corresponds to a portion of the similar data corresponding to the differential data. In this case, the partial data is the moving similar data corresponding to the differential data A.
[0075] It should be noted that, on the server side, the server can determine the size of the space occupied by each target sub-data. For each target sub-data, the size of the space occupied by the target sub-data is the size of the target storage space corresponding to the target sub-data. The target sub-data is the target data obtained after the differential data corresponding to the target sub-data is restored. Based on the size of the space occupied by each target sub-data, the size of the target storage space of the target data corresponding to each differential data is determined. Based on the similar data corresponding to each target sub-data and the target storage space, the mobile similar data corresponding to each target sub-data can be determined, that is, which data in the similar data corresponding to each target sub-data is the similar data that needs to be moved. After the move, the target storage space can store the corresponding target data. Among them, there is a storage space for storing the first firmware in the server, and there is also a storage space for storing the first firmware in the terminal device. The above-mentioned firmware storage space refers to the storage space for storing the first firmware in the terminal device, such as the second storage area described above.
[0076] In which, the above-mentioned position indication information may include the first starting storage address of the first firmware in the server, and the first correspondence between each differential data and the first indication information of the corresponding similar data. The first indication information is the first storage position information of the similar data corresponding to each differential data in the server relative to the first starting storage address. Taking the similar data corresponding to a differential data as an example, based on the first storage position information corresponding to the similar data, the storage position of the similar data relative to the first starting storage address in the server can be determined. Since whether it is the first firmware stored in the server or the first firmware stored in the terminal device, the storage position of the similar data relative to the starting storage address of the first firmware is the same, that is, the position offset of the similar data relative to the first starting storage address is the same as the position offset of the similar data relative to the second starting storage address (the starting storage address of the first firmware in the terminal device). In order to determine the first storage space in the firmware storage space of the terminal device of the similar data corresponding to each parsed differential data, the first indication information of the similar data corresponding to each differential data can be determined based on the first corresponding relationship, and the second starting storage address of the firmware storage space can be determined; based on each first indication information, the storage position of the similar data corresponding to each differential data in the server relative to the first starting storage address can be determined. Since in the server and the terminal device, for the same similar data, the storage position of the similar data relative to the first starting storage address and the storage position relative to the second starting storage address are the same, therefore, for each differential data, based on the first indication information and the second starting storage address of the similar data corresponding to the differential data, the storage position of the similar data corresponding to the differential data in the terminal device can be determined, that is, the first storage space of the similar data corresponding to the differential data in the firmware storage space, and the storage space corresponding to one storage position is the corresponding first storage space.
[0077] The first starting storage address of the first firmware is the starting storage address corresponding to the first firmware data stored in the server's storage space. The second starting storage address of the first firmware is the starting storage address corresponding to the first firmware data stored in the terminal device's storage space (the user terminal on which the first firmware to be upgraded is installed). Typically, the first and second starting storage addresses are different. A storage address is an identifier for storing data in the device's storage space, not the data itself. The data stored in that storage space can be found using the storage address.
[0078] As an example, the first starting storage address indicates that data stored starting from the 5kth (k is a data storage unit, kilobyte) data in the server's storage space is the first firmware data, and the second starting storage address indicates that data stored starting from the 8kth data in the terminal device's storage space is the first firmware data. Suppose the first firmware has 20k data, and a similar data item in the first firmware is stored between the 5kth and 8kth data items. The storage location of this similar data, relative to the first starting storage address, is the storage location corresponding to data items 10kth to 13kth in the server's storage space, and the storage location of this similar data, relative to the second starting storage address, is the storage location corresponding to data items 13kth to 16kth in the terminal device's storage space. Regardless of whether the data item is stored in the server or the terminal device, this similar data item corresponds to data items 5kth to 8kth in the first firmware's storage space. The first storage space corresponding to this similar data item is the storage space corresponding to data items 13kth to 16kth in the terminal device's storage space (firmware storage space).
[0079] It should be noted that the upgrade control information also includes a first identifier corresponding to each first data, which is used to identify the first data. The upgrade control information also includes a second identifier corresponding to each similar data corresponding to each differential data, which is used to identify the similar data.
[0080] In an optional solution of the present application, the number of bytes of data is represented by the data length. For each similar data, the first indication information includes the first address offset of the similar data corresponding to the differential data relative to the first starting storage address and the first data length of the similar data corresponding to the differential data. For each differential data, the above-mentioned determination of the first storage space in the firmware storage space of the similar data corresponding to the differential data based on the first storage position information and the second starting storage address corresponding to the differential data includes: determining the third starting storage address in the firmware storage space of the similar data corresponding to the differential data based on the first address offset and the second starting storage address corresponding to the differential data; and determining the first storage space in the firmware storage space of the similar data corresponding to the differential data based on the third starting storage address and the first data length.
[0081] Among them, for the first address offset of a similar data, the first address offset represents the address offset of the similar data in the server relative to the first starting storage address. Optionally, the address offset can be represented by the amount of data. Since the address offset corresponding to the same similar data is the same whether in the server or in the terminal device, the starting storage address (third starting storage address) corresponding to the similar data in the terminal device can be determined based on the first address offset and the second starting storage address, and then the first storage space corresponding to the similar data in the terminal device can be determined based on the third starting storage address and the first data length. For each similar data, based on the first indication information corresponding to the similar data, the first storage space corresponding to the similar data can be determined in the firmware storage space, that is, which part of the storage space corresponding to the first firmware the similar data occupies.
[0082] Similarly, regardless of whether the first firmware is stored in the server or the terminal device, for each mobile-similar data, the storage location of the mobile-similar data relative to the starting storage address of the first firmware is the same, that is, the position offset of the mobile-similar data relative to the first starting storage address is the same as the position offset of the mobile-similar data relative to the second starting storage address (the starting storage address of the first firmware in the terminal device). The above-mentioned position indication information also includes a second correspondence between each differential data and its corresponding second indication information, wherein the above-mentioned second indication information is the second storage location information of each mobile-similar data relative to the first starting storage address in the server; and determining the second storage space of each mobile-similar data in the terminal device based on the position indication information includes: determining the second indication information corresponding to each differential data according to the second correspondence; and determining the second storage space of each mobile-similar data based on each second storage location information and the second starting storage address.
[0083] In an optional solution of the present application, the number of bytes of data is represented by the data length. For each mobile similar data, the second indication information includes the second address offset of the mobile similar data corresponding to the differential data relative to the first starting storage address and the second data length of the mobile similar data corresponding to the differential data. For each differential data, the above-mentioned second storage space of each mobile similar data is determined based on each second storage position information and the second starting storage address, including: determining the fourth starting storage address corresponding to the mobile similar data corresponding to the differential data in the firmware storage space based on the second address offset and the second starting storage address corresponding to the differential data; and determining the second storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the fourth starting storage address and the second data length.
[0084] Among them, for the second address offset of a mobile similar data, the second address offset represents the address offset of the mobile similar data in the server relative to the first starting storage address. Optionally, the address offset can be represented by the amount of data. Since the address offset corresponding to the same mobile similar data is the same whether in the server or in the terminal device, the starting storage address (fourth starting storage address) corresponding to the mobile similar data in the terminal device can be determined based on the second address offset and the second starting storage address, and then the second storage space corresponding to the mobile similar data in the terminal device can be determined based on the fourth starting storage address and the second data length. For each mobile similar data, based on the second indication information corresponding to the mobile similar data, the second storage space corresponding to the mobile similar data can be determined in the firmware storage space, that is, which part of the storage space corresponding to the first firmware the mobile similar data occupies.
[0085] In an optional solution of the present application, each target sub-data can be determined according to the maximum data volume. For example, starting from the data starting position of the second firmware, the first firmware is traversed to determine similar data with the maximum data volume in the first firmware. The data in the second firmware corresponding to the similar data is the first target sub-data; in the same way, each target sub-data in the second firmware and the similar data of each target sub-data are determined. The data volume of each target sub-data may be different.
[0086] In an optional solution of the present application, the above-mentioned translation control information includes a third correspondence between each mobile similar data and its corresponding third indication information, wherein the above-mentioned third indication information is third storage position information of the mobile storage space of each mobile similar data in the server relative to the first starting storage address. Since, whether it is the first firmware stored in the server or the first firmware stored in the terminal device, for the mobile storage space corresponding to each mobile similar data, the storage position of the mobile storage space relative to the starting storage address of the first firmware is the same, that is, the position offset of the mobile storage space relative to the first starting storage address is the same as the position offset of the mobile storage space relative to the second starting storage address (the starting storage address of the first firmware in the terminal device). For each differential data, the above-mentioned determination of the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the translation control information includes: determining the third indication information of the mobile similar data corresponding to the differential data based on the third correspondence; and determining the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the third storage position information and the second starting storage address.
[0087] Since the order in which the differential data in the differential package is stored determines the order in which it will be used during the upgrade, the target data corresponding to each differential data is also stored in the order of the differential data. The mobile storage space corresponding to each mobile similar data can be determined in advance on the server side. Specifically, the mobile storage space for each mobile similar data in the non-similar data space in the firmware storage space can be determined based on the size of the storage space occupied by each mobile similar data. Since each differential data has a one-to-one correspondence with its corresponding similar data, the similar data corresponding to each differential data can be deleted after the differential data is upgraded. This allows the storage resources in the firmware storage space to be continuously released during the upgrade process, serving as mobile storage space for storing mobile similar data.
[0088] As an example, Figure 2 As shown in the schematic diagram of mobile similar data storage, the similar data corresponding to the differential data D1 is S1, the similar data corresponding to the differential data D2 is S2, and the similar data corresponding to the differential data D3 is S3. In the first firmware, the storage locations corresponding to S1, S2 and S3 are as follows: Figure 2 As shown, the storage position of S3 is before the storage position of S1, and the storage position of S1 is before the storage position of S2. When D1 is restored, the restoration is performed based on D1 and S1 to obtain the target data a1. The target storage space corresponding to a1 is the storage space corresponding to S3. At this time, S3 is the mobile similar data corresponding to D1, and the target mobile storage space corresponding to S3 is K2. The data in K2 is upgraded and unused data. The data in K2 is deleted, S3 is moved to the storage space corresponding to K2, and the target data a1 is stored in the storage space corresponding to S3.
[0089] It is understood that the mobile storage space can be at least two discontinuous storage spaces. If one storage space in the mobile storage space cannot store the next mobile similar data, the mobile similar data can be divided and stored in at least two storage spaces in the mobile storage space. Then, when the mobile similar data is transferred, the transfer can also be performed according to the order of the data in the mobile similar data, so that the order of the data in the mobile similar data after the transfer matches the order of the data in the mobile similar data before the transfer.
[0090] Through the solution of the present application, when the target software needs to be upgraded, that is, in response to an upgrade request, the corresponding differential package is obtained. In the process of upgrading based on multiple differential data in the differential package, for each differential data obtained by parsing, the data of the first firmware in the terminal device is moved and stored based on the differential data and the upgrade control information, so that during the upgrade process, the storage space for storing the first firmware in the terminal device can be fully utilized.
[0091] In an optional solution of the present application, the location indication information further includes fourth indication information of each first data, the first data being identical data in similar data corresponding to the two target sub-data, and the fourth indication information of one first data being fourth storage location information of the first data relative to the first starting storage address in the server, and the method further includes: for each first data, determining a third storage space of the first data in the firmware storage space according to the fourth storage location information and the second starting storage address of the first data;
[0092] For each differential data, the above-mentioned target data corresponding to the differential data is obtained based on the differential data and the similar data corresponding to the differential data, including: if the first storage space corresponding to the differential data includes a third storage space, and there is first data in the third storage space, the first data is stored in a designated storage space; based on the differential data and the similar data corresponding to the differential data, the target data corresponding to the differential data is obtained; if the first storage space corresponding to the differential data includes a third storage space, and there is no data in the third storage space, the first data corresponding to the first storage space is obtained from the designated storage space, and the target data corresponding to the differential data is obtained based on the differential data, the data in the first storage space, and the first data.
[0093] For each piece of differential data obtained through analysis, if the first storage space corresponding to the differential data includes the third storage space, this indicates that the similar data corresponding to the differential data contains identical data (first data). The identical data is the first data corresponding to the at least one fourth indication information, i.e., the data stored in the third storage space corresponding to the at least one fourth indication information. The designated storage space may be a storage space in the device to be upgraded, such as at least one of the first storage area or the second storage area, and the size of the designated storage space must be no less than the size of the space occupied by the first data.
[0094] Among them, there are two specific situations in which the similar data corresponding to at least two target sub-data in the second firmware contain the same data. In the first situation, the similar data corresponding to at least two target sub-data are the same similar data, and the same data corresponding to the at least two target sub-data is the same similar data. In the second situation, the same data contained in the similar data corresponding to at least two target sub-data is the overlapping data between the similar data corresponding to the at least two sub-data, and the same data corresponding to the at least two target sub-data is the overlapping data. As an example, Figure 3The schematic diagram of the same data shown is illustrated by taking the target sub-data 1 and target sub-data 2 in the second firmware as an example. The similar data corresponding to the target sub-data 1 in the first firmware is D1, and the similar data corresponding to the target sub-data 2 in the first firmware is also D1. Therefore, the same data contained in the similar data corresponding to the target sub-data 1 and the similar data corresponding to the target sub-data 2 is D1. Figure 4 Another schematic diagram of the same data is shown. The target sub-data 1 corresponds to similar data D2 in the first firmware. The target sub-data 2 corresponds to similar data D3 in the first firmware. There is overlapping data D4 between D2 and D3 ( Figure 3 ), D4 is the same data contained in the similar data corresponding to the target sub-data 1 and the similar data corresponding to the target sub-data 2.
[0095] It should be noted that the order in which the data in the differential package is stored is the order in which it is used during the upgrade. A first data corresponds to at least two differential data. At this time, on the one hand, if a differential data is the differential data obtained by first parsing among the at least two differential data (for the convenience of description, the differential data will be referred to as differential data a below), it means that when upgrading based on differential data a, the first data is used for the first time. The first data is the data stored in the first storage space corresponding to differential data a. Before using the first data for upgrading, the first data can be saved to a designated storage space, which can also be understood as backing up the first data. Then, the upgrade process is performed based on differential data a and the data in the first storage space corresponding to differential data a (similar data corresponding to the differential data) to obtain the target data corresponding to differential data a, wherein the target data is part of the data in the second firmware of the target version. At this time, since the data in the first storage space has been used and the first data has been stored in another designated storage space, the data in the first storage space will not be used again. The data in the first storage space can be deleted to release the first storage space so that the first storage space can be recycled.
[0096] On the other hand, if the differential data is the differential data obtained after parsing the at least two differential data (for ease of description, this differential data will be referred to as differential data b below), this indicates that when upgrading based on differential data b, the first data is not being used for the first time, and the data (including the first data) in the first storage space corresponding to differential data a has already been used and deleted. Therefore, when the first data needs to be used again, the first data can be retrieved from the designated storage space. Then, based on the first data, the remaining data (similar data) in the first storage space, and differential data b, the upgrade process can be performed to obtain the target data corresponding to differential data b. After obtaining the target data, the similar data in the first storage space corresponding to differential data b can also be deleted to free up the first storage space corresponding to differential data b. For the first data existing between similar data corresponding to two differential data, if the designated storage space only stores one first data at a time, after the first data is saved in the designated storage space, after the data obtained from the designated storage space is used for upgrading, the data in the designated storage space will not be used again. After the target data corresponding to the differential data is obtained based on the data obtained from the designated storage space, the data in the designated storage space can be deleted, which can further release storage resources.
[0097] Based on the above process, used similar data can be deleted during the upgrade, continuously freeing up storage resources. Furthermore, since similar data and differential data have a one-to-one correspondence, even if similar data is deleted during the upgrade, there is no need to worry about some of the identical data being deleted before it is fully used, thus affecting the upgrade. In this way, if two similar data contain identical data, the upgrade can be continued while deleting the similar data to obtain newly free storage space, and the target data can be stored in the newly free storage space, thereby fully utilizing the storage space of the first firmware in the terminal device.
[0098] In an optional solution of the present application, the number of bytes of data can be represented by the data length. For each first data item, the fourth indication information of the first data item includes the fourth address offset of the first data item relative to the first starting storage address and the fourth data length. The fourth data length indicates the number of bytes of the first data item, and the data length of each first data item may be different. For each first data item, the fourth storage location information includes the fourth address offset and the fourth data length of the first data item. Similar to the principle of moving the third storage location information of similar data, whether the first firmware item is stored in the server or the first firmware item is stored in the terminal device, the storage location of the first data item relative to the starting storage address of the first firmware item is the same, that is, the position offset of the first data item relative to the first starting storage address is the same as the position offset of the first data item relative to the second starting storage address. For each first data item, the third storage space of the first data item in the firmware storage space is determined based on the fourth storage location information and the second starting storage address of the first data item, including: determining the fifth starting storage address corresponding to the first data item in the firmware storage space based on the fourth address offset and the second starting storage address of the first data item, and determining the third storage space of the first data item in the firmware storage space based on the fifth starting storage address and the fourth data length.
[0099] Among them, for a fourth address offset of a first data, the fourth address offset represents the address offset of the first data relative to the first starting storage address in the server. Optionally, the address offset can be represented by the amount of data. Since the address offset corresponding to the same first data is the same in both the server and the terminal device, based on the fourth address offset and the second starting storage address of the first data, the starting storage address (fifth starting storage address) corresponding to the first data in the terminal device can be determined. Then, based on the fifth starting storage address and the fourth data length, the third storage space corresponding to the first data in the firmware storage space can be determined.
[0100] In the optional scheme of the present application, the specific implementation method of the server generating a differential package based on the current version of the firmware and the target version of the firmware is as follows: based on the identification information, determine the first firmware and the second firmware of the target software; based on the first firmware and the second firmware, determine multiple target sub-data in the second firmware, and similar data corresponding to each target sub-data; determine the differential data between each target sub-data and the corresponding similar data, generate first indication information for each similar data, and establish a first corresponding relationship between each differential data and the first indication information of the corresponding similar data; determine the size of the space occupied by each target sub-data, and based on the size of the space occupied by each target sub-data and the similar data corresponding to each target sub-data, determine the mobile similar data corresponding to each target sub-data; determine the second indication information for each mobile similar data , and establish a second correspondence between each differential data and its corresponding second indication information; determine the mobile storage space corresponding to each mobile similar data in the server, generate third indication information corresponding to each mobile similar data, and establish a third correspondence between each mobile similar data and its corresponding third indication information; for each target sub-data, if the similar data corresponding to at least two target sub-data contain the same data, then the same data is used as the first data corresponding to at least two target sub-data, and generate fourth indication information corresponding to the first data; obtain the first starting storage address of the first firmware in the server, and generate upgrade control information based on the first correspondence, the second correspondence, the third correspondence, the fourth indication information and the first starting storage address; generate a differential package based on the upgrade control information and each differential data.
[0101] Among them, the differential package refers to the information required to upgrade the current version of the target software to the target version. The differential package contains upgrade control information and differential data; during the upgrade, the differential data and the data of the first firmware stored on the device to be upgraded can be controlled based on the upgrade control information to restore the data of the second firmware of the target version. It should be noted that the server can make adjustments based on actual needs in the above process of generating the differential package. For example, the upgrade control information of the differential package may not include the fourth indication information. The above identification information can also include the version identification of the target version, that is, the user can choose which version to upgrade to, and the user can also not choose the version identification of the target version, then the terminal device can default to upgrading to the latest version.
[0102] The data in the first firmware and the data in the second firmware are usually binary numbers, and the similarity of the data in the second firmware to the data in the first firmware can be determined based on the similarity between the binary numbers corresponding to the data in the second firmware and the binary numbers corresponding to the data in the first firmware.
[0103] If the second firmware contains only the target sub-data and only newly added data, then the data at the starting storage location in the second firmware can be started, and the first firmware can be traversed to determine a segment of data with similar data in the second firmware, and the segment of data can be used as the target sub-data. The data after the target sub-data storage location is the newly added data, that is, the data with no similar data in the first firmware. In the same way, multiple target sub-data in the second firmware can be determined.
[0104] Optionally, if the first firmware contains additional data (also called newly added data) compared to the second firmware, the differential packet also includes the additional data. This differential data refers to information that differs between the current version of the firmware and the target version of the firmware. For example, if information a in the current version of the firmware corresponds to information b in the target version of the firmware, the differential data is the difference between information b and information a. During an upgrade, this additional data can be inserted into the current version of the firmware as information in the target version of the firmware (the new firmware).
[0105] If the differential package also includes newly added data; for each newly added data, based on the newly added data, the target data corresponding to the newly added data is obtained (to distinguish it from the above-mentioned target data, the target data is hereinafter referred to as the second target data); if there is mobile similar data in the target storage space corresponding to the second target data in the firmware storage space, based on the translation control information, the target mobile storage space in the firmware storage space for the mobile similar data corresponding to the newly added data is determined, and the mobile similar data is stored in the target mobile storage space, and the second target data is stored in the target storage space; if there is no mobile similar data in the target storage space corresponding to the second target data in the firmware storage space, the second target data is stored in the target storage space. Similarly, on the server side, the server side will pre-determine the mobile storage space for each mobile similar data.
[0106] Optionally, for each target sub-data, the above-mentioned determination of the differential data between each target sub-data and the corresponding similar data can be achieved in the following manner: performing a subtraction operation on the target sub-data and the similar data corresponding to the target sub-data, and using the operation result as the differential data corresponding to the target sub-data. Each target sub-data corresponds to one similar data, and there is a one-to-one correspondence between one target sub-data, the similar data corresponding to the target sub-data, the differential data corresponding to the target sub-data, and the first storage space corresponding to the similar data in the terminal device. After determining the differential data corresponding to each target sub-data, a first corresponding relationship can be established between each differential data and the first indication information of the corresponding similar data. When one differential data is known, the first indication information of the similar data corresponding to the differential data in the first firmware can be determined based on the first corresponding relationship.
[0107] It should be noted that the above scheme is a scheme for explaining the existence of first data between similar data corresponding to two differential data. For three adjacent differential data, the number of first storage spaces corresponding to the similar data corresponding to each of the three differential data is three. If one of the first storage spaces contains two third storage spaces, it means that the similar data corresponding to the first storage space contains two first data. In this case, when upgrading the differential data corresponding to the first storage space containing the two third storage spaces (hereinafter referred to as differential data D2 for convenience of description), it is necessary to consider whether there is first data in the two third storage spaces. When restoring the differential data corresponding to the storage space, if the first data (hereinafter referred to as data a for ease of description) in the third storage space with a forward storage position has already been saved to the designated storage space, then when upgrading the differential data corresponding to the first storage space with a middle storage position, since the first data (hereinafter referred to as data b for ease of description) in the third storage space with a backward storage position is being used for the first time, data b can be saved to the designated storage space. During the upgrade, data a can be retrieved from the designated storage space, and an upgrade is performed based on the retrieved data a and similar data in the first storage space corresponding to differential data D2, resulting in target data corresponding to differential data D2. When restoring the differential data corresponding to the first storage space with a backward storage position (hereinafter referred to as differential data D3 for ease of description), an upgrade is performed based on the retrieved data b in the designated storage space, similar data in the first storage space, and differential data D3, resulting in target data corresponding to differential data D3.
[0108] As an example, see Figure 5 As shown in the differential data upgrade schematic diagram, the similar data corresponding to the differential data D1 is S1, the similar data corresponding to the differential data D2 is S2, and the similar data corresponding to the differential data D3 is S3. There is first data a between the similar data S1 and the similar data S2, and there is first data b between the similar data S2 and the similar data. When the differential data D1 is upgraded, the first data a is saved to a designated storage space, and the upgrade is performed based on the differential data D1 and the similar data S1 to obtain the target data corresponding to the differential data D1, and the similar data S1 is deleted. When the differential data D2 is upgraded, the first data b is saved to a designated storage space, and the first data a is obtained from the designated storage space. Based on the first data a, the data in the differential data D2 and the similar data S2 except the first data a are upgraded to obtain the target data corresponding to the differential data D2. When the differential data D3 is upgraded, the first data b is obtained from the designated storage space, and the upgrade is performed based on the first data b, the differential data D3, and the data in the similar data S3 except the first data b to obtain the target data corresponding to the differential data D3.
[0109] As described above, the similar data corresponding to the two target sub-data can be the same similar data, and the first data can be the same similar data (the similar data corresponding to the differential data). In this case, the similar data is the data obtained from the designated storage space, and there is no data in the first storage space corresponding to the differential data. During an upgrade, the target data corresponding to the differential data can be obtained based on the data obtained from the designated storage space and the differential data. If the identical data contained in the similar data corresponding to the two target sub-data is overlapping data between the similar data corresponding to the two target sub-data, that is, the first data is part of the similar data corresponding to the differential data, during an upgrade, the target data corresponding to the differential data can be obtained based on the data in the first storage space, the data obtained from the designated storage space, and the differential data. In this case, the similar data corresponding to the differential data is the data in the first storage space and the data obtained from the designated storage space.
[0110] Optionally, the above-mentioned designated storage space can only store one first data at a time, and the designated storage space can also store multiple first data at a time. Then, when the designated storage space stores multiple first data at a time, in order to ensure that the first data corresponding to the differential data can be accurately found from the designated storage space, any of the following methods can be adopted: First, when the first data is saved in the designated storage space, the storage identifier corresponding to the first data is recorded. The storage identifier represents the storage position corresponding to the first data in the designated storage space. When the first data is needed, the corresponding first data can be found in the designated storage space based on the storage identifier. Second, when the first data is saved in the designated storage space, a corresponding relationship between the first data and the storage identifier of the storage space where the first data is located in the designated storage space is established. When the first data is needed, the first data can be obtained from the storage space where the first data is located in the designated storage space based on the corresponding relationship. It can be understood that the above two implementation methods are only one possible implementation method, and the present application solution does not limit the above two implementation methods.
[0111] In an optional solution of the present application, based on the first firmware and the second firmware, determining multiple target sub-data in the second firmware, and similar data corresponding to each target sub-data, can include: dividing the second firmware into several sub-data according to a set space size; based on the first firmware and each sub-data, determining the target sub-data in each sub-data, and similar data corresponding to each target sub-data.
[0112] To reduce the resources used for each restore, the second firmware can be divided into several sub-data according to a set space size when generating a differential package. Specifically, the second firmware is divided into multiple sub-data of equal size. For the second firmware, all data in it, except the target sub-data, is newly added data. If the second firmware does not contain newly added data, each sub-data is a target sub-data. If the second firmware does contain newly added data, a sub-data may contain both target sub-data and newly added data. After determining each target sub-data, similar data to each target sub-data can be determined from the first firmware.
[0113] In an optional scheme of the present application, for each differential data, if the first storage space corresponding to the differential data does not include a third storage space, the method further includes: obtaining the target data corresponding to the differential data based on the similar data in the first storage space corresponding to the differential data and the differential data, and deleting the similar data in the first storage space.
[0114] If the first storage space corresponding to the differential data does not include the third storage space, indicating that the similar data corresponding to the differential data does not contain the same data (the first data), the upgrade process can be performed directly based on the differential data and the data in the first storage space to obtain the target data corresponding to the differential data, and the data in the first storage space can be deleted. In this way, for any differential data in the differential package, regardless of whether the similar data corresponding to the differential data contains the same data, the similar data corresponding to the differential data can be deleted after the upgrade process is performed using the similar data corresponding to the differential data, further freeing up storage resources.
[0115] The solution provided by the embodiment of the present application is to obtain and store the corresponding differential package when the target software needs to be upgraded, that is, in response to the upgrade request. In the process of upgrading based on multiple differential data in the differential package, for each differential data obtained by parsing, if the third storage space corresponding to at least one of the first storage space identifiers contained in the upgrade control information is included in the first storage space, it indicates that the same data (first data) exists in the similar data corresponding to the differential data. At this time, if there is data in the third storage space, the data can be saved to the designated storage space first. At this time, there is a one-to-one correspondence between each differential data and the storage space where the corresponding similar data is located. Therefore, when upgrading based on the differential data and the similar data corresponding to the differential data, the target data of the differential data can be upgraded while the data in the storage space where the similar data is located can be deleted to release the storage space, so that the storage space can be recycled.
[0116] Since the solution of the present application is applicable to any differential upgrade algorithm, when upgrading the target software based on the differential package, any upgrade algorithm can be used for the upgrade. Upgrading refers to upgrading the current version of the firmware to the target version of the firmware. After the upgrade, a corresponding target version of the software can be obtained. Optionally, the solution of the present application can be upgraded using OTA (Over-the-Air Technology) upgrade technology. OTA technology refers to a technology in which a user terminal downloads an upgrade package (differential package) on a remote server via a wireless network and upgrades the operating system or application of the user terminal based on the differential package. In the solution of the present application, there are many ways to implement differential upgrades. The solution of the present application is applicable to any differential upgrade method, such as the bsdiff algorithm, the hdiffpatch algorithm, the xdelta3 algorithm, etc.
[0117] In the scheme of the present application, since the first firmware includes second data that is not required for the upgrade, in order to further save storage resources, the first data storage space for storing the first data can be determined from the fourth storage space corresponding to the second data. In the optional scheme of the present application, the server also performs the following operations: based on the first firmware and the second firmware, determine the fourth storage space for the second data in the first firmware, where the second data refers to the data contained in the first firmware that is not required for the upgrade; for each first data, determine the first data storage space of the first data in the fourth storage space based on the storage space size required for the first data, and based on the first data storage space, generate the fifth indication information corresponding to the first data, and establish a fourth correspondence between the fourth indication information corresponding to each first data and the fifth indication information. The above-mentioned upgrade control information also includes the fourth correspondence.
[0118] Since the second data is included in the first firmware and is not required for the upgrade, to conserve storage resources on the device being upgraded and further improve resource utilization, the first data storage space for storing the first data can be determined from the fourth storage space corresponding to the second data. For each piece of second data, the fifth indication information is used to indicate the storage location on the server of the storage space where the first data is stored.
[0119] Specifically, the first data storage space may be the entire storage space of the fourth storage space, or a portion of the storage space within the fourth storage space. The size of the first data storage space may be determined based on the storage space required to store the first data, i.e., the maximum size of the first data storage space must be no less than the storage space required to store the first data. If the fourth storage space corresponding to the second data in the server is a continuous storage space, then the first data storage space is a continuous storage space. If the fourth storage space corresponding to the second data in the server is a discontinuous storage space, then the first data storage space is a discontinuous storage space.
[0120] When the above-mentioned upgrade control information includes a third correspondence, the above-mentioned saving of the first data to the designated storage space includes: determining, according to the third correspondence, the fifth indication information corresponding to the fourth indication information corresponding to the first data; based on the fifth indication information and the second starting storage address, determining the fifth storage space corresponding to the second data corresponding to the fifth indication information in the firmware storage space, and using the fifth storage space as the designated storage space corresponding to the first data; deleting the data in the fifth storage space, and copying the first data to the fifth storage space.
[0121] Among them, for each differential data, after obtaining the first data corresponding to the first storage space from the designated storage space, and obtaining the target data corresponding to the differential data based on the differential data, the data in the first storage space and the first data, it also includes: deleting the data in the designated storage space corresponding to the first data.
[0122] Based on the above description, it can be known that the third corresponding relationship is the corresponding relationship between the fourth indication information and the fifth indication information corresponding to the first data. Based on the third corresponding relationship, the fifth indication information corresponding to the first data can be determined. Based on the fifth indication information and the second starting storage address, the fifth storage space corresponding to the first data is determined. Since the fifth storage space is the storage space corresponding to the second data in the firmware storage space, and the second data is data contained in the first firmware and is not required for the upgrade, the second data in the fifth storage space can be deleted, and the fifth storage space can be used as the first data storage space for storing the first data. In this way, the storage space corresponding to the second data in the first firmware in the firmware storage space can be fully utilized. At the same time, since the designated storage space is the storage space in the firmware storage space, the data in the designated storage space can also be deleted after the upgrade to release more storage space. The designated storage space after the data is deleted can also be used as the storage space for storing the target data.
[0123] As an example, see Figure 6 Schematic diagram of the first data storage space shown in; Figure 3 For example, in the second firmware, the similar data corresponding to target sub-data 1 and the similar data corresponding to target sub-data 2 contain the same data (first data) as D1. That is, the similar data corresponding to target sub-data 1 in the first firmware is D1, and the similar data corresponding to target sub-data 2 in the first firmware is also D1. The first firmware also includes second data K1, and the storage space corresponding to K1 on the server is the target storage space corresponding to D1. The third correspondence relationship includes the correspondence between the fourth indication information corresponding to D1 and the fifth indication information. In this example, when saving the first data to a designated storage space, the specific process is as follows: based on the third correspondence relationship, the fifth indication information corresponding to the fourth indication information corresponding to D1 is determined, and the second data K1 in the fifth storage space corresponding to the fifth indication information is deleted. At this point, the storage space corresponding to K1 is empty and does not store any data. D1 is then saved to the storage space corresponding to K1. At this point, two copies of D1 are stored. There is a one-to-one mapping between target sub-data 1 and the storage space corresponding to similar data D1 (the first storage space), and there is also a one-to-one mapping between target sub-data 2 and the storage space corresponding to similar data D1 (the storage space corresponding to K1).
[0124] In an optional solution of the present application, if the fourth storage space is a discontinuous storage space, that is, the fourth storage space includes multiple discontinuous sixth storage spaces, then for each first data, the first data storage space of the first data in the fourth storage space is determined according to the storage space size required for the first data, including: determining the space size of each sixth storage space; according to the storage space size required for the first data, determining the first data storage space corresponding to the first data in each sixth storage space, the first data storage space includes at least one sixth storage space whose target space size is not less than and is closest to the required storage space size, and the target space size is the space size corresponding to at least one sixth storage space.
[0125] Among the multiple sixth storage spaces, a storage space with a size no smaller than the target space size (i.e., a storage space capable of storing the first data) is selected, and is the storage space with the smallest size among the multiple sixth storage spaces (the at least one sixth storage space closest to the required storage space size). This can save storage resources. It is understood that if the at least one sixth storage space closest to the required storage space size is at least two sixth storage spaces, then the target space size is the size corresponding to the at least two sixth storage spaces; if the at least one sixth storage space closest to the required storage space size is one sixth storage space, then the target space size is the size of that sixth storage space.
[0126] As an example, for example, the fourth storage space includes three sixth storage spaces, and the three sixth storage spaces are discontinuous, namely storage space K1, storage space K2 and storage space K3. Among these three storage spaces, the storage space sizes are sorted from small to large as follows: storage space K1, storage space K3 and storage space k2. The target space size is larger than the space size of storage space K1 and smaller than the space size of storage space K3. Then, among these three sixth storage spaces, the storage space that can store the first data is storage space K2 and storage space K3. Among these two storage spaces, since the space size of storage space K2 is larger than the space size of storage space K3, in order to save storage resources, storage space K3 can be used as the first data storage space for the first data.
[0127] If the first data storage space corresponding to the first data is a discontinuous storage space, that is, the target storage space is at least two sixth storage spaces, then the data in the first data can be stored in the corresponding sixth storage spaces according to the space size of each of the at least two sixth storage spaces corresponding to the first data storage space. In this case, the correspondence between the first data and the first data storage space corresponding to the first data includes the correspondence between a portion of the first data and the sixth storage space corresponding to the portion of the data, as well as the correspondence between the data in the first data other than the portion of the data and the corresponding sixth storage space.
[0128] As an example, for example, the fourth storage space includes three sixth storage spaces, and the three sixth storage spaces are discontinuous, namely storage space K1, storage space K2, and storage space K3. Among these three storage spaces, the storage space sizes are sorted from small to large as follows: storage space K1, storage space K3, and storage space k2. The target space size is larger than the space size of storage space k2. Then, from these three sixth storage spaces, at least two sixth storage spaces that can store the first data can be determined, for example, storage space K1 and storage space K3. The sum of the space size of storage space K1 and the space size of storage space K3 is not less than the target space size. If the space size required to store the first data is 5k, the space size of storage space K1 is 2k, and the space size of storage space K3 is 4k, then 2k of the first data can be stored in storage space K1, and the remaining 3k of the first data can be stored in storage space K3. The sum of the space size of storage space K1 and the space size of storage space K3 is the smallest sum of the storage spaces among the three storage spaces.
[0129] In order to better illustrate and understand the principles of the method provided by this application, the solution of this application is described below in conjunction with an optional specific embodiment. It should be noted that the specific implementation of each step in this specific embodiment should not be understood as a limitation to the solution of this application. Based on the principles of the solution provided by this application, other implementations that can be thought of by those skilled in the art should also be considered within the scope of protection of this application.
[0130] As an example, consider user terminals A, B, and C. Each of these three terminals has application a installed, with application a being the target software. When any of these three terminals sends an upgrade request to the server, application a can be upgraded using the solution of this application. User terminals A, B, and C are merely examples, and this solution does not limit the number or specific form of user terminals A. For example, in this example, the user terminal can be a mobile phone. It is understood that, for ease of maintenance, different applications can correspond to different servers. In this example, the target software is application a installed on the user's mobile phone, and the current version of application a is 2.0. In this example, an "upgrade" indicator for application a is displayed on the client interface of the user's mobile phone. Upon the user's triggering action on this indicator, an upgrade request is generated, which the mobile phone sends to the server. This upgrade request includes identification information for application a, including its application identifier (software identifier) and version identifier.
[0131] After receiving the upgrade request, the server determines the target version of the second firmware (new firmware) and the current version of the first firmware (old firmware) for application a based on the version identifier of application a. If the target version is 3.0, the upgrade request aims to upgrade the target software from version 2.0 to 3.0. After determining the target version of the second firmware, the server generates a differential package based on the first and second firmware of application a.
[0132] In this example, Figure 7 Taking the first firmware and the second firmware shown in as an example, the first firmware includes the similar data, the second data, and the first data corresponding to each differential data in the differential package, and the second firmware includes each target sub-data and the newly added data. The specific process of the server generating the differential package is as follows:
[0133] Step 1: Based on the first firmware and the second firmware, determine each target sub-data in the second firmware, similar data corresponding to each target sub-data, and newly added data ( Figure 7 N1 and N2 shown in ), based on each target sub-data (such as Figure 7D1, D2 and D3) and similar data corresponding to each target sub-data ( Figure 7 ), determine the differential data corresponding to each target sub-data. Delete the second data in the first firmware ( Figure 7 K1 and K2 shown in Figure 1).
[0134] Step 2: For each target sub-data, if the similar data corresponding to at least two target sub-data contain the same data, the same data is used as the first data corresponding to the at least two target sub-data, and fourth indication information corresponding to the first data in the server is generated (including a fourth address offset and a fourth data length).
[0135] Step 3, determine the size of the storage space required to store the first data, determine the fourth storage space in the server corresponding to the second data in the first firmware, and based on the size of the storage space required for the first data, determine the fifth indication information of the first data storage space corresponding to the first data in the fourth storage space, where the first data storage space is part or all of the fourth storage space. Establish a fourth correspondence between the fourth indication information and the fifth indication information corresponding to the first data. In this example, the fourth storage space can be multiple discontinuous sixth storage spaces, and the data (second data) corresponding to each sixth storage space can be called a free block, see Figure 7 K1, K2 and K3 shown in.
[0136] Continuing with the previous example, Figure 7 The schematic diagram of free blocks shown includes free blocks K1, K2, and K3. That is, the fourth storage space corresponding to the second data in the server includes the sixth storage space corresponding to free block K1, the sixth storage space corresponding to free block K2, and the sixth storage space corresponding to free block K3. These sixth storage spaces are discontinuous. The storage space required for the first data is determined. For example, to store 5KB of data, the sixth storage space corresponding to free block K1 is sized for 5KB, the sixth storage space corresponding to free block K2 is sized for 10KB, and the sixth storage space corresponding to free block K3 is sized for 8KB. Among these three sixth storage spaces, the storage space with the smallest space (the sixth storage space corresponding to free block K1) that is larger than the storage space required for the first data is used as the first data storage space. A fourth correspondence is established between the fourth indication information corresponding to the first data and the fifth indication information.
[0137] Step 4: Determine the differential data between each target sub-data and the corresponding similar data, generate first indication information for each similar data (which may be a first address offset and a first data length), and establish a first correspondence between each differential data and its corresponding first indication information. In this example, taking target sub-data D1 and D2 as examples, based on target sub-data D1 and similar data S1 corresponding to target sub-data D1, differential data B1 corresponding to target sub-data D1 is calculated. Based on target sub-data D2 and similar data S2 corresponding to target sub-data D2, differential data B2 corresponding to target sub-data D2 is calculated. Optionally, B1 = D1 - S1, and B2 = D2 - S2. This first correspondence includes the correspondence between B1 and the first indication information corresponding to S1, and the correspondence between B2 and the first indication information corresponding to S2. In this example, since the target sub-data participate in the calculation of the differential data, the target sub-data can be referred to as a differential block of the second firmware, and the newly added data in the second firmware can be referred to as a newly added block.
[0138] Step 5: Determine the size of each target sub-data's occupied space. Based on the size of each target sub-data and the similar data corresponding to each target sub-data, determine the mobile similar data corresponding to each target sub-data and second indication information for each mobile similar data. A second correspondence is then established between each differential data item and its corresponding second indication information. The second indication information is the second storage location information of each mobile similar data item relative to the first starting storage address in the server. For each target sub-data item, the mobile similar data corresponding to the target sub-data item may be all or part of the similar data corresponding to the target sub-data item.
[0139] Step 6: Determine the mobile storage space corresponding to each mobile similar data item in the server, generate third indication information corresponding to each mobile similar data item, and establish a third correspondence between each mobile similar data item and its corresponding third indication information. The third indication information is third storage location information of the mobile storage space of each mobile similar data item in the server relative to the first starting storage address. For each mobile similar data item, the mobile storage space corresponding to the mobile similar data item is the storage space corresponding to the mobile similar data item when it is moved. It should be noted that the size of the mobile storage space is not less than the size of the space occupied by the mobile similar data item.
[0140] Step 7: Obtain the first starting storage address of the first firmware on the server. Based on the second correspondence, the first correspondence, the third correspondence, the fourth correspondence, each fourth indication information, and the first starting storage address, generate upgrade control information. A differential packet is generated based on the upgrade control information, the newly added data, and each differential data. The upgrade control information can be understood as information used to control the restoration of the target version of the firmware, and the differential data and additional data can be understood as data used for the upgrade. During the upgrade, the upgrade control information is used to control the restoration of the target version of the second firmware with the newly added data, thereby upgrading the target software. After generating the differential packet, the differential packet is encoded and sent to the user terminal (the user's mobile phone) corresponding to the upgrade request. The upgrade request may also include a terminal identifier, which identifies the user terminal sending the upgrade request. Based on the terminal identifier, the server may send the encoded differential packet to the user terminal. The terminal identifier can be at least one of text, characters, or symbols. This application does not limit the specific form of the terminal identifier.
[0141] After receiving the encoded differential packet sent by the server, the user terminal stores it, then decodes the encoded differential packet to obtain a differential packet, and then parses the differential packet to obtain differential data B1, differential data B2, and upgrade control information. The user terminal then upgrades the first firmware (version 2.0 application a) in the user terminal based on the parsed information. The specific upgrade process is as follows:
[0142] Step A: for the differential data B1, based on the first corresponding relationship, determine the first storage space ( Figure 7 The specific determination process has been described above and will not be repeated here.
[0143] Step B: Based on the differential data B1 and the similar data S1 corresponding to the differential data B1, obtain the target data a1 corresponding to the differential data, delete S1, and turn it into a free block K3.
[0144] Step C: The target storage space corresponding to the target data a1 is Figure 7 The storage space corresponding to S3 in the target storage space is included in the second storage space corresponding to S3. If there is mobile similar data S3 in the target storage space, then based on the translation control information, it is determined that the target mobile storage space corresponding to S3 is the storage space corresponding to K2. Then S3 is moved to the storage space corresponding to K2, and the target data a1 is stored in the storage space corresponding to S3. Figure 8 The firmware storage space shown in .
[0145] Step D: for the newly added data N1, the target data a2 is obtained based on the newly added data N1. The target storage space corresponding to the target data a2 is the storage space corresponding to K1. K1 is the free storage space. The target data a2 is stored in the storage space corresponding to K1. Figure 9 The firmware storage space shown in .
[0146] Step F: for the differential data B2, the target data a3 corresponding to the differential data B2 is obtained based on the differential data B2 and the similar data S2. The target storage space corresponding to a3 is Figure 8 If there is no data in the storage space corresponding to K3, a3 can be directly stored in the storage space corresponding to K3, S2 can be deleted, and a new free block K4 can be obtained. Figure 10 The firmware storage space shown in .
[0147] If the server divides the second firmware into several sub-data according to a set space size when generating a differential packet, each sub-data has the same data volume, and some sub-data may include both the target sub-data and the newly added data, the target sub-data in each sub-data and the similar data corresponding to each target sub-data are determined based on the first firmware and each sub-data.
[0148] like Figure 11 As shown, when restoring the first sub-data c1, based on the differential data corresponding to the sub-data c1 (partial data of the differential data B1) and the similar data corresponding to the sub-data (partial similar data in the similar data S1), the target data b1 corresponding to the sub-data c1 is obtained, see Figure 12 , there is mobile similar data (partial data S31 in similar data S3) in the target storage space corresponding to b1, determine that the target mobile storage space corresponding to the mobile similar data is part of the storage space corresponding to K2, move the mobile similar data to the target mobile storage space, store the target data b1 in the target storage space, delete the similar data corresponding to the sub-data c1, and obtain a new free block K5. At this time, S31 has been moved to the storage space corresponding to K2. The data in the second firmware corresponding to S31 is the data D31 at the front position of D3. For details, please refer to Figure 12 .
[0149] See also Figure 13 The second sub-data c2 in the , the differential data corresponding to c2 is part of the differential data B1. The specific restoration process is similar to the restoration process of the sub-data c1 mentioned above, see Figure 14, the target storage space corresponding to the target data b2 corresponding to c2 contains similar mobile data (partial data S32 in S3). The target mobile storage space corresponding to S32 is part of the storage space corresponding to K3. S32 is moved to the target mobile storage space (part of the storage space corresponding to K3), b2 is stored in the corresponding target storage space, and the similar data corresponding to c1 is deleted to obtain a new free block K6. At this time, S32 has been moved to the storage space corresponding to K3. The data in the second firmware corresponding to S32 is the data D32 after D31. For details, please refer to Figure 14 .
[0150] See also Figure 15 When restoring the third sub-data c3, the sub-data c3 includes both the newly added data N1 and part of the differential data B1. Based on the differential data corresponding to the sub-data c3 and the similar data corresponding to the differential data, the target data b3 corresponding to the sub-data c3 is obtained. The similar data corresponding to the sub-data c3 is deleted to obtain a new free block K7. Figure 16 , there is mobile similar data (partial data S33 in similar data S3) in the target storage space corresponding to b3, and the target mobile storage space corresponding to the mobile similar data S33 is determined to be the free storage space corresponding to the storage space after S2, and the mobile similar data is moved to the free storage space, and the target data b3 is stored in the target storage space. At this time, S33 has been moved to the free storage space, and the data in the second firmware corresponding to S33 is the data D33 after D32. For details, please refer to Figure 16 .
[0151] In the above two cases, if similar data S1 and S2 are two adjacent similar data and there is first data between the two similar data, the third storage space of the first data in the firmware storage space can be determined based on the fourth storage location information and the second starting storage address of the first data.
[0152] If, when restoring the differential data B1, the first storage space corresponding to the differential data B1 includes a third storage space, and the first data is stored in the third storage space, the first data can be first saved to a designated storage space so that the differential data B1 and its corresponding similar data are in a one-to-one correspondence. Then, the target data corresponding to the differential data can be obtained directly based on the differential data and the similar data corresponding to the differential data.
[0153] If the first storage space corresponding to the differential data B1 includes a third storage space, and the first data does not exist in the third storage space, the first data corresponding to the first storage space can be obtained from the designated storage space, and the target data corresponding to the differential data can be obtained based on the differential data B1, the data in the first storage space and the first data.
[0154] According to the above-mentioned differential upgrade method, each differential data in the differential package is upgraded, and a differential upgrade is performed based on the additional data in the differential package, so that the obtained target data can fully utilize the storage space of the first firmware released after the upgrade in the terminal device, and finally obtain the target version of the application. At this time, the upgraded application a is a version 3.0 application.
[0155] In actual applications, if the amount of the first data is small, the storage space occupied by the first data is small. Because the storage space occupied by the first data is small, the storage resources released based on the solution of the present application are small. Therefore, when the amount of the first data is less than the set threshold, the solution of the present application may not be used for upgrading. When the amount of the first data is greater than the set threshold, the solution of the present application is used for upgrading.
[0156] Based on this application Figure 1 The same principle as the method provided, the embodiment of the present application also provides a software upgrade device, such as Figure 17 As shown, the software upgrade device 20 includes a differential packet acquisition module 210, a parsing module 220, and an upgrade module 230. The differential packet acquisition module 210 is configured to, in response to an upgrade request for the target software, acquire a differential packet corresponding to the target software. The differential packet includes upgrade control information and a plurality of differential data. The upgrade control information includes position indication information and translation control information. The position indication information is used to determine the storage space of similar data corresponding to each differential data in the terminal device and the storage space of each mobile similar data in the terminal device. The translation control information is used to determine the mobile storage space corresponding to each mobile similar data in the terminal device. The mobile similar data is the similar data that needs to be moved among the similar data corresponding to each differential data. The parsing module 220 is configured to parse the differential packet to obtain the plurality of differential data and the upgrade control information. The upgrade module 230 is configured to complete the upgrade of the target software based on the plurality of differential data and the upgrade control information.
[0157] Optionally, when the upgrade module completes the upgrade of the target software based on multiple differential data and upgrade control information, it is specifically used to: perform the following operations on each differential data in turn according to the order in which the differential data are parsed: obtain the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data; determine whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space, and store the target data in the target storage space according to the determination result, or store the mobile similar data corresponding to the differential data in the target mobile storage space in the firmware storage space determined by the translation control information, wherein the firmware storage space is the space in the terminal device used to store the current version of the firmware.
[0158] Optionally, when the above-mentioned upgrade module determines whether there is mobile similar data in the target storage space corresponding to the target data in the firmware storage space, it is specifically used to: determine the first storage space in the firmware storage space of the similar data corresponding to each differential data, and the second storage space in the firmware storage space of each mobile similar data according to the position indication information; for each differential data, if the first storage space corresponding to the differential data includes the second storage space, it is determined that there is mobile similar data in the target storage space; if the first storage space corresponding to the differential data does not include the second storage space, it is determined that there is no mobile similar data in the target storage space.
[0159] Optionally, for each differential data, when the upgrade module 230 obtains the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data, it is specifically used to: if the first storage space corresponding to the differential data includes all the similar data of the differential data, obtain the target data corresponding to the differential data based on the differential data and the similar data in the first storage space; if the first storage space corresponding to the differential data includes some similar data of the differential data, obtain the some similar data corresponding to the differential data from the target mobile storage space corresponding to the differential data, and obtain the target data corresponding to the differential data based on the differential data, the data obtained from the target mobile storage space, and the data in the first storage space except the some similar data corresponding to the differential data; if the first storage space corresponding to the differential data does not include the similar data corresponding to the differential data, obtain the similar data corresponding to the differential data from the target mobile storage space corresponding to the differential data, and obtain the target data corresponding to the differential data based on the differential data and the data obtained from the target mobile storage space.
[0160] Optionally, the above-mentioned position indication information includes the first starting storage address of the first firmware in the server, the first corresponding relationship between each differential data and its corresponding first indication information, and the second corresponding relationship between each differential data and its corresponding second indication information, wherein the above-mentioned first indication information is the first storage position information of the similar data corresponding to each differential data in the server relative to the first starting storage address, and the second indication information is the second storage position information of each mobile similar data in the server relative to the first starting storage address.
[0161] Optionally, when the above-mentioned upgrade module determines the first storage space in the firmware storage space of the similar data corresponding to each differential data and the second storage space in the firmware storage space of each mobile similar data based on the position indication information, it is specifically used to: determine the first indication information of the similar data corresponding to each differential data based on the first correspondence relationship; determine the second starting storage address of the firmware storage space; for each differential data, determine the first storage space in the firmware storage space of the similar data corresponding to the differential data based on the first storage position information and the second starting storage address corresponding to the differential data; determine the second indication information corresponding to each differential data based on the second correspondence relationship; determine the second storage space of each mobile similar data based on each second storage position information and the second starting storage address.
[0162] Optionally, the above-mentioned translation control information includes a third correspondence between each mobile similar data and its corresponding third indication information, and the above-mentioned third indication information is the third storage position information of the mobile storage space of each mobile similar data in the server relative to the first starting storage address; for each differential data, the above-mentioned upgrade module 230 determines the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the translation control information, which is specifically the same as: determining the third indication information of the mobile similar data corresponding to the differential data based on the third correspondence; determining the target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space based on the third storage position information and the second starting storage address corresponding to the differential data.
[0163] Optionally, the above-mentioned location indication information also includes fourth indication information of each first data, the first data is the same data in the similar data corresponding to the two target sub-data, and the fourth indication information of a first data is the fourth storage location information of the first data in the server relative to the first starting storage address. The above-mentioned target sub-data refers to data in the second firmware that has similar data in the first firmware.
[0164] Optionally, the device also includes: a third storage space determination module (not shown in the figure), which is used to determine the third storage space of each first data in the firmware storage space based on the fourth storage location information and the second starting storage address of the first data.
[0165] For each differential data, when the upgrade module 230 obtains the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data, it is specifically used to: if the first storage space corresponding to the differential data includes a third storage space, and there is first data in the third storage space, save the first data to a designated storage space; obtain the target data corresponding to the differential data based on the differential data and the similar data corresponding to the differential data; if the first storage space corresponding to the differential data includes a third storage space, and there is no first data in the third storage space, obtain the first data corresponding to the first storage space from the designated storage space, and obtain the target data corresponding to the differential data based on the differential data, the data in the first storage space and the first data.
[0166] Optionally, the upgrade request includes identification information of the target software, the identification information including the software identification and the version identification of the current version, and the differential package is generated by the server in the following manner: based on the identification information, determining the first firmware and the second firmware of the target software; based on the first firmware and the second firmware, determining multiple target sub-data in the second firmware, and similar data corresponding to each target sub-data; determining differential data between each target sub-data and the corresponding similar data, generating first indication information for each similar data, and establishing a first corresponding relationship between each differential data and the first indication information of the corresponding similar data; Determine the second indication information of the mobile similar data corresponding to each target sub-data, and establish a second corresponding relationship between each differential data and its corresponding second indication information; determine the mobile storage space corresponding to each mobile similar data in the server, generate the third indication information corresponding to each mobile similar data, and establish a third corresponding relationship between each mobile similar data and its corresponding third indication information; determine the first data in each target sub-data, and generate the fourth indication information corresponding to each first data; obtain the first starting storage address of the first firmware in the server, and generate upgrade control information based on the first corresponding relationship, the second corresponding relationship, the third corresponding relationship, the fourth indication information and the first starting storage address; generate a differential package based on the upgrade control information and the differential data.
[0167] Optionally, when the above-mentioned server determines multiple target sub-data in the second firmware based on the first firmware and the second firmware, and similar data corresponding to each target sub-data, it is specifically used to: divide the second firmware into several sub-data according to the set space size; based on the first firmware and each sub-data, determine the target sub-data in each sub-data, and similar data corresponding to each target sub-data.
[0168] The software upgrade device of the embodiments of the present application can execute the software upgrade method provided in the embodiments of the present application. The implementation principles are similar. The actions performed by the modules and units in the software upgrade device in each embodiment of the present application correspond to the steps in the software upgrade method in each embodiment of the present application. For detailed functional descriptions of the modules of the software upgrade device, please refer to the description of the corresponding software upgrade method shown above and will not be repeated here. The above-mentioned software upgrade device can be a computer program (including program code) running on a computer device, for example, the user interface display device is an application software; this device can be used to execute the corresponding steps in the method provided in the embodiments of the present application.
[0169] In some embodiments, the software upgrade device provided by the embodiments of the present invention can be implemented in a combination of software and hardware. As an example, the software upgrade device provided by the embodiments of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the software upgrade method provided by the embodiments of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0170] In other embodiments, the software upgrade device provided by the embodiments of the present invention can be implemented in software. The software upgrade device stored in the memory can be software in the form of a program or plug-in, and includes a series of modules, including the modules in the software upgrade device 20. The modules in the software upgrade device 20 are used to implement the software upgrade method provided by the embodiments of the present invention. The above describes the software upgrade device of the present application from the perspective of a virtual module or virtual unit. The following describes the electronic device of the present application from the perspective of a physical device.
[0171] Based on the same principle as the method provided in the embodiments of the present application, an electronic device is provided in the embodiments of the present application, which includes a memory and a processor; a computer program is stored in the memory, and when the computer program is executed by the processor, it can implement the method provided in any optional method of the present application.
[0172] As an alternative, Figure 18 FIG. 4 shows a schematic diagram of the structure of an electronic device 4000 to which the embodiment of the present application is applicable. Figure 18 As shown, Figure 18 The electronic device 4000 shown includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, there is not limited to one transceiver 4004, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application. The processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. Bus 4002 may include a path for transmitting information between the above components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 18The bus 4003 is represented by only one bold line, but this does not mean that there is only one bus or only one type of bus. Memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, an optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these. Memory 4003 is used to store application code (computer program) that executes the solution of the present application, and is controlled for execution by processor 4001. Processor 4001 is used to execute the application code stored in memory 4003 to implement the content of the aforementioned method embodiment.
[0173] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer can execute the corresponding contents of the aforementioned method embodiment.
[0174] According to one aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations of the above-described method embodiments.
[0175] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0176] The above are only some of the embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A software upgrade method, characterized in that: include: In response to an upgrade request for target software, a differential package corresponding to the target software is obtained, the differential package including upgrade control information and multiple differential data, the upgrade control information including position indication information and translation control information, the position indication information being used to determine a storage space in the terminal device for similar data corresponding to each differential data and a storage space in the terminal device for each mobile similar data, the translation control information being used to determine a mobile storage space in the terminal device for each mobile similar data, the similar data corresponding to each differential data being data corresponding to the differential data in a first firmware, the first firmware being firmware of a current version of the target software; the mobile similar data being similar data in the similar data corresponding to each differential data stored in a storage space of the target data; the target data being data corresponding to the differential data in the upgraded target software; and the mobile storage space being a storage space to which the mobile similar data is to be stored during the upgrade process; Parse the differential packet to obtain multiple differential data and upgrade control information; Complete the upgrade of the target software based on the multiple differential data and the upgrade control information; The upgrading of the target software based on the plurality of differential data and the upgrade control information comprises the following steps: According to the order in which the differential data are obtained through analysis, perform the following operations on each differential data: determining, according to the location indication information, a second storage space for each mobile similar data in the firmware storage space; Obtaining target data corresponding to the differential data based on the differential data and similar data corresponding to the differential data; According to the parsing order of the differential data, the target storage space of the target data corresponding to the differential data is determined; if there is a second storage space in the target storage space, it is determined that there is mobile similar data in the target storage space; according to the translation control information, the mobile similar data stored in the second storage space in the target storage space is stored in the mobile storage space corresponding to the mobile similar data, and the target data is stored in the target storage space.
2. The method according to claim 1, characterized in that For each differential data, based on the differential data and the similar data corresponding to the differential data, the target data corresponding to the differential data is obtained, including: If the first storage space corresponding to the differential data includes all similar data to the differential data, obtaining target data corresponding to the differential data based on the differential data and the similar data in the first storage space; If the first storage space corresponding to the differential data includes partially similar data to the differential data, then obtaining the partially similar data corresponding to the differential data from the target mobile storage space corresponding to the differential data, and obtaining the target data corresponding to the differential data based on the differential data, the data obtained from the target mobile storage space, and the data in the first storage space other than the partially similar data corresponding to the differential data; If the first storage space corresponding to the differential data does not include similar data corresponding to the differential data, the similar data corresponding to the differential data is obtained from the target mobile storage space corresponding to the differential data, and the target data corresponding to the differential data is obtained based on the differential data and the data obtained from the target mobile storage space.
3. The method according to claim 1 or 2, characterized in that The location indication information includes a first starting storage address of the first firmware in the server, a first correspondence between each differential data and its corresponding first indication information, and a second correspondence between each differential data and its corresponding second indication information. The first indication information is the first storage location information of the similar data corresponding to each differential data in the server relative to the first starting storage address, and the second indication information is the second storage location information of each mobile similar data in the server relative to the first starting storage address.
4. The method according to claim 3, characterized in that The determining, based on the position indication information, a first storage space in the firmware storage space for similar data corresponding to each differential data and a second storage space in the firmware storage space for each mobile similar data includes: Based on the first corresponding relationship, determining first indication information of similar data corresponding to each differential data; Determining a second starting storage address of the firmware storage space; For each differential data, based on the first storage location information corresponding to the differential data and the second starting storage address, determining a first storage space in the firmware storage space for similar data corresponding to the differential data; Determining second indication information corresponding to each differential data according to the second corresponding relationship; Based on each second storage location information and the second starting storage address, a second storage space for each mobile similar data is determined.
5. The method according to claim 4, characterized in that The translation control information includes a third correspondence between each mobile similar data and its corresponding third indication information, wherein the third indication information is third storage position information of the mobile storage space of each mobile similar data relative to the first starting storage address in the server; For each differential data, determining, based on the translation control information, a target mobile storage space of mobile similar data corresponding to the differential data in the firmware storage space includes: Based on the third corresponding relationship, determining third indication information of the mobile similar data corresponding to the differential data; Based on the third storage location information corresponding to the differential data and the second starting storage address, a target mobile storage space of the mobile similar data corresponding to the differential data in the firmware storage space is determined.
6. The method according to claim 1 or 2, characterized in that The location indication information also includes fourth indication information of each first data, where the first data is the same data in the similar data corresponding to the two target sub-data, and the fourth indication information of one first data is the fourth storage location information of the first data in the server relative to the first starting storage address, and the target sub-data refers to data in the second firmware that has similar data in the first firmware.
7. The method according to claim 6, characterized in that The method further comprises: For each first data, determining a third storage space of the first data in the firmware storage space according to the fourth storage location information of the first data and the second starting storage address; For each differential data, obtaining target data corresponding to the differential data based on the differential data and similar data corresponding to the differential data includes: If the first storage space corresponding to the differential data includes a third storage space, and the first data exists in the third storage space, the first data is stored in a designated storage space; based on the differential data and similar data corresponding to the differential data, the target data corresponding to the differential data is obtained; If the first storage space corresponding to the differential data includes a third storage space, and the first data does not exist in the third storage space, obtain the first data corresponding to the first storage space from the designated storage space, and obtain the target data corresponding to the differential data based on the differential data, the data in the first storage space, and the first data.
8. The method according to claim 1 or 2, characterized in that The upgrade request includes identification information of the target software, including the software identification and the version identification of the current version. The differential package is generated by the server in the following manner: Determining, based on the identification information, a first firmware and a second firmware of the target software, where the second firmware is a firmware of a target version of the target software; determining, based on the first firmware and the second firmware, a plurality of target sub-data in the second firmware, and similar data corresponding to each of the target sub-data; Determine differential data between each target sub-data and corresponding similar data, generate first indication information for each similar data, and establish a first corresponding relationship between each differential data and the first indication information for the corresponding similar data; Determine the second indication information of the mobile similar data corresponding to each target sub-data, and establish a second corresponding relationship between each differential data and its corresponding second indication information; Determining a mobile storage space corresponding to each mobile similarity data in the server, generating third indication information corresponding to each mobile similarity data, and establishing a third corresponding relationship between each mobile similarity data and its corresponding third indication information; Determine the first data in each target sub-data, and generate fourth indication information corresponding to each first data; Obtaining a first starting storage address of the first firmware in the server, and generating the upgrade control information based on the first corresponding relationship, the second corresponding relationship, the third corresponding relationship, each of the fourth indication information, and the first starting storage address; The differential package is generated based on the upgrade control information and each of the differential data.
9. The method according to claim 8, characterized in that The determining, based on the first firmware and the second firmware, a plurality of target sub-data in the second firmware and similar data corresponding to each of the target sub-data includes: Dividing the second firmware into a plurality of sub-data according to a set space size; Based on the first firmware and each of the sub-data, target sub-data in each of the sub-data and similar data corresponding to each target sub-data are determined.
10. A software upgrading device, characterized in that: include: A differential packet acquisition module is configured to, in response to an upgrade request for target software, acquire a differential packet corresponding to the target software, wherein the differential packet includes upgrade control information and a plurality of differential data, wherein the upgrade control information includes position indication information and translation control information, wherein the position indication information is used to determine a storage space in the terminal device for similar data corresponding to each differential data and a storage space in the terminal device for each mobile similar data, and wherein the translation control information is used to determine a mobile storage space in the terminal device for each mobile similar data, wherein the similar data corresponding to each differential data is data corresponding to the differential data in a first firmware, wherein the first firmware is firmware of a current version of the target software; the mobile similar data is similar data in the similar data corresponding to each differential data stored in a storage space of the target data; the target data is data corresponding to the differential data in the upgraded target software; and the mobile storage space is a storage space to which the mobile similar data is to be stored during the upgrade process; The parsing module is used to parse the differential packet to obtain multiple differential data and upgrade control information; The upgrade module is used to complete the upgrade of the target software based on the multiple differential data and the upgrade control information; the upgrade of the target software based on the multiple differential data and the upgrade control information includes the following steps: According to the order in which the differential data are obtained through analysis, perform the following operations on each differential data: determining, according to the location indication information, a second storage space for each mobile similar data in the firmware storage space; Obtaining target data corresponding to the differential data based on the differential data and similar data corresponding to the differential data; According to the parsing order of the differential data, the target storage space of the target data corresponding to the differential data is determined; if there is a second storage space in the target storage space, it is determined that there is mobile similar data in the target storage space; according to the translation control information, the mobile similar data stored in the second storage space in the target storage space is stored in the mobile storage space corresponding to the mobile similar data, and the target data is stored in the target storage space.
11. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the method according to any one of claims 1 to 9 when running the computer program.
12. A computer-readable storage medium, characterized in that The storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Software upgrading method and device, electronic equipment and computer readable storage medium
CN113986310A