Firmware upgrading method and device, equipment, server and storage medium

By dividing the firmware data packet into multiple data slices and verifying it, the problem of firmware data packets being tampered with or damaged during transmission is solved, and the reliability of firmware upgrades and the integrity of the data packets are improved.

CN119806576APending Publication Date: 2025-04-11QUECTEL WIRELESS SOLUTIONS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411829226.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Firmware data packets may be tampered with or damaged during transmission, resulting in failure of firmware upgrades.

Method used

Ensure the integrity and correctness of the data shards by dividing the firmware data packet into multiple data shards and verifying them between the terminal device and the server. The specific steps include receiving the data shard and the firmware verification value, calculating the second firmware verification value, and assembling the data shard into a firmware data packet when it is equal to the first firmware verification value.

Benefits of technology

Improve the reliability of firmware upgrades, ensure the integrity and correctness of firmware data packets, and promptly detect and resolve abnormal situations during firmware upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806576A_ABST
    Figure CN119806576A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method and device, equipment, a server and a storage medium. The firmware upgrading method comprises the steps that a first server sends m data fragments and a first firmware check value of target firmware to terminal equipment; the terminal equipment calculates a second firmware check value of the target firmware according to the m data fragments; if the second firmware verification value is equal to the first firmware verification value, the terminal equipment assembles the m data fragments into a firmware data packet; wherein the firmware data packet is used for upgrading target firmware in the terminal equipment. According to the embodiment of the invention, before the m data fragments are assembled into the firmware data packet, verification is carried out according to the m data fragments, so that the integrity and correctness of the firmware data packet assembled by the m data fragments are ensured, and the reliability of firmware upgrading is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a firmware upgrade method, device, equipment, server and storage medium. Background Art

[0002] The firmware upgrade of terminal devices is an indispensable part of device maintenance. It can improve the performance and compatibility of terminal devices and make terminal devices reach a better operating state. When upgrading the firmware, the terminal device needs to obtain a new firmware data packet, and then upgrade the firmware in the terminal device to a new firmware version according to the new firmware data packet. However, the firmware data packet may be tampered with or damaged during the transmission process, resulting in the failure of the firmware upgrade. Summary of the invention

[0003] The embodiments of the present application provide a firmware upgrade method, apparatus, device, server, and storage medium, which can ensure the integrity and correctness of a firmware data packet assembled from m data slices and improve the reliability of the firmware upgrade.

[0004] On the one hand, an embodiment of the present application provides a firmware upgrade method, which is applied to a terminal device, and the method includes:

[0005] Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0006] Calculating a second firmware check value of the target firmware according to the m data slices;

[0007] If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0008] In some embodiments of the present application, calculating the second firmware check value of the target firmware according to the m data slices includes:

[0009] Calculate a second slice check value of each data slice according to the data slice;

[0010] The second firmware check value is calculated according to the m second slice check values.

[0011] In some embodiments of the present application, calculating the second slice check value of the data slice according to each of the data slices includes:

[0012] For each of the data slices, in response to receiving the data slice, calculating the second slice check value of the data slice;

[0013] or,

[0014] In response to receiving the m data slices, for each of the data slices, the second slice check value of the data slice is calculated.

[0015] In some embodiments of the present application, the method further includes:

[0016] Receiving m first shard check values ​​from the first server; wherein one first shard check value corresponds to one data shard;

[0017] For each of the data slices, compare the second slice check value and the first slice check value of the data slice.

[0018] In some embodiments of the present application, calculating the second firmware check value of the target firmware according to the m data slices includes:

[0019] If the second slice check values ​​of the m data slices are all equal to the first slice check value, the second firmware check value of the target firmware is calculated based on the m data slices.

[0020] In some embodiments of the present application, after receiving the m data slices from the first server, the method further includes:

[0021] For each of the data slices, the second preset key is used to decrypt the data slice to obtain the decrypted data slice; wherein, the m decrypted data slices are used to calculate the second firmware check value, and the m decrypted data slices are used to assemble the firmware data packet.

[0022] On the other hand, an embodiment of the present application provides a firmware upgrade method, applied to a first server, the method comprising:

[0023] Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0024] In some embodiments of the present application, before sending the m data slices and the first firmware check value of the target firmware to the terminal device, the method further includes:

[0025] Calculate a first slice check value of each data slice according to the data slice;

[0026] The first firmware check value is calculated according to the m first slice check values.

[0027] In some embodiments of the present application, the method further includes:

[0028] Send m first-slice check values ​​to the terminal device.

[0029] In some embodiments of the present application, the method further includes:

[0030] For each of the data slices, encrypt the data slice using a first preset key to obtain the encrypted data slice;

[0031] The sending m data slices to the terminal device includes:

[0032] Send m encrypted data fragments to the terminal device.

