Firmware differential upgrading method and system, electronic equipment and storage medium

The firmware is split into multiple data subcontracts through the firmware differential upgrade method. The differential data list and digital signature certificate are used to solve the problems of low firmware update efficiency and insufficient security, and an efficient and secure firmware update process is achieved.

CN119065699APending Publication Date: 2024-12-03GUANGDONG CHUTIAN DRAGON SMART CARD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411079907.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing firmware update methods are inefficient and insufficiently secure, which leads to long update times and it is difficult for users to ensure the legality and integrity of the downloaded firmware, which may cause the device to fail to start and affect the interests of manufacturers.

Method used

Using the firmware differential upgrade method, split the firmware into multiple data subcontracts, download and verify the difference part through the differential data list to ensure the security and efficiency of data transmission, use digital signature certificates to verify the legality, and select the appropriate one Compression algorithm to improve decompression speed.

Benefits of technology

It realizes breakpoint continuous transmission and download, saves time and bandwidth, ensures the security and efficiency of firmware during transmission, shortens upgrade time and improves update efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065699A_ABST
    Figure CN119065699A_ABST
Patent Text Reader

Abstract

The invention provides a firmware differential upgrading method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining a difference data list which is used for indicating the difference between new firmware in a server and current firmware in terminal equipment; downloading at least one target data sub-package in a plurality of data sub-packages of the new firmware from the server according to the difference data list; verifying the at least one target data subpackage one by one; after the last target data sub-package is verified and verification is passed, obtaining restored new firmware according to the at least one target data sub-package and the current firmware; and verifying the restored new firmware, and updating the firmware after the verification is passed, so as to update the current firmware into the restored new firmware. According to the method, the firmware upgrading efficiency and security can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of firmware upgrade, and in particular to a firmware differential upgrade method, system, electronic device and storage medium. Background Art

[0002] Firmware update is a key link in the maintenance cycle of products and equipment. It involves the process of replacing the software (i.e. firmware) embedded in the hardware device with the latest version. Firmware is the core software component of the hardware device. Firmware consists of a set of compiled binary codes, including boot loaders, kernel files, file systems and other modules. In order to improve the software functions of products and equipment or fix bugs, manufacturers will continuously upgrade the firmware of their products after the products and equipment leave the factory. The firmware to be released will be generated into binary files with corresponding names according to the modules, and then released to the server to notify users to download. Users can download the corresponding version of firmware from the server for upgrading as needed.

[0003] At present, the traditional method is usually that during the firmware update process, the microcontroller unit of the product and equipment applies to the server for the program to be updated, and updates after the download is completed, and replaces the old program with the downloaded new program. This traditional method requires the entire program package to be downloaded and installed, which may cause problems such as slow program upgrade efficiency and network connection, large update data volume, and long update time. At the same time, due to the diffusion and diversity of network transmission, most users cannot guarantee the legality (confirm that it is the original and unmodified) and integrity of the downloaded firmware. When users accidentally download damaged or illegal versions or even maliciously tampered firmware to upgrade the product, it often causes the product to fail to start and the user suffers a large loss. If the manufacturer's copyright, version and other information in the firmware are also modified, the manufacturer's interests will also be damaged. Summary of the invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a firmware differential upgrade method, system, electronic device and storage medium, which effectively solve the problems of long update time and low security in the firmware upgrade process.

[0005] In a first aspect, the present invention provides a firmware differential upgrade method, which is applied to a terminal device and includes:

[0006] Obtaining a difference data list, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device;

[0007] Downloading at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list;

[0008] Verifying at least one of the target data subpackets one by one;

[0009] After the last target data sub-package is verified and passes the verification, obtaining a restored new firmware according to at least one target data sub-package and the current firmware;

[0010] The restored new firmware is verified, and after the verification passes, the firmware is updated to update the current firmware to the restored new firmware.

[0011] In a second aspect, the present invention further provides a firmware differential upgrade method, which is applied to a terminal device and comprises:

[0012] Obtaining a difference data list, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device;

[0013] Downloading at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list;

[0014] After each target data sub-packet is downloaded, verification is performed, and if the verification passes, the target data sub-packet is written into the memory of the terminal device; if the verification fails, subsequent data reception is stopped;

[0015] After the last target data sub-packet is verified and passes the verification, the current firmware is updated according to at least one target data sub-packet.

[0016] According to the first aspect or the second aspect of the application, further, obtaining the difference data list includes:

[0017] Acquire an attribute table in an information package of the new firmware from the server, wherein the attribute table includes check values ​​of a plurality of the data subpackets of the new firmware;

