Differential package generation method, differential upgrading method, electronic equipment and vehicle
By generating differential packets on the server side based on the consistency of the configuration source file and the client's identification information, and storing default values in the header file, the problem of differential upgrade failure caused by electronic device storage partitioning is solved, thereby improving the upgrade success rate and user satisfaction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-24
AI Technical Summary
When the storage space of electronic devices is partitioned, differential upgrades often fail, affecting the stability and reliability of the vehicle system.
Before the server generates the differential packet, it determines whether the identification information sent by the client is consistent. If they are inconsistent, the server generates the differential packet according to the configuration source file and stores the preset default value in the header file of the differential packet. After receiving the differential packet, the client does not need to check the consistency of the identification information and can directly perform differential upgrade.
It significantly improves the success rate of differential upgrades, reduces data transmission volume and network bandwidth requirements, shortens upgrade time, reduces after-sales needs and manual maintenance costs, and enhances user trust and satisfaction.
Smart Images

Figure CN121722418A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle-side software upgrade technology, and in particular to a differential package generation method, a differential upgrade method, electronic equipment, and a vehicle. Background Technology
[0002] Currently, electronic devices with storage space in the terminal (such as vehicle-mounted electronic control units (ECUs)) generally use a partitioned approach for daily management and upgrades, with different partitions used to store different software code and data. Differential upgrade is a commonly used software upgrade method, which upgrades electronic devices by transmitting differential packets containing different data, reducing data transfer volume and upgrade time. However, when the storage space of the electronic device is partitioned, upgrade failures often occur during the differential upgrade process. Summary of the Invention
[0003] In view of this, the purpose of this application is to propose a differential package generation method, a differential upgrade method, an electronic device, and a vehicle, so as to solve the problem that differential upgrades are prone to failure when the storage space of an electronic device is partitioned.
[0004] To achieve the above objectives, the first aspect of this application provides a differential packet generation method, applied to a server, comprising: Receive an identification file sent by the client, the identification file including first identification information corresponding to each storage partition in the client; For each storage partition, it is determined whether the first identification information and the second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server. In response to the inconsistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the target upgrade file corresponding to the configuration source file, and a preset default value is stored in the header file of the differential package; The differential packet is sent to the client.
[0005] Optionally, determining whether the first identification information and the second identification information corresponding to the storage partition are consistent includes: In response to the fact that the first identification information includes multiple first sub-identification information, the source partition used to store the configuration source file is divided into blocks according to the identification file to obtain multiple source file blocks; each source file block corresponds one-to-one with the first sub-identification information. Calculate the second sub-identifier information corresponding to each source file block; Determine whether the first sub-identifier information and the second sub-identifier information corresponding to each source file block are consistent.
[0006] Optional, also includes: In response to the consistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the configuration source file and the target upgrade file corresponding to the configuration source file, and the second identification information corresponding to the configuration source file is stored in the header file of the differential package.
[0007] Based on the same inventive concept, a second aspect of this application provides a differential upgrade method applied to a client, comprising: Receive differential packets sent by the server; In response to determining that the header file in the differential packet includes a preset default value, or determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information, differential upgrade is performed on the configuration file stored in the storage partition according to the differential packet; The first identification information is determined based on the identification file stored on the client.
[0008] Optionally, determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information includes: In response to the fact that the multiple second sub-identifiers included in the second identification information are matched one by one with the multiple first sub-identifiers included in the first identification information, it is determined that the second identification information is consistent with the first identification information; Each storage block in the storage partition corresponds to a first sub-identifier and a second sub-identifier.
[0009] Optionally, the method for generating the identifier file includes: Obtain the configuration files stored in each storage partition of the client; The first identifier information corresponding to each storage partition is calculated based on the configuration file. The identification file is generated based on the first identification information and the relevant information of the storage partition; The identification file is sent to the server.
[0010] Optionally, the step of calculating the first identifier information corresponding to each storage partition based on the configuration file includes: In response to the storage capacity of the storage partition exceeding a preset storage capacity threshold, the storage partition is divided into multiple storage blocks; The first sub-identifier information is calculated based on the configuration file stored in each storage block; The first sub-identifier information of all storage blocks contained in the storage partition is used as the first identifier information corresponding to the storage partition.
[0011] Optionally, the method further includes: Real-time monitoring of whether the configuration files stored in each storage partition have changed; In response to the determination that the configuration file has changed, new first identification information is calculated based on the changed configuration file, and the identification file is updated based on the new first identification information.
[0012] Based on the same inventive concept, a third aspect of this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor, when executing the computer program, implements the method as described in the second aspect.
[0013] Based on the same inventive concept, a fourth aspect of this application also provides a vehicle including electronic equipment as described in the third aspect.
[0014] As described above, this application provides a differential packet generation method, a differential upgrade method, an electronic device, and a vehicle. The differential packet generation method is applied to a server and includes: receiving an identification file sent by a client, the identification file including first identification information corresponding to each storage partition in the client. For each storage partition, determining whether the first identification information and second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server. If the first identification information and the second identification information are consistent, it indicates that the configuration file stored in the storage partition has not changed and is the same as the configuration source file stored on the server. If the first identification information and the second identification information are inconsistent, it indicates that the configuration file stored in the storage partition has changed and is different from the configuration source file. Then, based on the target upgrade file corresponding to the configuration source file, a differential packet is calculated using a differential algorithm, and a preset default value is stored in the header file of the differential packet. The differential packet is then sent to the client. After receiving the differential packet, the client verifies it. If the header file contains a preset default value, the verification step is skipped, and the differential packet is used directly for differential upgrade. There is no need to compare whether the first and second identification information corresponding to the storage partition are consistent. This avoids the problem of differential upgrade failure caused by inconsistent identification information corresponding to the storage partition, and improves the success rate of differential upgrade. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart illustrating the differential packet generation method according to an embodiment of this application; Figure 2 This is a flowchart illustrating the differential upgrade method according to an embodiment of this application; Figure 3 This is a schematic diagram of the differential packet generation device according to an embodiment of this application; Figure 4 This is a schematic diagram of the differential upgrade device according to an embodiment of this application; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0018] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0019] The vehicle-side ECU divides its storage area into multiple storage partitions, each storing different program code and data. For example, storage partitions may include bootloader partitions, application partitions, backup / redundancy partitions, and data partitions. Differential upgrade is a common software upgrade method that relies on differential algorithms such as bsdiff and hdiffpatch. Differential upgrade consists of two parts. The first part involves generating a differential package on the server side. The server stores both the old and new versions of the same software configuration files. The server uses a differential algorithm to perform binary comparison analysis on the old and new configuration files, generating a differential package. The header of the differential package includes the hash value calculated by the server based on the old configuration file. The second part involves executing the differential upgrade on the vehicle-side ECU. The server sends the differential package to the vehicle's ECU. The ECU needs to verify the authenticity and integrity of the differential package, such as by comparing the hash value of the old version configuration file it calculates with the hash value of the old version configuration file sent by the server. If they match, it means that the ECU's current configuration file is indeed the old version configuration file, identical to the old version configuration file stored on the server, ensuring the consistency of the basic data for differential upgrades. Afterwards, the vehicle's ECU performs a differential upgrade on the old version configuration file in the storage partition based on the differential package. Differential upgrades can save data overhead, accelerate the upgrade speed, and reduce server load.
[0020] However, when a software update, configuration file update, or other operation occurs in a storage partition of the vehicle's ECU, or when software failure, hardware failure, or data corruption occurs, it will affect the subsequent differential upgrade process of the storage partition. This is because any change to a storage partition will cause a change in the hash value calculated based on the storage partition. Since the hash value in the differential packet sent by the server is calculated based on the storage partition before the change, the hash value carried in the differential packet often differs from the hash value calculated by the vehicle itself.
[0021] During differential upgrades, after receiving the differential packet from the server, the vehicle's ECU needs to perform a hash check to ensure the packet's integrity and correctness. This involves comparing the hash value of the storage partition carried in the differential packet with its own calculated hash value. If the hash value sent by the server does not match its own calculated hash value, the vehicle will not execute the differential upgrade process to protect the ECU's security and stability and prevent erroneous or malicious software intrusion, resulting in upgrade failure. Therefore, differential upgrade failures frequently occur when the vehicle's ECU is partitioned, affecting the stability and reliability of the vehicle system. In view of this, this application proposes a differential packet generation method. Before generating the differential packet on the server side, it determines whether the first and second identifier information in the identifier file sent by the client are consistent. If they are inconsistent, the differential packet is generated only based on the target upgrade file of the configuration source file stored on the server side, and a preset default value is stored in the header file of the differential packet. The differential packet is then sent to the client. When the client verifies the differential packet, if the preset default value is detected in the header file, it does not need to determine whether the first and second identifier information corresponding to the storage partition are consistent. It can directly perform differential upgrades on the configuration file of the storage partition based on the differential packet, effectively reducing the probability of differential upgrade failure. When the differential packet generation method of this application is applied to a vehicle scenario, the server can be a cloud or remote management platform, and the client can be a vehicle ECU. When the server generates the differential packet in the above manner and sends it to the vehicle ECU, the probability of differential upgrade failure due to hash value verification failure can be reduced when the ECU performs an upgrade based on the differential packet, significantly improving the success rate of vehicle OTA (Over-The-Air Updating). This significantly reduces after-sales service needs and labor costs, while increasing user trust and satisfaction.
[0022] The embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0023] This application provides a method for generating differential packets, referencing Figure 1 When applied to the server side, it includes the following steps: Step 102: Receive the identification file sent by the client, wherein the identification file includes the first identification information corresponding to each storage partition in the client.
[0024] Specifically, in this embodiment, the server can be a cloud-based or remote management platform, used to provide software upgrade services to the client and responsible for generating and distributing differential packages. The client in this embodiment can be a vehicle-side controller, such as a vehicle-side ECU, or other terminals requiring upgrades. The identification file is generated and sent by the client, storing relevant information about each storage partition in the client, such as the partition name, ID, storage capacity, configuration file version number, and first identification information. Each storage partition stores the corresponding configuration file for the software. The first identification information is calculated based on the configuration file and is used to uniquely identify the storage partition. For example, the first identification information can be a hash value, specifically, the configuration file is converted into a fixed-length string using a hash algorithm; this string is the hash value, which is equivalent to the digital fingerprint or digest of the configuration file. The hash algorithm can be MD5, SHA-1, SHA-256, BLAKE2, etc.
[0025] Step 104: For each storage partition, determine whether the first identification information and the second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server.
[0026] Specifically, under normal circumstances, the client includes multiple storage partitions, and the server includes multiple source partitions. The storage partitions store configuration files, and the source partitions store the source configuration files; there is a one-to-one correspondence between the storage partitions and the source partitions. The configuration files are identical to the source configuration files. However, since storage partitions often change, causing configuration files to differ from the source configuration files, it is necessary to check whether the client's storage partitions have changed before generating the differential package on the server side.
[0027] For each storage partition, to determine whether the configuration file stored in the storage partition is consistent with the configuration source file stored on the server, it is necessary to compare and analyze whether the first identification information and the second identification information are consistent. The first identification information is calculated by the client based on the configuration file, and the second identification information is calculated by the server based on the configuration source file. For example, the second identification information can be a hash value. If the first identification information and the second identification information are consistent, it means that the configuration file and the configuration source file are the same, that is, the configuration file stored in the client's storage partition has not changed. If the first identification information and the second identification information are inconsistent, it means that the configuration file and the configuration source file are different, that is, the configuration file stored in the client's storage partition has changed before the differential upgrade. If a differential package is created based on the difference information between the configuration source file and the target upgrade file, the client will not be able to successfully perform a differential upgrade based on the differential package, because the configuration file and the configuration source file are different, which is equivalent to different basic data for the differential upgrade, and the differential package cannot be adapted to the configuration file stored in the client.
[0028] Step 106: In response to the inconsistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the target upgrade file corresponding to the configuration source file, and a preset default value is stored in the header file of the differential package.
[0029] Specifically, in cases where the first and second identifier information are inconsistent, to avoid upgrade failure due to differing base data, this step directly calculates the differential package based on the target upgrade file using a differential algorithm. When generating the differential package, the configuration source file is treated as an empty file, and the difference between the target upgrade file and the empty file is calculated using a differential algorithm to generate the differential package. This differential package contains all the information of the target upgrade file. Simultaneously, preset default values are stored in the header file of the differential package, serving as the data basis for client verification. Preset default values can be pre-set verification information with fixed format and content; for example, preset default values can be values such as 0 or -1, or even include information such as hash=null. Setting preset default values helps the client recognize that the current differential package was generated when the first and second identifier information are inconsistent, requiring adjustment of the corresponding verification rules, without needing to compare whether the second identifier information in the differential package header file matches the first identifier information calculated by the client itself. This avoids the problem of differential upgrade operations failing due to inconsistent identifier information.
[0030] Step 108: Send the differential packet to the client.
[0031] Specifically, after generating the differential packet, the server sends it to the client. When the client is a vehicle, the server can send the differential packet to the vehicle's ECU via a TelematicsBOX (T-BOX). Upon receiving the differential packet, the client verifies it. If the verification is successful, the client uses the differential packet to perform a differential upgrade on the configuration file in its storage partition, thus completing the client's upgrade task.
[0032] It should be noted that, to further ensure the correct delivery of differential packets, the server verifies the differential packets before sending them to the client. Specifically, the server verifies the correctness of the differential packets based on the latest received identification file. For each storage partition corresponding to a differential packet, if the first and second identification information of the storage partition are consistent, the differential packet header should include the second identification information, indicating the differential packet is correct. If the first and second identification information of the storage partition are inconsistent, the differential packet header should include a preset default value, indicating the differential packet is correct. After the differential packet passes the correctness verification, the server then delivers the differential packet to the client, ensuring the correctness of the differential packet delivery and facilitating the subsequent successful completion of differential upgrades by the client.
[0033] Based on steps 102 to 108 above, this embodiment provides a differential packet generation method applied to a server, comprising: receiving an identification file sent by a client, the identification file including first identification information corresponding to each storage partition in the client. For each storage partition, determining whether the first identification information and second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server. If the first identification information and the second identification information are consistent, it indicates that the configuration file stored in the storage partition has not changed and is the same as the configuration source file stored on the server. If the first identification information and the second identification information are inconsistent, it indicates that the configuration file stored in the storage partition has changed and is different from the configuration source file, then a differential packet is calculated based on the target upgrade file corresponding to the configuration source file using a differential algorithm, and a preset default value is stored in the header file of the differential packet. The differential packet is then sent to the client. Upon receiving the differential packet, the client verifies it. If a preset default value is detected in the header file, the verification step is skipped, and the differential upgrade is performed directly using the differential packet. There's no need to compare the first and second identifier information corresponding to the storage partitions, thus avoiding upgrade failures due to inconsistencies and improving the success rate. Furthermore, the server and client no longer need to download the entire package to upgrade the client, reducing unnecessary data transmission, lowering communication volume between the server and client, reducing network bandwidth requirements, and shortening upgrade time.
[0034] In some embodiments, determining whether the first identification information and the second identification information corresponding to the storage partition are consistent includes: In response to the fact that the first identification information includes multiple first sub-identification information, the source partition used to store the configuration source file is divided into blocks according to the identification file to obtain multiple source file blocks; each source file block corresponds one-to-one with the first sub-identification information. Calculate the second sub-identifier information corresponding to each source file block; Determine whether the first sub-identifier information and the second sub-identifier information corresponding to each source file block are consistent.
[0035] Specifically, when the storage capacity of a client's storage partition is large, it is typically divided into multiple storage blocks, with different blocks storing different code and data. This block division facilitates partition management; for example, each storage block can be independently upgraded and maintained, improving the flexibility of storage partition management. In OTA upgrade scenarios, the block division supports differential algorithms that perform calculations only on the changed storage blocks, significantly reducing the computing resources required for differential upgrades. The first sub-identifier information corresponding to each storage block is generated based on the configuration file stored in that block. For example, the first sub-identifier information can be a hash value. The first sub-identifier information of all storage blocks corresponding to a storage partition constitutes the first identifier information of that storage partition. Simultaneously, multiple first sub-identifier information are stored in an identifier file. After receiving the identifier file, if the server determines that the first identifier information corresponding to the storage partition includes multiple first sub-identifier information, it indicates that the storage partition includes multiple storage blocks. Further block processing is needed on the server side based on the identifier information to obtain multiple source file blocks, each storing the corresponding configuration source file.
[0036] The identification information stores not only multiple first sub-identifiers, but also the name, ID, storage capacity, and configuration file version number corresponding to each storage block. The server can divide the source partition according to the information of each storage block, obtaining multiple source file blocks, ensuring a one-to-one correspondence between the source file blocks and the storage blocks, and also a one-to-one correspondence between the source file blocks and the first sub-identifiers. The server calculates the second sub-identifier based on the configuration source file stored in each source file block. For example, the second sub-identifier can be a hash value. For each storage partition, when determining whether the first and second identifications of the storage partition are consistent, it is necessary to further determine whether the first and second sub-identifiers corresponding to each storage block within that storage partition are consistent. If the first and second sub-identifiers of a certain storage block are inconsistent, it indicates that the configuration file within the storage block is different from the configuration source file in the source file block, and the configuration file has changed. To ensure successful differential upgrades, a differential package needs to be generated based on the target upgrade file corresponding to the source file block, and the preset default values are stored in the header file of the differential package, which is then sent to the client to ensure that the configuration files within each storage block can be successfully upgraded. If the first sub-identifier and the second sub-identifier of a storage block are the same, it means that the configuration file within the storage block is the same as the configuration source file in the source file block, and the configuration file has not changed. In this case, a differential package is generated based on the configuration source file stored in the source file block and the corresponding target upgrade file. The header file of the differential package stores relevant information about the source file block and relevant information about the target partition used to store the target upgrade file. This relevant information includes the name, ID, storage capacity, and corresponding identification information.
[0037] This embodiment provides a method for determining whether the first and second identifier information are consistent after the storage partition has been divided into storage blocks. It requires comparing the first and second sub-identifier information corresponding to each storage block. By comparing each storage block individually, precise location of the changed configuration file is achieved. Subsequently, a differential package containing all target upgrade file information can be generated only for the changed configuration file, enabling a full upgrade of local data. This effectively reduces the probability of differential upgrade failure for the entire storage partition and improves the success rate of differential upgrades.
[0038] In some embodiments, the differential packet generation method further includes: In response to the consistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the configuration source file and the target upgrade file corresponding to the configuration source file, and the second identification information corresponding to the configuration source file is stored in the header file of the differential package.
[0039] Specifically, if the first and second identifiers match, it indicates that the configuration file in the storage partition has not changed and is identical to the configuration source file stored on the server. In this case, the server can generate a differential package using a differential algorithm based on the differences between the configuration source file and the target upgrade file. This differential package contains only the incremental data required for the upgrade. Simultaneously, the second identifier corresponding to the configuration source file is stored in the header file of the differential package. Upon receiving the differential package, the client compares the second identifier in the header file with its own calculated first identifier. If the first and second identifiers match, it can be determined that the differential package was generated by the server based on the same configuration source file and target upgrade file. The client can then directly upgrade the configuration file of the storage partition using the differential package. The header file of the differential package may also include the name, ID, and storage capacity of the source partition used to store the configuration source file, and the name, ID, and storage capacity of the target partition used to store the target upgrade file.
[0040] Furthermore, if the storage partition includes multiple storage blocks and the source partition includes multiple source file blocks, when the first sub-identification information and the second sub-identification information corresponding to the storage block are consistent, the server generates a differential package corresponding to the storage block based on the configuration source file and the target upgrade file in the source file block, so as to realize the differential upgrade of each storage block on the vehicle side.
[0041] In this embodiment, if the configuration file remains unchanged, the first and second identifier information are consistent, and a differential package can be generated based on the configuration source file and the target upgrade file. The client can perform a differential upgrade based on the differential package, and can verify the differential package by combining the second identifier information in the header file with its own calculated first identifier information to ensure the success rate of the differential upgrade.
[0042] Based on the same inventive concept, this application also provides a differential upgrade method, applied to a client side, see reference. Figure 2 This includes the following steps: Step 202: Receive the differential packet sent by the server.
[0043] Step 204: In response to determining that the header file in the differential packet includes a preset default value, or determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information, perform differential upgrade on the configuration file stored in the storage partition according to the differential packet; wherein, the first identification information is determined according to the identification file stored in the client.
[0044] Specifically, when client software needs an upgrade, the server sends out a differential upgrade package. The client can then upgrade its software based on this package. When the client's storage partition has a large capacity, it is typically divided into multiple storage blocks for easier regional management. Different storage blocks store different code and data. The differential upgrade package provides differential data for each storage partition. Each storage partition performs a differential upgrade based on its corresponding differential upgrade package. However, to ensure upgrade security, the differential upgrade package needs to be verified for security and integrity.
[0045] The header of a differential packet typically contains verification information sent by the server. If the verification information passes the client's verification, a differential upgrade can be performed using the differential packet. If the verification information fails, the differential upgrade will not be performed to protect client security. When verifying the verification information, if it is determined to be a preset default value, the differential packet is considered correct. For example, the preset default value can be a value such as 0 or -1, or it can include information such as hash=null. In this case, a differential upgrade can be performed based on the differential packet, that is, a differential upgrade is performed on the configuration file in the storage partition based on the differential packet. The differential upgrade process is a conventional technique in this field and will not be described in detail here. The fact that the verification information is a preset default value indicates that the configuration file of the storage partition is different from the configuration source file of the server's source partition. When generating the differential packet, the server only generates the differential packet based on the target upgrade file corresponding to the configuration source file, and stores the preset default value in the header file.
[0046] If the verification information in the header file is not the default value but includes the second identifier information corresponding to the storage partition, then the second identifier information needs to be compared with the first identifier information. If the second identifier information matches the first identifier information, the differential package is confirmed to be correct, and differential upgrade can be performed based on the differential package. The first identifier information is calculated by the client based on the configuration file and is used to uniquely identify the storage partition. The second identifier information is calculated by the server based on the configuration source file stored in the source partition corresponding to the storage partition and is used to uniquely identify the source partition. For example, the first and second identifier information can be hash values. Storage partitions and source partitions correspond one-to-one. Under normal circumstances, the configuration file stored in the storage partition is the same as the configuration source file stored in the source partition, and the calculated first and second identifier information are also the same. However, if the configuration file in the storage partition changes, the configuration source file changes, or data is lost or tampered with during the differential package distribution process, the first identifier information and the second identifier information will be different. In this case, for security reasons, the client will not perform the differential upgrade operation.
[0047] It should be noted that the first identification information is stored in an identification file, which is pre-built on the client side. This file stores relevant information about each storage partition on the client, such as the partition's name, ID, storage capacity, configuration file version number, and the first identification information. Each storage partition stores the corresponding software's configuration file, and the first identification information is calculated based on the configuration file. By sending the identification file to the server, the server can be aware of changes to each storage partition on the client in real time, and thus adjust the distributed differential packets accordingly. This ensures the differential packets match the client's storage partitions, improving the success rate of differential upgrades.
[0048] This embodiment provides a verification method for differential packages. If the header file includes preset default values, there is no need to compare identification information; the differential package can be used directly to perform differential upgrades on the storage partition, reducing the probability of differential upgrade failure due to inconsistent identification information and improving the success rate of differential upgrades. If the header file includes second identification information, the differential package must be used to perform differential upgrades on the storage partition only if the second identification information matches the first identification information, ensuring the security of differential upgrades.
[0049] In some embodiments, determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information includes: In response to the fact that the multiple second sub-identifiers included in the second identification information are matched one-to-one with the multiple first sub-identifiers included in the first identification information, it is determined that the second identification information is consistent with the first identification information; wherein, each storage block in the storage partition corresponds to one first sub-identifier and one second sub-identifier.
[0050] Specifically, when the client's storage partition has a large storage capacity, it is typically divided into blocks for easier regional management. These blocks store different code and data. Similarly, the server's source partition is also divided into multiple source file blocks, each storing different configuration source files. Each source file block corresponds to a second sub-identifier, calculated based on the configuration source files stored within it. There is a one-to-one correspondence between storage blocks and source file blocks; each storage block corresponds to a first identifier, and each source file block corresponds to a second identifier. Therefore, each storage block has one first identifier and one second identifier. If the header file contains multiple second sub-identifiers within its second identifier, each second sub-identifier is compared to its corresponding first sub-identifier. If all second sub-identifiers for a storage partition match their first sub-identifiers, then the storage partition's second identifier matches its first identifier. In this embodiment, the client not only needs to ensure that the differential packets of the storage partition are correct, but also needs to ensure that the differential packets corresponding to each storage block are correct when the storage partition is divided into multiple storage blocks. This is equivalent to performing a detailed verification of the differential packets of each storage partition to further improve the success rate of differential upgrades.
[0051] In some embodiments, the method for generating the identifier file includes: Obtain the configuration files stored in each storage partition of the client; The first identifier information corresponding to each storage partition is calculated based on the configuration file. The identification file is generated based on the first identification information and the relevant information of the storage partition; The identification file is sent to the server.
[0052] Specifically, since client storage partitions frequently change, leading to changes in configuration files and corresponding changes in the first identification information, this embodiment stores the first identification information by creating an identification file on the client side to enable real-time monitoring of these changes. The configuration files stored in each storage partition on the client are retrieved, and the first identification information corresponding to each storage partition is calculated based on the configuration files to uniquely identify the storage partition. For example, the first identification information can be a hash value, specifically, the configuration file is converted into a fixed-length string using a hash algorithm; this string is the hash value, which is equivalent to a digital fingerprint or digest of the configuration file. The hash algorithm can be MD5, SHA-1, SHA-256, BLAKE2, etc. An identification file is generated based on the calculated first identification information and relevant information about the storage partition. This relevant information may include the storage partition's name, ID, storage capacity, and configuration file version number.
[0053] By constructing an identification file, the initial identification information of each storage partition can be stored. This identification file is then synchronously sent to the server. The server can obtain the current initial identification information of each storage partition. If the initial identification information differs from the second identification information stored on the server, it indicates that the configuration file of the storage partition has changed. The server then adjusts the generation method of the differential packet and the verification information in the header file based on the changed initial identification information. The construction of the identification file provides the server with a basis for adjusting the differential packet, thereby helping to improve the success rate of differential upgrades.
[0054] In some embodiments, calculating the first identifier information corresponding to each storage partition based on the configuration file includes: In response to the storage capacity of the storage partition exceeding a preset storage capacity threshold, the storage partition is divided into multiple storage blocks; a first sub-identifier is calculated based on the configuration file stored in each storage block; and the first sub-identifier of all storage blocks contained in the storage partition is used as the first identifier of the storage partition.
[0055] Specifically, when the storage capacity of a storage partition exceeds a preset storage capacity threshold, the storage partition can be divided into multiple storage blocks. For example, the preset storage capacity threshold can be 1GB. The storage capacity of the resulting storage blocks can be 100MB, 200MB, or 500MB, etc. Different storage blocks can have the same or different storage capacities. This storage block division allows for fine-grained management of storage partitions. When a configuration file stored in a storage block needs upgrading, only the storage block needs differential upgrading, without upgrading the entire storage partition, reducing data transfer volume. When the configuration file stored in a storage block changes, the server can adjust the generation method of the differential packet for that storage block and perform a full upgrade on that block, instead of upgrading all storage partitions, reducing data transfer volume and improving upgrade efficiency.
[0056] After dividing the storage partition into multiple storage blocks, the first sub-identifier information is calculated based on the configuration file stored in each storage block. All the first sub-identifier information is stored in the identifier file as the first identifier information corresponding to the coarse-out partition. Through the setting of the first sub-identifier information in this embodiment, a data foundation can be provided for the identification information comparison of storage blocks, enabling the server to accurately identify which storage block's configuration file has changed, thereby achieving differentiated differential package generation and ensuring that each storage block can successfully perform differential upgrades.
[0057] In some embodiments, the method further includes: Real-time monitoring of whether the configuration files stored in each storage partition have changed; In response to the determination that the configuration file has changed, new first identification information is calculated based on the changed configuration file, and the identification file is updated based on the new first identification information.
[0058] Specifically, after the identifier file is constructed, it needs to be updated in real time so that both the client and server can be aware of the real-time changes to each storage partition. In practice, the first identifier information for each storage partition can be recalculated at regular intervals, and the identifier file can be updated as a whole based on the calculation results. Preferably, to reduce client computational consumption, only the first identifier information of storage partitions that have changed can be recalculated. Real-time monitoring determines whether the configuration file for each storage area has changed. If it has, the new first identifier information is calculated based on the changed configuration file, and the new first identifier information replaces the original first identifier information in the identifier file. This avoids recalculating the first identifier information for each storage partition, improving the update efficiency of the identifier file. Real-time monitoring of configuration files in storage partitions can be achieved by setting up polling, checking the configuration files stored in each storage partition at fixed time intervals, reducing client computational consumption. Simultaneously, a backup mechanism can be established so that when the identifier file becomes invalid or lost, the backup identifier file can be quickly retrieved, improving client reliability. By updating the identifier file in real time, the accuracy of the differential packets generated by the server can be ensured, the risk of differential upgrade failure can be reduced, the maintenance and time costs for users can be reduced, and user satisfaction can be improved.
[0059] It should be noted that when the client is the vehicle, the identification file management method is integrated into the vehicle ECU. Through the application programming interface (API), other modules on the vehicle can easily access and update the identification file, achieving seamless integration with the vehicle.
[0060] In the above embodiments, the generation, distribution, and differential upgrade processes of differential packets can be continuously monitored by a monitoring module. If an error occurs, an alarm message will be issued in a timely manner to prompt the user to handle and optimize the problem, thus ensuring the smooth progress of the differential upgrade process.
[0061] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.
[0062] It should be noted that some embodiments of this application have been described above. In some cases, the actions or steps described in the above embodiments can be performed in a different order than that shown in the above embodiments and the desired result can still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0063] Based on the same inventive concept, corresponding to any of the above-described embodiments, this application also provides a differential packet generation apparatus.
[0064] refer to Figure 3 The differential packet generation device, applied on the server side, includes: The first receiving module 302 is configured to receive an identification file sent by the client, the identification file including first identification information corresponding to each storage partition in the client; The determination module 304 is configured to determine, for each storage partition, whether the first identification information and the second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server. The first generation module 306 is configured to, in response to the inconsistency between the first identification information and the second identification information, calculate a differential package using a differential algorithm based on the target upgrade file corresponding to the configuration source file, and store a preset default value in the header file of the differential package; The sending module 308 is configured to send the differential packet to the client.
[0065] In some embodiments, the determining module 304 is configured to, in response to the first identification information including a plurality of first sub-identification information, perform block processing on the source partition used to store the configuration source file according to the identification file to obtain a plurality of source file blocks; the source file blocks correspond one-to-one with the first sub-identification information; calculate the second sub-identification information corresponding to each source file block; and determine whether the first sub-identification information and the second sub-identification information corresponding to each source file block are consistent.
[0066] In some embodiments, the generation module 306 is configured to, in response to the consistency between the first identification information and the second identification information, calculate a differential package using a differential algorithm based on the configuration source file and the target upgrade file corresponding to the configuration source file, and store the second identification information corresponding to the configuration source file in the header file of the differential package.
[0067] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0068] The apparatus of the above embodiments is used to implement the corresponding differential packet generation method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0069] Based on the same inventive concept, corresponding to any of the above-described embodiments, this application also provides a differential upgrade device.
[0070] refer to Figure 4 The differential upgrade device, applied to the client, includes: The second receiving module 402 is configured to receive differential packets sent by the server; Upgrade module 404 is configured to perform differential upgrade on the configuration file stored in the storage partition according to the differential package in response to determining that the header file in the differential package includes a preset default value, or determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information; wherein, the first identification information is determined according to the identification file stored in the client.
[0071] In some embodiments, the upgrade module 404 is configured to determine that the second identification information is consistent with the first identification information in response to a one-to-one match between a plurality of second sub-identification information included in the second identification information and a plurality of first sub-identification information included in the first identification information; Each storage block in the storage partition corresponds to a first sub-identifier and a second sub-identifier.
[0072] In some embodiments, a second generation module is further included, configured to obtain configuration files stored in each storage partition of the client; calculate first identification information corresponding to each storage partition based on the configuration files; generate the identification file based on the first identification information and the relevant information of the storage partition; and send the identification file to the server.
[0073] In some embodiments, the second generation module is configured to, in response to the storage capacity of the storage partition exceeding a preset storage capacity threshold, divide the storage partition into multiple storage blocks; calculate first sub-identifier information based on the configuration file stored in each storage block; and use the first sub-identifier information of all storage blocks contained in the storage partition as the first identifier information corresponding to the storage partition.
[0074] In some embodiments, the second generation module is configured to monitor in real time whether the configuration files stored in each storage partition have changed; In response to the determination that the configuration file has changed, new first identification information is calculated based on the changed configuration file, and the identification file is updated based on the new first identification information.
[0075] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0076] The apparatus of the above embodiments is used to implement the corresponding differential upgrade method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0077] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the differential packet generation method or differential upgrade method described in any of the above embodiments.
[0078] Figure 5 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0079] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0080] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0081] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0082] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0083] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0084] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0085] The electronic devices described above are used to implement the corresponding differential upgrade methods in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0086] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the differential packet generation method or differential upgrade method as described in any of the above embodiments.
[0087] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0088] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the differential packet generation method or differential upgrade method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0089] Based on the same concept, corresponding to any of the above embodiments, this application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer causes the computer to execute the differential package generation method or differential upgrade method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0090] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0091] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to choose, based on the prompt message, whether to provide personal information to the software or hardware such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution.
[0092] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" regarding the provision of personal information by the electronic device.
[0093] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0094] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application is limited to these examples; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in detail for the sake of brevity.
[0095] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0096] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0097] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of this application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.
Claims
1. A method for generating differential packets, characterized in that, Applied to the server side, including: Receive an identification file sent by the client, the identification file including first identification information corresponding to each storage partition in the client; For each storage partition, it is determined whether the first identification information and the second identification information corresponding to the storage partition are consistent; wherein, the second identification information is calculated and determined by the server based on the configuration source file corresponding to the storage partition on the server. In response to the inconsistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the target upgrade file corresponding to the configuration source file, and a preset default value is stored in the header file of the differential package; The differential packet is sent to the client.
2. The method according to claim 1, characterized in that, Determining whether the first identification information and the second identification information corresponding to the storage partition are consistent includes: In response to the fact that the first identification information includes multiple first sub-identification information, the source partition used to store the configuration source file is divided into blocks according to the identification file to obtain multiple source file blocks; each source file block corresponds one-to-one with the first sub-identification information. Calculate the second sub-identifier information corresponding to each source file block; Determine whether the first sub-identifier information and the second sub-identifier information corresponding to each source file block are consistent.
3. The method according to claim 1, characterized in that, Also includes: In response to the consistency between the first identification information and the second identification information, a differential package is calculated using a differential algorithm based on the configuration source file and the target upgrade file corresponding to the configuration source file, and the second identification information corresponding to the configuration source file is stored in the header file of the differential package.
4. A differential upgrade method, characterized in that, Applied to the client side, including: Receive differential packets sent by the server; In response to determining that the header file in the differential packet includes a preset default value, or determining that the second identification information corresponding to the storage partition in the client included in the header file is consistent with the first identification information, differential upgrade is performed on the configuration file stored in the storage partition according to the differential packet; The first identification information is determined based on the identification file stored on the client.
5. The method according to claim 4, characterized in that, The step of determining that the second identification information corresponding to the storage partition in the client, included in the header file, is consistent with the first identification information includes: In response to the fact that the multiple second sub-identifiers included in the second identification information are matched one by one with the multiple first sub-identifiers included in the first identification information, it is determined that the second identification information is consistent with the first identification information; Each storage block in the storage partition corresponds to a first sub-identifier and a second sub-identifier.
6. The method according to claim 4, characterized in that, The method for generating the identifier file includes: Obtain the configuration files stored in each storage partition of the client; The first identifier information corresponding to each storage partition is calculated based on the configuration file. The identification file is generated based on the first identification information and the relevant information of the storage partition; The identification file is sent to the server.
7. The method according to claim 6, characterized in that, The step of calculating the first identifier information corresponding to each storage partition based on the configuration file includes: In response to the storage capacity of the storage partition exceeding a preset storage capacity threshold, the storage partition is divided into multiple storage blocks; The first sub-identifier information is calculated based on the configuration file stored in each storage block; The first sub-identifier information of all storage blocks contained in the storage partition is used as the first identifier information corresponding to the storage partition.
8. The method according to claim 6, characterized in that, The method further includes: Real-time monitoring of whether the configuration files stored in each storage partition have changed; In response to the determination that the configuration file has changed, new first identification information is calculated based on the changed configuration file, and the identification file is updated based on the new first identification information.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 4 to 8.
10. A vehicle, characterized in that, The vehicle includes the electronic equipment as described in claim 9.