Software upgrading method and device and storage medium

By generating differential incremental packages and evaluating upgrade time, the problems of long, unstable and insufficient software upgrade time in the prior art are solved, and a more efficient and secure software upgrade process is achieved.

CN119829112APending Publication Date: 2025-04-15FOSS (HANGZHOU) INTELLIGENT TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510071857.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing software upgrade technology has problems such as long upgrade time, instability, high risk of failure, and insufficient security and effectiveness.

Method used

By obtaining the new version and old version data packets of the target software of the target terminal, generating differential increment packages, evaluating the upgrade time, and generating an upgrade policy set when preset conditions are met, to achieve software upgrade from the old version to the new version.

Benefits of technology

It reduces the amount of data transmission during the software upgrade process, improves the upgrade efficiency, and enhances the security and reliability of the upgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829112A_ABST
    Figure CN119829112A_ABST
Patent Text Reader

Abstract

The invention discloses a software upgrading method and device and a storage medium, and relates to the technical field of software upgrading. The method comprises the following steps: acquiring a new version data packet and an old version data packet of target software of a target terminal; based on the new version data packet and the old version data packet, generating a difference increment packet which is used for representing data difference information of the new version data packet and the old version data packet; evaluating the upgrading time of the difference increment packet and the upgrading time of the new version data packet to obtain an evaluation result; when it is determined that the evaluation result meets the preset condition, an upgrading strategy set is generated, and the upgrading strategy set is used for upgrading the target software from the old version to the new version. According to the technical scheme, the data transmission amount in the software upgrading process is reduced and the upgrading efficiency is improved by setting the upgrading mode of the differential increment package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software upgrading, and in particular to a software upgrading method, device and storage medium. Background Art

[0002] With the rapid development of science and technology and the rapid iteration of smart products, in order to provide users with sustainable updates and optimized services, or to repair some known problems, the software of the vehicle system is often upgraded; and the number of cars in the world is increasing. This large-scale system upgrade will also expose some problems that affect customer experience due to the huge amount of data, such as long upgrade time, unstable upgrade, and upgrade failure. At the same time, there may also be some security risks caused by unofficial upgrades; therefore, improving customer experience, improving upgrade efficiency, and enhancing software upgrade security is a relatively important research topic.

[0003] In the prior art, software is usually upgraded by upgrading the complete data packet. As the iterative data packet of the software increases, the upgrade time will become longer and longer. The differential method is used to solve the problems of long upgrade duration and low efficiency. However, the software that needs to be updated is refreshed and overwritten. If the upgrade fails, it will cause the system to crash. In addition, the security and effectiveness of the upgrade are not considered.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a software upgrade method, device and storage medium to at least solve the technical problems of poor security and low efficiency of software upgrade in related technologies.

[0006] According to one aspect of an embodiment of the present invention, a software upgrade method is provided, comprising the following steps: obtaining a new version data packet and an old version data packet of a target software of a target terminal; generating a differential incremental packet based on the new version data packet and the old version data packet, the differential incremental packet being used to represent data difference information between the new version data packet and the old version data packet; evaluating the upgrade time of the differential incremental packet and the upgrade time of the new version data packet to obtain an evaluation result; and generating an upgrade strategy set when it is determined that the evaluation result meets a preset condition, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version.

[0007] Optionally, when it is determined that the evaluation result meets preset conditions, an upgrade strategy set is generated, including: when it is determined that the upgrade time of the differential incremental package is less than the upgrade time of the new version data package, generating the first strategy in the upgrade strategy set based on the differential incremental package, wherein the first strategy is used to upgrade the target software from the old version to the new version.

[0008] Optionally, when it is determined that the evaluation result meets preset conditions, an upgrade strategy set is generated, including: when it is determined that the upgrade time of the new version data packet is less than or equal to the upgrade time of the differential incremental package, a full package is generated based on the new version data packet according to the differential rule, and the full package includes all data of the new version data packet; based on the full package, a second strategy in the upgrade strategy set is generated, wherein the second strategy is used to upgrade the target software from the old version to the new version.

[0009] Optionally, a differential incremental package is generated based on the new version data packet and the old version data packet, including the following steps: dividing the data in the old version data packet into multiple data blocks, and determining the hash value of each data block, wherein the size of the data block is smaller than the coverage line size; using a coverage line matching method and a hash value calculation method to perform data comparison on the new version data packet and the old version data packet to generate a differential incremental package, the differential incremental package at least including differential control information and differential data information, the differential data information is used to represent difference data, the differential control information is used to represent a data reading method during the software upgrade process, and the data reading method is at least used to guide the data reading position and the data reading length.

[0010] Optionally, based on the differential incremental package, a first strategy in the upgrade strategy set is generated, wherein the first strategy is used to upgrade the target software from an old version to a new version, and includes the following steps: performing data restoration according to differential control information, differential data information and old version data information, and writing the restored data into a backup partition of the target terminal, the backup partition being different from the partition where the old version of the target software is located; after completing the restoration of all data, verifying whether the data in the backup partition is correct; and when determining that the data in the backup partition is correct, switching the backup partition to an enabled partition of the target software to upgrade the target software from the old version to the new version.

[0011] Optionally, data restoration is performed based on the differential control information, differential data information and old version data information, and the restored data is written to the backup partition of the target terminal, including the following steps: data restoration is performed based on the differential control information, differential data information and old version data information, and the restored data is written to the secondary cache, where the secondary cache is an empty data cache obtained from the primary cache queue; when the secondary cache is full, the secondary cache is returned to the primary cache queue; when it is determined that there is a full secondary cache in the primary cache queue, the data in the full secondary cache is written to the backup partition.

[0012] Optionally, a coverage line matching method and a hash value calculation method are used to compare the new version data packet with the old version data packet to generate a differential incremental packet, including the following steps: dividing the new version data packet into multiple operation data blocks, wherein the size of the operation data block is larger than the coverage line size; comparing each operation data block with the old version data packet to generate a differential incremental packet, wherein the differential incremental packet includes at least header information, differential control information of each operation data block, and differential data information of the operation data block, wherein the header information includes at least version information of the new version data packet, verification information, and block information of the new version data packet, wherein the block information includes at least block number information and matching information, and the matching information is used to represent the matching rules between the operation data block and the differential control information and the differential data information.