[0018] Acquire a local checksum of the current firmware from the terminal device;

[0019] The check value in the attribute table is compared with the local check table, and the difference data list is generated according to the comparison result.

[0020] According to the first aspect or the second aspect of the application, further, the downloading of at least one target data subpacket from the multiple data subpackets of the new firmware from the server according to the difference data list includes:

[0021] Determine, according to the difference data list, a data subpacket in the new firmware that is inconsistent with the current firmware as at least one target data subpacket;

[0022] Acquire an information package of the new firmware from the server, and acquire a storage location of at least one target data subpackage in the server from the information package;

[0023] At least one of the target data sub-packets is downloaded according to the storage location.

[0024] According to the first aspect or the second aspect of the application, further, before downloading at least one target data subpacket of the multiple data subpackets of the new firmware from the server according to the difference data list, the method further includes:

[0025] Download the information package of the new firmware from the server;

[0026] The signature value of the information packet is verified, where the signature value is calculated based on the private key of the digital signature certificate.

[0027] According to the first aspect or the second aspect of the application, further, the obtaining the restored new firmware according to at least one of the target data subpackets and the current firmware includes:

[0028] Decrypt each target data sub-packet downloaded to obtain a decrypted compressed data sub-packet;

[0029] Decompressing the decrypted compressed data subpacket to obtain a decompressed data subpacket;

[0030] The public key of the digital signature certificate is used to verify the signature value of the decompressed data sub-packet to verify the legitimacy of the decompressed data sub-packet;

[0031] The restored new firmware is obtained according to the current firmware and all the decompressed data sub-packets that have passed the legality verification.

[0032] In a third aspect, the present invention provides a firmware generation method, the method is used to generate the new firmware in the first aspect and the second aspect of the present invention, the method comprising:

[0033] Acquire firmware update data, and divide the firmware update data into multiple data packets;

[0034] Generate an attribute table for the multiple data subpackets, and generate the new firmware according to the multiple data subpackets and the attribute table, wherein the attribute table includes signature values ​​and check values ​​for the multiple data subpackets, the signature value is used to perform a legitimacy check on at least one target data subpacket, and the check value is used to obtain a difference data list and to perform an integrity check on the restored new firmware.

[0035] Further, the generating of the attribute tables of the plurality of data subpackets and the generating of the new firmware according to the plurality of data subpackets and the attribute tables comprises:

[0036] Calculating a check value for each of the data subpackets, and generating an attribute table according to a plurality of the check values;

[0037] Compressing the plurality of data subpackets to obtain a plurality of compressed data subpackets;

[0038] Encrypting the plurality of compressed data subpackets to obtain a plurality of encrypted compressed data subpackets;

[0039] Integrate the encrypted compressed data subpacket with the attribute table to obtain the new firmware;

[0040] and / or;

[0041] Before generating the new firmware according to the plurality of data packets and the attribute table, the method further comprises:

[0042] Using different compression algorithms to compress the plurality of data subpackets respectively, and obtaining the total capacity of the compressed files corresponding to the different compression algorithms respectively;

[0043] The total capacities of the compressed files corresponding to different compression algorithms are compared, and a compressed file based on the same compression algorithm and having the smallest total capacity is determined as a target compressed file, and the target compressed file is used to generate the new firmware.

[0044] In a fourth aspect, the present invention further provides a firmware differential upgrade method, which is applied to a terminal device, a compiling device and a server, and the method comprises:

[0045] generating firmware update data on the compiling device, and dividing the firmware update data into a plurality of data sub-packets;

[0046] The compiling device generates a plurality of attribute tables of the data subpackets, generates a new firmware according to the plurality of data subpackets and the attribute tables, and sends the new firmware to the server;

[0047] generating a difference data list on the terminal device, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device;

[0048] The terminal device downloads at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list;

[0049] The terminal device obtains the restored new firmware according to at least one of the target data subpackets and the current firmware, and performs firmware update according to the restored new firmware.

[0050] In a fifth aspect, the present invention provides a firmware differential upgrade system, which is applied to a terminal device, a compiling device and a server, and includes:

[0051] A firmware segmentation module, used for segmenting the firmware update data into a plurality of data sub-packets on the compiling device;

[0052] A firmware generation module, used for the compiling device to generate attribute tables of the plurality of data subpackets, generate new firmware according to the plurality of data subpackets and the attribute tables, and send the new firmware to the server;

[0053] A differential download module, configured to generate a differential data list on the terminal device, and download at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the differential data list;

[0054] A data verification module, configured to verify at least one of the target data sub-packages on the terminal device, and obtain a restored new firmware according to at least one of the target data sub-packages and the current firmware after the verification passes;