[0033] On the other hand, an embodiment of the present application provides a firmware upgrade device, the device comprising:

[0034] A first receiving module, configured to receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0035] A first calculation module, configured to calculate a second firmware check value of the target firmware according to the m data slices;

[0036] A data packet assembly module is used to assemble the m data fragments into a firmware data packet if the second firmware check value is equal to the first firmware check value; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0037] On the other hand, an embodiment of the present application provides a firmware upgrade device, the device comprising:

[0038] A second sending module is used to send m data slices and a first firmware check value of the target firmware to the terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0039] On the other hand, an embodiment of the present application provides a terminal device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor performs the following steps:

[0040] Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0041] Calculating a second firmware check value of the target firmware according to the m data slices;

[0042] If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0043] On the other hand, an embodiment of the present application provides a first server, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor performs the following steps:

[0044] Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0045] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of any one of the firmware upgrade methods provided in the embodiments of the present application.

[0046] The firmware upgrade method provided in the embodiment of the present application improves the reliability of data transmission by dividing the firmware data packet required for the firmware upgrade into multiple data fragments. In addition, in the embodiment of the present application, for the case of using multiple data fragments for transmission, the first server and the terminal device respectively calculate the firmware check value according to the m data fragments, and then the terminal device compares the first firmware check value calculated by the first server with the second firmware check value calculated by the terminal device. If the two are the same, it is considered that the multiple data fragments have passed the check, and the terminal device further assembles the m data fragments into a firmware data packet for firmware upgrade. The embodiment of the present application verifies according to the m data fragments before assembling the m data fragments into a firmware data packet to ensure the integrity and correctness of the firmware data packet assembled by the m data fragments, timely discovers abnormal situations in the firmware upgrade process, and improves the reliability of the firmware upgrade. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 It is a schematic diagram of the architecture of a firmware upgrade system provided in an embodiment of the present application;

[0049] Figure 2 It is a flowchart of a firmware upgrade method provided in an embodiment of the present application;

[0050] Figure 3 It is a structural schematic diagram of a firmware upgrade device provided in an embodiment of the present application;

[0051] Figure 4 It is a structural schematic diagram of another firmware upgrade device provided in an embodiment of the present application;

[0052] Figure 5 It is a structural diagram of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0054] In the following description, specific embodiments of the present invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise specified. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and computer execution referred to herein includes operations by a computer processing unit of electronic signals representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the above text, which does not represent a limitation, and those skilled in the art will understand that the various steps and operations described below can also be implemented in hardware.

[0055] The term "module" or "unit" used herein can be regarded as a software object executed on the computing system. The different components, modules, engines and services described herein can be regarded as implementation objects on the computing system. The apparatus and method described herein are preferably implemented in software, but can also be implemented in hardware, all within the scope of protection of the present invention.

[0056] Those skilled in the art will appreciate that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when an element is "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0057] Please refer to Figure 1 , which shows a schematic diagram of the architecture of a firmware upgrade system provided by an embodiment of the present application. The firmware upgrade system may include: a terminal device 10 and a first server 20.

[0058] The terminal device 10 may be any type of smart device, which may be a mobile terminal or a relatively fixed terminal. For example, the terminal device 10 may be a mobile phone, a computer, a game console, an e-reader, a wearable device, a smart home device, a vehicle, an Internet of Things device, etc.

[0059] The first server 20 communicates and interacts with the terminal device 10 to implement the firmware upgrade of the terminal device 10. For example, the first server 20 can provide the terminal device 10 with a data packet required for the firmware upgrade, or provide the address of the data packet required for the firmware upgrade. For another example, the first server 20 can retry or resume the firmware upgrade process of the terminal device 10 according to an error that occurs during the firmware upgrade process of the terminal device 10.

[0060] Alternatively, if Figure 1 As shown, the firmware upgrade system may further include a second server 30. The second server 30 communicates and interacts with the first server 20 to provide background management for the firmware upgrade of the terminal device 10. For example, the second server 30 may display the progress and status of the firmware upgrade, initiate the firmware upgrade, upload the data packets required for the firmware upgrade, and the like.

[0061] like Figure 1As shown, the first server 20 and the second server 30 can both be components of the developer center console. The firmware developer can upload the data packets required for the firmware upgrade, view the progress and status of the firmware upgrade, etc. through the second server 30, and can also manage the transmission method of the data packets required for the firmware upgrade through the first server 20.

[0062] In one example, the firmware upgrade method provided in the embodiment of the present application is implemented through OTA (Over-the-Air) technology, and the terminal device 10 and the first server 20 communicate based on the MQTT (Message Queuing Telemetry Transport) protocol; based on this, the first server 20 can be implemented as an MQTT Broker (MQTT proxy server), and the second server 30 can be implemented as an OTA server. Of course, the devices in the firmware upgrade system can also communicate based on other communication protocols, such as HTTP (HyperText Transfer Protocol), LwM2M (Lightweight M2M, Lightweight M2M (Machine-to-Machine, Device to Device)) protocol, etc., and the embodiment of the present application does not limit this.