[0013] Optionally, data restoration is performed according to the differential control information, the differential data information and the old version data information, and the restored data is written to the backup partition of the target terminal, including the following steps: based on the block number information of the header information of the differential incremental packet, a preset number of data cache threads is created, and a preset number of cache resources are configured, wherein the preset number is the same as the number of blocks of the new version data packet; based on the block information of the header information, the differential data information and differential control information corresponding to the data cache thread are obtained; based on the old version data information, the corresponding differential data information and differential control information, data restoration is performed, and the restored data generated by the data cache thread is written to the specified location of the backup partition.

[0014] According to another aspect of an embodiment of the present invention, a software upgrade device is also provided, including: an acquisition module, the acquisition module is used to acquire a new version data packet and an old version data packet of a target software of a target terminal; an incremental package generation module, the incremental package generation module is used to generate a differential incremental package based on the new version data packet and the old version data packet, the differential incremental package is used to represent data difference information between the new version data packet and the old version data packet; an evaluation module, the evaluation module is used to evaluate the upgrade time of the differential incremental package and the upgrade time of the new version data packet to obtain an evaluation result; and a generation module, the generation module is used to generate an upgrade strategy set when it is determined that the evaluation result meets a preset condition, wherein the upgrade strategy set is used to upgrade the target software from an old version to a new version.

[0015] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned software upgrade method when running.

[0016] In an embodiment of the present invention, a new version data packet and an old version data packet of a target software of a target terminal are obtained; based on the new version data packet and the old version data packet, a differential incremental packet is generated, and the differential incremental packet is used to represent the data difference information between the new version data packet and the old version data packet; the upgrade time of the differential incremental packet and the upgrade time of the new version data packet are evaluated to obtain an evaluation result; when it is determined that the evaluation result meets the preset conditions, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version. By generating a differential incremental packet from the difference data between the new and old version data packets, the software is evaluated by using the differential incremental packet and the whole package to update the software, and the preset conditions are set. When the differential incremental packet update method meets the preset conditions, the differential incremental packet method is selected for software upgrade and update, otherwise the complete package method is selected for upgrade, that is, by setting the differential incremental packet upgrade method, the data transmission volume during the software upgrade process is reduced, and the upgrade efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0018] Figure 1 is a hardware structure block diagram of a computer terminal according to a software upgrading method according to one embodiment of the present invention;

[0019] Figure 2 is a flowchart of a software upgrading method according to one optional embodiment of the present invention;

[0020] Figure 3 is a structural block diagram of a software upgrading device according to one embodiment of the present invention;

[0021] Figure 4 is a flowchart of package upgrade according to one optional embodiment of the present invention;

[0022] Figure 5 is a flow chart of differential packaging according to one optional embodiment of the present invention;

[0023] Figure 6 is a schematic diagram of the structure of a differential data packet according to one optional embodiment of the present invention;

[0024] Figure 7 is a flowchart of differential restoration according to one optional embodiment of the present invention;

[0025] Figure 8 is a schematic diagram of a differential restoration process according to one optional embodiment of the present invention;

[0026] Fig. 9is a schematic diagram of a multi-device scenario according to one of the optional embodiments of the present invention;

[0027] Fig.10 is a schematic diagram of a multi-node scenario according to one of the optional embodiments of the present invention;

[0028] Fig.11 is a schematic diagram of a cover line according to one optional embodiment of the present invention;

[0029] Fig.12 is a schematic diagram of a cover line according to an optional embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0033] Covering line idea: Covering line idea is a technical strategy used in data processing, especially in the field of data differentiation and compression.

[0034] Hash algorithm: An algorithm that maps a message or data of arbitrary length to an output value of fixed length.

[0035] According to one embodiment of the present invention, an embodiment of a software upgrade method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] The method embodiment can be executed in a computer terminal or similar computing device including a memory and a processor. For example, if the method is executed on a computer terminal, Figure 1 As shown, the computer terminal may include one or more processors 102 (the processor may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the above-mentioned computer terminal may also include a transmission device 106 for communication functions, an input and output device 108, and a display 110. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include more or fewer components than the above-mentioned structure description, or have a configuration different from the above-mentioned structure description.

[0037] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the software upgrade method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above-mentioned software upgrade method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0038] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0039] The display 110 may be, for example, a touch screen liquid crystal display (LCD). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contact and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.

[0040] This embodiment provides a software upgrade method running on the above-mentioned computer terminal. Figure 2 is a flowchart of a software upgrade method according to one embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0041] Step S21, obtaining a new version data packet and an old version data packet of the target software of the target terminal;

[0042] Specifically, the target software is the software that needs to be upgraded this time. The target software is stored in the target terminal. The target terminal can be a vehicle-mounted system or various system terminals such as a computer system. The old version data packet is the data packet currently used by the target software, and the new version data packet is the target data packet to which the target software needs to be updated this time.

[0043] In step S21, obtaining accurate new version data packets and old version data packets is a prerequisite for ensuring that subsequent software is accurately upgraded to the target data packets. Obtaining the old version data packet requires determining the location where the software version is stored, extracting the software data packet based on the software version identifier, and determining the new version data packet.

[0044] Step S22, generating a differential incremental packet based on the new version data packet and the old version data packet, where the differential incremental packet is used to represent data difference information between the new version data packet and the old version data packet;

[0045] Specifically, the new version data packet and the old version data packet have been completely retrieved and stored on the terminal or server. Through data comparison tools or algorithms, the new version data packet is compared byte by byte with the old version data packet, and the position and length of the mismatched parts between the new and old version data packets are recorded to form difference information, that is, differential data information.

[0046] In step S22, the difference information (differential data information) is stored in the form of a differential incremental package. In addition to representing the data difference information between the new version data packet and the old version data packet, the differential incremental package can also facilitate subsequent data packaging, verification, distribution, analysis and application.

[0047] It should be noted that the use of differential incremental packages can accurately represent the differences between the new and old versions, which can significantly reduce the amount of data transmission while ensuring the correctness and security of software upgrades, improve upgrade efficiency, and reduce the demand for storage resources.

[0048] Step S23, evaluating the upgrade time of the differential incremental package and the upgrade time of the new version data package to obtain an evaluation result;

[0049] Specifically, upgrading from an old version to a new version can be done by performing a differential upgrade on differential data packets or by performing a complete upgrade on the entire data packet. The evaluation results are used to evaluate the time required for the two upgrade methods to determine which upgrade method requires a shorter upgrade time. The more efficient upgrade method is then used to improve data upgrade efficiency.

[0050] In step S23, the evaluation result evaluates the upgrade time, including a comprehensive evaluation of network transmission time, local processing time, storage writing time, verification time, etc., that is, the time used for each step of the data packet upgrade is added to obtain the total upgrade time, and the total upgrade time is compared to determine which upgrade method is more efficient.

[0051] It should be noted that based on the comprehensive evaluation of the above time, the two different data packet upgrade methods will be affected by network conditions, terminal processing capabilities, storage device read and write speeds, and the size of the software differential data packet and the overall data packet.

[0052] Step S24: if it is determined that the evaluation result meets the preset condition, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version.

[0053] Specifically, the preset conditions are standards for evaluating the upgrade time of differential incremental packages and the upgrade time of complete new version data packets, which are used to determine the upgrade method for the target software from an old version to a new version. The conditions for the upgrade standards can be set artificially, specifically by setting time thresholds, data integrity and security, storage efficiency, hardware resources, network conditions and other upgrade standards, and by evaluating whether the upgrade method of the differential incremental package and the upgrade method of the new version data packet meet the preset conditions, a corresponding upgrade policy set is generated.

[0054] In step S24, when the differential incremental package upgrade method meets the preset conditions, a corresponding upgrade strategy set is generated. The strategy set includes steps such as differential incremental package generation, packaging, transmission, parsing, data restoration, verification and partition switching to ensure the security and efficiency of the upgrade process; if the differential incremental package does not meet the preset conditions, a complete package upgrade strategy set is generated to directly download and apply the entire new version data package to ensure the reliability of the upgrade first.

[0055] Through the above steps, the new version data packet and the old version data packet of the target software of the target terminal are obtained; based on the new version data packet and the old version data packet, a differential incremental packet is generated, and the differential incremental packet is used to represent the data difference information between the new version data packet and the old version data packet; the upgrade time of the differential incremental packet and the upgrade time of the new version data packet are evaluated to obtain the evaluation result; when it is determined that the evaluation result meets the preset conditions, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version. By generating a differential incremental packet from the difference data between the new and old version data packets, the software is evaluated by using the differential incremental packet and the overall package to update the software, and the preset conditions are set. When the differential incremental package update method meets the preset conditions, the differential incremental package method is selected for software upgrade, otherwise the complete package method is selected for upgrade, that is, by setting the differential incremental package upgrade method, the data transmission volume during the software upgrade process is reduced and the upgrade efficiency is improved.

[0056] Optionally, in step S24, when it is determined that the evaluation result meets a preset condition, an upgrade strategy set is generated, including:

[0057] Step S241, when it is determined that the upgrade time of the differential incremental package is less than the upgrade time of the new version data package, generate the first strategy in the upgrade strategy set based on the differential incremental package, wherein the first strategy is used to upgrade the target software from the old version to the new version.

[0058] Specifically, the first strategy is based on the efficient and secure upgrade characteristics of differential incremental packages, and will upgrade the target software from the old version to the new version through differential incremental package upgrades. The premise for generating the first strategy is that the differential incremental package upgrade method meets the preset conditions based on the evaluation results, that is, based on the differential incremental package, only the differential incremental package can be upgraded and updated, combined with the old version of the target software, to the new version.

[0059] In this embodiment, after the first strategy is generated, the first strategy is executed to download the differential incremental package to the memory or cache of the target device. After downloading, the integrity of the differential incremental package is verified, and then the cache is initialized, differential data is parsed and written, and other subsequent update steps are performed. The first strategy aims to ensure that software upgrades are both efficient and secure, while providing a good user experience, so that the target software can be quickly and reliably updated from the old version to the new version.

[0060] Optionally, in step S24, when it is determined that the evaluation result meets a preset condition, an upgrade strategy set is generated, including:

[0061] Step S242, when it is determined that the upgrade time of the new version data packet is less than or equal to the upgrade time of the differential incremental packet, a full packet is generated based on the new version data packet according to the differential rule, and the full packet includes all data of the new version data packet;

[0062] Specifically, according to the differential rule, when the time taken to upgrade the differential data using the differential incremental package is greater than the time taken for the overall update, a full package is generated based on the new version data package to upgrade and update all data in the new version data package.

[0063] It should be noted that when a software update contains a large number of new features, or the search for the coverage line between the new and old versions fails or is inefficient, hardware resources are limited, the cost of generating differential incremental packages is too high, or network transmission conditions are poor, choose to generate a full package and upgrade all the data in the new version data package to balance the upgrade efficiency, resource consumption and security, and ensure that the software update can be carried out in the most effective way. The update strategy of using the full package to perform software upgrades can be used as a substitute software upgrade update strategy. When the differential incremental package upgrade solution is not used, the full package method is used for software upgrades.

[0064] Step S243: Generate a second strategy in the upgrade strategy set based on the full package, wherein the second strategy is used to upgrade the target software from the old version to the new version.

[0065] Specifically, the second strategy is based on the safe and complete upgrade characteristics of differential incremental packages, and will upgrade the target software from the old version to the new version through a full package upgrade. The premise for generating the second strategy is that the differential incremental package upgrade method does not meet the preset conditions based on the evaluation results, that is, based on the full package, all the software data is upgraded to the new version as a whole.

[0066] In this embodiment, after the second strategy is generated, the second strategy is executed to download and transmit the full package and optimize it, and sufficient storage space and cache resources are pre-allocated to ensure that the full package can be quickly received and temporarily stored, and then the integrity check of the full package is performed to ensure the security and integrity of the data, and then the subsequent update steps such as initialization cache, differential full data parsing and writing are performed. Through the second strategy, the full package can be used to complete the software update as quickly and safely as possible to improve the user experience.

[0067] Optionally, in step S22, generating a differential incremental package based on the new version data package and the old version data package includes the following steps:

[0068] Step S221, dividing the data in the old version data packet into a plurality of data blocks, and determining a hash value of each data block, wherein the size of the data block is smaller than the size of the coverage line;

[0069] Specifically, the data of the old version data packet is divided into multiple data blocks, that is, the data in the data packet is divided into multiple comparison units for easy data comparison; the hash value of each data block is determined to facilitate rapid acquisition of preliminary comparison results between the new and old version data packets during subsequent data comparison.

[0070] It should be noted that the data block size is set to be smaller than the preset coverage line size. The length of the coverage line is determined based on a comprehensive consideration of the software package size and performance requirements. A smaller data block size can easily find the part corresponding to the coverage line in the new version of the data package, which helps to identify the same sequence more finely and accurately, thereby achieving a higher compression ratio when packaging differential packages.

[0071] Step S222, using the coverage line matching method and the hash value calculation method, compares the new version data packet and the old version data packet to generate a differential incremental packet, the differential incremental packet includes at least differential control information and differential data information, the differential data information is used to represent the difference data, the differential control information is used to represent the data reading method in the software upgrade process, the data reading method is at least used to guide the data reading position and the data reading length.

[0072] Specifically, the old version data packet is divided into multiple data blocks, and the hash value of each data block is calculated. Starting from the starting position of the new version data packet, the window size with the same or similar data block size is slid, and the hash value of the data in the window is calculated and compared with the hash value of the data block in the old version data packet; when the hash values ​​of the new and old version data packets match, further check whether the data in the window is exactly the same to eliminate hash conflicts; if the data matches completely, record the matching position and length as differential control information; if the data does not match, record the data sequence as differential data information; then generate a differential incremental packet based on the differential control information and the differential data information.

[0073] In one embodiment of the present application, the old version data packet is first divided into multiple data blocks according to half the length of the coverage line. Assuming that the data block size is uniformly 1 byte, starting from the starting position of the new version data packet, a 1-byte window is used to slide, and a hash value is calculated for the data in the current window and compared with the hash value of the old version data block. Then the window slides backward 1 byte to obtain new data, and the hash value is recalculated and compared with the hash value of the old version. The sliding and comparison steps are repeated until the comparison value meets the mismatch condition, and the differential information is recorded.

[0074] Optionally, in step S241, based on the differential incremental package, a first strategy in the upgrade strategy set is generated, wherein the first strategy is used to upgrade the target software from the old version to the new version, including the following steps:

[0075] Step S2411, performing data restoration according to the differential control information, the differential data information and the old version data information, and writing the restored data into a backup partition of the target terminal, the backup partition being different from the partition where the old version of the target software is located;

[0076] Specifically, the differential data and differential control information provided in the differential incremental package are combined with the old version data information to perform data restoration to recover the complete data of the new version of the software. The restored data is written to the backup partition of the target terminal to retain the complete data of the new version of the software during the upgrade process. When upgrading and updating, only the differences between the old and new versions can be transmitted and applied, rather than all the data of the entire software package, thereby significantly reducing the network bandwidth and storage space required for the upgrade.

[0077] In step S2411, after the target terminal receives the differential incremental packet, it parses the differential control information in the packet to obtain the type, read position and read length of the read data. The differential data information contains a data sequence in the new version that does not exist in the old version. The target terminal writes it to the backup partition according to the instructions of the differential control information.

[0078] It should be noted that the backup partition is a storage space independent of the partition where the currently running software is located. Writing data to the backup partition can prevent data from being overwritten or damaging the running software during the upgrade process, ensuring that you can still return to the old version when the upgrade fails and maintain the original functions, thus ensuring stability and security during the upgrade process.

[0079] Step S2412, when all data restoration is completed, verify whether the data in the backup partition is correct;

[0080] Specifically, verifying the data in the backup partition includes data integrity verification, file structure verification, data consistency verification and function verification. Verifying the correctness of the data in the backup partition can ensure the integrity and correctness of the version software data before upgrading.

[0081] Step S2413, when it is determined that the data in the backup partition is correct, the backup partition is switched to the activation partition of the target software, so that the target software is upgraded from the old version to the new version.

[0082] Specifically, after confirming that the data is correct, perform partition switching, stop the services and applications currently running on the old version, point the startup of the loader to the backup partition, update the startup information and configuration files, and after completing the partition switching, restart the system to load the new version of the software.

[0083] In step S2413, switching the backup partition to the enabled partition of the target software can ensure a smooth transition of the new version of the software, provide users with a seamless upgrade experience, and reduce system downtime caused by upgrade failures.

[0084] Optionally, in step S2411, data restoration is performed according to the differential control information, the differential data information and the old version data information, and the restored data is written into the backup partition of the target terminal, including the following steps:

[0085] Step S24111, performing data restoration according to the differential control information, the differential data information and the old version data information, and writing the restored data into the secondary cache, where the secondary cache is an empty data cache obtained from the primary cache queue;

[0086] Specifically, before data restoration, the pre-allocation of the first-level cache queue and the idle state of the second-level cache must be ensured. The first-level cache queue usually contains multiple empty cache units, which can be taken out of the queue and used as the second-level cache. The restored data is written to the second-level cache, and the multi-level cache mechanism is used to reduce the number of direct accesses to the hardware storage, thereby improving the performance of the overall upgrade process.

[0087] It should be noted that, according to the instructions of the differential control information, the system reads specified data fragments from the differential data information and the old version data information, combines the read data according to its position and length in the new version to construct a complete file or data block, and writes the combined data into the secondary cache.

[0088] Step S24112, when the L2 cache is full, returning the L2 cache to the L1 cache queue;

[0089] Specifically, when the data restoration thread writes data to the secondary cache, it will continuously monitor the cache filling status. When the secondary cache reaches the preset full state, it will stop writing data. After confirming that the secondary cache is full, the secondary cache is returned to the primary cache queue. When it is returned, the data in it is emptied and used again for other data restoration threads.

[0090] Step S24113: When it is determined that there is a full L2 cache in the L1 cache queue, the data in the full L2 cache is written into the backup partition.

[0091] Specifically, when the L2 cache is returned to the L1 cache queue, the data in the cache is simultaneously written into the backup partition, and the L1 cache queue simultaneously updates its state and adds the released L2 cache unit back into the queue.