[0055] The firmware update module is used to verify the restored new firmware on the terminal device and perform firmware update after the verification passes, so as to update the current firmware to the restored new firmware.

[0056] In a sixth aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the firmware differential upgrade method described in the first aspect of the present invention and the second aspect of the present invention, the firmware generation method described in the third aspect of the present invention, and the firmware differential upgrade method described in the fourth aspect of the present invention.

[0057] In the seventh aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the firmware differential upgrade method described in the first aspect of the present invention and the second aspect of the present invention, the firmware generation method described in the third aspect of the present invention, and the firmware differential upgrade method described in the fourth aspect of the present invention.

[0058] The firmware differential upgrade method, system, electronic device and storage medium provided by the present invention split a large firmware file into multiple smaller data packets, which can be convenient for transmission and management. After the firmware is split, it can be downloaded in a breakpoint-resume mode. During the download process, if a network interruption or other errors occur, the system can record the downloaded data packets and continue downloading from the last interruption point after the connection is restored, instead of restarting the download of the entire firmware, which greatly saves time and bandwidth. The firmware is encrypted during transmission to ensure that the firmware is not intercepted or tampered with by an unauthorized third party during transmission. The most suitable compression algorithm is selected according to the firmware characteristics to ensure a higher compression rate and a faster decompression speed. The signature value of the updated firmware is a signature of the firmware's information packet attribute table, not the entire firmware, which can improve the efficiency of signature verification. The attribute table adds a check value for each data packet, and the difference data list can be obtained based on the check value to filter out different firmware update packages for differential upgrades. It is not necessary to download the entire firmware for update and replacement, which greatly shortens the upgrade time and improves the upgrade efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0060] Figure 1 This is a first schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention;

[0061] Figure 2 This is a second schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention;

[0062] Figure 3 This is a third schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention;

[0063] Figure 4 This is a fourth schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention;

[0064] Figure 5 This is a flowchart of a firmware differential upgrade method provided by Embodiment 2 of the present invention;

[0065] Figure 6 This is a first schematic diagram of a firmware generation method process provided by Embodiment 3 of the present invention;

[0066] Figure 7This is a second schematic diagram of a firmware generation method process provided by Embodiment 3 of the present invention;

[0067] Figure 8 This is a flowchart of a firmware differential upgrade method provided by Embodiment 4 of the present invention;

[0068] Fig. 9 This is a schematic diagram of the structure of a firmware differential upgrade system provided by Embodiment 5 of the present invention;

[0069] Fig.10 It is a structural schematic diagram of an electronic device provided in Example 6 of the present invention.

[0070] Description of main component symbols:

[0071] 500, firmware differential upgrade system; 510, firmware segmentation module; 520, firmware generation module; 530, differential download module; 540, data verification module; 550, firmware update module; 600, electronic device; 610, processor; 620, communication interface; 630, memory; 640, communication bus. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be further clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be noted that 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 making creative work are within the scope of protection of the present invention.

[0073] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0074] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0075] At present, during the firmware update process, the microcontroller unit of the product and device applies to the server for the program to be updated, and updates after the download is complete, and replaces the old program with the downloaded new program. This traditional method requires the entire program package to be downloaded and installed, which may cause problems such as slow program upgrade efficiency and network connection, large update data volume, and long update time. At the same time, due to the diffusion and diversity of network transmission, most users cannot guarantee the legality (confirm that it is the original and unmodified) and integrity of the downloaded firmware. When users accidentally download damaged or illegal versions or even maliciously tampered firmware to upgrade the product, it often causes the product to fail to start and the user suffers a large loss. If the manufacturer's copyright, version and other information in the firmware are also modified, the manufacturer's interests will also be damaged.

[0076] Example 1

[0077] In view of the above-mentioned deficiencies in the prior art, an embodiment of the present invention provides a firmware differential upgrade method, which effectively solves the problems of long update time and low security in the firmware upgrade process. The method is applied to terminal devices, which include but are not limited to electronic devices such as mobile phones, tablets and computers. Figure 1 1 is a first schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0078] S100: Obtain a difference data list, where the difference data list is used to indicate the difference between the new firmware in the server and the current firmware in the terminal device.

[0079] In the embodiment of the present invention, the corresponding firmware data package is selected for downloading according to the difference data list, that is, specific data in the server is read instead of all data, and the data package is downloaded partially instead of all data packages. Figure 2 2 is a second schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention, such as Figure 2 As shown, obtaining the difference data list includes the following steps:

[0080] S101. Obtain an attribute table in an information package of a new firmware from a server, where the attribute table includes check values ​​of multiple data subpackets of the new firmware.

[0081] Optionally, the compiling device uses a cyclic redundancy check algorithm to calculate the check value of the data subpacket of the new firmware to obtain the check values ​​of multiple data subpackets. An attribute table is generated according to the check values ​​of all data subpackets, and the attribute table is sent to the server for storage and obtained by the terminal device.

[0082] S102: Obtain a local checksum of the current firmware from the terminal device.

[0083] The local checksum of the current firmware of the terminal device is usually a tool or document used to verify the integrity and consistency of the device firmware, configuration or data. The local checksum can contain a variety of information, such as the firmware version number, checksum value, digital signature, etc., to ensure that the device is using the correct and untampered firmware or configuration during operation.

[0084] S103: Compare the check value in the attribute table with the local check table, and generate a difference data list according to the comparison result.

[0085] By reading the data in the attribute table and the local verification table, the records in the two are associated and compared by primary key or unique identifier, and for the fields where differences are found, the specific information of the differences is recorded, including the field name, the value in the attribute table, the value in the local verification table, and the unique identifier of the record, so as to generate a list of difference data.

[0086] As a preferred implementation of the embodiment of the present invention, the information package of the new firmware can also be downloaded from the server to verify the signature value of the information package to prevent tampering or illegal attacks, wherein the signature value is calculated based on the private key of the digital signature certificate.

[0087] S110 . Download at least one target data subpacket among multiple data subpackets of the new firmware from the server according to the difference data list.

[0088] Figure 3 3 is a third schematic diagram of a firmware differential upgrade method process provided by Embodiment 1 of the present invention, such as Figure 3 As shown, the downloading of the target data sub-packet includes the following steps:

[0089] S111. Determine, according to the difference data list, a data sub-packet in the new firmware that is inconsistent with the current firmware as at least one target data sub-packet.

[0090] S112: Obtain an information package of the new firmware from the server, and obtain a storage location of at least one target data subpackage in the server from the information package.

[0091] Optionally, obtain an interface for the server to provide a new firmware information package, such as an HTTP or HTTPS URL. The terminal device sends a request to the URL, and the server returns the new firmware information package after receiving the request. The information package can be a data structure in JSON, XML or other formats. The storage location information of the target data sub-packet is searched in the information package, which can be a URL, file path or some identifier.

[0092] S113. Download at least one target data subpackage according to the storage location.

[0093] If the storage location is a URL, the target data package can be downloaded directly using the URL. If the storage location is a file path or identifier, it is combined with the server's base URL or other parameters to construct a complete download URL for downloading.

[0094] S120: Verify at least one target data subpacket one by one.

[0095] The public key of the digital signature certificate is used to verify the signature value of the target data subpacket. If the calculation is correct, the verification is successful.

[0096] S130: After the last target data sub-package is verified and passes the verification, a restored new firmware is obtained according to at least one target data sub-package and the current firmware.

[0097] Figure 4 4 is a schematic diagram of a firmware differential upgrade method provided in Embodiment 1 of the present invention. Figure 4 As shown, obtaining the restored new firmware specifically includes the following steps:

[0098] S131, decrypt each downloaded target data sub-packet to obtain a decrypted compressed data sub-packet;

[0099] S132, decompressing the decrypted compressed data sub-packet to obtain a decompressed data sub-packet;

[0100] S133, using the public key of the digital signature certificate to perform signature verification calculation on the signature value of the decompressed data sub-packet to verify the legitimacy of the decompressed data sub-packet;

[0101] S134. Obtain a restored new firmware based on the current firmware and all decompressed data packets that have passed the legality verification.

[0102] The verified decompressed data is parsed in packets to extract the update data required for the current firmware update, which may include but is not limited to new firmware code, configuration files, patches, etc. The update data is written into the current firmware to obtain the restored new firmware.

[0103] S500: Verify the restored new firmware, and update the firmware after the verification passes, so as to update the current firmware to the restored new firmware.

[0104] In an embodiment of the present invention, integrity check and legality check are performed on the restored new firmware, wherein the integrity check uses a cyclic redundancy check algorithm to perform an overall integrity check on the check value of the restored new firmware, and the legality check uses the public key of the digital signature certificate to perform signature verification calculation on the signature value of the restored new firmware to obtain a verification result.

[0105] Example 2

[0106] The embodiment of the present invention provides another firmware differential upgrade method, which is applied to a terminal device. Figure 5 : is a flowchart of a firmware differential upgrade method provided by Embodiment 2 of the present invention, such as Figure 5 As shown, the method comprises the following steps:

[0107] S200: Obtain a difference data list, where the difference data list is used to indicate the difference between the new firmware in the server and the current firmware in the terminal device.

[0108] In the embodiment of the present invention, the steps of acquiring the difference data list are the same as those in Embodiment 1, that is, acquiring the difference data list through steps S101 - S103 .

[0109] S210 . Download at least one target data subpacket among multiple data subpackets of the new firmware from the server according to the difference data list.

[0110] In the embodiment of the present invention, the steps of acquiring the target data subpacket are the same as those in Embodiment 1, that is, acquiring the target data subpacket through steps S111 - S113 .

[0111] S220, after each target data sub-packet is downloaded, verification is performed. If the verification passes, the target data sub-packet is written into the memory of the terminal device. If the verification fails, the reception of subsequent data is stopped.

[0112] Each time a target data sub-package is downloaded, it is decrypted to obtain a decrypted compressed data sub-package; the decrypted compressed data sub-package is then decompressed to obtain a decompressed data sub-package; the signature value of the decompressed data sub-package is verified and calculated using the public key of the digital signature certificate to verify the legitimacy of the decompressed data sub-package. The decompressed data sub-package that passes the verification is written into the memory of the terminal device. If there is a decompressed data sub-package that fails the verification, the subsequent data reception is stopped.

[0113] S230: After the last target data sub-packet is verified and passes the verification, the current firmware is updated according to at least one target data sub-packet.

[0114] The decompressed data stored in the memory of the terminal device is parsed and sub-packed to extract the update data required for the current firmware update. The update data may include but is not limited to new firmware code, configuration files, patches, etc. The update data is directly imported into the current firmware for firmware update.

[0115] Example 3

[0116] The embodiment of the present invention provides a firmware generation method, which is used to generate the new firmware in Embodiment 1 and Embodiment 2. Figure 6: is a first schematic diagram of a firmware generation method process provided by Embodiment 3 of the present invention, such as Figure 6 As shown, the firmware generation method includes the following steps:

[0117] S300: Obtain firmware update data, and divide the firmware update data into multiple data packets.

[0118] Obtaining the firmware update data and dividing it into multiple data packets of 4K size, by dividing a large firmware update file into multiple smaller data packets, it is possible to adapt to the limitations of network transmission, optimize storage, and improve processing efficiency.

[0119] S310: Generate attribute tables of multiple data packets, and generate new firmware according to the multiple data packets and the attribute tables.

[0120] In an embodiment of the present invention, the attribute table includes signature values ​​and check values ​​of multiple data subpackets, the signature value is used to verify the legitimacy of at least one target data subpacket, and the check value is used to obtain a difference data list and to perform integrity verification on the restored new firmware.

[0121] Figure 7 is a second schematic diagram of a firmware generation method process provided by Embodiment 3 of the present invention, such as Figure 7 As shown, the generation of new firmware specifically includes the following steps:

[0122] S311. Calculate the check value of each data subpacket, and generate an attribute table according to multiple check values.

[0123] Optionally, a cyclic redundancy check algorithm is used to calculate a check value for each data subpacket to obtain check values ​​of multiple data subpackets, and an attribute table is generated according to the check values ​​of all data subpackets.

[0124] S312: compress the multiple data subpackets to obtain multiple compressed data subpackets.

[0125] Each data sub-packet is compressed using different compression algorithms to obtain the total capacity of compressed files corresponding to different compression algorithms, wherein the compression algorithms include but are not limited to one or more of fastlz, quicklz and minilzo. The total capacity of compressed files corresponding to different compression algorithms is compared, and the compressed file based on the same compression algorithm and with the smallest total capacity is determined as the target compressed file, and finally the compressed data sub-packets corresponding to each data sub-packet are obtained according to the target compressed file.

[0126] Specifically, if the first compression method is used to compress all data packets and then the total file size is calculated to obtain B1, the second compression method is used to compress all data packets and then the total file size is calculated to obtain B2, and the third compression method is used to compress all data packets and then the total file size is calculated to obtain B3, then the sizes of B1, B2 and B3 are compared, and the compressed file with the smallest total size among the three compressed files is selected as the compressed data packet of all data packets, thereby saving firmware update download traffic and download time.

[0127] S313. Encrypt the multiple compressed data subpackets to obtain multiple encrypted compressed data subpackets.

[0128] A block encryption algorithm is used to perform encryption operations on multiple compressed data packets. The block encryption algorithm encrypts each block of plaintext through a key and a specific encryption function to generate a corresponding ciphertext block. The decryption process is the reverse process of encryption, and the ciphertext block is restored to a plaintext block using the same key and algorithm. In the embodiment of the present invention, the block encryption algorithm includes but is not limited to encryption algorithms such as SM4, DES and AES.

