Firmware upgrading method and device, electronic equipment and storage medium
By identifying the target differential packet from the target device and performing data segmentation and verification tree construction, only the difference data between firmware versions is transmitted, which solves the problem of long firmware upgrade time for wearable electronic devices and improves upgrade efficiency and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-04-10
AI Technical Summary
Firmware upgrades for wearable electronic devices involve a large amount of computation, resulting in long upgrade times and low efficiency. Wearable devices with limited hardware resources struggle to complete upgrades quickly.
The target differential packet is determined by the target device, and the target device is used to perform data segmentation, check value calculation and check tree establishment, which reduces the data processing volume of wearable devices, transmits only the difference data between firmware versions, and performs data reception and verification on the wearable device.
It shortens firmware upgrade time, improves upgrade efficiency, reduces the computational burden on hardware resources, avoids the problem of long upgrade time caused by large amount of computation, and ensures the stability and reliability of the upgrade process.
Smart Images

Figure CN121349502B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of firmware upgrading, and more particularly to a firmware upgrading method and device, an electronic device, and a storage medium. BACKGROUND
[0002] As a smart terminal with high-frequency interaction in daily life of users, the firmware of a wearable electronic device is a basic software carrier supporting core functions such as health monitoring, motion tracking, and low-power connection. With the acceleration of iteration of consumer electronics technology, firmware upgrading has become a key means for repairing security vulnerabilities, optimizing functional experience, and adapting to new hardware modules.
[0003] However, the wearable electronic device is limited by its miniaturized design, and therefore hardware resources are generally weak. The existing firmware upgrading scheme for the wearable electronic device has not been adapted and modified, and still requires the wearable electronic device to perform a large amount of data calculation, resulting in a long firmware upgrading process and low efficiency. SUMMARY
[0004] The application aims to provide a firmware upgrading method and device, an electronic device, and a storage medium to reduce the data processing amount of the wearable electronic device, shorten the firmware upgrading time, and improve the firmware upgrading efficiency.
[0005] In a first aspect, the application provides a firmware upgrading method, including:
[0006] In response to receiving a firmware update instruction, obtaining the link quality of a data transmission link;
[0007] determining a target differential package based on a target firmware installation package; the target firmware installation package is stored in a target device; the target device interacts with the wearable electronic device; the target firmware installation package is a complete firmware installation package corresponding to the latest version of the wearable electronic device; the target differential package is a differential partial installation package of the target firmware installation package and a to-be-upgraded firmware installation package; the to-be-upgraded firmware installation package is a firmware installation package before upgrading in the wearable electronic device;
[0008] determining a target differential transmission strategy based on the link quality of the data transmission link;
[0009] based on the target differential transmission strategy and the target differential package, performing a check tree construction operation to construct a first check tree;
[0010] based on the target differential transmission strategy, sending the first check tree and the target differential package to the wearable electronic device through the data transmission link, so that the wearable electronic device performs firmware upgrading based on the first check tree and the target differential package;
[0011] The check tree construction operation includes:
[0012] cut the target differential package into a plurality of data slices based on the target differential transmission strategy;
[0013] calculate a check value of each data slice as a leaf node check value; the data slice and the leaf node check value correspond one by one; determine a plurality of parent node check values based on the check values of the respective leaf nodes; determine a root node check value based on the respective parent node check values; determine the first check tree based on the respective leaf node check values, the respective parent node check values and the root node check value.
[0014] In a second aspect, the embodiment of the application provides a firmware upgrading device, comprising:
[0015] a link quality determination module, configured to acquire link quality of a data transmission link in response to receiving a firmware update instruction;
[0016] a differential package determination module, configured to determine a target differential package based on a target firmware installation package; the target firmware installation package is stored in a target device; the target device interacts with wearable electronic device data; the target firmware installation package is a complete firmware installation package of a latest version corresponding to the wearable electronic device; the target differential package is a differential partial installation package of the target firmware installation package and a firmware installation package to be upgraded; the firmware installation package to be upgraded is a firmware installation package before being upgraded in the wearable electronic device;
[0017] a strategy transmission module, configured to determine a target differential transmission strategy based on the link quality of the data transmission link;
[0018] a check tree construction module, configured to perform a check tree construction operation based on the target differential transmission strategy and the target differential package, and construct the first check tree;
[0019] a data sending module, configured to send the first check tree and the target differential package to the wearable electronic device through the data transmission link based on the target differential transmission strategy, so that the wearable electronic device performs firmware upgrading based on the first check tree and the target differential package;
[0020] The check tree construction operation comprises:
[0021] cut the target differential package into a plurality of data slices based on the target differential transmission strategy;
[0022] calculate a check value of each data slice as a leaf node check value; the data slice and the leaf node check value correspond one by one; determine a plurality of parent node check values based on the check values of the respective leaf nodes; determine a root node check value based on the respective parent node check values; determine the first check tree based on the respective leaf node check values, the respective parent node check values and the root node check value.
[0023] In a third aspect, the embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the steps of the firmware upgrading method when running the computer program.
[0024] In a fourth aspect, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the firmware upgrading method when executed by a processor.
[0025] The firmware upgrading method and device, the electronic device, and the storage medium provided by the embodiment of the present application have the following beneficial effects.
[0026] The embodiment of the present application determines the target difference package, that is, the difference part installation package of the target firmware installation package and the firmware installation package to be upgraded, only transmits the difference data between the firmware versions, rather than the complete firmware installation package, thereby reducing the amount of data to be transmitted and reducing the data calculation amount of the wearable electronic device in the firmware upgrading process. For the wearable electronic device with limited hardware resources, the data processing burden is reduced, thereby shortening the time required for firmware upgrading and improving the firmware upgrading efficiency. In addition, the embodiment of the present application limits the calculation-intensive tasks such as data segmentation, calculation and verification of the verification value, and establishment of the verification tree to be performed by the target device, and fully utilizes the powerful computing performance of the target device. At the same time, the wearable electronic device with limited hardware resources is only responsible for data extraction and verification after receiving data, avoiding complex data calculation thereon. Since the wearable electronic device does not need to perform complex calculations such as data segmentation, calculation of the verification value, and establishment of the verification tree, the data processing amount of the wearable electronic device in the firmware upgrading process is reduced, so that the wearable electronic device can more intensively use limited resources for data reception and simple verification operation, thereby solving the problem of long upgrading time caused by large calculation amount of the wearable electronic device in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0028] Figure 1 The flowchart of the firmware upgrading method provided by an embodiment of the present application is shown in the figure.
[0029] Figure 2 The structural block diagram of the firmware upgrading device provided by an embodiment of the present application is shown in the figure.
[0030] Figure 3A schematic block diagram of an electronic device according to an embodiment of the present application is provided. DETAILED DESCRIPTION
[0031] In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, and circuits are omitted so as not to obscure the description of the present application with unnecessary detail.
[0032] It can be understood that, in the embodiments of the present application, the data related to user information and the like need to be obtained with the permission or consent of the user when the embodiments of the present application are applied to specific products or technologies, and the collection, use and processing of the related data need to comply with relevant laws, regulations and standards.
[0033] It should be noted that the terms "first", "second", and the like in the description, claims, and drawings of the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0034] In order to make the purposes, technical solutions and advantages of the present application clearer, specific embodiments will be described below with reference to the accompanying drawings.
[0035] In an embodiment of the present application, a firmware upgrade method is executed by a target device for upgrading firmware in a wearable electronic device. The target device and the wearable electronic device interact with each other through a data transmission link. In this embodiment, the wearable electronic device can be smart glasses or smart earphones, and the target device can be a mobile phone or a tablet. The data transmission link can be Bluetooth or WiFi. Firmware refers to the hardened software embedded in a hardware device, which is the intermediate layer between the device hardware and the upper application, responsible for controlling the basic operation of the hardware, such as Bluetooth connection, audio decoding, touch response, etc. of smart glasses. Firmware upgrade can fix vulnerabilities, optimize performance or add new functions.
[0036] Reference is made to Figure 1 , Figure 1 A flowchart of the firmware upgrade method according to an embodiment of the present application is provided, which can be executed by a target device. The method can include S101-S105.
[0037] S101: In response to receiving a firmware update instruction, the link quality of the data transmission link is obtained.
[0038] In this embodiment, the firmware update instruction refers to a signal triggered after the user initiates an operation, such as a signal instruction triggered after the user clicks a firmware upgrade button in the user interface of the mobile phone. The link quality of the data link refers to the performance indicators of the data transmission link, which can be, for example, the signal strength, transmission rate, packet loss rate, and delay of Bluetooth. The link quality directly affects the stability of data transmission. For example, when the signal is weak, the data transmission link is prone to packet loss, resulting in transmission failure. In this embodiment, the signal strength of Bluetooth is used as the link quality of the data transmission link.
[0039] S102: Determine the target difference package based on the target firmware installation package.
[0040] In this embodiment, the target firmware installation package is stored in the target device; the target firmware installation package is the complete firmware installation package of the latest version corresponding to the wearable electronic device, which contains all the complete contents of the wearable device after upgrading, such as function codes, configuration information, etc. The firmware installation package to be upgraded is the firmware installation package before upgrading in the wearable electronic device, that is, the firmware installation package currently used by the wearable electronic device, that is, the old version firmware currently running by the device. It records the function codes, configurations, etc. before the device is upgraded.
[0041] In this embodiment, the target difference package is the difference part of the target firmware installation package and the firmware installation package to be upgraded, that is, by comparing the latest version and the old version (to be upgraded) firmware content, only the different parts are extracted, such as new function codes, modified vulnerability repair codes, etc., to form a simplified data package. Its core function is to reduce the amount of data transmission. Compared with directly transmitting the complete latest firmware package, transmitting the difference package can greatly save transmission bandwidth and time.
[0042] S103: Determine the target difference transmission strategy based on the link quality of the data transmission link.
[0043] In this embodiment, the target difference transmission strategy can be determined based on the pre-established mapping table and the link quality of the data transmission link. The pre-established mapping table contains the target difference transmission strategy corresponding to the link quality of each data transmission link. The target difference transmission strategy refers to the fragmentation strategy, that is, the data block size of the data block.
[0044] S104: Based on the target difference transmission strategy and the target difference package, perform a check tree construction operation to construct a first check tree.
[0045] In this embodiment, the first check tree refers to a multi-level check structure generated by the target device, which is used to verify the integrity and correctness of the difference package transmission in the subsequent process. Each node of the tree corresponds to a check value, and the check value of each node can be calculated by a hash algorithm. The levels are divided from bottom to top as follows:
[0046] Leaf node: the check value of each data shard after the target differential package is split; parent node: the check value calculated by combining the check values of multiple adjacent leaf nodes; root node: the final check value calculated by combining the check values of all parent nodes.
[0047] In this embodiment, first, the shard size should be determined based on the target differential transmission strategy, and the data in the target differential package is fragmented to obtain multiple data shards, each of which corresponds to a leaf node, and the leaf node also corresponds to a check value determined based on the data shard. Then, according to the preset rule, each leaf node is grouped and divided into multiple parent nodes, and each parent node corresponds to different leaf nodes. Based on the check values of the leaf nodes corresponding to each parent node, the check values of each parent node are determined, and finally the root node is determined based on each parent node, and the root node check value is determined based on the check values of each parent node, to obtain the first check tree.
[0048] In this embodiment, the check tree construction operation can be:
[0049] Cut the target differential package into multiple data shards based on the target differential transmission strategy;
[0050] Calculate the check value of each data shard as the leaf node check value; the data shard and the leaf node check value correspond one by one; determine the parent node check value based on the check value of each leaf node; determine the root node check value based on the check value of each parent node; determine the first check tree based on the check value of each leaf node, the check value of each parent node, and the root node check value.
[0051] In this embodiment, the target differential transmission strategy includes a fragmentation strategy. The fragmentation strategy determines the cutting method of the data shard, such as cutting one shard every 500KB or cutting by a fixed number. The data shard refers to a small data block obtained after the target differential package is cut according to the fragmentation strategy, which is the basic unit of transmission. The check value can be a string of feature values calculated by a hash algorithm on the data. Even if there is a 1-byte change in the data content, the check value will be completely different, which is used to verify the integrity of the data.
[0052] The first check tree is a tree structure composed of all leaf node check values, parent node check values, and root node check values in a hierarchical relationship.
[0053] S105: Send the first check tree and the target differential package to the wearable electronic device through the data transmission link based on the target differential transmission strategy.
[0054] In this embodiment, the first check tree and the target differential package are sent to the wearable electronic device through the data transmission link, so that the wearable electronic device can perform firmware upgrade based on the first check tree and the target differential package.
[0055] In the embodiment, the wearable device first verifies whether the received target differential package is complete and correct through the first verification tree, such as whether the check value of each fragment matches the leaf node of the verification tree and whether the whole passes the root node verification. Only when the differential package passes the verification, the wearable device updates the old firmware with the differential package, and finally completes the upgrade from the old version to the latest version.
[0056] In the embodiment, considering that the hardware resources of the wearable electronic device are relatively weak compared with the target device, in the embodiment, the segmentation of data, the calculation of check values and the establishment of verification trees are all limited to be performed by the target device, and the wearable electronic device only needs to perform data extraction and verification on the received data.
[0057] From the above, it can be concluded that the embodiment of the application determines the target differential package, that is, the differential part installation package of the target firmware installation package and the firmware installation package to be upgraded, only transmits the differential data between the firmware versions, rather than the complete firmware installation package, thereby reducing the amount of data to be transmitted, and further reducing the data calculation amount of the wearable electronic device in the firmware upgrade process. For the wearable electronic device with limited hardware resources, the data processing burden is reduced, thereby shortening the time required for firmware upgrade and improving the efficiency of firmware upgrade. In addition, the embodiment of the application limits the calculation-intensive tasks such as segmentation of data, calculation of check values and establishment of verification trees to be performed by the target device, and fully utilizes the powerful computing performance of the target device. At the same time, the wearable electronic device with limited hardware resources is only responsible for data extraction and verification after receiving data, avoiding complex data calculation thereon. Since the wearable electronic device does not need to perform complex calculations such as data segmentation, check value calculation and verification tree establishment, the data processing amount of the wearable electronic device in the firmware upgrade process is reduced, so that it can more concentratedly use limited resources for data reception and simple verification operation, thereby solving the problem of long upgrade time caused by large calculation amount of the wearable electronic device in the prior art.
[0058] In an embodiment of the application, the firmware in the wearable electronic device is divided into a plurality of function firmwares;
[0059] Determining the target differential package based on the target firmware installation package comprises:
[0060] Dividing the target firmware installation package into a plurality of sub-installation packages based on the plurality of function firmwares in the wearable electronic device; the sub-installation packages correspond to the function firmwares one by one;
[0061] Based on each sub-installation package and the sub-installation package of the corresponding function firmware before upgrading, from each sub-installation package, determine the first sub-installation package and the second sub-installation package, the difference degree of the first sub-installation package and the sub-installation package of the corresponding function firmware before upgrading is greater than the preset difference degree, and the difference degree of the second sub-installation package and the sub-installation package of the corresponding function firmware before upgrading is less than or equal to the preset difference degree; the first sub-installation package and the second sub-installation package are at least one;
[0062] Integrate each first sub-installation package into a first target differential package, and determine a second target differential package based on each second sub-installation package;
[0063] Integrate the first target differential package and the second target differential package to obtain a target differential package.
[0064] In this embodiment, each firmware can be divided into multiple function firmwares in advance based on the function of the firmware, such as heart rate monitoring function firmware, time display function firmware, and motion counting function firmware, etc. Each function firmware is independently responsible for a core function and is relatively independent of each other. The target firmware installation package contains the installation package of all firmwares, so in this embodiment, the target firmware installation package is split according to the division method to obtain a module-level sub-installation package. The sub-installation package corresponds to the function firmware one by one, for example, the heart rate monitoring sub-installation package corresponds to the heart rate monitoring function firmware, and contains the latest version code and configuration of the function module.
[0065] In this embodiment, since the firmware usually exists in the form of a binary file, the difference of the byte sequence can be directly compared to determine the difference degree, which is an index for measuring the difference between the sub-installation package and the sub-installation package before upgrading. The higher the difference degree, the greater the difference between the two versions of the function firmware installation package. The preset difference degree can be a preset threshold, which can be determined based on experience. The first sub-installation package is the sub-installation package whose difference degree with the corresponding sub-installation package before upgrading is greater than the preset difference degree, and the second sub-installation package is the sub-installation package whose difference degree with the corresponding sub-installation package before upgrading is less than or equal to the preset difference degree.
[0066] In this embodiment, the first target differential package is a differential package part directly integrated by all first sub-installation packages, which directly contains the entire sub-package more efficiently due to the large difference. And the second target differential package is a fine-grained difference part extracted based on all second sub-installation packages, which does not need to contain the entire sub-package, and only extracts specific difference content.
[0067] From the above, the embodiments of the present application divide the firmware in the wearable electronic device into multiple functional firmware, and split the target firmware installation package into multiple sub-installation packages corresponding thereto based on the functional firmware. This modular division method enables the firmware upgrade to be refined to the specific functional module level. When determining the target difference package, by comparing the difference degrees of each sub-installation package and the corresponding sub-installation package before upgrade, it can be accurately located which functional modules have changed and the degree of change. Compared with the traditional whole firmware upgrade method, this method of refining the upgrade granularity avoids unnecessary full update, and only upgrades the functional modules that have changed, improving the pertinence and efficiency of the upgrade. For the first sub-installation package with a difference degree greater than the preset difference degree, it is directly integrated into the first target difference package. Since the installation packages of these functional modules have large differences between the two versions, the direct inclusion of the entire sub-package is more efficient. Complex calculations and additional overheads that may occur when extracting fine-grained differences can be avoided, reducing the complexity of data processing. At the same time, during the data transmission process, the complete functional module update content can be transmitted at one time, improving the transmission efficiency, especially for wearable electronic devices with limited hardware resources and high requirements for transmission speed. For the second sub-installation package with a difference degree less than or equal to the preset difference degree, the embodiments extract the fine-grained difference part to determine the second target difference package. Because the installation packages of these functional modules have small changes, the entire sub-package does not need to be transmitted, and only the specific difference content needs to be extracted, reducing the amount of data that needs to be transmitted and further reducing the requirement for hardware resources of the wearable electronic device. Under limited hardware resources, data transmission and processing can be completed more quickly, thereby improving the efficiency of the entire firmware upgrade process. When receiving and installing the target difference package, the wearable electronic device only needs to process the update content related to its own functional modules, without the need for large-scale full data calculation and processing, reducing the computational burden and memory occupation of the wearable electronic device during the firmware upgrade process, and avoiding upgrade failure or system freezing problems caused by insufficient hardware resources. At the same time, the refined upgrade method also makes the upgrade process more controllable, reduces the compatibility problems and system risks that may be caused by the whole upgrade, and ensures the stability and reliability of the firmware upgrade.
[0068] In an embodiment of the present application, determining the second target difference package based on each second sub-installation package comprises:
[0069] analyzing each second sub-installation package through a decompilation tool to obtain the function structure in each second sub-installation package and the non-function structure in each second sub-installation package;
[0070] obtain the function structure of the installation package of the corresponding function firmware of each second sub installation package before the firmware is upgraded and the non-function structure of the installation package of the corresponding function firmware of each second sub installation package before the firmware is upgraded by analyzing the installation package of the corresponding function firmware of each second sub installation package before the firmware is upgraded through the decompilation tool;
[0071] determine the first difference data based on the function structure in each second sub installation package and the function structure of the installation package of the corresponding function firmware of each second sub installation package before the firmware is upgraded; the first difference data includes the function code segment position changed in each second sub installation package and the corresponding function call relationship correction information;
[0072] determine the second difference data based on the non-function structure in each second sub installation package and the non-function structure of the installation package of the corresponding function firmware of each second sub installation package before the firmware is upgraded; the second difference data includes the byte position changed and the byte-level difference instruction corresponding to the byte position;
[0073] integrate the first difference data and the second difference data to obtain the second target difference package.
[0074] In the embodiment, the decompilation tool can convert binary code into understandable structured code. The firmware is essentially a binary file, and it is difficult to see the difference by direct comparison. After decompilation, the internal logic structure can be parsed. The function structure refers to the composition and relationship of functions in the firmware. The function is a code block that completes a specific function. The function structure includes the position, parameters, return value, internal code logic, and the calling relationship of the function and other functions. The non-function structure includes but is not limited to constants, configuration information, comments, and blank bytes. The non-function structure does not directly participate in code execution, but affects the running configuration of the firmware.
[0075] In the embodiment, the first difference data refers to the function-level difference information obtained by comparing the function structure of the second sub installation package with the function structure of the corresponding function firmware of the old version, including the function code segment position changed and the function call relationship correction information.
[0076] The function code segment position changed refers to which part of which function is modified, and the function call relationship correction information refers to the calling logic change between functions, such as "the original A function calls the B function, and now it is changed to the A function calling the C function", "the original B function is called 3 times, and now it is changed to be called 5 times", and other relationships that need to be corrected.
[0077] In the embodiment, the second difference data is the byte-level difference information obtained by comparing the non-function structure of the second sub installation package with the non-function structure of the corresponding function firmware of the old version, including the byte position changed and the byte-level difference instruction.
[0078] The byte position that is changed represents which binary byte in the non-function structure is modified, such as "the byte at address 0x0020 in the configuration information"; the byte-level difference instruction represents what the byte at the position is modified to, such as "modified from 0x01 to 0x03", which corresponds to "the default brightness is changed from level 1 to level 3".
[0079] In this embodiment, the second target difference package is a difference package portion integrated from the first difference data (function-level difference) and the second difference data (byte-level difference), and only contains the specific difference content of the second sub-installation package and the old version, rather than the entire sub-package.
[0080] As can be seen from the above, the embodiments of the present application only upgrade the specific difference content of the second sub-installation package and the old version, rather than transmitting the entire sub-package. When receiving and processing data, the wearable electronic device does not need to perform large-scale full-data calculation, thereby reducing the calculation burden of the wearable electronic device and enabling it to more efficiently complete the firmware upgrade task under limited hardware resources. During the upgrade process, the wearable electronic device only needs to store and process difference data, rather than complete firmware installation packages. Taking the byte-level difference as an example, only the byte position that is changed and the specific modification content need to be recorded, without occupying a large amount of memory to store the entire non-function structure, thereby reducing the probability of upgrade failure or system freezing caused by insufficient memory, and ensuring the stable operation of the wearable electronic device during the firmware upgrade process.
[0081] In an embodiment of the present application, the plurality of parent node check values are determined based on the check values of the respective leaf nodes, comprising:
[0082] According to the cutting order, adjacent leaf node check values every N are sent as a group of sender check data, to obtain a plurality of groups of sender check data, and the number of leaf node check values contained in the last group of sender check data is less than or equal to N;
[0083] Based on each group of sender check data, a check value corresponding to each group of sender check data is obtained, and the check value corresponding to each group of sender check data is taken as the parent node check value of the leaf node contained in the sender check data.
[0084] In the embodiment, the leaf node check value refers to the check value corresponding to each data slice, which is the bottom layer node of the check tree. The sending end check data refers to a group of data composed of every N adjacent leaf node check values in the cutting order of the data slice, N being a preset number, such as 5 leaf nodes for a group, which is used to calculate the check value of the upper layer. The parent node check value refers to the check value calculated for each group of sending end check data (i.e. N leaf node check values), which is the upper layer node of the leaf node, and each parent node corresponds to a group of leaf nodes. The root node check value is the final check value calculated for all parent node check values, which is the highest layer node of the check tree and represents the overall check result of the entire target differential package. The first check tree is a tree structure composed of all leaf node check values, parent node check values and root node check values in hierarchical relationship.
[0085] From the above, it can be concluded that the embodiments of the present application cut the target differential package into multiple data slices based on the slicing strategy, so that the large-capacity target differential package can be transmitted in small data blocks. In the complex network environment of the wearable electronic device, small data slice transmission can effectively reduce the data transmission error probability caused by network fluctuations, interference and other factors. Even if an error occurs in a certain data slice during transmission, only the slice needs to be retransmitted, and the transmission of other slices will not be affected, thereby improving the reliability of the entire data transmission process. The first check tree is constructed by calculating the check value of each data slice as the leaf node check value, then grouping the adjacent leaf node check values according to the cutting order and calculating the parent node check value, and finally generating the root node check value, forming a multi-level check mechanism that can verify the integrity of the data from different levels. The leaf node check value ensures the correctness of each data slice itself; the parent node check value checks the adjacent data slice group and can find data errors within the slice group; and the root node check value represents the overall check result of the entire target differential package, ensuring the integrity of the combined data slices. Through multi-level checking, data errors in the transmission process can be found and corrected in a timely manner, reducing the risk of transmission errors. In the check process of the embodiments, when the check value of a certain level does not match, the corresponding next level node can be quickly located. For example, if a parent node check value does not match, it can be determined that there is an error in the leaf nodes (i.e. data slices) contained in the parent node. In this way, the data slice with errors can be quickly and accurately located, reducing the time and cost of troubleshooting and improving the efficiency of firmware upgrade.
[0086] In an embodiment of the present application, the first check tree and the target differential package are sent to the wearable electronic device through the data transmission link based on the target differential transmission strategy, comprising:
[0087] extracting the root node structure and the parent node structure of the first check tree;
[0088] determining a target check value list based on the root node structure, the parent node structure, the check values of the leaf nodes, the check values of the parent nodes, and the check value of the root node; the target check value list includes a root node check value list and a parent node check value list; the root node check value list contains the check value of the root node and a plurality of check values of the parent nodes corresponding to the check value of the root node; the parent node check value list contains a plurality of check values of the child nodes corresponding to each check value of the parent nodes respectively;
[0089] performing fragmentation on the target check value list based on a fragmentation strategy to obtain a plurality of check tree fragments;
[0090] determining a first overall check value based on the check values of the leaf nodes, the check values of the parent nodes, and the check value of the root node;
[0091] sending the plurality of check tree fragments and the first overall check value to the wearable electronic device through a data transmission link;
[0092] in response to receiving a check tree consistency instruction, sending the plurality of data fragments to the wearable electronic device through the data transmission link; the check tree consistency instruction is sent by the wearable electronic device after integrating the check tree based on the plurality of check tree fragments and the first overall check value and passing the check of the check tree.
[0093] In this embodiment, the logic is to send the check tree first and confirm its correctness, and then send the differential packet data, to ensure that the subsequent data check has a reliable benchmark.
[0094] In this embodiment, the root node structure and the parent node structure are the hierarchical relationship topology of the nodes in the first check tree, that is, which parent nodes correspond to the root node, and which leaf nodes correspond to each parent node. The structure information ensures that the wearable device can correctly restore the hierarchy of the check tree. The target check value list is a list that integrates all information of the check tree, and is used for the wearable device to restore the check tree. It contains two types of sub-lists, a root node check value list and a parent node check value list.
[0095] In this embodiment, the root node check value list records the check value of the root node and all check values of the parent nodes corresponding to the root node, which reflects the hierarchical relationship of the root node pointing to the parent nodes; the parent node check value list records each check value of the parent nodes and all check values of the leaf nodes corresponding to the parent nodes, which reflects the hierarchical relationship of the parent nodes pointing to the leaf nodes. The check tree fragment refers to a small data block obtained by cutting the target check value list according to the fragmentation strategy. Since the check tree may contain a large number of check values and structure information, it needs to be fragmented for transmission, and the splitting rule is consistent with that of the data fragment, facilitating transmission management.
[0096] In the embodiment, the first overall check value refers to a check value calculated based on all leaf node check values, parent node check values and root node check values of the first check tree, and is used to verify whether the check tree is complete and has not been tampered with. The check tree consistency instruction refers to a confirmation signal sent by the wearable device to the target device after receiving and integrating all check tree fragments and verifying that the first overall check value is passed, indicating that the check tree has been correctly received and data fragments can be sent.
[0097] From the above, it can be seen that the embodiment of the application first sends the check tree related content and confirms its correctness, and then sends the differential packet data, thereby building a reliable benchmark for subsequent data checking. In a complex use environment, the wearable electronic device may face signal interference, network fluctuations and other problems. The embodiment can effectively avoid the situation of misjudgment of the differential packet data due to errors in the check tree itself, thereby improving the accuracy of the overall data transmission process. In the embodiment, the target check value list includes the root node check value list and the parent node check value list, and records the check values and corresponding relationships between nodes at different levels, so that the possible error position can be accurately located during data transmission and checking, thereby improving the fault locating efficiency.
[0098] In an embodiment of the application, the firmware upgrade based on the first check tree and the target differential packet is implemented by the wearable electronic device in the following manner:
[0099] Integrating the received check tree fragments to obtain a second check tree;
[0100] Extracting each leaf node check value, each parent node check value and the root node check value in the second check tree to determine a second overall check value;
[0101] If the first overall check value and the second overall check value are the same, the check tree passes the check, and a check tree consistency instruction is sent to the target device;
[0102] Performing a first operation on each received data fragment;
[0103] In response to passing the leaf node check of all data fragments in the first operation, performing a parent node check until all parent node checks pass;
[0104] In response to passing all parent node checks, performing a root node check until the root node check passes, and completing the integrity check;
[0105] Performing a firmware upgrade based on the target differential packet;
[0106] The first operation includes: calculating the check value of the data fragment, and comparing with the corresponding leaf node check value in the second check tree, if consistent, the leaf node check of the data fragment is passed, and the data fragment is temporarily stored; if inconsistent, a first fragment retransmission request is sent to the target device, so that the target device retransmits the data fragment based on the first fragment retransmission request; the first fragment retransmission request carries the corresponding leaf node check value of the data fragment in the second check tree.
[0107] In the embodiment, the logic is a multi-layer verification mechanism of verification through the check tree, data fragment verification and hierarchical check in sequence, ensuring that the received differential package is complete and correct before performing the upgrade.
[0108] In the embodiment, the second check tree refers to the check tree obtained by integrating all the check tree fragments received by the wearable device, which is the check tree restored locally by the wearable device. The second overall check value refers to the overall check value calculated by the wearable device based on all the check values (leaf node check value, parent node check value and root node check value) in the second check tree, which is used to verify whether the locally integrated check tree is complete, corresponding to the first overall check value sent by the target device.
[0109] In the embodiment, when the second overall check value is exactly the same as the first overall check value sent by the target device, it indicates that the check tree fragments received by the wearable device are complete and have not been tampered with, and the check tree is valid, that is, the check tree passes the check. The check tree consistency instruction refers to the confirmation signal sent by the wearable device to the target device after the check tree passes the check, informing the target device that the check tree has been correctly received, and the wearable device can start sending data fragments.
[0110] In the embodiment, the first operation refers to the verification process performed by the wearable device after receiving each data fragment, the core of which is to verify whether a single fragment is correct, which specifically includes: calculating the check value of the received fragment; comparing with the check value of the corresponding leaf node in the second check tree; consistent, then pass the verification and temporarily store the fragment; inconsistent, then request to retransmit the fragment.
[0111] Among them, the leaf node check refers to the check performed on each data fragment, which is the most bottom layer check. The first fragment retransmission request refers to the request sent by the wearable device to the target device when the check value of a data fragment is inconsistent with the leaf node check value of the data fragment in the second check tree, which is used to request to retransmit the fragment. The request carries the corresponding leaf node check value, which facilitates the target device to quickly locate the fragment that needs to be retransmitted.
[0112] In the embodiment, the parent node check refers to the check on each group of leaf node check values after all data shards pass the leaf node check, which is used to verify whether the whole group of shards is correct, and is the check at the intermediate layer. The root node check refers to the check on the combination of all parent node check values after all parent node checks pass, which is used to verify whether the whole differential package is complete, and is the check at the highest layer. The integrity check refers to the confirmation of the whole target differential package when the leaf node check, the parent node check and the root node check all pass, and the integrity check is completed.
[0113] In the embodiment, the parent node check can specifically include:
[0114] The leaf node check values of each temporarily stored data shard are extracted, and every N leaf node check values are received as a group of receiver check data according to the receiving order;
[0115] For each group of receiver check data, the group of receiver check data is compared with the corresponding parent node check value in the first check tree; if they are consistent, the group of parent node check values passes the check; if they are inconsistent, the second operation is performed;
[0116] The second operation includes:
[0117] The second shard retransmission request is sent to the target device, so that the target device retransmits the data shard corresponding to the group of parent nodes based on the second shard retransmission request, performs the first operation on the received data shard corresponding to the group of parent nodes, compares the check data of the data shard corresponding to the group of parent nodes with the corresponding parent node check value in the first check tree in response to the leaf node check of the data shard corresponding to the group of parent nodes passing, and if they are inconsistent, the second operation is repeatedly performed until the group of parent node check values pass the check; the second shard retransmission request carries the corresponding parent node check value of the group of parent nodes in the first check tree.
[0118] In the embodiment, the leaf node check value of the temporarily stored data shard refers to the check value corresponding to the data shard temporarily stored after the wearable device receives and passes the leaf node check (i.e. the first operation), and the check value of each shard has been confirmed to be consistent with the leaf node check value of the second check tree. The receiving order refers to the order in which the data shards are received by the wearable device, which is consistent with the order sent by the target device, and ensures that the grouping logic matches the grouping rule of the check tree.
[0119] In the embodiment, the receiving end check data refers to the data group composed of the temporarily stored leaf node check values by the wearable device per N adjacent leaf node check values, and the data group corresponds to the sending end check data sent by the target device. N is the same as the grouping rule when the target device constructs the check tree. The corresponding parent node check value in the first check tree refers to the parent node check value in the first check tree constructed by the target device, which corresponds to the current receiving end check data. It can be understood as the reference check value of the group of leaf node check values.
[0120] In the embodiment, the parent node check value passing refers to that when the combined check value (calculated by the wearable device) of the receiving end check data is consistent with the corresponding parent node check value (previously calculated by the target device) in the first check tree, it is indicated that the group of fragments is complete as a whole, and the parent node check is passed. The second operation is a remedial process performed when the parent node check is inconsistent. The core is to request retransmission of the fragments of the corresponding group and re-verification until the group of parent nodes passes the check. The second fragment retransmission request refers to the instruction sent by the wearable device to the target device for requesting retransmission of the data fragments corresponding to the group of parent nodes. The request carries the parent node check value of the group of parent nodes in the first check tree, so as to facilitate the target device to quickly locate the group of fragments that need to be retransmitted.
[0121] In the embodiment, when the parent node check is inconsistent, the wearable device sends the second fragment retransmission request to inform the target device that the group of fragments is incorrect as a whole and needs to be retransmitted. The target device retransmits all data fragments corresponding to the group based on the request. After receiving the retransmitted fragments, the wearable device first performs the first operation to verify the leaf node check value of the single fragment. If the retransmitted fragment passes the leaf node check, the receiving end check data of the group is calculated again, and is compared with the corresponding parent node check value. If it is still inconsistent, the above retransmission and verification process is repeated until the group of parent nodes passes the check. Through the cyclic retransmission and verification, it is ensured that the problem group eventually reaches the overall correctness, and it is avoided that the subsequent root node check is affected due to the error of the group.
[0122] From the above, the multi-layer verification mechanism of the application embodiment is constructed by verifying the tree, verifying the data slices and hierarchical verification. From the overall integrity verification of the verification tree, to the bottom layer verification of each data slice, to the middle and high layer verification of the parent node and the root node, the layers are checked to ensure that the received difference package is complete and correct before performing the upgrade operation, thereby reducing the risk of firmware upgrade failure or device failure caused by data errors. The embodiment reasonably allocates the resources of the device through the phased and hierarchical verification method. In the verification tree verification stage, the wearable device mainly integrates the verification tree and calculates the overall verification value; in the data slice verification stage, the device processes the data slices one by one and performs bottom layer verification; in the hierarchical verification stage, the device performs middle and high layer verification in hierarchical order, avoiding the device to process a large amount of data at one time, reducing the demand of the device on memory and processing capacity, improving the operation efficiency of the device, and in this process, only data extraction and integration are involved, without calculation of verification value, so the data processing amount is small, the resource occupation is reduced, and the firmware upgrade speed is improved.
[0123] The firmware upgrade method corresponding to the above embodiment, Figure 2 The structure block diagram of the firmware upgrade device provided by an embodiment of the application is shown. For ease of illustration, only the parts related to the embodiments of the application are shown. Refer to Figure 2 The firmware upgrade device 20 is used for upgrading the firmware in the wearable electronic device, and the firmware upgrade device is executed by the target device; the target device and the wearable electronic device interact with each other through a data transmission link, and the firmware upgrade device 20 comprises a link quality determination module 21, a difference package determination module 22, a strategy transmission module 23, a verification tree construction module 24 and a data sending module 25.
[0124] The link quality determination module 21 is configured to acquire the link quality of the data transmission link in response to receiving the firmware update instruction.
[0125] The difference package determination module 22 is configured to determine the target difference package based on the target firmware installation package; the target firmware installation package is stored in the target device; the target device and the wearable electronic device interact with each other; the target firmware installation package is the complete firmware installation package corresponding to the latest version of the wearable electronic device; the target difference package is the difference part installation package of the target firmware installation package and the to-be-upgraded firmware installation package; and the to-be-upgraded firmware installation package is the firmware installation package in the wearable electronic device before being upgraded.
[0126] The strategy transmission module 23 is configured to determine the target difference transmission strategy based on the link quality of the data transmission link.
[0127] The verification tree construction module 24 is configured to perform a verification tree construction operation based on the target difference transmission strategy and the target difference package, and construct a first verification tree.
[0128] The verification tree construction operation comprises:
[0129] cutting the target differential package into a plurality of data fragments based on the target differential transmission strategy;
[0130] calculating a verification value of each data fragment as a leaf node verification value; the data fragments correspond to the leaf node verification values one by one; determining a plurality of parent node verification values based on the verification values of the leaf nodes; determining a root node verification value based on the verification values of the parent nodes; and determining a first verification tree based on the verification values of the leaf nodes, the verification values of the parent nodes, and the root node verification value.
[0131] The data sending module 25 is configured to send the first verification tree and the target differential package to the wearable electronic device through a data transmission link based on the target differential transmission strategy, so that the wearable electronic device performs firmware upgrading based on the first verification tree and the target differential package.
[0132] In an embodiment of the present application, the firmware in the wearable electronic device is divided into a plurality of functional firmwares;
[0133] The differential package determination module 22 is specifically configured to divide the target firmware installation package into a plurality of sub-installation packages based on the plurality of functional firmwares in the wearable electronic device; the sub-installation packages correspond to the functional firmwares one by one;
[0134] Based on the sub-installation packages and the sub-installation packages corresponding to the functional firmwares before upgrading, the first sub-installation package and the second sub-installation package are determined from the sub-installation packages; the difference degree of the first sub-installation package and the sub-installation package corresponding to the functional firmware before upgrading is greater than the preset difference degree; the difference degree of the second sub-installation package and the sub-installation package corresponding to the functional firmware before upgrading is less than or equal to the preset difference degree; the first sub-installation package and the second sub-installation package are at least one;
[0135] The first target differential package is integrated from each first sub-installation package, and the second target differential package is determined based on each second sub-installation package;
[0136] The first target differential package and the second target differential package are integrated to obtain the target differential package.
[0137] In an embodiment of the present application, the differential package determination module 22 is specifically further configured to parse each second sub-installation package through a decompilation tool to obtain function structures in each second sub-installation package and non-function structures in each second sub-installation package;
[0138] The function structure of the function firmware before upgrading of each second sub installation package and the non-function structure of the function firmware before upgrading of each second sub installation package are obtained by parsing the function firmware before upgrading of each second sub installation package through a decompilation tool.
[0139] The first difference data is determined based on the function structure in each second sub installation package and the function structure of the function firmware before upgrading of each second sub installation package; the first difference data includes: the function code segment position changed in each second sub installation package and the corresponding function call relationship correction information;
[0140] The second difference data is determined based on the non-function structure in each second sub installation package and the non-function structure of the function firmware before upgrading of each second sub installation package; the second difference data includes: the byte position changed and the corresponding byte level difference instruction;
[0141] The first difference data and the second difference data are integrated to obtain the second target difference package.
[0142] In an embodiment of the present application, the verification tree construction module 24 is specifically configured to send the verification values of every N adjacent leaf nodes as a group of sender verification data according to the cutting order, to obtain a plurality of groups of sender verification data, and the number of leaf node verification values contained in the last group of sender verification data is less than or equal to N;
[0143] Based on each group of sender verification data, the verification value corresponding to each group of sender verification data is obtained, and the verification value corresponding to each group of sender verification data is taken as the parent node verification value of the leaf node contained in the sender verification data;
[0144] Based on the parent node verification values, the root node verification value is generated;
[0145] Based on the leaf node verification values, the parent node verification values and the root node verification value, the first verification tree is determined.
[0146] In an embodiment of the present application, the target difference transmission strategy includes: a fragmentation strategy; the data sending module 25 is specifically configured to extract the root node structure and the parent node structure of the first verification tree;
[0147] Based on the root node structure, the parent node structure, the leaf node verification values, the parent node verification values and the root node verification value, the target verification value list is determined; the target verification value list includes: a root node verification value list and a parent node verification value list; the root node verification value list contains the root node verification value and a plurality of parent node verification values corresponding to the root node verification value; the parent node verification value list contains a plurality of child node verification values corresponding to each parent node verification value respectively.
[0148] The target check value list is fragmented based on a fragmentation strategy to obtain multiple check tree fragments;
[0149] The first overall check value is determined based on the check values of each leaf node, the check values of each parent node, and the check value of the root node;
[0150] The multiple check tree fragments and the first overall check value are sent to the wearable electronic device through a data transmission link;
[0151] In response to receiving the check tree consistency instruction, the multiple data fragments are sent to the wearable electronic device through the data transmission link; the check tree consistency instruction is sent by the wearable electronic device after the integration of the check tree based on the multiple check tree fragments and the first overall check value and the check tree passes the check.
[0152] In an embodiment of the present application, the firmware upgrade based on the first check tree and the target differential package is implemented by the wearable electronic device and through the following manner:
[0153] The second check tree is obtained by integrating the check tree based on all the received check tree fragments;
[0154] The second overall check value is determined by extracting the check values of each leaf node, the check values of each parent node, and the check value of the root node in the second check tree;
[0155] If the first overall check value and the second overall check value are the same, the check tree passes the check, and a check tree consistency instruction is sent to the target device;
[0156] Upon receiving each data fragment, a first operation is performed on each received data fragment;
[0157] In response to all data fragments passing the leaf node check in the first operation, a parent node check is performed until all parent node checks pass;
[0158] In response to all parent node checks passing, a root node check is performed until the root node check passes, completing the integrity check;
[0159] The firmware is upgraded based on the target differential package;
[0160] The first operation includes: calculating the check value of the data fragment and comparing it with the corresponding leaf node check value in the second check tree; if they are consistent, the leaf node check of the data fragment passes, and the data fragment is temporarily stored; if they are inconsistent, a first fragment retransmission request is sent to the target device to make the target device resend the data fragment based on the first fragment retransmission request; the first fragment retransmission request carries the corresponding leaf node check value of the data fragment in the second check tree.
[0161] In one embodiment of this application, parent node verification includes:
[0162] Extract the leaf node checksums of each temporarily stored data fragment, and use the checksums of every N leaf nodes as a set of receiver checksums according to the receiving order.
[0163] For each set of receiver verification data, compare the set of receiver verification data with the corresponding parent node verification value in the first verification tree; if they match, the parent node verification value of the set passes the verification; if they do not match, perform the second operation.
[0164] The second operation includes:
[0165] A second fragment retransmission request is sent to the target device, so that the target device retransmits the data fragments corresponding to the parent nodes of the group based on the second fragment retransmission request. The first operation is performed on the received data fragments corresponding to the parent nodes of the group. In response to the leaf node verification of the data fragments corresponding to the parent nodes of the group passing the verification, the verification data of the data fragments corresponding to the parent nodes of the group is compared with the corresponding parent node verification value in the first verification tree. If they do not match, the second operation is performed repeatedly until the verification value of the parent nodes of the group passes the verification. The second fragment retransmission request carries the corresponding parent node verification value of the parent nodes of the group in the first verification tree.
[0166] See Figure 3 , Figure 3 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 3 The electronic device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of each module / unit in the above-described device embodiments, for example... Figure 2 The functions of the link quality determination module 21, differential packet determination module 22, policy transmission module 23, check tree construction module 24, and data transmission module 25 are shown.
[0167] It should be understood that, in the embodiments of the present application, the processor 301 can be a central processing unit (CPU), and can 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, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0168] The input device 302 can include a touchpad, a fingerprint collection sensor (for collecting fingerprint information and direction information of a fingerprint of a user), a microphone, etc., and the output device 303 can include a display (LCD, etc.), a speaker, etc.
[0169] The memory 304 can include read-only memory and random access memory, and provide instructions and data for the processor 301. A part of the memory 304 can also include non-volatile random access memory. For example, the memory 304 can also store device type information.
[0170] In specific implementations, the processor 301, the input device 302 and the output device 303 described in the embodiments of the present application can execute the implementation manners described in the firmware upgrade method provided by the embodiments of the present application, and can also execute the implementation manners of the electronic device described in the embodiments of the present application, which will not be described here.
[0171] In another embodiment of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program includes program instructions, and the program instructions are executed by a processor to implement all or part of the processes of the above-mentioned embodiment methods. The computer program can also be used to instruct related hardware to complete, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form, etc. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0172] The computer readable storage medium can be an internal storage unit of the electronic device of any of the preceding embodiments, for example, a hard disk or a memory of the electronic device. The computer readable storage medium can also be an external storage device of the electronic device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, or the like, equipped on the electronic device. Further, the computer readable storage medium can include both the internal storage unit and the external storage device of the electronic device. The computer readable storage medium is used to store a computer program and other programs and data required by the electronic device. The computer readable storage medium can also be used to temporarily store data that has been output or will be output.
[0173] Those skilled in the art can understand that the modules / units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in general terms in the foregoing description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0174] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic device and the units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0175] In several embodiments provided in the present application, it should be understood that the disclosed electronic device and method can be implemented in other ways. For example, the above-described device embodiments are only schematic, for example, the division of the modules / units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of modules, units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces or modules / units, and can also be electrical, mechanical or other form of connection.
[0176] The modules / units described as separate components may or may not be physically separate, and the components shown as modules / units may or may not be physical modules / units, i.e., may be located in one place, or may be distributed on multiple network modules / units. Part or all of the modules / units may be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0177] In addition, each functional module / unit in each embodiment of the present application can be integrated in one processing module / unit, or each module / unit can exist physically alone, or two or more modules / units can be integrated in one module / unit. The integrated module / unit can be realized in the form of hardware or in the form of a software functional module / unit.
[0178] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A firmware upgrade method characterized by comprising: The application comprises: in response to receiving the firmware update instruction, obtaining the link quality of the data transmission link; determining a target differential package based on a target firmware installation package; the target firmware installation package is stored in a target device; the target device interacts with wearable electronic device data; the target firmware installation package is the latest version of the complete firmware installation package corresponding to the wearable electronic device; the target differential package is the differential part installation package of the target firmware installation package and the firmware installation package to be upgraded; the firmware installation package to be upgraded is the firmware installation package in the wearable electronic device before upgrading; determining a target differential transmission strategy based on the link quality of the data transmission link; based on the target differential transmission strategy and the target differential package, performing a check tree construction operation to construct a first check tree; based on the target differential transmission strategy, sending the first check tree and the target differential package to the wearable electronic device through the data transmission link, so that the wearable electronic device performs firmware upgrade based on the first check tree and the target differential package; wherein the check tree construction operation comprises: based on the target differential transmission strategy, cutting the target differential package into multiple data slices; calculating the check value of each data slice as a leaf node check value; the data slice and the leaf node check value correspond one by one; determining a plurality of parent node check values based on the check values of each leaf node; determining a root node check value based on each parent node check value; determining the first check tree based on each leaf node check value, each parent node check value and the root node check value; the firmware in the wearable electronic device is divided into multiple functional firmware; determining a target differential package based on a target firmware installation package comprises: based on the multiple functional firmware in the wearable electronic device, dividing the target firmware installation package into multiple sub installation packages; the sub installation package corresponds to the functional firmware one by one; based on each sub installation package and the un-upgraded sub installation package of the functional firmware corresponding to each sub installation package, determining a first sub installation package and a second sub installation package from the each sub installation package, the difference degree of the first sub installation package and the un-upgraded sub installation package of the functional firmware corresponding to the first sub installation package is greater than the preset difference degree, and the difference degree of the second sub installation package and the un-upgraded sub installation package of the functional firmware corresponding to the second sub installation package is less than or equal to the preset difference degree; the first sub installation package and the second sub installation package are at least one; integrating each first sub installation package into a first target differential package, and determining a second target differential package based on each second sub installation package; integrating the first target differential package and the second target differential package to obtain the target differential package.
2. The firmware upgrade method of claim 1, wherein, determining a second target differential package based on each second sub installation package comprises: analyzing each second sub installation package through a decompilation tool to obtain the function structure in each second sub installation package and the non-function structure in each second sub installation package; The function structure of the firmware installation package corresponding to each second sub installation package before the firmware is upgraded and the non-function structure of the firmware installation package corresponding to each second sub installation package before the firmware is upgraded are obtained by analyzing the firmware installation package corresponding to each second sub installation package before the firmware is upgraded through a decompilation tool; The first difference data is determined based on the function structure in each second sub installation package and the function structure of the firmware installation package corresponding to each second sub installation package before the firmware is upgraded; the first difference data includes: the function code segment position changed in each second sub installation package and the corresponding function call relationship correction information; The second difference data is determined based on the non-function structure in each second sub installation package and the non-function structure of the firmware installation package corresponding to each second sub installation package before the firmware is upgraded; the second difference data includes: the byte position changed and the corresponding byte-level difference instruction; The first difference data and the second difference data are integrated to obtain the second target difference package.
3. The firmware upgrade method of claim 1, wherein, The plurality of parent node check values are determined based on the check values of the plurality of leaf nodes, including: According to the cutting order, adjacent leaf node check values of every N are sent as a group of sender check data, to obtain a plurality of groups of sender check data, and the number of leaf node check values contained in the last group of sender check data is less than or equal to N; Based on each group of sender check data, a check value corresponding to each group of sender check data is obtained, and the check value corresponding to each group of sender check data is taken as the parent node check value of the leaf node contained in the sender check data.
4. The firmware upgrade method of claim 3, wherein, The target difference transmission strategy includes: a fragmentation strategy; the first check tree and the target difference package are sent to the wearable electronic device through the data transmission link based on the target difference transmission strategy, including: The root node structure and the parent node structure of the first check tree are extracted; A target check value list is determined based on the root node structure, the parent node structure, the plurality of leaf node check values, the plurality of parent node check values and the root node check value; the target check value list includes: a root node check value list and a parent node check value list; the root node check value list contains the root node check value and a plurality of parent node check values corresponding to the root node check value; the parent node check value list contains a plurality of child node check values corresponding to each parent node check value; The target check value list is fragmented based on the fragmentation strategy, to obtain a plurality of check tree fragments; A first overall check value is determined based on the plurality of leaf node check values, the plurality of parent node check values and the root node check value; The plurality of check tree fragments and the first overall check value are sent to the wearable electronic device through the data transmission link; In response to receiving a check tree consistency instruction, the plurality of data fragments are sent to the wearable electronic device through the data transmission link; the check tree consistency instruction is sent by the wearable electronic device after the integration of the check tree based on the plurality of check tree fragments and the first overall check value and the check of the check tree is passed.
5. The firmware upgrade method of claim 4, wherein, The firmware upgrade based on the first check tree and the target differential package is implemented by the wearable electronic device and by: performing check tree integration based on all received check tree fragments to obtain a second check tree; extracting each leaf node check value, each parent node check value, and a root node check value in the second check tree to determine a second overall check value; if the first overall check value and the second overall check value are the same, the check tree check passes, and a check tree consistency instruction is sent to the target device; performing a first operation on each data fragment received after receiving one data fragment; in response to all data fragments passing the leaf node check in the first operation, performing parent node checks until all parent node checks pass; in response to all parent node checks passing, performing a root node check until the root node check passes, completing the integrity check; performing firmware upgrade based on the target differential package; the first operation includes: calculating the check value of the data fragment, and comparing it with the corresponding leaf node check value in the second check tree; if they are consistent, the leaf node check of the data fragment passes, and the data fragment is temporarily stored; if they are inconsistent, a first fragment retransmission request is sent to the target device, so that the target device re-sends the data fragment based on the first fragment retransmission request; the first fragment retransmission request carries the corresponding leaf node check value of the data fragment in the second check tree.
6. The firmware upgrade method of claim 5, wherein, the parent node check includes: extracting the leaf node check value of each temporarily stored data fragment, and arranging every N leaf node check value as a group of receiver check data according to the receiving order; for each group of receiver check data, compare the group of receiver check data with the corresponding parent node check value in the first check tree; if they are consistent, the group of parent node check values passes the check; if they are inconsistent, perform a second operation; the second operation includes: sending a second fragment retransmission request to the target device to make the target device retransmit the data fragment corresponding to the group of parent nodes based on the second fragment retransmission request, performing the first operation on the received data fragment corresponding to the group of parent nodes, in response to the leaf node check of the data fragment corresponding to the group of parent nodes passing, comparing the check data of the data fragment corresponding to the group of parent nodes with the corresponding parent node check value in the first check tree; if they are inconsistent, perform the second operation in a loop until the group of parent node check values pass the check; the second fragment retransmission request carries the corresponding parent node check value of the group of parent nodes in the first check tree.
7. A firmware upgrade apparatus characterized by comprising: includes: a link quality determination module for obtaining the link quality of a data transmission link in response to receiving a firmware update instruction; a differential package determination module for determining a target differential package based on a target firmware installation package; The target firmware installation package is stored in a target device; the target device interacts with wearable electronic device data; the target firmware installation package is a complete firmware installation package of a latest version corresponding to the wearable electronic device; the target difference package is a difference part installation package of the target firmware installation package and a firmware installation package to be upgraded; the firmware installation package to be upgraded is a firmware installation package before being upgraded in the wearable electronic device; A policy transmission module is configured to determine a target difference transmission policy based on link quality of the data transmission link; A check tree construction module is configured to perform a check tree construction operation based on the target difference transmission policy and the target difference package, and construct a first check tree; A data sending module is configured to send the first check tree and the target difference package to the wearable electronic device through the data transmission link based on the target difference transmission policy, so that the wearable electronic device performs firmware upgrade based on the first check tree and the target difference package; The check tree construction operation includes: The target difference package is cut into a plurality of data fragments based on the target difference transmission policy; A check value of each data fragment is calculated and used as a leaf node check value; the data fragment and the leaf node check value correspond to each other; a plurality of parent node check values are determined based on the check values of the leaf nodes; a root node check value is determined based on the parent node check values; and the first check tree is determined based on the leaf node check values, the parent node check values, and the root node check value. The firmware in the wearable electronic device is divided into a plurality of functional firmwares; A difference package determination module is configured to divide the target firmware installation package into a plurality of sub-installation packages based on the plurality of functional firmwares in the wearable electronic device; the sub-installation package and the functional firmware correspond to each other; Based on the sub-installation packages and the sub-installation packages corresponding to the functional firmwares before being upgraded, a first sub-installation package and a second sub-installation package are determined from the sub-installation packages; the difference degree of the first sub-installation package and the sub-installation package corresponding to the functional firmware before being upgraded is greater than a preset difference degree; the difference degree of the second sub-installation package and the sub-installation package corresponding to the functional firmware before being upgraded is less than or equal to the preset difference degree; and the first sub-installation package and the second sub-installation package are at least one; Each first sub-installation package is integrated into a first target difference package, and a second target difference package is determined based on each second sub-installation package; The first target difference package and the second target difference package are integrated to obtain the target difference package.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Upgrading method and device of vehicle-mounted controller, equipment and medium
CN118283031A
Method and device for wirelessly upgrading firmware of Bluetooth headset via Bluetooth connection
CN119739410A