[0092] It should be noted that the first-level cache queue is a temporary storage area used to quickly store and process data during differential data restoration. In the differential restoration process, the first-level cache queue contains multiple cache blocks, each of which can be used as a second-level cache space to temporarily store the data of the current thread's real-time differential restoration. When the second-level cache (i.e., the cache block in the first-level cache) is full, it will be returned to the first-level cache queue. The backup partition is a persistent storage area for storing differential restoration results. During the software upgrade process, the new version data will be restored and written to the backup partition to ensure the integrity of the original version of the software and the rollback of the upgrade process (i.e., when the upgrade fails, it can be quickly restored to the old version) to avoid the situation where the software cannot work due to an upgrade failure.

[0093] A highly efficient collaborative working relationship of data processing and storage pipeline is formed between the first-level cache queue and the backup partition, which ensures fast data processing and security during the upgrade process, thus achieving efficient optimization of the software upgrade process.

[0094] In this embodiment, a multi-threaded, multi-level cache mechanism is adopted, and multiple data restoration threads can work in parallel at the same time, and the work will be repeated continuously until all the data to be upgraded is restored and written to the backup partition. Through the multi-threaded and multi-level cache mechanism, the differential upgrade solution can effectively manage and utilize cache resources, ensure the fast writing of data, and reduce the number of system calls and hardware accesses, thereby greatly shortening the upgrade time. Through this mechanism, differential upgrade can not only handle the efficient transmission and storage of large-scale data, but also provide a fast, reliable and user-friendly upgrade experience while ensuring data integrity and correctness.

[0095] Optionally, in step S222, a coverage line matching method and a hash value calculation method are used to compare the new version data packet with the old version data packet to generate a differential incremental packet, including the following steps:

[0096] Step S2221, dividing the new version data packet into a plurality of operation data blocks, wherein the size of the operation data block is larger than the size of the coverage line;

[0097] Specifically, the coverage line size is the minimum data length used to identify the same sequence in the new and old versions. The size of the operation data block is larger than the coverage line size, which can improve search efficiency, reduce system calls, and simplify data restoration. Based on the coverage line size, the new version data packet is divided into multiple operation data blocks. According to the number of blocks of the data packet, a corresponding number of processing threads are created. Each thread is responsible for processing the differential matching and data restoration tasks of an operation data block.

[0098] Step S2222, perform data comparison on each operation data block and the old version data packet to generate a differential incremental packet, the differential incremental packet includes at least header information, differential control information of each operation data block and differential data information of the operation data block, wherein the header information includes at least version information of the new version data packet, verification information, and block information of the new version data packet, wherein the block information includes at least block number information and matching information, and the matching information is used to represent the matching rules between the operation data block and the differential control information and the differential data information.

[0099] Optionally, the old version data packet is divided into blocks of fixed size, and then divided into a series of large blocks according to the size of the new version data packet. The size of each large block is the same as the block of the old version data packet. The old version data packet generates a hash value through hash calculation. At the same time, the new version data block is also hashed, and the generated hash value is compared and matched with the old version to generate a differential incremental packet.

[0100] It should be noted that by comparing the hash values ​​of each operation data block and the old version data packet, when the hash value of an operation data block in the new version is the same as the hash value of the data block at the corresponding position in the old version data packet, it indicates that the data block is exactly the same in the new and old versions, which means that this part of the data does not need to be transmitted in the differential incremental packet and can continue to be applied to the old version directly; if the hash values ​​of the new and old data are different, it means that there are differences between the data blocks in the new and old versions. At this time, the part of the data in the new version will be retained, and the corresponding identical part in the old version does not need to be retained.

[0101] In this embodiment, the hash value matching is similar to that of the old version. When the hash values ​​of the new and old data packets match, it is further checked whether the data in the window is exactly the same to eliminate hash conflicts. If the data completely matches, the matching position and length are recorded as differential control information. If the data does not match, the data sequence is recorded as differential data information. Then a differential incremental packet is generated based on the differential control information and the differential data information.

[0102] In one embodiment of the present application, the differential incremental packet includes header information, differential control information and differential data information. The header information includes version information, verification information and block information of the new version data packet. The block information includes how many operation data blocks the new version data packet is divided into, as well as the matching rules of each operation data block and the location of the corresponding differential information; the differential control information includes the starting position and starting length of the operation data block, and the corresponding position in the old version data packet; the differential data information determines the amount of data that needs to be transmitted and processed during the upgrade process.

[0103] In this embodiment, the matching information is used to represent the matching rules between the operation data block in the new version data packet and the differential control information and the differential data information. When the differential control information indicates to read data from the old version data packet, the matching information provides the exact location of the data in the old version data packet and how it is aligned with the operation data block in the new version data packet.

[0104] Optionally, in step S2411, data restoration is performed according to the differential control information, the differential data information and the old version data information, and the restored data is written into the backup partition of the target terminal, including the following steps:

[0105] Step S24114: based on the block number information of the header information of the differential incremental packet, create a preset number of data cache threads and configure a preset number of cache resources, where the preset number is the same as the block number of the new version data packet;

[0106] Specifically, by creating threads with the same number of blocks as the new version of the data packet, each thread can independently process an operation data block, thereby realizing multi-threaded parallel operation; at the same time, a preset number of cache resources are configured to store the data deserialized from the differential incremental package and the matching data read from the old version of the data packet; the preset number of threads and cache resources is the same as the number of blocks of the new version of the data packet, ensuring smooth data flow and balanced data processing.

[0107] In step S24114, after the differential upgrade package is downloaded to the target terminal, the header information is parsed to obtain the number of blocks of the new version data packet, and a preset number of data cache threads are created according to the number of blocks and a preset number of cache resources are configured. The differential upgrade solution can effectively reduce the amount of data transmission and storage requirements, improve the upgrade efficiency, and ensure the security and accuracy of the upgrade. Each data cache thread independently processes an operation data block according to the guidance of the header information, realizes parallel operation, improves the processing speed of differential data, and shortens the upgrade time.

[0108] Step S24115, based on the block information of the header information, obtaining the differential data information and differential control information corresponding to the data cache thread;

[0109] Specifically, a first-level cache and a second-level cache resource are allocated to each data cache thread, and the data cache thread reads the differential data in the differential control information and the differential data information according to the address provided by the header information.