[0129] S314, integrating the encrypted compressed data subpacket and the attribute table to obtain a new firmware.

[0130] Optionally, space may be directly allocated for the metadata of the attribute table in the data structure of the encrypted compressed data packet for integration, and an archiving tool (such as ZIP, TAR, etc.) may be used to encapsulate the encrypted compressed data packet and the attribute table into a single file.

[0131] Example 4

[0132] The embodiment of the present invention provides a firmware differential upgrade method, which is applied to a terminal device, a compiling device and a server. Figure 8 4 is a flowchart of a firmware differential upgrade method provided by Embodiment 4 of the present invention. Figure 8 As shown, the method specifically comprises the following steps:

[0133] S400: Generate firmware update data on a compiling device, and divide the firmware update data into multiple data packets.

[0134] The compiling device obtains the firmware update data and divides it into multiple data packets of 4K size, thereby dividing the large firmware update file into multiple smaller data packets.

[0135] S410: The compiling device generates attribute tables of multiple data packets, generates new firmware according to the multiple data packets and the attribute tables, and sends the new firmware to the server.

[0136] The compilation device calculates the check value of each data packet, generates an attribute table according to multiple check values, compresses and encrypts multiple data packets, obtains multiple encrypted compressed data packets, integrates the attribute table and the encrypted compressed data packet to generate new firmware and sends it to the server.

[0137] S420: Generate a difference data list on the terminal device, where the difference data list is used to indicate the difference between the new firmware in the server and the current firmware in the terminal device.

[0138] In the embodiment of the present invention, the steps of acquiring the difference data list are the same as those in Embodiment 1, that is, acquiring the difference data list through steps S101 - S103 .

[0139] S430, the terminal device downloads at least one target data subpacket from multiple data subpackets of the new firmware from the server according to the difference data list;

[0140] In the embodiment of the present invention, the steps of acquiring the target data subpacket are the same as those in Embodiment 1, that is, acquiring the target data subpacket through steps S111 - S113 .

[0141] S440: The terminal device obtains a restored new firmware according to at least one target data subpacket and the current firmware, and performs a firmware update according to the restored new firmware.

[0142] Optionally, at least one target data subpacket can be verified one by one, and after the last target data subpacket is verified and the verification passes, a restored new firmware can be obtained based on at least one target data subpacket and the current firmware, the restored new firmware can be verified, and the firmware can be updated after the verification passes to update the current firmware to the restored new firmware.

[0143] It can be understood that the implementation methods of the firmware differential upgrade method and the firmware generation method described in the above embodiments 1-3 are also applicable to this embodiment and can achieve the same technical effects, so they will not be repeated here.

[0144] Example 5

[0145] Based on the same technical concept as the method embodiments of the above-mentioned embodiments 1 to 4, an embodiment of the present invention provides a firmware differential upgrade system, which is applied to a terminal device, a compilation device and a server. Fig. 9 is a schematic diagram of a firmware differential upgrade system structure provided by Embodiment 5 of the present invention, such as Fig. 9 As shown, the firmware differential upgrade system 500 includes:

[0146] The firmware segmentation module 510 is used to segment the firmware update data into multiple data packets on the compiling device;

[0147] The firmware generation module 520 is used to compile the device to generate a property table of multiple data sub-packets, generate new firmware according to the multiple data sub-packets and the property table, and send the new firmware to the server;

[0148] The difference download module 530 is used to generate a difference data list on the terminal device, and download at least one target data subpacket among multiple data subpackets of the new firmware from the server according to the difference data list;

[0149] The data verification module 540 is used to verify at least one target data subpackage on the terminal device, and obtain the restored new firmware according to the at least one target data subpackage and the current firmware after the verification passes;

[0150] The firmware update module 550 is used to verify the restored new firmware on the terminal device, and to update the firmware after the verification passes, so as to update the current firmware to the restored new firmware.

[0151] It can be understood that the implementation methods of the firmware differential upgrade method and the firmware generation method described in the above embodiments 1-4 are also applicable to this embodiment and can achieve the same technical effects, so they will not be repeated here.

[0152] Example 6

[0153] Based on the same concept, an embodiment of the present invention further provides an electronic device, Fig.10 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.10 As shown, the electronic device 600 may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the steps of the firmware differential upgrade method and the firmware generation method described in the above embodiments. For example, it includes:

[0154] S100, obtaining a difference data list, where the difference data list is used to indicate the difference between the new firmware in the server and the current firmware in the terminal device;