[0063] Please refer to Figure 2 , which shows a flowchart of a firmware upgrade method provided by an embodiment of the present application. The firmware upgrade method can be applied to Figure 1 In the firmware upgrade system shown in FIG. 1 , for example, the firmware upgrade method may be performed by Figure 1 The terminal device and the first server in the firmware upgrade system shown in the figure interact with each other. Figure 2 As shown, the firmware upgrade method includes the following steps (steps 110 to 130):

[0064] Step 110: The first server sends m data slices and a first firmware check value of the target firmware to the terminal device;

[0065] Step 120: The terminal device calculates a second firmware check value of the target firmware according to the m data slices;

[0066] Step 130: If the second firmware check value is equal to the first firmware check value, the terminal device assembles the m data fragments into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0067] The terminal device includes a target firmware, which may be any firmware in the terminal device or a specific firmware preset in the terminal device. The firmware upgrade process of the target firmware may be initiated by the terminal device, or by the first server, or by the above Figure 1 The embodiment of the present application does not limit this. For example, in the case where the firmware upgrade process is initiated by the terminal device, before step 110, the terminal device can send a firmware upgrade request to the first server, and then the first server executes step 110 in response to the firmware upgrade request. For another example, in the case where the firmware upgrade process is initiated by the first server, the first server can execute step 110 when there is an update to the data packet of the target firmware, or the first server can execute step 110 every preset time (such as every half a month). For another example, in the case where the firmware upgrade process is initiated by the second server, before step 110, the second server can send the data packet required for the firmware upgrade to the first server, and the first server executes step 110 in response to receiving the data packet.

[0068] In an embodiment of the present application, the firmware data packet required for the target firmware upgrade in the terminal device can be divided into m data slices, where m is a positive integer. Optionally, multiple channels can be established between the terminal device and the first server, and one or more data slices can be transmitted through a channel between the terminal device and the first server. The embodiment of the present application does not limit the correspondence between the transmission of multiple channels and multiple data slices, and can be flexibly set according to the needs in actual applications. Of course, only one channel for transmitting the data required for the upgrade can be established between the terminal device and the first server, so that m data slices are transmitted through the same channel.

[0069] The first server may send the first firmware check value of the target firmware to the terminal device while sending the m data slices to the terminal device; or may send the first firmware check value of the target firmware to the terminal device after sending the m data slices to the terminal device. The embodiment of the present application does not limit the specific type of the first firmware check value. Optionally, the first firmware check value may be a check value calculated based on a hash value or a checksum value.

[0070] After receiving the data fragment, the terminal device can calculate the second firmware check value of the target firmware by itself. The second firmware check value and the first firmware check value are check values ​​calculated based on the same method. For example, the terminal device and the first server can pre-agree on the calculation method of the check value, and then each checks the firmware check value according to the pre-agreement calculation method. Among them, the firmware check value calculated by the first server is called the first firmware check value in the embodiment of the present application, and the firmware check value calculated by the terminal device is called the second firmware check value in the embodiment of the present application.

[0071] The terminal device compares the first firmware check value and the second firmware check value. If the second firmware check value is equal to the first firmware check value, the m data slices pass the check. The terminal device assembles the m data slices into a firmware data packet to facilitate upgrading the target firmware in the terminal device. If the second firmware check value is not equal to the first firmware check value, the m data slices fail to pass the check. The terminal device can request the first server to retransmit the m data slices, or can request the first server to retransmit some data slices. Please refer to the introduction of the following embodiment, which will not be elaborated here.

[0072] In summary, the firmware upgrade method provided in the embodiment of the present application improves the reliability of data transmission by dividing the firmware data packet required for the firmware upgrade into multiple data fragments. In addition, in the embodiment of the present application, for the case of using multiple data fragments for transmission, the first server and the terminal device respectively calculate the firmware check value according to the m data fragments, and then the terminal device compares the first firmware check value calculated by the first server with the second firmware check value calculated by the terminal device. If the two are the same, it is considered that the multiple data fragments have passed the check, and the terminal device further assembles the m data fragments into a firmware data packet for firmware upgrade. The embodiment of the present application verifies according to the m data fragments before assembling the m data fragments into a firmware data packet to ensure the integrity and correctness of the firmware data packet assembled by the m data fragments, timely discovers abnormal situations in the firmware upgrade process, and improves the reliability of the firmware upgrade.

[0073] In one example, the above step 110 may further include the following steps (steps 011 to 012):