[0110] Step S24116, based on the old version data information, the corresponding differential data information and the differential control information, data restoration is performed, and the restored data generated by the data cache thread is written to the specified location of the backup partition.

[0111] Specifically, based on the differential control information, the thread reads data of specified position and length from the old version data or differential data, combines the data in the order of instructions, and generates corresponding data blocks in the new version data packet. After the data combination is completed and verified to be correct, the data cache thread writes the generated data blocks into the secondary cache. After all data blocks are restored and written to the backup partition, an integrity check is performed.

[0112] like Figure 4 As shown, the present application also provides a preferred embodiment of a software upgrade method, Figure 4 A flowchart of an optional software upgrade method.

[0113] Step 1: Select the old version and new version of the software that need to be differentially packaged from the software warehouse, and divide the old version of the software data into blocks according to the fixed blocksize (i.e. block size);

[0114] Among them, the new version of the software data is searched for matching the same blocks according to the same blocksize size data, so as to find the same sequences in the new and old versions. Such sequences can be found in the old version of the software, so they do not need to be packaged into the differential upgrade package.

[0115] Step 2: After all sequences that meet the requirements are found, record the unmatched sequences in the new version and the matching sequences in the old version, package the above sequence information according to specific rules, obtain the differential incremental package corresponding to the new and old versions, and record the key information in the header of the differential upgrade package;

[0116] Step 3: Evaluate the upgrade time of the differential package and the new version full package. If the upgrade time of the incremental package is longer than the upgrade time of the full package, generate a full package based on the differential rule.

[0117] Among them, the incremental package and the full package are not noticeable to the vehicle upgrade end, and both are written using differential rule analysis.

[0118] Step 4: When upgrading the vehicle, first download the differential upgrade package to the vehicle computer, and then establish relevant resources to serialize and deserialize the differential package based on the header information of the differential upgrade package, and write it to the backup partition;

[0119] Step 5: After all the data is written, perform a read-back verification to ensure that the written data is correct. After the verification passes, you can cut the partition and restart, and the upgrade is complete.

[0120] Figure 5 The flow chart for differential data packaging is as follows: Figure 5 As shown, differential data packaging is performed according to the following steps:

[0121] Step 1: Obtain the new version data packet and the old version data packet that need to be differentially packaged;

[0122] The format of the data packet is not limited, as long as the upgrade end can parse it.

[0123] Step 2: Based on the coverage line idea, find the same data sequence in the new version and the old version, and generate differential packets based on this;

[0124] Among them, based on the differentiated search and matching of the byte stream, if the complexity of unpacking and writing is not considered, the minimum coverage line length is selected, and in theory the smallest differential upgrade package can be generated. In practice, it is necessary to comprehensively consider the complexity and performance issues of unpacking, restoring and installing and writing. The length of the coverage line is determined to a reasonable value S based on the size of the software package.

[0125] Step 3: Find the same sequence of the new version and the old version data sequence, use the hash idea + sliding window to search, first divide the old version software data into blocks of size B, the value of B is half of the coverage line length, find all matching blocks that meet the coverage line length, and divide the last block into blocks according to the actual remaining size; calculate the hash value of each block size, and store the hash value and the corresponding block number in the hash table; the new version software will first evaluate the data size, and if the data is large, it will consider dividing the new version software into blocks;

[0126] The specific block division rules of the new version of the software are shown in Table 1 below. In Table 1, the coverage line length is planned according to the data size. The coverage line length increases in sequence from the bytes covered by B1 to B4, and the corresponding data size also increases. In actual operation, it can be adjusted according to the device memory resources.

[0127] Table 1:

[0128]

[0129] Step 4: After the new version is divided into large blocks, the starting position and length of each large block are recorded for subsequent packaging of header information;

[0130] Step 5: Repeat steps 3 and 4, take the B window size data from the starting position of the new version block, calculate the hash value, and check whether there is a match in the hash table of the old version information stored above. If there is no match, the window slides backward by bytes, and the hash is calculated and the match is found at the same time for each byte sliding. When matching, in order to avoid hash conflicts, it is necessary to further check whether the specific data in the window is the same. When the data in this window is completely matched, it means that the coverage line exists, and it is considered that there is consistent data before and after the window; take the B window size from the position after the end point of the coverage line, and continue to repeat the above search operation until the data of this new version block ends;

[0131] Among them, the front moves forward by sliding the window, so when searching forward to the window, you can compare by bytes (except the first window because there is no data in front), until the forward search stops when the bytes do not match, and the starting point of the coverage line can be recorded; the window does not know how long the data match is, so the window can move backward by step of window size B, and search for matches in the hash table at the same time. When the matching block number and the block number of the previous block are continuous, it indicates that the coverage line is continuous, and you can continue to move backward by step of window size B to match until the window data does not match, and then you can further compare backward by bytes at the starting position of the current mismatched window until you stop when it matches, that is, you have found the end point of the coverage line and recorded the information.

[0132] Step 6: After the search for the coverage lines of the new version of the data after the block is completed, the coverage lines are sorted from front to back according to their positions in the new version;

[0133] Among them, the data within the coverage line is the same part of the new and old data. This part of the data does not need to be packaged. It is only necessary to record the starting position and length of the data in the old version of the data; the part of the data not covered by the coverage line is data unique to the new version and needs to be packaged into the differential package. It should be noted that the data to be packaged and the coverage line information need to be recorded in order from the beginning to the end according to the distribution in the new version.

[0134] Step 7: Based on the block information and coverage line information, perform differential packet assembly processing.

[0135] Among them, the differential package is generally divided into three types of data: header information, differential control information, and differential data information; the header information needs to record the block status of the new version, version verification information, and differential control information content; the differential control information records whether the restored data is obtained from the old version data or from the packaged data; the differential data information is the data unique to the new version, which cannot be found in the old version and needs to be read from this part, such as Figure 6 As shown, Figure 6 This is the structural diagram of the differential upgrade package.