[0155] S110, downloading at least one target data subpacket among multiple data subpackets of the new firmware from the server according to the difference data list;

[0156] S120, verifying at least one target data subpacket one by one;

[0157] S130, after the last target data sub-package is verified and the verification passes, obtaining a restored new firmware according to at least one target data sub-package and the current firmware;

[0158] S140: Verify the restored new firmware, and update the firmware after the verification passes, so as to update the current firmware to the restored new firmware.

[0159] The processor 610 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0160] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the 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, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0161] The memory 630 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor 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 combinations thereof.

[0162] Example 7

[0163] Based on the same concept, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, and the computer program includes at least one code segment, which can be executed by a main control device to control the main control device to implement the steps of the firmware differential upgrade method and the firmware generation method described in the above embodiments. For example, it includes:

[0164] S100, obtaining a difference data list, where the difference data list is used to indicate the difference between the new firmware in the server and the current firmware in the terminal device;

[0165] S110, downloading at least one target data subpacket among multiple data subpackets of the new firmware from the server according to the difference data list;

[0166] S120, verifying at least one target data subpacket one by one;

[0167] S130, after the last target data sub-package is verified and the verification passes, obtaining a restored new firmware according to at least one target data sub-package and the current firmware;

[0168] S140: Verify the restored new firmware, and update the firmware after the verification passes, so as to update the current firmware to the restored new firmware.

[0169] Based on the same technical concept, an embodiment of the present invention further provides a computer program, which is used to implement the above method embodiment when executed by a main control device.

[0170] The computer program may be stored in whole or in part on a computer-readable storage medium packaged with the processor, or may be stored in whole or in part on a memory not packaged with the processor.

[0171] Based on the same technical concept, an embodiment of the present invention further provides a processor, which is used to implement the above method embodiment. The above processor can be a chip.

[0172] In summary, the firmware differential upgrade method, system, electronic device and storage medium provided by the present invention split a large firmware file into multiple smaller data packets, which can be convenient for transmission and management. After the firmware is split, it can be downloaded in a breakpoint-resume mode. During the download process, if a network interruption or other errors occur, the system can record the downloaded data packets and continue downloading from the last interruption point after the connection is restored, instead of restarting the download of the entire firmware. This greatly saves time and bandwidth. The firmware is encrypted during transmission to ensure that the firmware is not intercepted or tampered with by an unauthorized third party during transmission. The most suitable compression algorithm is selected according to the firmware characteristics to ensure a high compression rate and a faster decompression speed. The signature value of the updated firmware is a signature of the firmware's information packet attribute table, not the entire firmware, which can improve the efficiency of signature verification. The attribute table adds a check value for each data packet, and the difference data list can be obtained based on the check value to filter out different firmware update packages for differential upgrades. It is not necessary to download the entire firmware for update and replacement, which greatly shortens the upgrade time and improves the upgrade efficiency.

[0173] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0174] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A firmware differential upgrade method, It is characterized in that The method is applied to a terminal device, and the method comprises: Obtaining a difference data list, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device; Downloading at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list; Verifying at least one of the target data subpackets one by one; After the last target data sub-package is verified and passes the verification, obtaining a restored new firmware according to at least one target data sub-package and the current firmware; The restored new firmware is verified, and after the verification passes, the firmware is updated to update the current firmware to the restored new firmware.

2. The firmware differential upgrade method according to claim 1, It is characterized in that The step of obtaining a difference data list includes: Acquire an attribute table in an information package of the new firmware from the server, wherein the attribute table includes check values ​​of a plurality of the data subpackets of the new firmware; Acquire a local checksum of the current firmware from the terminal device; The check value in the attribute table is compared with the local check table, and the difference data list is generated according to the comparison result.

3. The firmware differential upgrade method according to claim 1, It is characterized in that The step of downloading at least one target data subpacket from the plurality of data subpackets of the new firmware from the server according to the difference data list comprises: Determine, according to the difference data list, a data subpacket in the new firmware that is inconsistent with the current firmware as at least one target data subpacket; Acquire an information package of the new firmware from the server, and acquire a storage location of at least one target data subpackage in the server from the information package; At least one of the target data sub-packets is downloaded according to the storage location.

4. The firmware differential upgrade method according to claim 1, It is characterized in that Before downloading at least one target data subpacket of the multiple data subpackets of the new firmware from the server according to the difference data list, the method further includes: Download the information package of the new firmware from the server; The signature value of the information packet is verified, where the signature value is calculated based on the private key of the digital signature certificate.