[0074] Step 011: The first server calculates a first slice check value of each data slice according to the data slice;

[0075] Step 012: The first server calculates a first firmware check value based on the m first slice check values.

[0076] Before sending the first firmware check value to the terminal device, the first server may first calculate the first firmware check value. In the embodiment of the present application, the firmware check value may be calculated based on the slice check values ​​of multiple data slices. Therefore, the first server first calculates the first slice check value of each data slice; then, based on the first slice check values ​​of the m data slices (i.e., the m first slice check values), calculates the first firmware check value of the target firmware.

[0077] The embodiment of the present application does not limit the calculation method of the shard check value. Optionally, the first server can calculate the first shard check value of each data shard based on hash value calculation or checksum value calculation. For example, if the first shard check value is calculated based on the checksum value, the first server can treat each data shard as a series of bytes, and then perform addition operations or XOR operations on these bytes to calculate the first shard check value of the data shard.

[0078] The embodiment of the present application does not limit the specific method of calculating the firmware checksum value based on the slice check value. Optionally, the first server can add the first slice check values ​​of the m data slices to obtain the first firmware check value; or, the first server can perform an XOR operation (such as a pairwise XOR operation) on the first slice check values ​​of the m data slices to obtain the first firmware check value; or, the first server can perform a weighted summation process on the first slice check values ​​of the m data slices to obtain the first firmware check value. Optionally, when performing a weighted summation process on the first slice check values ​​of the m data slices, the weight corresponding to each data slice can be determined based on the priority ranking of the data slice. The higher the priority ranking of the data slice, the greater the weight corresponding to the data slice. Among them, the priority ranking of the m data slices is consistent with the ranking of the degree of influence of the m data slices on the device operation status of the terminal device; or, the priority ranking of the m data slices is consistent with the ranking of the degree of influence of the m data slices on the firmware upgrade process of the target firmware.

[0079] In an example, the above step 120 may include the following steps:

[0080] Step 121: The terminal device calculates a second fragment check value of each data fragment according to the data fragment;

[0081] Step 122: The terminal device calculates a second firmware check value based on the m second slice check values.

[0082] The terminal device calculates the second slice check value of each data slice for the data slice; and then calculates the second firmware check value of the target firmware based on the second slice check values ​​of the m data slices (ie, m second slice check values).

[0083] Optionally, the terminal device may calculate the second shard check value of each data shard based on a hash value calculation or a checksum value calculation, etc. For example, if the second shard check value is calculated based on a checksum value, the terminal device may treat each data shard as a series of bytes, and then perform an addition operation or an XOR operation on the bytes to calculate the second shard check value of the data shard.

[0084] Optionally, the terminal device may add the second slice check values ​​of the m data slices to obtain the second firmware check value; or, the terminal device may perform an XOR operation (such as a pairwise XOR operation) on the second slice check values ​​of the m data slices to obtain the second firmware check value; or, the terminal device may perform a weighted summation process on the second slice check values ​​of the m data slices to obtain the second firmware check value. Optionally, when performing a weighted summation process on the second slice check values ​​of the m data slices, the weight corresponding to each data slice may be determined based on the priority ranking of the data slice, and the higher the priority ranking of the data slice, the greater the weight corresponding to the data slice. Among them, the priority ranking of the m data slices is consistent with the ranking of the degree of influence of the m data slices on the device operating status of the terminal device; or, the priority ranking of the m data slices is consistent with the ranking of the degree of influence of the m data slices on the firmware upgrade process of the target firmware.

[0085] It should be understood that in order to ensure the correctness of the verification process, in the embodiment of the present application, the first server and the terminal device should adopt the same calculation method to calculate the slice check value and the firmware check value. For example, the first server calculates the first slice check value and the first firmware check value based on the checksum value, and the first firmware check value is the sum of the m first slice check values; the terminal device also calculates the second slice check value and the second firmware check value based on the checksum value, and the second firmware check value is the sum of the m second slice check values.

[0086] Optionally, the above step 121 may include: the terminal device calculates the second shard check value of each data shard in response to receiving the data shard; or, the terminal device calculates the second shard check value of each data shard in response to receiving m data shards. That is, the terminal device may calculate the second shard check value of each data shard in real time each time it receives a data shard; or, after receiving each data shard, the terminal device first stores the data shard until all the data shards are received, and then calculates the second shard check value of each data shard in sequence or in parallel.

[0087] To sum up, the firmware upgrade method provided in the embodiment of the present application first calculates the slice check value of each of the m data slices, and then calculates the firmware check value based on the m slice check values. This can make the integrity and correctness of each data slice affect the overall check, thereby improving the reliability of data verification and thus improving the reliability of firmware upgrade.

[0088] In an example, the firmware upgrade method may further include the following steps:

[0089] Step 141: The first server sends m first fragment check values ​​to the terminal device.

[0090] Step 142: The terminal device compares the second fragment check value and the first fragment check value of each data fragment;

[0091] Step 143: If the second slice check values ​​of the m data slices are all equal to the first slice check value, the terminal device calculates the second firmware check value of the target firmware according to the m data slices.

[0092] The first server may also send the first shard check value of each data shard calculated by it to the terminal device. For example, the first server may send the first shard check value of the data shard at the same time as sending the data shard, that is, step 141 may be executed simultaneously with the above step 110; or, the first server may send m first shard check values ​​uniformly after sending m data shards, that is, step 141 may be executed after the above step 110; or, the first server may send m first shard check values ​​before sending m data shards, that is, step 141 may be executed before step 110. The embodiment of the present application does not limit the order of transmission of the first shard check value and the data shard.

[0093] The terminal device will also automatically calculate the second slice check value of each data slice, so that the terminal device can compare the first slice check value and the second slice check value of each data slice. If there is any data slice whose first slice check value is not equal to the second slice check value, the verification of the data slice fails, and the terminal device can request the first server to resend the data slice. If the first slice check value of all data slices is equal to the second slice check value, the verification of all data slices is successful, and the terminal device can further calculate the second firmware check value of the target firmware based on the second slice check values ​​of the m data slices to perform verification as a whole.

[0094] To sum up, the firmware upgrade method provided in the embodiment of the present application first verifies each data slice, and then verifies the whole data slice when all data slices have been verified successfully. This can enrich the verification dimension, thereby improving the accuracy of data verification, and further improving the success rate of firmware upgrade.

[0095] In an example, the firmware upgrade method may further include the following steps:

[0096] Step 151: The first server encrypts each data slice using a first preset key to obtain an encrypted data slice;

[0097] Step 152: The first server sends m encrypted data slices to the terminal device;

[0098] Step 153: For each data slice, the terminal device uses the second preset key to decrypt the data slice to obtain a decrypted data slice; wherein the m decrypted data slices are used to calculate the second firmware check value, and the m decrypted data slices are used to assemble a firmware data packet.

[0099] In the embodiment of the present application, data transmission between the terminal device and the first server can be performed in an encrypted manner. Before the above step 110, the first server executes step 151 to encrypt the data slices. Then, the first server sends m encrypted data slices to the terminal device, that is, "the first server sends m data slices to the terminal device" in the above step 110, including "the first server sends m encrypted data slices to the terminal device" in step 152. After receiving the m encrypted data slices, the terminal device first decrypts them to obtain m decrypted data slices, then verifies them according to the m decrypted data slices, and assembles the m decrypted data slices to obtain a firmware data packet.

[0100] Among them, the first preset key used by the first server for encryption and the second preset key used by the terminal device for decryption can be the same key or a pair of keys (such as a public key and a private key), which is not limited in the embodiment of the present application. The second preset key can be embedded in the target firmware of the terminal device, that is, during the compilation process of the target firmware, the second preset key is embedded in the target firmware; or, the second preset key can be stored in a preset position of the terminal device, and the second preset key can be read from the preset position when the data fragment needs to be decrypted.

[0101] Of course, in actual application, other methods can also be used to verify the identity of the data source, for example, using data signatures or digital certificates. The embodiments of this application do not limit the specific authentication method, and it can be flexibly selected according to needs in actual application.

[0102] To sum up, the firmware upgrade method provided in the embodiment of the present application, in addition to verifying the data required for the firmware upgrade, also performs identity verification on the data source. For example, by transmitting the data required for the firmware upgrade in an encrypted manner, the reliability and authenticity of the data source can be ensured, thereby ensuring the device security of the terminal device during the firmware upgrade process.

[0103] In one example, the above step 110 includes: the first server sends m data slices to the terminal device on n first channels between the terminal device and the first server; wherein one first channel is used to transmit one or more data slices; and n is a positive integer.

[0104] Based on this, the above step 110 includes: the terminal device receives m data slices from the first server on n first channels between the terminal device and the first server.

[0105] In one example, before the above step 110, it also includes: the terminal device sends m data transmission topics to the first server on n first channels; wherein a data transmission topic is used to indicate the transmission of a data slice, and a first channel is used to transmit one or more data transmission topics.

[0106] In the embodiment of the present application, multiple channels are established between the terminal device and the first server, and the multiple channels include n first channels. Among them, the first channel can be a channel dedicated to transmitting data slices, or a channel for transmitting data slices and other data (such as log information, etc.). The multiple channels between the terminal device and the first server can also include other channels other than the first channel, such as the second channel and the third channel, which can be used to transmit other types of information, such as heartbeat packets and log information, etc.

[0107] A first channel is used to transmit one or more data slices. In an embodiment of the present application, the data slices transmitted in two different first channels may be the same or different. Taking a first channel used to transmit a data slice, and the data slices transmitted in any two different first channels are different as an example, the above n is equal to m. Of course, in the case where the number of data slices transmitted by a first channel is multiple, or the data slices transmitted in two different first channels are the same, the above n may not be equal to m, such as n may be less than m or n may be greater than m, and the embodiment of the present application does not limit this.

[0108] Among them, a data transmission topic is used to indicate the transmission of a data slice, and a first channel is also used to transmit one or more data transmission topics. In an embodiment of the present application, for a first channel, if a terminal device sends a data transmission topic to a first server on the first channel, the first server sends the data slice indicated by the data transmission topic to the terminal device on the first channel; if the terminal device sends multiple data transmission topics to the first server on the first channel, the first server sends the data slices indicated by the multiple data transmission topics to the terminal device on the first channel.

[0109] Optionally, the terminal device may send m data transmission topics to the first server at the same time, and the first server may return the data slices (m data slices) indicated by the m data transmission topics to the terminal device in sequence, or may return the data slices (m data slices) indicated by the m data transmission topics to the terminal device at the same time. Optionally, the terminal device may send m data transmission topics to the first server in sequence, and continue to send the next order of data transmission topics after receiving each data slice from the first server. Optionally, the terminal device may send m data transmission topics to the first server at the same time, and the first server may also return the data slices (m data slices) indicated by the m data transmission topics to the terminal device at the same time. The terminal device may receive the data slices (m data slices) indicated by the m data transmission topics at the same time or in sequence.

[0110] In summary, the firmware upgrade method provided in the embodiment of the present application divides the firmware data packet required for the firmware upgrade into multiple data slices, and the terminal device receives the multiple data slices from the first server through multiple channels, and then obtains the firmware data packet according to the multiple data slices to further realize the firmware upgrade. The embodiment of the present application transmits multiple data slices through multiple channels, which can improve the efficiency of data transmission, so as to further improve the efficiency of firmware upgrade. In addition, multiple channels are established between the terminal device and the first server, and when a channel is abnormally connected, the transmission task can be undertaken through other channels, which can improve the stability and reliability of data transmission, so as to further improve the stability and reliability of firmware upgrade.

[0111] One point that needs to be explained is that the above embodiment introduces and explains the firmware upgrade method provided in the embodiment of the present application from the perspective of the interaction between the terminal device, the first server and the second server. In practical applications, the steps performed by the terminal device in the above embodiment can be independently implemented as a firmware upgrade method on the terminal device side; the steps performed by the first server in the above embodiment can be independently implemented as a firmware upgrade method on the first server side; the steps performed by the second server in the above embodiment can be independently implemented as a firmware upgrade method on the second server side.

[0112] Exemplarily, taking the firmware upgrade method on the terminal device side as an example, the steps performed by the terminal device in the above embodiment can be implemented as the following firmware upgrade method:

[0113] Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0114] Calculating a second firmware check value of the target firmware according to the m data slices;

[0115] If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0116] In one example, calculating the second firmware check value of the target firmware according to the m data slices includes:

[0117] Calculate a second slice check value of each data slice according to the data slice;

[0118] The second firmware check value is calculated according to the m second slice check values.

[0119] In one example, calculating the second slice check value of the data slice according to each of the data slices includes:

[0120] For each of the data slices, in response to receiving the data slice, calculating the second slice check value of the data slice;

[0121] or,

[0122] In response to receiving the m data slices, for each of the data slices, the second slice check value of the data slice is calculated.

[0123] In one example, the method further includes:

[0124] Receiving m first shard check values ​​from the first server; wherein one first shard check value corresponds to one data shard;

[0125] For each of the data slices, compare the second slice check value and the first slice check value of the data slice.

[0126] In one example, calculating the second firmware check value of the target firmware according to the m data slices includes:

[0127] If the second slice check values ​​of the m data slices are all equal to the first slice check value, the second firmware check value of the target firmware is calculated based on the m data slices.

[0128] In one example, the method further includes:

[0129] For each of the data slices, the second preset key is used to decrypt the data slice to obtain the decrypted data slice; wherein, the m decrypted data slices are used to calculate the second firmware check value, and the m decrypted data slices are used to assemble the firmware data packet.

[0130] Exemplarily, taking the firmware upgrade method on the first server side as an example, the steps performed by the first server in the above embodiment can be implemented as the following firmware upgrade method:

[0131] Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0132] In one example, the method further includes:

[0133] Calculate a first slice check value of each data slice according to the data slice;

[0134] The first firmware check value is calculated according to the m first slice check values.

[0135] In one example, the method further includes:

[0136] Send m first-slice check values ​​to the terminal device.

[0137] In one example, the method further includes:

[0138] For each of the data slices, encrypt the data slice using a first preset key to obtain the encrypted data slice;

[0139] The sending m data slices to the terminal device includes:

[0140] Send m encrypted data fragments to the terminal device.

[0141] In order to better implement the firmware upgrade method provided in the embodiment of the present application, the embodiment of the present application also provides a firmware upgrade device based on the above firmware upgrade method. The meanings of the terms are the same as those in the above firmware upgrade method, and the specific implementation details can refer to the description in the method embodiment.

[0142] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a firmware upgrade device provided in an embodiment of the present application. The firmware upgrade device has the function of implementing the method example on the terminal device side described above. The function can be implemented by hardware or by hardware executing corresponding software. The firmware upgrade device can be the terminal device described above or can be set in the terminal device. Figure 3As shown, the firmware upgrade device 300 may include: a first receiving module 310 , a first calculating module 320 and a data packet assembling module 330 .

[0143] The first receiving module 310 is used to receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0144] A first calculation module 320, configured to calculate a second firmware check value of the target firmware according to the m data slices;

[0145] The data packet assembly module 330 is used to assemble the m data fragments into a firmware data packet if the second firmware check value is equal to the first firmware check value; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0146] In one example, the first calculation module 320 is further used to:

[0147] Calculate a second slice check value of each data slice according to the data slice;

[0148] The second firmware check value is calculated according to the m second slice check values.

[0149] In one example, the first calculation module 320 is further used to:

[0150] For each of the data slices, in response to receiving the data slice, calculating the second slice check value of the data slice;

[0151] or,

[0152] In response to receiving the m data slices, for each of the data slices, the second slice check value of the data slice is calculated.

[0153] In one example, the firmware upgrade device 300 further includes a first comparison module ( Figure 3 not shown);

[0154] The first receiving module 310 is further configured to: receive m first shard check values ​​from the first server; wherein one first shard check value corresponds to one data shard;

[0155] The first comparison module is used to: for each of the data slices, compare the second slice check value and the first slice check value of the data slice.

[0156] In one example, the first calculation module 320 is further used to:

[0157] If the second slice check values ​​of the m data slices are all equal to the first slice check value, the second firmware check value of the target firmware is calculated based on the m data slices.

[0158] In one example, the firmware upgrade device 300 further includes a first decryption module ( Figure 3 ), for:

[0159] For each of the data slices, the second preset key is used to decrypt the data slice to obtain the decrypted data slice; wherein, the m decrypted data slices are used to calculate the second firmware check value, and the m decrypted data slices are used to assemble the firmware data packet.

[0160] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a firmware upgrade device provided in an embodiment of the present application. The firmware upgrade device has the function of implementing the method example on the first server side described above. The function can be implemented by hardware or by hardware executing corresponding software. The firmware upgrade device can be the first server described above, or it can be set in the first server. Figure 4 As shown, the firmware upgrade device 400 may include: a second sending module 410.

[0161] The second sending module 410 is used to send m data slices and a first firmware check value of the target firmware to the terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0162] In one example, the firmware upgrade device 400 further includes a second computing module ( Figure 4 ), for:

[0163] Calculate a first slice check value of each data slice according to the data slice;

[0164] The first firmware check value is calculated according to the m first slice check values.

[0165] In an example, the second sending module 410 is further used to:

[0166] Send m first-slice check values ​​to the terminal device.

[0167] In one example, the firmware upgrade device 400 further includes a second encryption module ( Figure 4 not shown);

[0168] A second encryption module is used to: for each of the data slices, use the first preset key to encrypt the data slice to obtain the encrypted data slice;

[0169] The second sending module 410 is further used to send m encrypted data fragments to the terminal device.

[0170] Figure 5 It is a schematic diagram of the structure of the communication device of an embodiment of the present application. Figure 5 A dashed line in a box indicates that the unit or module is optional. Figure 5 The communication device 500 in the embodiment may be used to implement the method described in the above method embodiment. The communication device 500 may be a chip, a terminal device or a first server.

[0171] The communication device 500 may include one or more processors 510. The processor 510 may support the communication device 500 to implement the method described in the foregoing method embodiment. The processor 510 may be a general-purpose processor or a special-purpose processor. For example, the processor may be a central processing unit (CPU). Alternatively, 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 gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0172] The communication device 500 may further include one or more memories 520. Computer programs are stored in the memories 520. The memories 520 may be independent of the processor 510 or may be integrated in the processor 510.

[0173] The communication device 500 may further include a transceiver 530. The processor 510 may communicate with other devices or chips through the transceiver 530. For example, the processor 510 may transmit and receive data with other devices or chips through the transceiver 530.

[0174] The computer program in the memory 520 can be executed by the processor 510, so that the processor 510 performs the following steps:

[0175] Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0176] Calculating a second firmware check value of the target firmware according to the m data slices;

[0177] If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0178] Alternatively, the computer program in the memory 520 may be executed by the processor 510, so that the processor 510 performs the following steps:

[0179] Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0180] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0181] To this end, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program is loaded by a processor to execute the steps in any one of the firmware upgrade methods provided in the embodiments of the present application.

[0182] For example, the computer program may be loaded by a processor and may execute the following steps:

[0183] Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer;

[0184] Calculating a second firmware check value of the target firmware according to the m data slices;

[0185] If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

[0186] For another example, the computer program may be loaded by the processor and the following steps may be executed:

[0187] Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

[0188] The specific implementation of the above operations / steps can be found in the previous embodiments and will not be repeated here.

[0189] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0190] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the firmware upgrade methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the firmware upgrade methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0191] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the terminal device or the first server reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the terminal device or the first server executes the method provided in various optional implementations in the above embodiments.

[0192] The above is a detailed introduction to a firmware upgrade method, device, equipment, server and storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A firmware upgrade method, characterized in that: Applied to a terminal device, the method comprises: Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer; Calculating a second firmware check value of the target firmware according to the m data slices; If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

2. The firmware upgrade method according to claim 1, characterized in that: The calculating the second firmware check value of the target firmware according to the m data slices includes: Calculate a second slice check value of each data slice according to the data slice; The second firmware check value is calculated according to the m second slice check values.

3. The firmware upgrade method according to claim 2, characterized in that: The step of calculating the second slice check value of each data slice according to the data slice includes: For each of the data slices, in response to receiving the data slice, calculating the second slice check value of the data slice; or, In response to receiving the m data slices, for each of the data slices, the second slice check value of the data slice is calculated.

4. The firmware upgrade method according to claim 2, characterized in that: The method further comprises: Receiving m first shard check values ​​from the first server; wherein one first shard check value corresponds to one data shard; For each of the data slices, compare the second slice check value and the first slice check value of the data slice.

5. The firmware upgrade method according to claim 4, characterized in that: The calculating the second firmware check value of the target firmware according to the m data slices includes: If the second slice check values ​​of the m data slices are all equal to the first slice check value, the second firmware check value of the target firmware is calculated based on the m data slices.

6. The firmware upgrade method according to any one of claims 1 to 5, characterized in that: After receiving the m data slices from the first server, the method further includes: For each of the data slices, the second preset key is used to decrypt the data slice to obtain the decrypted data slice; wherein, the m decrypted data slices are used to calculate the second firmware check value, and the m decrypted data slices are used to assemble the firmware data packet.

7. A firmware upgrade method, characterized in that: Applied to a first server, the method comprises: Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

8. The firmware upgrade method according to claim 7, characterized in that: Before sending the m data slices and the first firmware check value of the target firmware to the terminal device, the method further includes: Calculate a first slice check value of each data slice according to the data slice; The first firmware check value is calculated according to the m first slice check values.

9. The firmware upgrade method according to claim 8, characterized in that: The method further comprises: Send m first-slice check values ​​to the terminal device.

10. The firmware upgrade method according to any one of claims 7 to 9, characterized in that: The method further comprises: For each of the data slices, encrypt the data slice using a first preset key to obtain the encrypted data slice; The sending m data slices to the terminal device includes: Send m encrypted data fragments to the terminal device.

11. A firmware upgrade device, characterized in that: The device comprises: A first receiving module, configured to receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer; A first calculation module, configured to calculate a second firmware check value of the target firmware according to the m data slices; A data packet assembly module is used to assemble the m data fragments into a firmware data packet if the second firmware check value is equal to the first firmware check value; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

12. A firmware upgrade device, characterized in that: The device comprises: A second sending module is used to send m data slices and a first firmware check value of the target firmware to the terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

13. A terminal device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps: Receive m data slices and a first firmware check value of a target firmware from a first server; wherein m is a positive integer; Calculating a second firmware check value of the target firmware according to the m data slices; If the second firmware check value is equal to the first firmware check value, the m data fragments are assembled into a firmware data packet; wherein the firmware data packet is used to upgrade the target firmware in the terminal device.

14. A first server, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps: Send m data slices and a first firmware check value of a target firmware to a terminal device; wherein the m data slices are used by the terminal device to obtain a firmware data packet when the second firmware check value is equal to the first firmware check value, and the firmware data packet is used to upgrade the target firmware in the terminal device; the second firmware check value is calculated by the terminal device based on the m data slices; and m is a positive integer.

15. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the firmware upgrade method described in any one of claims 1 to 6, or to execute the steps in the firmware upgrade method described in any one of claims 7 to 10.

Citation Information

Cited By

  • Firmware recovery method, system and equipment and storage medium

    CN121433957A