[0136] After the differential packet is verified, the differential packet header is parsed to obtain how many blocks the new version is divided into. Set the number of blocks to n, create n threads and allocate cache resources to process the differential restoration data corresponding to these n blocks respectively; then, according to the data address of the header information, obtain the differential control information and differential data information corresponding to these n blocks of data, as well as the physical address of the restored new data in the partition, and give them to the corresponding threads; then each thread can start data restoration and writing, such as Figure 7 , Figure 8 As shown, Figure 7 This is the differential restoration flowchart. Figure 8 This is a schematic diagram of the differential restoration process. When restoring data to the backup partition, frequent system calls are required, which will cause a large CPU resource overhead and affect the efficiency of differential restoration. Therefore, a multi-level cache mechanism is designed to reduce system calls and improve restoration efficiency. The specific steps are as follows:

[0137] Step 1: First, obtain an empty data cache from the created first-level cache queue in order, and use the cache space as the second-level cache to temporarily store the data of the current thread's real-time differential restoration;

[0138] Among them, as long as the current secondary cache resource is not full, subsequent restoration data will be written into this cache space.

[0139] Step 2: When the current L2 cache space is full, the current cache is returned to the original position of the L1 cache queue, and then an empty cache is immediately obtained from the L1 cache queue in order to continue to store differentially restored data as the L2 cache;

[0140] Among them, the above-mentioned operation is to write the differentially restored data into the cache, and the data in the cache needs to be written into the backup partition. In order to avoid wasting waiting time, this part of writing to the partition is executed in parallel with restoring the data to the cache, that is, there will be another task that keeps checking whether there is a second-level cache in the first-level cache that is full of restored data. If so, the cache is immediately obtained in sequence, and then the data is written to the partition; after writing, it is queried again and written in sequence until all data restoration is completed.

[0141] Step 3: After the data of each new version data block is restored and written, it is necessary to perform hash or md5 (Message-Digest Algorithm) and other algorithm verification and comparison with the data at the beginning of packaging to verify the correctness of the written data; when all data restoration and writing are completed and the data verification passes, it indicates that the differential upgrade is successful, and you can switch partitions and restart to complete the installation process.

[0142] like Fig. 9 , Fig.10 As shown, the scope of use of this embodiment includes multi-device and multi-node scenarios. If it is a multi-device scenario, the differential package can be sent to multiple devices in parallel. After each device downloads the differential upgrade package it needs, it will parse and verify the differential restoration and installation by itself. If it is a multi-node scenario, the main node downloads the differential upgrade package, and then sends the data package to the child nodes they need, and the child nodes parse and verify the differential restoration and installation by themselves.

[0143] like Fig.11 , Fig.12 As shown, the concept of covering lines in this embodiment can be understood through the following simple demonstration:

[0144] Assume that the new data is: hiiamsophiawhatisyourname; the old data is: helloiambobwhatisyourname;

[0145] A matrix is ​​established with the old data as the horizontal direction and the new data as the vertical direction. If the new and old data at the matrix coordinates are the same, the value at that matrix is ​​recorded as 1. If they are different, the value at that matrix is ​​recorded as 0. If the right diagonal values ​​are both 1, they are connected, and the connected line is the covering line.

[0146] Assuming the length of the covering line is set to 1, we can find the covering line as Fig.11 As shown; the differential data only needs to record the p that is not covered by the new version, which is the theoretical minimum differential data; according to actual conditions, the coverage line will not be set to 1, because the restoration operation will be very complicated and may not save time; if the coverage line length is set to 3, as shown in 12, the coverage line complexity is reduced and the restoration efficiency will be correspondingly improved.

[0147] The packaging method in this embodiment can record the following information when the coverage line is 3:

[0148] Differential control information: type 1 means reading from differential data information, the reading position is offset, and the reading length is length; type 2 means reading from the old version data, the reading position is offset, and the reading length is length;

[0149] Differential data information: hisophia;

[0150] The differential restoration step restores the new data in the order of serialization rules, which is:

[0151] Step 1: Read 2 bytes from the differential data information 0 address;

[0152] Step 2: Read 3 bytes from address 5 of the old version data;

[0153] Step 3: Read 6 bytes from differential data information 2 address;

[0154] Step 4: Read 14 bytes from address 11 of the old version data;

[0155] The new data obtained is: hiiamsophIawhatisyourname, which is consistent with the defined new data, which shows that the restoration is successful.

[0156] From the above description, it can be seen that the software upgrade method in this embodiment has the following beneficial effects: full differential adaptive upgrade to ensure upgrade efficiency; obtain a more ideal differential package to effectively shorten the upgrade time and save storage space resources; design block packaging and multi-threaded multi-level cache mechanism to improve upgrade efficiency.

[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0158] In this embodiment, a software upgrade device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0159] Figure 3 is a structural block diagram of a software upgrading device according to one embodiment of the present invention. Figure 3 As shown, the device includes: an acquisition module 32, the acquisition module 32 is used to acquire the new version data packet and the old version data packet of the target software of the target terminal; an incremental package generation module 34, the incremental package generation module 34 is used to generate a differential incremental package based on the new version data packet and the old version data packet, and the differential incremental package is used to represent the data difference information between the new version data packet and the old version data packet; an evaluation module 36, the evaluation module 36 is used to evaluate the upgrade time of the differential incremental package and the upgrade time of the new version data packet to obtain an evaluation result; a generation module 38, the generation module 38 is used to generate an upgrade strategy set when it is determined that the evaluation result meets the preset conditions, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version.

[0160] Through the above device, the new version data packet and the old version data packet of the target software of the target terminal are obtained; based on the new version data packet and the old version data packet, a differential incremental packet is generated, and the differential incremental packet is used to represent the data difference information between the new version data packet and the old version data packet; the upgrade time of the differential incremental packet and the upgrade time of the new version data packet are evaluated to obtain the evaluation result; when it is determined that the evaluation result meets the preset conditions, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version. By generating a differential incremental packet from the difference data between the new and old version data packets, the software is evaluated by using the differential incremental packet and the whole package to update the software, and the preset conditions are set. When the differential incremental packet update method meets the preset conditions, the differential incremental packet method is selected for software upgrade and update, otherwise the complete package method is selected for upgrade, that is, by setting the differential incremental packet upgrade method, the data transmission volume during the software upgrade process is reduced and the upgrade efficiency is improved.

[0161] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0162] Optionally, the software upgrade device provided in the present application may also include other modules. For example, the software upgrade device may also include a communication module, which is used to download differential upgrade packages and communicate with an upgrade server or a Master Node. The software upgrade device may also include a user interface module, which is used to provide a user-friendly user interface for users to monitor upgrade progress, view upgrade status information, cancel or pause the upgrade process, etc.

