Software upgrading method, device, electronic device and computer readable storage medium
By reasonably allocating the storage space of differential packets and firmware in the first and second storage areas of the terminal device, the problem of differential packets not being stored in low-memory devices is solved, and the storage and software upgrade of differential packets are realized.
Patent Information
- Application Number
- CN202111501517.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In terminal devices with low memory and low Flash storage space, differential packages cannot be stored, resulting in software upgrade failure.
By storing differential packets in the available storage space of the first storage area and the second storage area, the first storage area is used to store the differential packets, and the second storage area is used to store firmware, maximizing the storage differential packets using the available storage resources of the firmware area.
With limited storage resources, the software upgrade is successfully completed, making full use of the available storage resources in the firmware area to realize differential package storage and upgrade.
Smart Images

Figure CN113986315B_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, there is storage space in the terminal device for storing differential packets. However, in the scenario of low memory and low Flash storage space, the storage resources of the storage space are insufficient, resulting in the inability to store differential packets and thus the inability to upgrade the software. 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, obtaining a differential package corresponding to the target software and determining a target space size required to store the differential package;
[0007] If the target space size is not greater than the first space size of the first storage area, the differential package is stored in the first storage area, where the first storage area is a storage space for storing differential packages;
[0008] If the target space size is larger than the first space size, determining a second space size of the available storage space of the second storage area; if the sum of the first space size and the second space size is not smaller than the target space size, storing the differential package in the available storage space and the first storage area, where the second storage area is a storage space for storing the firmware of the target software;
[0009] Upgrade the target software based on the differential package.
[0010] On the other hand, an embodiment of the present application provides a software upgrade device, which includes:
[0011] A differential package acquisition module is used to respond to an upgrade request for the target software, obtain the differential package corresponding to the target software, and determine the target space size required to store the differential package;
[0012] A differential package storage module, configured to store the differential package in the first storage area when the target space size is not greater than the first space size of the first storage area, where the first storage area is a storage space for storing differential packages;
[0013] When the target space size is larger than the first space size, determining a second space size of an available storage area of the second storage area, and when the sum of the second space size and the first space size is not smaller than the target space size, storing the differential package in the available storage area and the first storage area, wherein the second storage area is a storage space for storing firmware of the target software;
[0014] The upgrade module is used to upgrade the target software based on the differential package.
[0015] Optionally, the upgrade request includes a version identifier of the firmware of the target software, and the differential package is determined by:
[0016] Based on the version identifier, determining the current version of the firmware of the target software and the target version of the firmware corresponding to the target software;
[0017] Based on the current version of the firmware and the target version of the firmware, determining a header file, control information for controlling the restoration of the target version of the firmware, and differential data for upgrading included in the differential package, wherein the header file includes a space size identifier for indicating the size of the storage space required to store the differential package;
[0018] Generate a differential packet based on the header file, control information and difference data.
[0019] Optionally, when determining the target space size required to store the differential package, the differential package acquisition module is specifically configured to:
[0020] Parse the differential packet to obtain control information and differential data;
[0021] Determine a third space size required for storing the control information and a fourth space size required for storing the difference data, wherein the target space size is the sum of the third space size and the fourth space size;
[0022] When storing the differential packet in the available storage space and the first storage area, the differential packet storage module is specifically used to:
[0023] Calculating a first difference between the first space size and the third space size;
[0024] The control information is stored in the first storage area, the first data in the difference data whose data amount is equal to the first difference value is stored in the first storage area, and the second data in the difference data except the first data is stored in the available storage space.
[0025] Optionally, when the differential packet storage module stores first data in the differential data whose data volume is equal to the first difference value in the first storage area, and stores second data in the differential data other than the first data in the available storage space, it is specifically configured to:
[0026] Calculate a second difference between the fourth spatial size and the first difference;
[0027] According to the order of data parsing, the second data obtained by parsing the difference data first, which has a data amount equal to the second difference, is stored in the available storage space, and the first data except the second data obtained by parsing later is stored in the first storage area;
[0028] When upgrading the target software based on the differential package, the above upgrade module is specifically used to:
[0029] Based on the control information in the first storage area, the difference data in the available storage space is read in the order of data parsing, and the target software is upgraded accordingly based on the read data;
[0030] The read difference data in the available storage space is deleted, and the data obtained by the upgrade operation is stored in the second storage area.
[0031] Optionally, when parsing the differential packet to obtain the control information and difference data, the differential packet acquisition module is specifically configured to:
[0032] Adjusting the position of the first data partition where the control information is located in the differential packet to after the position of the second data partition where the difference data is located;
[0033] Parsing the adjusted differential packet according to the front and back positions of the data partitions in the differential packet to obtain control information and difference data;
[0034] When storing the differential packet in the available storage space and the first storage area, the differential packet storage module is specifically used to:
[0035] The control information is stored in the first storage area, and in the order of difference data parsing, the data obtained by parsing the adjusted differential packet and having a data amount equal to the second difference is stored in the available storage space, and the data parsed later is stored in the first storage area.
[0036] Optionally, when determining the target space size required to store the differential packets, the differential packet processing module is specifically configured to:
[0037] Parse the header file of the differential package to obtain the space size identifier;
[0038] Based on the space size identifier, the target space size required to store the differential package is determined.
[0039] Optionally, when storing the differential package in the available storage space and the first storage area, the differential package storage module is specifically configured to:
[0040] Parse the differential packet to obtain the parsed data;
[0041] The third data in the parsed data, whose data volume is equal to the size of the second space, is stored in the available storage space; and the fourth data in the parsed data except the third data is stored in the first storage area.
[0042] 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.
[0043] 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.
[0044] 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.
[0045] The beneficial effects of the technical solution provided by the present application are as follows: the solution provided by the embodiment of the present application, when the target software needs to be upgraded, that is, in response to an upgrade request for the target software, determines the target space size required to store the differential package corresponding to the target software. When the first space size of the first storage area (such as the upgrade area) used to store the differential package is smaller than the target space size required to store the differential package corresponding to the target software, and the target space size is not greater than the sum of the first space size and the second space size of the second storage area (such as the firmware area), the differential package is stored using the available storage space of the first storage area and the second storage area. In this way, when the storage resources on the upgrade area side are limited, the available storage resources of the firmware area can be fully utilized to store the differential package, maximizing the storage resources and achieving the storage of the differential package to complete the upgrade of the target software.
[0046] 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
[0047] 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.
[0048] Figure 1 A flowchart of a software upgrade method provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of data partitioning in a differential packet before adjustment provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of data partitioning in an adjusted differential packet provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of the structure of a software upgrade system provided in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of the structure of a software upgrade device 20 provided in an embodiment of the present application;
[0053] Figure 6 This is a structural diagram of an electronic device 4000 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] 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.
[0055] 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.
[0056] In the prior art, taking the operation of an embedded device in a network environment 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, it is achieved by updating the online firmware of the embedded device in a WIFI network, providing users with a service version with a better experience. There are generally three solutions for OTA upgrades, full upgrades, incremental upgrades, and differential upgrades. Full upgrades are full data download upgrades of the new firmware, which are mostly used for upgrades in cases where the network environment is good and the memory and Flash resource space are large. Incremental upgrades, according to different solutions, are divided into individual program file download and replacement, which is aimed at environments with file systems. Differential upgrades are a variant of full upgrades, that is, only the difference between the new and old firmware is downloaded, the full data content of the new firmware is restored on the device to be upgraded, and then the upgrade strategy is performed.
[0057] Current differential upgrades primarily aim to reduce network transmission time by performing a differential upgrade between the old and new firmware. To achieve this goal, sufficient resources are required to store, verify, and perform upgrade and restore operations on the differential packets. However, the current challenge is that embedded devices with limited memory and Flash storage space cannot store large differential packets.
[0058] This application addresses the limited resource space in existing technologies and proposes a software upgrade method to maximize existing storage resources and increase the likelihood of successful differential package storage. This application is applicable to any scenario where the current version of software needs to be upgraded to the target version of software, and is applicable to any differential upgrade method.
[0059] In this solution, when the target software needs to be upgraded, that is, in response to an upgrade request for the target software, the target space size required to store the differential package corresponding to the target software is determined. If the first space size of the first storage area (e.g., the upgrade area) used to store the differential package is smaller than the target space size required to store the differential package corresponding to the target software, and the target space size is not greater than the sum of the first space size and the second space size of the second storage area (e.g., the firmware area), the differential package is stored using the available storage space in the first storage area and the second storage area. In this way, even if the storage resources on the upgrade area side are limited, the available storage resources in the firmware area can be fully utilized to store the differential package, maximizing the storage resources and achieving the target software upgrade by storing the differential package.
[0060] Based on the application scenarios described above, the solutions provided by the embodiments of the present application can be executed by any electronic device, which can be a user terminal or a server. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed system. The user terminal 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.
[0061] 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.
[0062] 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 package 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.
[0063] Optionally, in an environment without a file system, the storage area for differential packages, i.e., the upgrade area, is generally relatively limited in size. In an environment without a file system, it is often the case that the upgrade area cannot store differential packages. Therefore, the present application solution is suitable for a software upgrade environment without a file system.
[0064] The following combination Figure 1 A software upgrade method is shown to illustrate the present application solution. Figure 1 A flow chart of a software upgrade method provided in an embodiment of the present application is shown. The method can be executed by an electronic device, wherein the electronic device can be a user terminal or a server.
[0065] like Figure 1 As shown in , the method may include the following steps:
[0066] Step S110 , in response to an upgrade request for the target software, obtaining a differential package corresponding to the target software, and determining a target space size required to store the differential package.
[0067] If the executor of this method is a user terminal, then in response to an upgrade request for the target software, obtaining the differential package corresponding to the target software and determining the target space size required to store the differential package may include the following steps: sending an upgrade request for the target software to the server, wherein the upgrade request includes identification information of the target software, receiving the differential package sent by the server based on the identification information, and determining the target space size required to store the differential package.
[0068] If the executor of this method is a server, then in response to an upgrade request for the target software, obtaining the differential package corresponding to the target software and determining the target space size required to store the differential package 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 the differential package corresponding to the identification information based on the identification information, and sending the differential package to the user terminal so that the user terminal determines the target space size required to store the differential package.
[0069] 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.
[0070] Among them, the target software refers to the operating system or application that needs to be upgraded. If it 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, the 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.
[0071] 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.
[0072] 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. The difference between the current version of the software and the target version of the software is called a differential package. After the differential package is downloaded on the server side, the target version of the software can be restored on the user terminal side based on the differential package. 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 will 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.
[0073] 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 version identifier, determine the current version of the firmware of the target software and the target version of the firmware corresponding to the target software; based on the current version of the firmware and the target version of the firmware, determine the header file included in the differential package, control information for controlling the restoration of the target version of the firmware, and differential data for upgrading, wherein the header file includes a space size identifier for representing the size of the storage space required to store the differential package; generate a differential package based on the header file, control information, and differential data.
[0074] 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 control information, differential data, and header files. During the upgrade, the differential data used for the upgrade can be controlled based on the control information to restore the data of the target version of the firmware.
[0075] The difference data includes differential information and additional information. Differential information refers to the information that is different between the current version of the firmware and the target version of the firmware. For example, information a in the current version of the firmware corresponds to information b in the target version of the firmware, and the differential information is the information corresponding to the difference between information b and information a. Additional information refers to information that does not exist in the current version of the firmware compared to the target version of the firmware, or it can also be understood as information that the target version of the firmware adds to the current version of the firmware. During the upgrade, this additional information can be integrated into the current version of the firmware by insertion as the information in the target version of the firmware (new firmware).
[0076] In an optional solution of the present application, as can be seen from the previous description, the header file of the differential package contains a space size identifier that represents the size of the storage space required to store the differential package. When determining the target space size required to store the differential package, the following steps are included: parsing the header file of the differential package to obtain the space size identifier; based on the space size identifier, determining the target space size required to store the differential package.
[0077] Among them, since when the differential package is generated, the header file contains a space size identifier that represents the target space size of the storage space required to store the differential package, when it is necessary to determine the target space size of the storage space required to store the differential package, the target space size can be determined based on the space size identifier obtained by parsing when parsing the header file of the differential package. Since the header file of the differential package is parsed first, the amount of data processing can be reduced.
[0078] In another solution, the header file of the differential packet may further include the file format of the differential packet, an identifier indicating the amount of control information in the differential packet, an identifier indicating the amount of difference data, etc. This information can be used to understand the format of the differential packet and the specific details of the data contained therein. Parsing this information can also determine the amount of storage space occupied by the differential packet.
[0079] Step S120: If the target space size is not greater than the first space size of the first storage area, the differential packet is stored in the first storage area.
[0080] Step S130: If the target space size is larger than the first space size, determine the second space size of the available storage space of the second storage area; if the sum of the first space size and the second space size is not less than the target space size, store the differential package in the available storage space and the first storage area; the second storage area is the storage space for storing the firmware of the target software.
[0081] On the one hand, based on the target space size, the amount of storage space required to store the differential package can be determined. If the target space size is not greater than the space size of the first storage area, it indicates that the first storage area can store the differential package, and the differential package can be directly stored in the first storage area. The first storage area is typically a storage space used to store differential packages, such as an upgrade area. The space size of the first storage area is usually pre-configured. In this example, the storage space is small and generally cannot store large differential packages.
[0082] On the other hand, when the target space size is larger than the first space size, it indicates that the first storage area cannot store the differential package, then the second storage area can be used in combination to save the differential package. The second storage area is usually the storage space for storing the firmware of the target software, such as the firmware area for storing the main version firmware (the current version of the firmware). The size of the available storage space in the firmware area can be determined based on the total space size of the firmware area and the size of the storage space required for storing the firmware of the target software (the main version firmware is occupied). When the target space size is not larger than the sum of the second space size and the first space size, that is, when the available storage space and the first storage area can store the differential package, the differential package is stored in the first storage area and the available storage space. In this way, the storage resources of the second storage area can be fully utilized, the storage resources can be maximized, and when the first storage area is not enough, the differential upgrade of the target software can also be achieved.
[0083] It can be understood that the above-mentioned steps S120 and S130 are two steps executed in parallel. The execution order of the two steps is not limited in the present application scheme. If the target space size is not larger than the first space size, step S120 is executed; if the target space size is larger than the first space size, step S130 is executed.
[0084] Step S140: Upgrade the target software based on the differential package.
[0085] Since the present application solution is applicable to any differential upgrade algorithm, when upgrading the target software based on the differential package, any upgrade algorithm can be used for upgrading. 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.
[0086] Optionally, the solution of the present application can be upgraded using OTA (Over-the-Air Technology) upgrade technology. OTA technology refers to the technology in which the user terminal downloads the upgrade package (differential package) on the remote server through the wireless network, and upgrades the operating system or application of the user terminal based on the differential package.
[0087] In the solution of this application, there are many ways to implement differential upgrade, and the solution of this application is applicable to any differential upgrade method, such as the bsdiff algorithm, the hdiffpatch algorithm, the xdelta3 algorithm, etc.
[0088] The solution provided by the embodiment of the present application determines the target space size required to store the differential package corresponding to the target software when the target software needs to be upgraded, that is, in response to an upgrade request for the target software. When the first space size of the first storage area (such as the upgrade area) used to store the differential package is smaller than the target space size required to store the differential package corresponding to the target software, and the target space size is not greater than the sum of the first space size and the second space size of the second storage area (such as the firmware area), the differential package is stored using the available storage space of the first storage area and the second storage area. In this way, when the storage resources on the upgrade area side are limited, the available storage resources of the firmware area can be fully utilized to store the differential package, maximizing the storage resources and achieving the storage of the differential package to complete the upgrade of the target software.
[0089] In an optional solution of the present application, the above-mentioned storage of the differential package in the available storage space and the first storage area includes: parsing the differential package to obtain the parsed data; storing the third data in the parsed data whose data volume is equal to the size of the second space in the available storage space; and storing the fourth data in the parsed data except the third data in the first storage area.
[0090] It should be noted that the order in which the data in the differential package is stored determines the order in which it is used during the upgrade. Therefore, when storing the data in the differential package, the third data located at the front of the differential package and having a data volume equal to the second space size can be stored in the available storage space (the remaining resources available in the firmware area) in the order of the parsed data, and the fourth data located at the back of the differential package and including the parsed data, excluding the third data, can be stored in the first storage area (upgrade area). In this way, if the space size of the second storage area is large enough, that is, without occupying the storage resources of the available storage space, the target version of the firmware obtained after the upgrade can be stored in the second storage area.
[0091] Specifically, after obtaining the parsed data, the third data can be determined based on the size of the second space (remaining resources in the firmware area). The third data is data whose amount is equal to the size of the second space and is located at the front position in the differential package. For example, the size of the second space is 20k (k is the storage unit of data, kilobyte KB (Kilobyte)), then the 20k data located at the head of the differential package is selected from the differential package as the third data and stored in the available storage space, and the fourth data located at the tail of the differential package is stored in the first storage area (upgrade area).
[0092] In actual applications, the control information is usually located before the differential data in the differential packet, and the amount of control information is smaller than the amount of differential data. The data stored in the available storage space usually includes the control information and the differential data that cannot be stored in the first storage area. The data stored in the first storage area is usually differential data.
[0093] In an optional solution of the present application, determining the target space size required for storing the differential packet includes: parsing the differential packet to obtain control information and differential data; determining a third space size required for storing the control information and a fourth space size required for storing the differential data, where the target space size is the sum of the third space size and the fourth space size. Storing the differential packet in available storage space and a first storage area includes: calculating a first difference between the first space size and the third space size; storing the control information in the first storage area, storing first data in the differential data whose data volume is equal to the first difference in the first storage area, and storing second data in the differential data other than the first data in the available storage space.
[0094] Among them, the second storage area is a storage space for storing the firmware of the target software. Before the upgrade, the second storage area stores the current version of the firmware. After the upgrade, the firmware stored in the second storage area is the target version of the firmware. In actual applications, since the control information is the data used to control the restoration of the target version of the firmware, it must be used all the time during the upgrade process, and the difference data is the data used for the upgrade and can be deleted while being used. Therefore, in order to occupy as little storage resources of the second storage area as possible, when storing the differential packet, the differential packet can be parsed first to obtain the control information and the difference data, and then the data stored in the first storage area and the data stored in the available storage space of the second storage area can be determined from the control information and the difference data. During storage, since the amount of control information is usually smaller than the amount of difference data, the first storage area can usually store the control information, and after the control information is stored in the first storage area, there is usually remaining storage space for storing the difference data. The first difference value determined based on the first space size and the third space size represents the data amount of the difference data stored in the first storage area. Based on the first difference value, the first data of the second type with a data amount equal to the first difference value is stored in the first storage area. At this time, the first storage area is filled with control information and the first data, and the second data in the difference data except the first data is stored in the available storage space.
[0095] In an optional solution of the present application, the above-mentioned storing first data in the difference data whose data volume is equal to the first difference value into the first storage area, and storing second data in the difference data excluding the first data into the available storage space, includes: calculating the second difference between the size of the fourth space and the first difference value; storing the second data in the difference data whose data volume is equal to the second difference obtained by first parsing into the available storage space in the order of data parsing, and storing the first data excluding the second data parsed later into the first storage area. The above-mentioned upgrading of the target software based on the differential package includes: based on the control information in the first storage area, reading the difference data in the available storage space in the order of data parsing, and performing corresponding upgrading operations on the target software based on the read data; deleting the difference data that has been read in the available storage space, and storing the data obtained by the upgrading operation into the second storage area.
[0096] Among them, in actual application, usually during the upgrade process, based on the need to reuse the storage resources of the second storage area, it is necessary to first read the data in the available storage space for upgrade processing. Since the control information is always used during the upgrade process, and the difference data can be deleted while being used, in the solution of the present application, when storing the data in the differential package, the second difference between the fourth space size and the first difference can be calculated first. The second difference represents the size of the data volume of the difference data stored in the available storage space. Based on the second difference, in the order of data parsing, the second data in the difference data whose data volume is equal to the second difference is first parsed and stored in the available storage space, and the first data other than the second data parsed later is stored in the first storage area. In this way, the differential data stored in the available storage space is the differential data first parsed when parsing the differential package. On the one hand, during the upgrade, the differential data is first read from the available storage space in the order of data parsing. While reading and upgrading, the differential data read in the available storage space is deleted. Therefore, when the target software is upgraded based on the read data, the data obtained by the upgrade operation can be stored in the second storage area in sequence to realize the reuse of the storage resources of the second storage area.
[0097] On the other hand, by storing the data first parsed from the difference data into the available storage space, when the amount of data corresponding to the upgraded target version of the firmware is greater than the amount of data corresponding to the current version of the firmware, the available storage space can be used to store the sixth data, and the amount of data of the sixth data is equal to the difference between the amount of data corresponding to the target version of the firmware and the amount of data corresponding to the current version of the firmware. That is, when the amount of data of the target version of the firmware is larger, the data of the target version of the firmware can be stored in the released available storage space, thereby ensuring that the target software can be used normally after the upgrade.
[0098] In an optional solution of the present application, the control information is located in the first data partition of the differential packet, the difference data is located in the second data partition of the differential packet, and the first data partition is located before the second data partition. Further, the differential packet is parsed to obtain the control information and the difference data, including: adjusting the position of the first data partition where the control information is located in the differential packet to after the position of the second data partition where the difference data is located (that is, adjusting the position of the first data partition to after the position of the second data partition); parsing the adjusted differential packet according to the front and back positions of the data partitions in the differential packet to obtain the control information and the difference data. Then, storing the differential packet in the available storage space and the first storage area includes: storing the control information in the first storage area, and according to the order of data parsing, storing the data obtained by parsing the adjusted differential packet and having an amount of data equal to the second difference value first parsed in the available storage space, and storing the data parsed later in the first storage area.
[0099] Among them, the control information and differential data in the differential packet can correspond to different data partitions. For example, the control information is located in the first data partition, the differential data is located in the second data partition, and the first data partition is located before the second data partition. In order to make the data parsed first the differential partition and the second data partition in the differential packet interchangeable, that is, the position of the first data partition can be adjusted to after the position of the second data partition to obtain an adjusted differential packet. At this time, in the adjusted differential packet, the differential data is located before the control information, and then, in the order of data parsing, the data obtained by parsing the adjusted differential packet and whose amount of data is equal to the second difference (corresponding to the first data in the previous text) is stored in the available storage space, and the data parsed later (corresponding to the second data in the previous text) is stored in the first storage area.
[0100] As an example, see Figure 2 The schematic diagram of data partition in the differential packet before adjustment is shown as Figure 2 As shown, the control information is located in the first data partition of the differential packet, the difference data is located in the second data partition of the differential packet, and the first data partition is located before the second data partition. Figure 3 The schematic diagram of data partition in the adjusted differential packet is shown as Figure 3 As shown, the control information is still located in the first data partition of the differential packet, and the difference data is still located in the second data partition of the differential packet, but through adjustment, the first data partition is located after the second data partition.
[0101] In an optional solution of the present application, if the target space size is larger than the sum of the second space size and the first space size, the method may further include: generating and displaying a prompt message, where the prompt message is used to indicate that the upgrade is impossible.
[0102] Among them, when the target space size is greater than the sum of the second space size and the space size of the first storage area, it indicates that the available storage space and the first storage area cannot store the differential package, and a prompt message can be generated and displayed to the user, informing the user that the upgrade cannot be performed.
[0103] Optionally, the prompt information may be text, voice, animation, etc. The specific form of the prompt information is not limited in this application, and all are within the scope of protection of this application.
[0104] 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.
[0105] See also Figure 4 A structural diagram of a software upgrade system is shown in FIG. Figure 4 As shown, the system includes a server, user terminal A, user terminal B, and user terminal C. User terminal A, user terminal B, and user terminal C all have application a installed. Application a is the target software. When any of the three user terminals sends an upgrade request to the server, application a can be upgraded using the solution of this application. User terminal A, user terminal B, and user terminal C are merely examples. The solution of this application does not limit the number or specific form of user terminal 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.
[0106] In this example, the target software is application a installed on the user's mobile phone, and the current version of the application is 2.0. In this example, for the user's mobile phone without a file system, the differential package and the firmware corresponding to the current version of application a can be stored in the solid-state memory flash. Among them, the flash includes a first storage area (also called an upgrade area) and a second storage area (also called a firmware area). The first storage area is used to store the differential package, and the second storage area is used to store the firmware of the current version of application a. In this example, it is assumed that the first space size of the first storage area is 50k and the storage space size of the second storage area is 150k.
[0107] An "upgrade" logo for application a is displayed on the client interface of the user's mobile phone. Based on the user's triggering operation on the logo, an upgrade request is generated and sent to the server. The upgrade request includes the identification information of application a, which includes the application identification (software identification) and version identification of application a.
[0108] After receiving the upgrade request, the server determines the target version of firmware corresponding to application a based on the version identifier of application a. If the target version is 3.0, the purpose of the upgrade request is to upgrade the target software from version 2.0 to version 3.0. After determining the target version of firmware, the server generates a differential package based on the current version of firmware of application a and the target version of firmware. The specific process of generating the differential package is as follows: based on the version identifier, the current version of the firmware of the target software and the target version of firmware corresponding to the target software are determined; based on the current version of firmware and the target version of firmware, the header file, control information, and differential data included in the differential package are determined, wherein the header file includes a space size identifier used to represent the storage space required to store the differential package; based on the header file, control information, and differential data, the differential package is generated.
[0109] The control information can be understood as information used to control the restoration of the target version of the firmware, and the difference data can be understood as data used for the upgrade. During the upgrade, the difference data is restored to the target version of the firmware based on the control information to achieve the upgrade of the target software. Specifically, the difference data includes difference information and additional information.
[0110] After the differential packet is generated, the differential packet is encoded and sent to the user terminal (user's mobile phone) corresponding to the upgrade request.
[0111] 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 may be at least one of text, characters, or symbols; this application does not limit the specific form of the terminal identifier.
[0112] After receiving the encoded differential packet sent by the server, the user terminal first decodes the encoded differential packet to obtain the differential packet; then parses the header file of the differential packet, and based on the space size identifier of the parsed header file, determines the target space size required to store the differential packet based on the space size identifier.
[0113] If the target space size is 40k, that is, the target space size is not larger than the first space size of the first storage area (50k), the differential package is stored in the first storage area. If the target space size is not larger than the first space size, it indicates that the first storage area can store the differential package, and the differential package can be directly stored in the first storage area.
[0114] If the target space size is 60k, that is, the target space size is larger than the first space size (50k), indicating that the first storage area cannot store the differential package, then the available storage space of the second storage area can be determined at this time. For example, the second space size of the available storage space is 30k, and the second storage area is usually the storage space for storing the firmware of the target software (the storage space occupied by the firmware of the target software is 120k). Then, when the target space size of 60k is not larger than the sum of the second space size and the first space size (30k+50k=80k), that is, when the differential package can be stored in the available storage space and the first storage area, the differential package is stored in the first storage area and the available storage space. In this way, the storage resources of the second storage space can be fully utilized, and when the first storage area is insufficient, the target software can also be upgraded.
[0115] Typically, in a differential packet, control information is located in the first data partition of the differential packet, and differential data is located in the second data partition of the differential packet, with the first data partition located before the second data partition. Typically, data in a differential packet is stored in the order in which the data is parsed, meaning that the data parsed first is stored first. The order in which the data in the differential packet is stored determines the order in which it is used during an upgrade. During the upgrade process, to reuse the storage resources of the second storage area, data in the available storage space must first be read for upgrade processing. Since control information is continuously used during the upgrade process, differential data can be deleted while being used. In the solution of the present application, to ensure that the data parsed first during differential packet parsing is differential data, the first and second data partitions in the differential packet can be swapped. Specifically, the first data partition can be repositioned after the second data partition, resulting in an adjusted differential packet.
[0116] At this time, in the adjusted differential packet, the difference data is located before the control information, and then the third space size required to store the control information (for example, 10k) and the fourth space size required to store the difference data (for example, 50k) are determined, and the target space size is the sum of the third space size and the fourth space size.
[0117] A first difference 40k between the first space size 50k and the third space size 10k is calculated, the first difference representing the amount of differential data stored in the first storage area, based on the first difference, a second difference 10k between the fourth space size 50k and the first difference 40k is calculated, the second difference representing the amount of differential data stored in the available storage space, based on the second difference 10k, the adjusted differential package is parsed according to the front and back positions of the data partitions in the differential package, the second data (10k) obtained by first parsing the differential data with a data amount equal to the second difference 10k is stored in the available storage space, and the first data (40k) other than the second data parsed later is stored in the first storage area. In this way, the differential data stored in the available storage space is the differential data first parsed when parsing the differential package. During the upgrade, on the one hand, the differential data is first read from the available storage space in the order of data parsing. While reading and upgrading, the differential data read in the available storage space is deleted. Therefore, when the target software is upgraded accordingly based on the read data, the data obtained by the upgrade operation can be stored in the second storage area in sequence.
[0118] On the other hand, if the storage space required for the upgraded target version of the firmware is 140k, which is larger than the storage space required for the current version of the firmware, when performing the corresponding upgrade operation on application a based on the difference data in the available storage space, the data obtained by the upgrade operation can be first stored in the storage space other than the available storage space in the first storage area (the storage space corresponding to 120k), and the data with a data volume greater than 120k can be stored in the available storage space (the storage space corresponding to the deleted and read data) to ensure that the second storage area can store the target version of the firmware.
[0119] After the target software is upgraded through the above steps, a reference program of the target version is obtained. At this time, the upgraded application program a is a 3.0 version application program.
[0120] 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 5 As shown, the software upgrading device 20 includes a differential packet acquiring module 210 , a differential packet storing module 220 and an upgrading module 230 .
[0121] Among them, the differential package acquisition module 210 is used to respond to the upgrade request for the target software, obtain the differential package corresponding to the target software, and determine the target space size required to store the differential package; the differential package storage module 220 is used to store the differential package in the first storage area when the target space size is not greater than the first space size of the first storage area, and the first storage area is a storage space for storing the differential package; when the target space size is greater than the first space size, the second space size of the available storage area of the second storage area is determined, and when the sum of the second space size and the first space size is not less than the target space size, the differential package is stored in the available storage area and the first storage area, and the second storage area is a storage space for storing the firmware of the target software; the upgrade module 230 is used to upgrade the target software based on the differential package.
[0122] The solution provided by the embodiment of the present application determines the target space size required to store the differential package corresponding to the target software when the target software needs to be upgraded, that is, in response to an upgrade request for the target software. When the first space size of the first storage area (such as the upgrade area) used to store the differential package is smaller than the target space size required to store the differential package corresponding to the target software, and the target space size is not greater than the sum of the first space size and the second space size of the second storage area (such as the firmware area), the differential package is stored using the available storage space of the first storage area and the second storage area. In this way, when the storage resources on the upgrade area side are limited, the available storage resources of the firmware area can be fully utilized to store the differential package, maximizing the storage resources and achieving the storage of the differential package to complete the upgrade of the target software.
[0123] Optionally, the above-mentioned upgrade request includes a version identifier of the firmware of the target software, and the above-mentioned differential package is determined in the following manner: based on the version identifier, determining the current version of the firmware of the target software and the target version of the firmware corresponding to the target software; based on the current version of the firmware and the target version of the firmware, determining the header file included in the differential package, the control information for controlling the restoration of the target version of the firmware, and the differential data for upgrading, wherein the header file includes a space size identifier for characterizing the size of the storage space required to store the differential package; and generating a differential package based on the header file, the control information, and the differential data.
[0124] Optionally, when determining the target space size required to store the differential packet, the differential packet acquisition module 210 is specifically configured to: parse the differential packet to obtain control information and differential data; determine the third space size required to store the control information, and the fourth space size required to store the differential data, where the target space size is the sum of the third space size and the fourth space size. When storing the differential packet in the available storage space and the first storage area, the differential packet storage module 220 is specifically configured to: calculate a first difference between the first space size and the third space size; store the control information in the first storage area, store first data in the differential data whose data volume is equal to the first difference in the first storage area, and store second data in the differential data other than the first data in the available storage space.
[0125] Optionally, when the differential packet storage module 220 stores the first data in the differential data whose data volume is equal to the first difference value in the first storage area and stores the second data in the differential data excluding the first data in the available storage space, it is specifically used to: calculate the second difference between the fourth space size and the first difference value; store the second data in the differential data whose data volume is equal to the second difference first parsed in the order of data parsing in the available storage space, and store the first data excluding the second data parsed later in the first storage area. When upgrading the target software based on the differential packet, the upgrade module 230 is specifically used to: read the differential data in the available storage space in the order of data parsing based on the control information in the first storage area, and perform corresponding upgrade operations on the target software based on the read data; delete the differential data that has been read in the available storage space, and store the data obtained by the upgrade operation in the second storage area.
[0126] Optionally, when parsing the differential packet to obtain the control information and the difference data, the differential packet obtaining module 210 is specifically configured to: adjust the position of the first data partition where the control information is located in the differential packet to after the position of the second data partition where the difference data is located; and parse the adjusted differential packet according to the front and back positions of the data partitions in the differential packet to obtain the control information and the difference data;
[0127] When storing the differential packet in the available storage space and the first storage area, the above-mentioned differential packet storage module 220 is specifically used to: store the control information in the first storage area, and in the order of difference data parsing, store the data obtained by parsing the adjusted differential packet first and whose data amount is equal to the second difference value in the available storage space, and store the data parsed later in the first storage area.
[0128] Optionally, when determining the target space size required for storing the differential package, the differential package acquisition module 210 is specifically used to: parse the header file of the differential package to obtain a space size identifier; and determine the target space size required for storing the differential package based on the space size identifier.
[0129] Optionally, when storing the differential package in the available storage space and the first storage area, the differential package storage module 220 is specifically used to: parse the differential package to obtain the parsed data; store the third data in the parsed data whose data volume is equal to the size of the second space in the available storage space; and store the fourth data in the parsed data except the third data in the first storage area.
[0130] Optionally, if the target space size is larger than the sum of the second space size and the first space size, the device further includes: a prompt module (not shown), configured to generate and display a prompt message, wherein the prompt message is used to indicate that the upgrade is impossible.
[0131] The software upgrade device of the embodiment of the present application can execute the software upgrade method provided by the embodiment of the present application, and its implementation principle is similar. The actions performed by each module and unit 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 the detailed functional description of each module of the video playback device, please refer to the description in the corresponding software upgrade method shown in the previous text, and will not be repeated here.
[0132] The above-mentioned software upgrading device can be a computer program (including program code) running in a computer device, for example, the display device of the user interface is an application software; the device can be used to execute the corresponding steps in the method provided in the embodiment of the present application.
[0133] In some embodiments, the software upgrade device provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the software upgrade device provided by the embodiment 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 embodiment 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.
[0134] In other embodiments, the software upgrade device provided by the embodiment of the present invention can be implemented in software. The software upgrade device stored in the memory can be software in the form of programs and plug-ins, and includes a series of modules, including each module in the software upgrade device 20, wherein each module in the software upgrade device 20 is used to implement the software upgrade method provided by the embodiment of the present invention.
[0135] The embodiment of the present application provides a software upgrade device. Compared with the prior art, when the target software needs to be upgraded, that is, in response to an upgrade request for the target software, the target space size required to store the differential package corresponding to the target software is determined. When the first space size of the first storage area (such as the upgrade area) used to store the differential package is smaller than the target space size required to store the differential package corresponding to the target software, and the target space size is not greater than the sum of the first space size and the second space size of the second storage area (such as the firmware area), the differential package is stored using the available storage space of the first storage area and the second storage area. In this way, when the storage resources on the upgrade area side are limited, the available storage resources of the firmware area can be fully utilized to store the differential package, maximizing the storage resources and achieving the storage of the differential package to complete the upgrade of the target software.
[0136] The above describes the software upgrade device of the present application from the perspective of a virtual module or a virtual unit. The following describes the electronic device of the present application from the perspective of a physical device.
[0137] 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.
[0138] As an alternative, Figure 6 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 6 As shown, Figure 6 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 may 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, the number of transceivers 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0139] 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, and the like.
[0140] 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. Bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0141] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, 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.
[0142] The memory 4003 is used to store the application code (computer program) for executing the solution of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.
[0143] 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.
[0144] 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.
[0145] 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.
[0146] 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, obtaining a differential package corresponding to the target software and determining a target space size required to store the differential package; If the target space size is not greater than the first space size of the first storage area, storing the differential package in the first storage area, where the first storage area is a storage space for storing differential packages; If the target space size is larger than the first space size, determining a second space size of the available storage space of the second storage area; if the sum of the first space size and the second space size is not smaller than the target space size, storing the differential package in the available storage space and the first storage area, where the second storage area is a storage space for storing the firmware of the target software; Upgrading the target software based on the differential package; The storing the differential packet into the available storage space and the first storage area includes: Storing the control information in the first storage area, storing the first parsed data whose amount of parsed data is equal to the second difference in the available storage space according to the order of parsing the difference data, and storing the data parsed later in the first storage area; The second difference is the difference between the fourth space size required for storing the difference data and the first difference, and the first difference is the difference between the first space size and the third space size required for the control information; The control information and the difference data are obtained by parsing the difference packet as follows: Adjusting the position of the first data partition where the control information is located in the differential packet to after the position of the second data partition where the difference data is located; The adjusted differential packet is parsed according to the front and back positions of the data partitions in the differential packet to obtain the control information and the difference data.
2. The method according to claim 1, characterized in that The upgrade request includes the version identifier of the firmware of the target software, and the differential package is determined in the following manner: Determining, based on the version identifier, a current version of the firmware of the target software and a target version of firmware corresponding to the target software; Determining, based on the current version of the firmware and the target version of the firmware, a header file, control information for controlling the restoration of the target version of the firmware, and differential data for upgrading, included in the differential package, wherein the header file includes a space size identifier for indicating the size of storage space required to store the differential package; The differential packet is generated based on the header file, the control information and the difference data.
3. The method according to claim 2, characterized in that The determining of the target space size required to store the differential packet includes: Parsing the differential packet to obtain the control information and the difference data; A third space size required for storing the control information and a fourth space size required for storing the difference data are determined, and the target space size is the sum of the third space size and the fourth space size.
4. The method according to claim 3, characterized in that The upgrading of the target software based on the differential package includes: Based on the control information in the first storage area, the difference data in the available storage space is read in the order of data parsing, and a corresponding upgrade operation is performed on the target software based on the read data; The read difference data in the available storage space is deleted, and the data obtained by the upgrade operation is stored in the second storage area.
5. The method according to any one of claims 2 to 4, characterized in that The determining of the target space size required to store the differential packet includes: Parsing the header file of the differential packet to obtain the space size identifier; Based on the space size identifier, a target space size required to store the differential packet is determined.
6. The method according to claim 1, characterized in that The storing the differential packet into the available storage space and the first storage area includes: Parsing the differential packet to obtain parsed data; The third data in the parsed data having a data volume equal to the size of the second space is stored in the available storage space; and the fourth data in the parsed data except the third data is stored in the first storage area.
7. A software upgrade device, characterized in that: include: 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 and determine a target space size required to store the differential package; a differential package storage module, configured to store the differential package in the first storage area when the target space size is not greater than the first space size of the first storage area, where the first storage area is a storage space for storing differential packages; When the target space size is larger than the first space size, determining a second space size of an available storage area of a second storage area; when the sum of the second space size and the first space size is not smaller than the target space size, storing the differential package in the available storage area and the first storage area, where the second storage area is a storage space for storing firmware of the target software; An upgrade module, configured to upgrade the target software based on the differential package; The differential packet storage module, when used to store the differential packet in the available storage area and the first storage area, is specifically used to: Storing the control information in the first storage area, storing the first parsed data whose amount of parsed data is equal to the second difference in the available storage space according to the order of parsing the difference data, and storing the data parsed later in the first storage area; The second difference is the difference between the fourth space size required for storing the difference data and the first difference, and the first difference is the difference between the first space size and the third space size required for the control information; The control information and the difference data are obtained by parsing the difference packet as follows: Adjusting the position of the first data partition where the control information is located in the differential packet to after the position of the second data partition where the difference data is located; The adjusted differential packet is parsed according to the front and back positions of the data partitions in the differential packet to obtain the control information and the difference data.
8. 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 6 when running the computer program.
9. 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 6.
Citation Information
Patent Citations
Software upgrading method and system
CN103577202A
Method and device for subarea dynamic adjustment of embedded system
CN104077234A
Terminal software upgrading method and device
CN104932909A