5. The firmware differential upgrade method according to any one of claims 1 to 4, It is characterized in that The step of obtaining the restored new firmware according to at least one of the target data sub-packets and the current firmware includes: Decrypt each target data sub-packet downloaded to obtain a decrypted compressed data sub-packet; Decompressing the decrypted compressed data subpacket to obtain a decompressed data subpacket; The public key of the digital signature certificate is used to verify the signature value of the decompressed data sub-packet to verify the legitimacy of the decompressed data sub-packet; The restored new firmware is obtained according to the current firmware and all the decompressed data sub-packets that have passed the legality verification.

6. A firmware differential upgrade method, It is characterized in that The method is applied to a terminal device, and the method comprises: Obtaining a difference data list, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device; Downloading at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list; After each target data sub-packet is downloaded, verification is performed, and if the verification passes, the target data sub-packet is written into the memory of the terminal device; if the verification fails, subsequent data reception is stopped; After the last target data sub-packet is verified and passes the verification, the current firmware is updated according to at least one target data sub-packet.

7. A firmware generation method, It is characterized in that The method is used to generate the new firmware in the firmware differential upgrade method according to any one of claims 1 to 6, and the method comprises: Acquire firmware update data, and divide the firmware update data into multiple data packets; Generate an attribute table for the multiple data subpackets, and generate the new firmware according to the multiple data subpackets and the attribute table, wherein the attribute table includes signature values ​​and check values ​​for the multiple data subpackets, the signature value is used to perform a legitimacy check on at least one target data subpacket, and the check value is used to obtain a difference data list and to perform an integrity check on the restored new firmware.

8. The firmware generation method according to claim 7, It is characterized in that The step of generating the attribute table of the plurality of data sub-packets and generating the new firmware according to the plurality of data sub-packets and the attribute table comprises: Calculating a check value for each of the data subpackets, and generating an attribute table according to a plurality of the check values; Compressing the plurality of data subpackets to obtain a plurality of compressed data subpackets; Encrypting the plurality of compressed data subpackets to obtain a plurality of encrypted compressed data subpackets; Integrate the encrypted compressed data subpacket with the attribute table to obtain the new firmware; and / or; Before generating the new firmware according to the plurality of data packets and the attribute table, the method further comprises: Using different compression algorithms to compress the plurality of data subpackets respectively, and obtaining the total capacity of the compressed files corresponding to the different compression algorithms respectively; The total capacities of the compressed files corresponding to different compression algorithms are compared, and a compressed file based on the same compression algorithm and having the smallest total capacity is determined as a target compressed file, and the target compressed file is used to generate the new firmware.

9. A firmware differential upgrade method, It is characterized in that The method is applied to a terminal device, a compiling device and a server, and the method comprises: generating firmware update data on the compiling device, and dividing the firmware update data into a plurality of data sub-packets; The compiling device generates a plurality of attribute tables of the data subpackets, generates a new firmware according to the plurality of data subpackets and the attribute tables, and sends the new firmware to the server; generating a difference data list on the terminal device, the difference data list being used to indicate the difference between the new firmware in the server and the current firmware in the terminal device; The terminal device downloads at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the difference data list; The terminal device obtains the restored new firmware according to at least one of the target data subpackets and the current firmware, and performs firmware update according to the restored new firmware.

10. A firmware differential upgrade system, It is characterized in that The system is applied to a terminal device, a compiling device and a server, and the system includes: A firmware segmentation module, used for segmenting the firmware update data into a plurality of data sub-packets on the compiling device; A firmware generation module, used for the compiling device to generate attribute tables of the plurality of data subpackets, generate new firmware according to the plurality of data subpackets and the attribute tables, and send the new firmware to the server; A differential download module, configured to generate a differential data list on the terminal device, and download at least one target data subpacket among the multiple data subpackets of the new firmware from the server according to the differential data list; A data verification module, configured to verify at least one of the target data sub-packages on the terminal device, and obtain a restored new firmware according to at least one of the target data sub-packages and the current firmware after the verification passes; The firmware update module is used to verify the restored new firmware on the terminal device and perform firmware update after the verification passes, so as to update the current firmware to the restored new firmware.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that The processor executes the computer program to implement the firmware differential upgrade method according to any one of claims 1 to 6, the firmware generation method according to claim 7 or 8, and the firmware differential upgrade method according to claim 9.

12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, it implements the firmware differential upgrade method according to any one of claims 1 to 6, the firmware generation method according to claim 7 or 8, and the firmware differential upgrade method according to claim 9.

Citation Information

Cited By

  • Remote upgrading method and system for concentrator

    CN119520273A

  • Transmitter parameter configuration method and device, readable storage medium and electronic equipment

    CN120800440A