[0163] An embodiment of the present invention further provides a non-volatile storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned software upgrading method embodiments when running.

[0164] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0165] Step S1, obtaining a new version data packet and an old version data packet of a target software of a target terminal;

[0166] Step S2, generating a differential incremental packet based on the new version data packet and the old version data packet, where the differential incremental packet is used to represent data difference information between the new version data packet and the old version data packet;

[0167] Step S3, evaluating the upgrade time of the differential incremental package and the upgrade time of the new version data package to obtain an evaluation result;

[0168] Step S4, when it is determined that the evaluation result meets the preset conditions, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from the old version to the new version.

[0169] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0170] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0171] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0172] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0173] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0175] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0176] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0177] The above is only a preferred embodiment 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 principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A software upgrade method, characterized in that: The method comprises the following steps: Obtain a new version data package and an old version data package of the target software of the target terminal; Generate a differential incremental packet based on the new version data packet and the old version data packet, wherein the differential incremental packet is used to represent data difference information between the new version data packet and the old version data packet; Evaluate the upgrade time of the differential incremental package and the upgrade time of the new version data package to obtain an evaluation result; When it is determined that the evaluation result meets a preset condition, an upgrade strategy set is generated, wherein the upgrade strategy set is used to upgrade the target software from an old version to a new version.

2. The method according to claim 1, characterized in that: When it is determined that the evaluation result meets the preset condition, generating the upgrade strategy set includes: When it is determined that the upgrade time of the differential incremental package is less than the upgrade time of the new version data package, a first policy in the upgrade policy set is generated based on the differential incremental package, wherein the first policy is used to upgrade the target software from the old version to the new version.

3. The method according to claim 1, characterized in that When it is determined that the evaluation result meets the preset condition, generating the upgrade strategy set includes: When it is determined that the upgrade time of the new version data packet is less than or equal to the upgrade time of the differential incremental packet, a full packet is generated based on the new version data packet according to the differential rule, and the full packet includes all data of the new version data packet; Based on the full package, a second strategy in the upgrade strategy set is generated, wherein the second strategy is used to upgrade the target software from an old version to a new version.

4. The method according to claim 2, characterized in that: Generating a differential incremental packet based on the new version data packet and the old version data packet includes the following steps: Divide the data in the old version data packet into a plurality of data blocks, and determine a hash value of each of the data blocks, wherein the size of the data block is smaller than the size of the coverage line; The coverage line matching method and the hash value calculation method are used to perform data comparison on the new version data packet and the old version data packet to generate the differential incremental packet. The differential incremental packet includes at least differential control information and differential data information. The differential data information is used to represent the difference data. The differential control information is used to represent the data reading method in the software upgrade process. The data reading method is at least used to guide the data reading position and the data reading length.

5. The method according to claim 4, characterized in that Based on the differential incremental package, a first strategy in the upgrade strategy set is generated, wherein the first strategy is used to upgrade the target software from an old version to a new version, including the following steps: Performing data restoration according to the differential control information, the differential data information and the old version data information, and writing the restored data into a backup partition of the target terminal, the backup partition being different from the partition where the old version of the target software is located; After all data restoration is completed, verify whether the data in the backup partition is correct; When it is determined that the data in the backup partition is correct, the backup partition is switched to be the activation partition of the target software, so that the target software is upgraded from the old version to the new version.

6. The method according to claim 5, characterized in that Performing data restoration according to the differential control information, the differential data information and the old version data information, and writing the restored data into the backup partition of the target terminal, comprises the following steps: Perform data restoration according to the differential control information, the differential data information and the old version data information, and write the restored data into a secondary cache, where the secondary cache is an empty data cache obtained from a primary cache queue; When the secondary cache is full, returning the secondary cache to the primary cache queue; When it is determined that there is a full L2 cache in the L1 cache queue, the data in the full L2 cache is written into the backup partition.

7. The method according to claim 5, characterized in that Using a coverage line matching method and a hash value calculation method to compare the new version data packet with the old version data packet to generate the differential incremental packet includes the following steps: Dividing the new version data packet into a plurality of operation data blocks, wherein the size of the operation data block is larger than the size of the coverage line; Data comparison is performed on each of the operation data blocks and the old version data packet to generate the differential incremental packet, wherein the differential incremental packet at least includes header information, the differential control information of each of the operation data blocks and the differential data information of the operation data block, wherein the header information at least includes version information of the new version data packet, verification information, and block information of the new version data packet, wherein the block information at least includes block number information and matching information, and the matching information is used to represent the matching rules between the operation data block and the differential control information and the differential data information.

8. The method according to claim 7, characterized in that Performing data restoration according to the differential control information, the differential data information and the old version data information, and writing the restored data into the backup partition of the target terminal, comprises the following steps: Based on the block number information of the header information of the differential incremental packet, create a preset number of data cache threads, and configure a preset number of cache resources, where the preset number is the same as the block number of the new version data packet; Based on the block information of the header information, acquiring the differential data information and the differential control information corresponding to the data cache thread; Based on the old version data information, the corresponding differential data information and the differential control information, data restoration is performed, and the restored data generated by the data cache thread is written into a designated location of the backup partition.

9. A software upgrade device, characterized in that: include: An acquisition module, the acquisition module is used to acquire a new version data packet and an old version data packet of a target software of a target terminal; An incremental packet generation module, the incremental packet generation module is used to generate a differential incremental packet based on the new version data packet and the old version data packet, the differential incremental packet is used to represent data difference information between the new version data packet and the old version data packet; An evaluation module, the evaluation module is used to evaluate the upgrade time of the differential incremental package and the upgrade time of the new version data package to obtain an evaluation result; A generation module is used to generate an upgrade strategy set when it is determined that the evaluation result meets a preset condition, wherein the upgrade strategy set is used to upgrade the target software from an old version to a new version.

10. A non-volatile storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the software upgrade method described in any one of claims 1 to 7 when running.

Citation Information

Cited By

  • Client upgrading method and system, electronic equipment and storage medium

    CN120631414A

  • Bus bar power supply controller software online loading method and system

    CN121579048A