CN119806576A - Firmware upgrade method, device, equipment, server and storage medium - Google Patents
Firmware upgrade method, device, equipment, server and storage medium Download PDFInfo
- Publication number
- CN119806576A CN119806576A CN202411829226.2A CN202411829226A CN119806576A CN 119806576 A CN119806576 A CN 119806576A CN 202411829226 A CN202411829226 A CN 202411829226A CN 119806576 A CN119806576 A CN 119806576A
- Authority
- CN
- China
- Prior art keywords
- firmware
- data
- check value
- terminal device
- slice
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The application discloses a firmware upgrading method, a 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 check value is equal to the first firmware check value, the terminal equipment assembles the m data fragments into a firmware data packet, and the firmware data packet is used for upgrading the target firmware in the terminal equipment. Before the m data fragments are assembled into the firmware data packet, the embodiment of the application checks the m data fragments according to the m data fragments so as to ensure the integrity and the correctness of the firmware data packet assembled by the m data fragments and improve the reliability of firmware upgrading.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a firmware upgrade method, apparatus, device, server, and storage medium.
Background
Firmware upgrade of the terminal equipment is an indispensable part in equipment maintenance, and can improve the performance and compatibility of the terminal equipment, so that the terminal equipment achieves a better running state. When the firmware is upgraded, the terminal equipment needs to acquire a new firmware data packet, and then the firmware in the terminal equipment is upgraded into 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, thereby causing a firmware upgrade failure.
Disclosure of Invention
The embodiment of the application provides a firmware upgrading method, a device, equipment, a server and a storage medium, which can ensure the integrity and the correctness of a firmware data packet assembled by m data fragments and improve the reliability of firmware upgrading.
In one aspect, an embodiment of the present application provides a firmware upgrade method, applied to a terminal device, where the method includes:
Receiving m data fragments from a first server and a first firmware check value of a target firmware, wherein m is a positive integer;
calculating a second firmware verification value of the target firmware according to the m data fragments;
And if the second firmware check value is equal to the first firmware check value, assembling the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
In some embodiments of the present application, the calculating a second firmware verification value of the target firmware according to the m pieces of data includes:
calculating a second fragment check value of the data fragments according to each data fragment;
And calculating the second firmware check value according to the m second fragment check values.
In some embodiments of the present application, the calculating, according to each of the data slices, a second slice check value of the data slice includes:
For each of the data slices, in response to receiving the data slice, calculating the second slice check value for the data slice;
or alternatively
In response to receiving m of the data slices, the second slice check value of the data slice is calculated for each of the data slices.
In some embodiments of the application, the method further comprises:
Receiving m first fragment check values from the first server, wherein one first fragment check value corresponds to one data fragment;
Comparing the second and first shard check values of the data shards for each of the data shards.
In some embodiments of the present application, the calculating a second firmware verification value of the target firmware according to the m pieces of data includes:
And if the second fragment check values of the m data fragments are equal to the first fragment check value, calculating the second firmware check value of the target firmware according to the m data fragments.
In some embodiments of the present application, after receiving the m pieces of data from the first server, the method further includes:
And decrypting each data fragment by adopting a second preset key to obtain decrypted data fragments, wherein m decrypted data fragments are used for calculating the second firmware check value, and m decrypted data fragments are used for assembling to obtain the firmware data packet.
In another aspect, an embodiment of the present application provides a firmware upgrade method, applied to a first server, where the method includes:
The method comprises the steps of sending m data fragments and a first firmware check value of target firmware to terminal equipment, wherein the m data fragments are used for obtaining a firmware data packet by the terminal equipment when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
In some embodiments of the present application, before the sending the m data slices to the terminal device and the first firmware check value of the target firmware, the method further includes:
According to each data fragment, calculating a first fragment check value of the data fragment;
And calculating the first firmware check value according to the m first fragment check values.
In some embodiments of the application, the method further comprises:
And sending m first fragment check values to the terminal equipment.
In some embodiments of the application, the method further comprises:
For each data fragment, encrypting the data fragment by adopting a first preset key to obtain the encrypted data fragment;
The sending m data fragments to the terminal device includes:
and sending m encrypted data fragments to the terminal equipment.
In another aspect, an embodiment of the present application provides a firmware upgrade apparatus, including:
The first receiving module is used for receiving m data fragments from a first server and a first firmware check value of target firmware, wherein m is a positive integer;
the first calculation module is used for calculating a second firmware check value of the target firmware according to m data fragments;
And the data packet assembling module is used for assembling 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 for upgrading the target firmware in the terminal equipment.
In another aspect, an embodiment of the present application provides a firmware upgrade apparatus, including:
the terminal equipment comprises a first sending module, a second sending module and a terminal equipment, wherein the first sending module is used for sending m data fragments and a first firmware check value of target firmware to the terminal equipment, the m data fragments are used for obtaining a firmware data packet when the second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
In another aspect, an embodiment of the present application provides a terminal device, including a memory and a processor, where the memory stores a computer program, and the computer program when executed by the processor causes the processor to perform the following steps:
Receiving m data fragments from a first server and a first firmware check value of a target firmware, wherein m is a positive integer;
calculating a second firmware verification value of the target firmware according to the m data fragments;
And if the second firmware check value is equal to the first firmware check value, assembling the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
In another aspect, an embodiment of the present application provides a first server, including a memory and a processor, where the memory stores a computer program, and the computer program when executed by the processor causes the processor to perform the following steps:
The method comprises the steps of sending m data fragments and a first firmware check value of target firmware to terminal equipment, wherein the m data fragments are used for obtaining a firmware data packet by the terminal equipment when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
In another aspect, an embodiment of the present application further provides a computer program product, including a computer program or instructions, where the computer program or instructions, when executed by a processor, implement steps in any of the firmware upgrade methods provided in the embodiments of the present application.
According to the firmware upgrading method provided by the embodiment of the application, the firmware data packet required by firmware upgrading is divided into a plurality of data fragments, so that the reliability of data transmission is improved. In addition, in the embodiment of the application, for the case of adopting a plurality of data fragments for transmission, the first server and the terminal equipment respectively calculate the firmware check value according to m data fragments, then the terminal equipment compares the first firmware check value calculated by the first server with the second firmware check value calculated by the terminal equipment, if the first firmware check value and the second firmware check value are the same, the plurality of data fragments pass the check, and the terminal equipment further assembles the m data fragments into a firmware data packet so as to upgrade the firmware. According to the embodiment of the application, before the m data fragments are assembled into the firmware data packet, the integrity and the correctness of the firmware data packet assembled by the m data fragments are ensured, the abnormal condition in the firmware upgrading process is found in time, and the reliability of the firmware upgrading is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a firmware upgrade system according to an embodiment of the present application;
fig. 2 is a flow chart of a firmware upgrading method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a firmware upgrading apparatus according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another firmware upgrade apparatus according to an embodiment of the present application;
Fig. 5 is a schematic structural diagram of a communication device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
In the description that follows, embodiments of the invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise indicated. Thus, these steps and operations will be referred to in several instances as being performed by a computer, which as referred to herein performs operations that include processing units by the computer that represent electronic signals that represent data in a structured form. This operation transforms the data or maintains it in place in the computer's memory system, which may reconfigure or otherwise alter the computer's operation in a manner well known to those skilled in the art. The data structure maintained by the data is the physical location of the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the foregoing text and are not meant to be limiting, and those of skill in the art will appreciate that various of the steps and operations described below may also be implemented in hardware.
The term "module" or "unit" as used herein may be considered a software object executing on the computing system. The various components, modules, engines, and services described herein may be viewed as implementing objects on the computing system. The apparatus and methods described herein are preferably implemented in software, but may of course also be implemented in hardware, all within the scope of the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
Fig. 1 is a schematic diagram illustrating a firmware upgrade system according to an embodiment of the present application. The firmware upgrade system may include a terminal device 10 and a first server 20.
The terminal device 10 may be any type of smart device, and may be a mobile terminal or a terminal with a relatively fixed location. For example, the terminal device 10 may be a cell phone, a computer, a game console, an electronic reader, a wearable device, a smart home device, a vehicle, an internet of things device, etc.
The first server 20 performs a communication interaction with the terminal device 10 to enable firmware upgrade of the terminal device 10. For example, the first server 20 may provide the terminal device 10 with a data packet required for firmware upgrade, or an address of the data packet required for firmware upgrade. As another example, the first server 20 may retry or resume the firmware upgrade process of the terminal device 10 according to an error occurring in the firmware upgrade process of the terminal device 10.
Optionally, as shown in fig. 1, the firmware upgrade system may further include a second server 30. The second server 30 is in communicative interaction with the first server 20 to enable background management to be provided for firmware upgrades 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 data packets required for the firmware upgrade, etc.
As shown in fig. 1, the first server 20 and the second server 30 may both be part of a central console of a developer, and a developer of firmware may upload a data packet required for firmware upgrade through the second server 30, check the progress and status of firmware upgrade, and may also manage a transmission mode of the data packet required for firmware upgrade through the first server 20.
In one example, the firmware upgrade method provided by the embodiment of the present application is implemented through an Over-the-Air (OTA) technology, and the terminal device 10 and the first server 20 implement communication based on an MQTT (Message Queuing Telemetry Transport, message queue transmission probe) protocol, based on which the first server 20 may be implemented as an MQTT Broker (MQTT proxy), and the second server 30 may be implemented as an OTA server. Of course, the devices in the firmware upgrade system may also implement communication based on other communication protocols, such as HTTP (HyperText Transfer Protocol ), lwM2M (LIGHTWEIGHT M M, lightweight M2M (device-to-device) protocol, etc., which is not limited by the embodiment of the present application.
Fig. 2 is a flowchart illustrating a firmware upgrade method according to an embodiment of the present application. The firmware upgrade method may be applied to the firmware upgrade system shown in fig. 1, for example, the firmware upgrade method may be interactively performed by a terminal device and a first server in the firmware upgrade system shown in fig. 1. As shown in fig. 2, the firmware upgrade method includes the following steps (steps 110 to 130):
step 110, a first server sends m data fragments and a first firmware check value of a target firmware to a terminal device;
Step 120, the terminal equipment calculates a second firmware check value of the target firmware according to the m data fragments;
And 130, if the second firmware check value is equal to the first firmware check value, the terminal equipment assembles the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
The terminal equipment comprises target firmware, and the target firmware can be any firmware in the terminal equipment or specific firmware preset in the terminal equipment. The firmware upgrade process of the target firmware may be initiated by the terminal device, or may be initiated by the first server, or may be initiated by the second server in fig. 1, which is not limited in this embodiment of the present application. For example, in the case where the firmware upgrade process is initiated by the terminal device, the terminal device may send a firmware upgrade request to the first server before step 110, and then the first server performs 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 may perform step 110 when there is an update to the data packet of the target firmware, or the first server may perform step 110 every preset time (e.g., every half month). For another example, in the case where the firmware upgrade process is initiated by the second server, the second server may send a data packet required for the firmware upgrade to the first server prior to step 110, and the first server may perform step 110 in response to receiving the data packet.
In the embodiment of the application, the firmware data packet required by the target firmware upgrade in the terminal equipment can be segmented into m data fragments, wherein m is a positive integer. Alternatively, a plurality of channels may be established between the terminal device and the first server, one or more data fragments may be transmitted through one channel between the terminal device and the first server, the embodiment of the application does not limit the corresponding relation between the transmission of the plurality of channels and the plurality of data fragments, and can be flexibly set according to requirements in practical application. Of course, only one channel for transmitting data required for the upgrade may be established between the terminal device and the first server, so that m data slices are transmitted through the same channel.
The first server may send the first firmware check value of the target firmware to the terminal device while sending the m data fragments 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 fragments to the terminal device. The embodiment of the application does not limit the specific type of the first firmware check value, and alternatively, the first firmware check value may be a check value calculated based on a hash value or a checksum value, etc.
After receiving the data fragments, 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 manner, for example, the terminal device and the first server may agree in advance on the calculation manner of the check values, and then check the firmware check values according to the calculation manner agreed in advance, respectively. The firmware verification value calculated by the first server is referred to as a first firmware verification value in the embodiment of the present application, and the firmware verification value calculated by the terminal device is referred to as a second firmware verification value in the embodiment of the present application.
And the terminal equipment compares the first firmware check value with the second firmware check value, if the second firmware check value is equal to the first firmware check value, the m data fragments pass the check, and the terminal equipment assembles the m data fragments into a firmware data packet so as to upgrade the target firmware in the terminal equipment. If the second firmware check value is not equal to the first firmware check value, the m data slices do not pass the check, and the terminal device may request the first server to retransmit the m data slices, or may request the first server to retransmit a portion of the data slices, please refer to the following description of the embodiments, which is not repeated herein.
In summary, according to the firmware upgrading method provided by the embodiment of the application, the firmware data packet required by firmware upgrading is divided into a plurality of data fragments, so that the reliability of data transmission is improved. In addition, in the embodiment of the application, for the case of adopting a plurality of data fragments for transmission, the first server and the terminal equipment respectively calculate the firmware check value according to m data fragments, then the terminal equipment compares the first firmware check value calculated by the first server with the second firmware check value calculated by the terminal equipment, if the first firmware check value and the second firmware check value are the same, the plurality of data fragments pass the check, and the terminal equipment further assembles the m data fragments into a firmware data packet so as to upgrade the firmware. According to the embodiment of the application, before the m data fragments are assembled into the firmware data packet, the integrity and the correctness of the firmware data packet assembled by the m data fragments are ensured, the abnormal condition in the firmware upgrading process is found in time, and the reliability of the firmware upgrading is improved.
In one example, the above step 110 may further include the following steps (steps 011 to 012):
step 011, the first server calculates a first fragment check value of each data fragment according to the data fragments;
step 012, the first server calculates a first firmware check value according to the m first fragment check values.
The first server may calculate the first firmware check value before sending the first firmware check value to the terminal device. In the embodiment of the application, the firmware check value can be calculated according to the fragment check values of a plurality of data fragments. Therefore, the first server calculates the first fragment check value of each data fragment, and calculates the first firmware check value of the target firmware according to the first fragment check values (i.e. m first fragment check values) of the m data fragments.
The calculation mode of the fragment check value in the embodiment of the application is not limited, and optionally, the first server may calculate the first fragment check value of each data fragment based on the hash value calculation or the checksum value calculation and other modes. For example, the first chunk check value is calculated based on the checksum value, then the first server may treat each data chunk as a series of bytes and then calculate the first chunk check value for that data chunk by adding or xoring the bytes, or the like.
The embodiment of the application is not limited to a specific way of calculating the firmware checksum value according to the slice checksum value, and optionally, the first server may add the first slice checksum values of the m data slices to obtain a first firmware checksum value, or the first server may perform an exclusive-or operation (such as a two-two exclusive-or operation) on the first slice checksum values of the m data slices to obtain a first firmware checksum value, or the first server may perform weighted summation processing on the first slice checksum values of the m data slices to obtain the first firmware checksum value. Optionally, when the weighted sum processing is performed on the first slice check values of the m data slices, the weight size corresponding to each data slice may be determined based on the priority ordering of the data slices, and the higher the priority ordering of the data slices, the greater the weight corresponding to the data slices. The priority ordering of the m data fragments is consistent with the ordering of the influence degree of the m data fragments on the running state of the equipment of the terminal equipment, or the priority ordering of the m data fragments is consistent with the ordering of the influence degree of the m data fragments on the firmware upgrading process of the target firmware.
In one example, the above step 120 may include the following steps:
Step 121, the terminal equipment calculates a second fragment check value of each data fragment according to each data fragment;
Step 122, the terminal equipment calculates a second firmware check value according to the m second fragment check values.
The terminal equipment calculates a second fragment check value of each data fragment according to the data fragments, and calculates a second firmware check value of the target firmware according to the second fragment check values (namely m second fragment check values) of the m data fragments.
Alternatively, the terminal device may calculate the second fragment check value of each data fragment based on hash value calculation or checksum value calculation, or the like. For example, the second slice check value is calculated based on the checksum value, and then the terminal device may treat each data slice as a series of bytes, and then calculate the second slice check value of the data slice by performing an addition operation or an exclusive-or operation on the bytes, or the like.
Optionally, the terminal device may add the second slice check values of the m data slices to obtain a second firmware check value, or the terminal device may perform an exclusive or operation (such as a two-by-two exclusive or operation) on the second slice check values of the m data slices to obtain a second firmware check value, or the terminal device may perform a weighted sum process on the second slice check values of the m data slices to obtain a second firmware check value. Optionally, when the weighted sum processing is performed on the second fragment check values of the m data fragments, the weight size corresponding to each data fragment may be determined based on the priority ordering of the data fragments, where the higher the priority ordering of the data fragments, the greater the weight corresponding to the data fragments. The priority ordering of the m data fragments is consistent with the ordering of the influence degree of the m data fragments on the running state of the equipment of the terminal equipment, or the priority ordering of the m data fragments is consistent with the ordering of the influence degree of the m data fragments on the firmware upgrading process of the target firmware.
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 calculate the fragment verification value and the firmware verification value in the same calculation manner. For example, the first server calculates a first shard check value and a first firmware check value based on the checksum value, and the first firmware check value is a sum of m first shard check values, and the terminal device also calculates a second shard check value and a second firmware check value based on the checksum value, and the second firmware check value is a sum of m second shard check values.
Alternatively, step 121 may include the terminal device calculating, for each data slice, a second slice check value for the data slice in response to receiving the data slice, or the terminal device calculating, for each data slice, a second slice check value for the data slice in response to receiving m data slices. That is, the terminal device may calculate the second burst check value for each data burst in real time every time it receives the data burst, or the terminal device may store each data burst after receiving the data burst until all the data bursts are received, and then calculate the second burst check value of each data burst sequentially or in parallel.
In summary, in the firmware upgrading method provided by the embodiment of the application, the respective fragment check values of the m data fragments are calculated first, and then the firmware check values are calculated based on the m fragment check values, so that the integrity and the correctness of each data fragment can influence the whole check, the reliability of the data check is improved, and the reliability of firmware upgrading is improved.
In one example, the firmware upgrade method may further include the steps of:
Step 141, the first server sends m first fragment check values to the terminal device.
Step 142, the terminal equipment compares the second fragment check value and the first fragment check value of the data fragments aiming at each data fragment;
step 143, if the second fragment check value of the m data fragments is equal to the first fragment check value, the terminal device calculates a second firmware check value of the target firmware according to the m data fragments.
The first server may also send the first fragment check value of each data fragment calculated by the first server to the terminal device. For example, the first server may transmit the first burst check value of the data burst at the same time when transmitting the data burst, that is, step 141 may be performed at the same time as step 110, or the first server may transmit m first burst check values after transmitting the m data bursts, that is, step 141 may be performed after step 110, or the first server may transmit m first burst check values before transmitting the m data bursts, that is, step 141 may be performed before step 110. The embodiment of the application does not limit the transmission sequence of the first fragment check value and the data fragments.
The terminal device also calculates the second burst check value of each data burst by itself, so that the terminal device can compare the first burst check value and the second burst check value of each data burst. If the first fragment check value of any one data fragment is not equal to the second fragment check value, the check of the data fragment fails, and the terminal equipment can request the first server to resend the data fragment. If the first fragment check values of all the data fragments are equal to the second fragment check value, the verification of all the data fragments is successful, and the terminal device can further calculate the second firmware check value of the target firmware according to the second fragment check values of the m data fragments so as to perform the verification on the whole.
In summary, according to the firmware upgrading method provided by the embodiment of the application, the verification is performed for each data fragment, and the verification is performed on the whole under the condition that all the data fragments are successfully verified, so that the verification dimension can be enriched, the accuracy of the data verification is improved, and the success rate of firmware upgrading is improved.
In one example, the firmware upgrade method may further include the steps of:
Step 151, the first server encrypts each data fragment by adopting a first preset key to obtain the encrypted data fragment;
Step 152, the first server sends m encrypted data fragments to the terminal equipment;
and 153, decrypting the data fragments by the terminal equipment by adopting a second preset key aiming at each data fragment to obtain decrypted data fragments, wherein m decrypted data fragments are used for calculating a second firmware check value, and m decrypted data fragments are used for assembling to obtain a firmware data packet.
The embodiment of the application can adopt an encryption mode for data transmission between the terminal equipment and the first server. Prior to step 110 described above, the first server performs step 151 to encrypt the data fragments. 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 step 110 above, including "the first server sends m encrypted data slices to the terminal device" in step 152. After receiving the m encrypted data fragments, the terminal equipment firstly decrypts the m encrypted data fragments to obtain m decrypted data fragments, then verifies the m decrypted data fragments according to the m decrypted data fragments, and assembles the m decrypted data fragments to obtain a firmware data packet.
The first preset key used for encryption by the first server and the second preset key used for decryption by the terminal device may be the same key or a pair of keys (such as a public key and a private key). The second preset key may be embedded in the target firmware of the terminal device, that is, the second preset key is embedded in the target firmware in the compiling process of the target firmware, or the second preset key may be stored in a preset position of the terminal device, and the second preset key may be read from the preset position when the data fragment needs to be decrypted.
Of course, in the practical application process, other ways of verifying the identity of the data source can be adopted, for example, a data signature or a digital certificate is adopted, the specific authentication mode is not limited, and the practical application can be flexibly selected according to requirements.
In summary, the firmware upgrading method provided by the embodiment of the application not only performs verification on the data required by firmware upgrading, but also performs identity verification on the data source, for example, the data required by firmware upgrading is transmitted in an encrypted manner, so that the reliability and the authenticity of the data source can be ensured, and the equipment safety of the terminal equipment can be ensured in the firmware upgrading process.
In one example, the step 110 includes the first server sending m data slices to the terminal device on n first channels between the terminal device and the first server, where one first channel is used to transmit one or more data slices, and n is a positive integer.
Based on this, the step 110 includes the terminal device receiving m data slices from the first server on n first channels between the terminal device and the first server.
In one example, before the step 110, the method further includes that the terminal device sends m data transmission topics to the first server on n first channels, where one data transmission topic is used to indicate transmission of one data slice, and one first channel is used to transmit one or more data transmission topics.
The embodiment of the application establishes a plurality of channels between the terminal equipment and the first server, wherein the channels comprise n first channels. The first channel may be a channel dedicated to transmitting data fragments, or may be a channel for transmitting data fragments and other data (such as log information). The channels between the terminal device and the first server may further include channels other than the first channel, such as a second channel and a third channel, and may be used to transmit other types of information, such as heartbeat packets, log information, and the like.
A first channel is used to transmit one or more data slices. In the embodiment of the present application, the data slices transmitted in two different first channels may be the same or different. Taking an example that one first channel is used for transmitting one data slice, and the data slices transmitted in any two different first channels are different, n is equal to m. Of course, in the case where the number of data slices transmitted in one first channel is plural, or the data slices transmitted in two different first channels are the same, n may not be equal to m, for example, n may be smaller than m or n may be greater than m, which is not limited in the embodiment of the present application.
Wherein one data transmission topic is used to indicate the transmission of one data slice and one first channel is also used to transmit one or more data transmission topics. In the embodiment of the application, aiming at a first channel, if a terminal device sends a data transmission theme to a first server on the first channel, the first server sends data fragments indicated by the data transmission theme to the terminal device on the first channel, and if the terminal device sends a plurality of data transmission themes to the first server on the first channel, the first server sends the data fragments indicated by the plurality of data transmission themes to the terminal device on the first channel.
Alternatively, the terminal device may send the m data transmission topics to the first server at the same time, and the first server may sequentially return the data slices indicated by the m data transmission topics (m data slices) to the terminal device, or may simultaneously return the data slices indicated by the m data transmission topics (m data slices) to the terminal device. Optionally, the terminal device may sequentially send m data transmission topics to the first server, and send the next sequential data transmission topic again after each data fragment from the first server is received. Optionally, the terminal device may send the m data transmission topics to the first server at the same time, and the first server may also return the data fragments indicated by the m data transmission topics (m data fragments) to the terminal device at the same time, and the terminal device may receive the data fragments indicated by the m data transmission topics (m data fragments) at the same time or sequentially.
In summary, according to the firmware upgrading method provided by the embodiment of the application, the firmware data packet required by firmware upgrading is split into a plurality of data fragments, the terminal device receives the plurality of data fragments from the first server through a plurality of channels, and then the firmware data packet is acquired according to the plurality of data fragments, so that the firmware upgrading is further realized. According to the embodiment of the application, the plurality of data fragments are transmitted through the plurality of channels, so that the data transmission efficiency can be improved, and the firmware upgrading efficiency can be further improved. And a plurality of channels are established between the terminal equipment and the first server, and when the connection of one channel is abnormal, the transmission task can be born through other channels, so that the stability and the reliability of data transmission can be improved, and the stability and the reliability of firmware upgrading can be further improved.
The above-mentioned embodiment describes the firmware upgrading method provided by the embodiment of the present application from the perspective of interaction among the terminal device, the first server and the second server. In practical applications, the steps executed by the terminal device in the above embodiment may be implemented as a firmware upgrade method on the terminal device side alone, the steps executed by the first server in the above embodiment may be implemented as a firmware upgrade method on the first server side alone, and the steps executed by the second server in the above embodiment may be implemented as a firmware upgrade method on the second server side alone.
Illustratively, taking a firmware upgrade method at the terminal device side as an example, the steps performed by the terminal device in the above embodiment may be implemented as the following firmware upgrade method:
Receiving m data fragments from a first server and a first firmware check value of a target firmware, wherein m is a positive integer;
calculating a second firmware verification value of the target firmware according to the m data fragments;
And if the second firmware check value is equal to the first firmware check value, assembling the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
In one example, the calculating the second firmware verification value of the target firmware according to the m pieces of data includes:
calculating a second fragment check value of the data fragments according to each data fragment;
And calculating the second firmware check value according to the m second fragment check values.
In one example, the calculating the second slice check value of the data slice according to each data slice includes:
For each of the data slices, in response to receiving the data slice, calculating the second slice check value for the data slice;
or alternatively
In response to receiving m of the data slices, the second slice check value of the data slice is calculated for each of the data slices.
In one example, the method further comprises:
Receiving m first fragment check values from the first server, wherein one first fragment check value corresponds to one data fragment;
Comparing the second and first shard check values of the data shards for each of the data shards.
In one example, the calculating the second firmware verification value of the target firmware according to the m pieces of data includes:
And if the second fragment check values of the m data fragments are equal to the first fragment check value, calculating the second firmware check value of the target firmware according to the m data fragments.
In one example, the method further comprises:
And decrypting each data fragment by adopting a second preset key to obtain decrypted data fragments, wherein m decrypted data fragments are used for calculating the second firmware check value, and m decrypted data fragments are used for assembling to obtain the firmware data packet.
Taking the firmware upgrade method of the first server side as an example, the steps performed by the first server in the above embodiment may be implemented as the following firmware upgrade method:
The method comprises the steps of sending m data fragments and a first firmware check value of target firmware to terminal equipment, wherein the m data fragments are used for obtaining a firmware data packet by the terminal equipment when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
In one example, the method further comprises:
According to each data fragment, calculating a first fragment check value of the data fragment;
And calculating the first firmware check value according to the m first fragment check values.
In one example, the method further comprises:
And sending m first fragment check values to the terminal equipment.
In one example, the method further comprises:
For each data fragment, encrypting the data fragment by adopting a first preset key to obtain the encrypted data fragment;
The sending m data fragments to the terminal device includes:
and sending m encrypted data fragments to the terminal equipment.
In order to facilitate better implementation of the firmware upgrading method provided by the embodiment of the application, the embodiment of the application also provides a firmware upgrading device based on the firmware upgrading method. Where nouns have the same meaning as in the firmware upgrade method described above, specific implementation details may be referred to in the description of the method embodiments.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a firmware upgrading apparatus according to an embodiment of the present application, where the firmware upgrading apparatus has a function of implementing an example of a method on a terminal device side, and the function may be implemented by hardware or may be implemented by executing corresponding software by hardware. The firmware upgrading device may be the terminal device described above, or may be provided in the terminal device. As shown in fig. 3, the firmware upgrade apparatus 300 may include a first receiving module 310, a first calculating module 320, and a packet assembling module 330.
A first receiving module 310, configured to receive m pieces of data from a first server and a first firmware check value of a target firmware, where m is a positive integer;
A first calculation module 320, configured to calculate a second firmware verification value of the target firmware according to m pieces of data;
And a data packet assembling module 330, configured to assemble m pieces of the data into a firmware data packet if the second firmware check value is equal to the first firmware check value, where the firmware data packet is used to upgrade the target firmware in the terminal device.
In one example, the first computing module 320 is further configured to:
calculating a second fragment check value of the data fragments according to each data fragment;
And calculating the second firmware check value according to the m second fragment check values.
In one example, the first computing module 320 is further configured to:
For each of the data slices, in response to receiving the data slice, calculating the second slice check value for the data slice;
or alternatively
In response to receiving m of the data slices, the second slice check value of the data slice is calculated for each of the data slices.
In one example, the firmware upgrade apparatus 300 further includes a first comparison module (not shown in fig. 3);
the first receiving module 310 is further configured to receive m first slice check values from the first server, where one first slice check value corresponds to one data slice;
And the first comparison module is used for comparing the second fragment check value and the first fragment check value of each data fragment.
In one example, the first computing module 320 is further configured to:
And if the second fragment check values of the m data fragments are equal to the first fragment check value, calculating the second firmware check value of the target firmware according to the m data fragments.
In one example, the firmware upgrade apparatus 300 further includes a first decryption module (not shown in fig. 3) for:
And decrypting each data fragment by adopting a second preset key to obtain decrypted data fragments, wherein m decrypted data fragments are used for calculating the second firmware check value, and m decrypted data fragments are used for assembling to obtain the firmware data packet.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a firmware upgrade apparatus according to an embodiment of the present application, where the firmware upgrade apparatus has a function of implementing the method example on the first server side, and the function may be implemented by hardware or may be implemented by executing corresponding software by hardware. The firmware upgrade apparatus may be the first server described above, or may be provided in the first server. As shown in fig. 4, the firmware upgrade apparatus 400 may include a second transmission module 410.
The second sending module 410 is configured to send m data fragments and a first firmware check value of a target firmware to a terminal device, where the m data fragments are used for the terminal device to obtain a firmware data packet when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal device, the second firmware check value is calculated by the terminal device according to the m data fragments, and the m is a positive integer.
In one example, the firmware upgrade apparatus 400 further includes a second computing module (not shown in fig. 4) for:
According to each data fragment, calculating a first fragment check value of the data fragment;
And calculating the first firmware check value according to the m first fragment check values.
In one example, the second sending module 410 is further configured to:
And sending m first fragment check values to the terminal equipment.
In one example, the firmware upgrade apparatus 400 further includes a second encryption module (not shown in fig. 4);
the second encryption module is used for encrypting the data fragments by adopting a first preset key aiming at each data fragment to obtain the encrypted data fragments;
The second sending module 410 is further configured to send m encrypted data fragments to the terminal device.
Fig. 5 is a schematic structural diagram of a communication device according to an embodiment of the present application. The dashed lines in fig. 5 indicate that the unit or module is optional. The communication device 500 in fig. 5 may be used to implement the method described in the method embodiments described above. The communication device 500 may be a chip, a terminal device or a first server.
The communication device 500 may include one or more processors 510. The processor 510 may support the communication device 500 to implement the methods described in the method embodiments above. The processor 510 may be a general purpose processor or a special purpose processor. For example, the processor may be a central processing unit (Central Processing Unit, CPU). Or the Processor may be another general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The communication device 500 may also include one or more memories 520. The memory 520 has stored thereon a computer program. The memory 520 may be separate from the processor 510 or may be integrated into the processor 510.
The communication device 500 may also 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 to and from other devices or chips through the transceiver 530.
The computer program in the memory 520 may be executed by the processor 510 such that the processor 510 performs the steps of:
Receiving m data fragments from a first server and a first firmware check value of a target firmware, wherein m is a positive integer;
calculating a second firmware verification value of the target firmware according to the m data fragments;
And if the second firmware check value is equal to the first firmware check value, assembling the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
Or a computer program in the memory 520 may be executed by the processor 510, causing the processor 510 to perform the steps of:
The method comprises the steps of sending m data fragments and a first firmware check value of target firmware to terminal equipment, wherein the m data fragments are used for obtaining a firmware data packet by the terminal equipment when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program that is loaded by a processor to perform the steps of any of the firmware upgrade methods provided by the embodiments of the present application.
For example, the loading of the computer program by the processor may perform the steps of:
Receiving m data fragments from a first server and a first firmware check value of a target firmware, wherein m is a positive integer;
calculating a second firmware verification value of the target firmware according to the m data fragments;
And if the second firmware check value is equal to the first firmware check value, assembling the m data fragments into a firmware data packet, wherein the firmware data packet is used for upgrading the target firmware in the terminal equipment.
For another example, the loading of the computer program by the processor may perform the steps of:
The method comprises the steps of sending m data fragments and a first firmware check value of target firmware to terminal equipment, wherein the m data fragments are used for obtaining a firmware data packet by the terminal equipment when a second firmware check value is equal to the first firmware check value, the firmware data packet is used for upgrading the target firmware in the terminal equipment, the second firmware check value is calculated by the terminal equipment according to the m data fragments, and the m is a positive integer.
The specific implementation of each operation/step can be referred to the previous embodiments, and will not be repeated here.
The computer readable storage medium may include, among others, read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disks, and the like.
Since the computer program stored in the computer readable storage medium can execute the steps in any firmware upgrading method provided by the embodiment of the present application, the beneficial effects that any firmware upgrading method provided by the embodiment of the present application can be achieved, and detailed descriptions of the previous embodiments are omitted herein.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the terminal device or the first server reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the terminal device or the first server performs the methods provided in the various alternative implementations of the above embodiments.
The foregoing describes in detail a firmware upgrading method, apparatus, device, server and storage medium provided in the embodiments of the present application, and specific examples are set forth herein to illustrate the principles and embodiments of the present application, and the above description of the embodiments is only for aiding in understanding of the method and core concept of the present application, and meanwhile, to those skilled in the art, according to the concept of the present application, there are variations in the specific embodiments and application ranges, so the disclosure should not be construed as limiting the present application.
Claims (15)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411829226.2A CN119806576A (en) | 2024-12-12 | 2024-12-12 | Firmware upgrade method, device, equipment, server and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411829226.2A CN119806576A (en) | 2024-12-12 | 2024-12-12 | Firmware upgrade method, device, equipment, server and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN119806576A true CN119806576A (en) | 2025-04-11 |
Family
ID=95269407
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411829226.2A Pending CN119806576A (en) | 2024-12-12 | 2024-12-12 | Firmware upgrade method, device, equipment, server and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119806576A (en) |
-
2024
- 2024-12-12 CN CN202411829226.2A patent/CN119806576A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10187358B2 (en) | Data transfer optimizations | |
| CN108701039B (en) | Method and device for wirelessly updating software of vehicle | |
| WO2022021992A1 (en) | Data transmission method and system based on nb-iot communication, and medium | |
| CN114830572B (en) | A data transmission method, device, equipment, system and storage medium | |
| JP2004280284A (en) | Control processor, electronic equipment, and program starting method for electronic equipment, and system module updating method for electronic equipment | |
| CN112422494B (en) | Data transmission method, data security verification method and data transmission system | |
| CN113765968B (en) | A file transmission method, device and system | |
| US7376721B2 (en) | System for inhibiting installing a radio configuration file onto a software defined radio device unless the file is compatible with the device | |
| CN109814889B (en) | Method and apparatus for updating source code base | |
| CN112261002B (en) | Data interface docking method and device | |
| CN113132409A (en) | Data transmission method and device | |
| CN118250016B (en) | TCP private protocol communication authentication method of Internet of things equipment | |
| CN119806576A (en) | Firmware upgrade method, device, equipment, server and storage medium | |
| US10949645B2 (en) | Method, apparatus, and storage medium for data verification | |
| CN115914367B (en) | Message pushing method and system of intelligent device | |
| CN118101298A (en) | Data encryption transmission method, device, computer equipment, medium and program product | |
| CN111262837A (en) | Data encryption method, data decryption method, system, equipment and medium | |
| CN115567297A (en) | Cross-site request data processing method and device | |
| KR20190041203A (en) | Efficient signature verification method for digital signatures using implicit certificates | |
| KR100970538B1 (en) | Method and system for loading data into mobile terminal | |
| CN115935379A (en) | Service processing method, device, equipment and computer readable storage medium | |
| CN112612499A (en) | Application program upgrading method and device, electronic equipment and storage medium | |
| CN118368294B (en) | Data transmission method, device, equipment and storage medium | |
| CN119806575A (en) | Firmware upgrade method, device, equipment, server and storage medium | |
| CN114338010B (en) | Database key exchange method and device and electronic equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |