Firmware upgrading method and device, equipment, server and storage medium
By performing legality verification before the firmware upgrade of the terminal device, abnormal problems that may occur during the firmware upgrade process are solved, and the success rate and reliability of the firmware upgrade are improved.
Patent Information
- Application Number
- CN202411829219.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-11
AI Technical Summary
An abnormal situation may occur during the firmware upgrade of the terminal device, causing the firmware upgrade to fail, affecting the normal operation of the device.
Before the firmware upgrade, perform legality verification on the firmware upgrade process, including compatibility verification of memory space and firmware version. If the verification fails, send an error message to the server and try again.
The success rate and reliability of firmware upgrades are improved through legality verification, and the equipment operation is avoided due to failures in the upgrade.
Smart Images

Figure CN119806574A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a firmware upgrade method, device, equipment, server and storage medium. Background Art
[0002] The firmware upgrade of terminal devices is an indispensable part of device maintenance. It can improve the performance and compatibility of terminal devices and enable terminal devices to achieve better operating status. During the firmware upgrade, the terminal device needs to obtain a new firmware data package, and then upgrade the firmware in the terminal device to a new firmware version according to the new firmware data package. However, during the firmware upgrade process of the terminal device, abnormal situations may occur, causing the firmware upgrade to fail, and even affecting the normal operation of the terminal device. Summary of the invention
[0003] The embodiments of the present application provide a firmware upgrade method, apparatus, device, server and storage medium. By performing a legitimacy check on the firmware upgrade process before the firmware upgrade, the success rate and reliability of the firmware upgrade can be improved, and adverse effects on the device operation of the terminal device can be avoided.
[0004] On the one hand, an embodiment of the present application provides a firmware upgrade method, which is applied to a terminal device, and the method includes:
[0005] In response to a first data address from a first server, obtaining a first data packet according to the first data address;
[0006] Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet;
[0007] If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0008] If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0009] In some embodiments of the present application, the performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes:
[0010] Determine, according to the first data packet, a first memory space required for the execution of the second data packet;
[0011] Acquire the second memory space currently remaining in the terminal device;
[0012] comparing the sizes of the first memory space and the second memory space;
[0013] If the first memory space is larger than the second memory space, the legitimacy check of the firmware upgrade process fails.
[0014] In some embodiments of the present application, the performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes:
[0015] Determine a target firmware version corresponding to the second data packet according to the first data packet;
[0016] Obtaining a current firmware version of the target firmware in the terminal device;
[0017] Determining whether the target firmware version is compatible with the current firmware version;
[0018] If the target firmware version is incompatible with the current firmware version, the legitimacy check of the firmware upgrade process fails.
[0019] In some embodiments of the present application, the first error information includes the error cause of the firmware upgrade process.
[0020] In some embodiments of the present application, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0021] If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes:
[0022] In response to a second data address from the first server, acquiring a third data packet according to the second data address;
[0023] Performing the legitimacy check on the firmware upgrade process of the terminal device according to the third data packet;
[0024] If the legitimacy check of the firmware upgrade process is successful, a fourth data packet is obtained according to the second data address; wherein the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version, and the third memory space required for the fourth data packet to run is smaller than the first memory space required for the second data packet to run.
[0025] In some embodiments of the present application, the error causes of the firmware upgrade process include: the firmware version of the target firmware is incompatible;
[0026] If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes:
[0027] In response to a third data address from the first server, acquiring a fifth data packet according to the third data address;
[0028] Performing the legitimacy check on the firmware upgrade process of the terminal device according to the fifth data packet;
[0029] If the legitimacy check of the firmware upgrade process is successful, a sixth data packet is obtained according to the third data address; wherein the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, and the transitional firmware version is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0030] In some embodiments of the present application, the method further includes:
[0031] Sending connection indication information to the first server at a first frequency; wherein the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal;
[0032] In response to the first data address from the first server, the connection indication information is sent to the first server at a second frequency; wherein the second frequency is greater than the first frequency.
[0033] On the other hand, an embodiment of the present application provides a firmware upgrade method, applied to a first server, the method comprising:
[0034] Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0035] Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0036] In some embodiments of the present application, the first error information includes the error cause of the firmware upgrade process.
[0037] In some embodiments of the present application, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0038] After receiving the first error information from the terminal device, the method further includes:
[0039] A second data address is sent to the terminal device; wherein the second data address is used to obtain a third data packet and a fourth data packet, the third data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version; a third memory space required for the fourth data packet to run is smaller than a first memory space required for the second data packet to run.
[0040] In some embodiments of the present application, the error causes of the firmware upgrade process include: the firmware version of the target firmware is incompatible;
[0041] After receiving the first error information from the terminal device, the method further includes:
[0042] A third data address is sent to the terminal device; wherein the third data address is used to obtain a fifth data packet and a sixth data packet, the fifth data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, which is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0043] On the other hand, an embodiment of the present application provides a firmware upgrade device, the device comprising:
[0044] A first acquisition module, configured to respond to a first data address from a first server and acquire a first data packet according to the first data address;
[0045] A legitimacy verification module, used to perform a legitimacy verification on the firmware upgrade process of the terminal device according to the first data packet;
[0046] A first sending module, configured to send a first error message to the first server if the legitimacy check of the firmware upgrade process fails; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0047] The second acquisition module is used to acquire a second data packet according to the first data address if the legitimacy check of the firmware upgrade process is successful; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0048] On the other hand, an embodiment of the present application provides a firmware upgrade device, the device comprising:
[0049] A second sending module, configured to send a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to perform a legitimacy check on a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0050] The second receiving module is used to receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0051] On the other hand, an embodiment of the present application provides a terminal device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor performs the following steps:
[0052] In response to a first data address from a first server, obtaining a first data packet according to the first data address;
[0053] Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet;
[0054] If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0055] If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0056] On the other hand, an embodiment of the present application provides a first server, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor performs the following steps:
[0057] Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0058] Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0059] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of any one of the firmware upgrade methods provided in the embodiments of the present application.
[0060] The firmware upgrade method provided in the embodiment of the present application first performs a validity check on the firmware upgrade process before executing the firmware upgrade. If the validity check is successful, the data packet required for the firmware upgrade is downloaded, and the target firmware in the terminal device is upgraded based on the data packet. By performing a validity check on the firmware upgrade process before the firmware upgrade, the embodiment of the present application can timely discover errors that may occur in the firmware upgrade process, so as to solve the errors in time, improve the success rate and reliability of the firmware upgrade, and avoid adverse effects on the device operation of the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0062] Figure 1 It is a schematic diagram of the architecture of a firmware upgrade system provided in an embodiment of the present application;
[0063] Figure 2 It is a flowchart of a firmware upgrade method provided in an embodiment of the present application;
[0064] Figure 3 It is a flowchart of another firmware upgrade method provided in an embodiment of the present application;
[0065] Figure 4 is a schematic diagram of a firmware upgrade management mechanism provided by an embodiment of the present application;
[0066] Figure 5 It is a structural schematic diagram of a firmware upgrade device provided in an embodiment of the present application;
[0067] Figure 6 It is a structural schematic diagram of another firmware upgrade device provided in an embodiment of the present application;
[0068] Figure 7 It is a structural diagram of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0070] In the following description, specific embodiments of the present invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise specified. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and computer execution referred to herein includes operations by a computer processing unit of electronic signals representing data in a structured form. This operation converts the data or maintains it at a location in the memory system of the computer, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the above text, which does not represent a limitation, and those skilled in the art will understand that the various steps and operations described below can also be implemented in hardware.
[0071] The term "module" or "unit" used herein can be regarded as a software object executed on the computing system. The different components, modules, engines and services described herein can be regarded as implementation objects on the computing system. The apparatus and method described herein are preferably implemented in software, but can also be implemented in hardware, all within the scope of protection of the present invention.
[0072] Those skilled in the art will appreciate that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when an element is "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0073] Please refer to Figure 1 , which shows a schematic diagram of the architecture of a firmware upgrade system provided by an embodiment of the present application. The firmware upgrade system may include: a terminal device 10 and a first server 20.
[0074] The terminal device 10 may be any type of smart device, which may be a mobile terminal or a relatively fixed terminal. For example, the terminal device 10 may be a mobile phone, a computer, a game console, an e-reader, a wearable device, a smart home device, a vehicle, an Internet of Things device, etc.
[0075] The first server 20 communicates and interacts with the terminal device 10 to implement the firmware upgrade of the terminal device 10. For example, the first server 20 can provide the terminal device 10 with a data packet required for the firmware upgrade, or provide the address of the data packet required for the firmware upgrade. For another example, the first server 20 can retry or resume the firmware upgrade process of the terminal device 10 according to an error that occurs during the firmware upgrade process of the terminal device 10.
[0076] Alternatively, if Figure 1 As shown, the firmware upgrade system may further include a second server 30. The second server 30 communicates and interacts with the first server 20 to provide background management for the firmware upgrade of the terminal device 10. For example, the second server 30 may display the progress and status of the firmware upgrade, initiate the firmware upgrade, upload the data packets required for the firmware upgrade, and the like.
[0077] like Figure 1 As shown, the first server 20 and the second server 30 can both be components of the developer center console. The firmware developer can upload the data packets required for the firmware upgrade, view the progress and status of the firmware upgrade, etc. through the second server 30, and can also manage the transmission method of the data packets required for the firmware upgrade through the first server 20.
[0078] In one example, the firmware upgrade method provided in the embodiment of the present application is implemented through OTA (Over-the-Air) technology, and the terminal device 10 and the first server 20 communicate based on the MQTT (Message Queuing Telemetry Transport) protocol; based on this, the first server 20 can be implemented as an MQTT Broker (MQTT proxy server), and the second server 30 can be implemented as an OTA server. Of course, the devices in the firmware upgrade system can also communicate based on other communication protocols, such as HTTP (HyperText Transfer Protocol), LwM2M (Lightweight M2M, Lightweight M2M (Machine-to-Machine, Device to Device)) protocol, etc., and the embodiment of the present application does not limit this.
[0079] Please refer to Figure 2, which shows a flowchart of a firmware upgrade method provided by an embodiment of the present application. The firmware upgrade method can be applied to Figure 1 In the firmware upgrade system shown in FIG. 1 , for example, the firmware upgrade method may be performed by Figure 1 The terminal device and the first server in the firmware upgrade system shown in the figure interact with each other. Figure 2 As shown, the firmware upgrade method includes the following steps (steps 110 to 150):
[0080] Step 110: The first server sends a first data address to the terminal device;
[0081] Step 120: The terminal device obtains a first data packet according to the first data address;
[0082] Step 130: The terminal device performs a legitimacy check on the firmware upgrade process of the terminal device according to the first data packet;
[0083] Step 140: If the legitimacy check of the firmware upgrade process fails, the terminal device sends a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0084] Step 150: If the legitimacy check of the firmware upgrade process is successful, the terminal device obtains a second data packet according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to the target firmware version.
[0085] The terminal device includes a target firmware, which may be any firmware in the terminal device or a specific firmware preset in the terminal device. The firmware upgrade process of the target firmware may be initiated by the terminal device, or by the first server, or by the above Figure 1 The embodiment of the present application does not limit this. For example, in the case where the firmware upgrade process is initiated by the terminal device, before step 110, the terminal device can send a firmware upgrade request to the first server, and then the first server executes step 110 in response to the firmware upgrade request. For another example, in the case where the firmware upgrade process is initiated by the first server, the first server can execute step 110 when there is an update to the data packet of the target firmware, or the first server can execute step 110 every preset time (such as every half a month). For another example, in the case where the firmware upgrade process is initiated by the second server, before step 110, the second server can send the data packet required for the firmware upgrade to the first server, and the first server executes step 110 in response to receiving the data packet.
[0086] When the target firmware in the terminal device needs to be upgraded, the first server sends a first data address to the terminal device, and the terminal device can obtain the first data packet and the second data packet according to the first data address. Optionally, the data address can be a URL (Uniform Resource Locator). The first data packet is used to perform a legitimacy check on the firmware upgrade process of the terminal device. For example, the first data packet includes data required for the legitimacy check, such as a key, the version number of the target firmware version, etc.; the second data packet is used to upgrade the target firmware in the terminal device. For example, the second data packet can include a firmware file, a firmware upgrade tool, etc. Optionally, in order to improve the success rate and reliability of the firmware upgrade, the terminal device can first obtain the first data packet according to the first data address, and then obtain the second data packet according to the first data address when the legitimacy check of the firmware upgrade process is successful according to the first data packet.
[0087] The embodiments of the present application do not limit the specific method of the legality check of the firmware upgrade process. Optionally, the legality check includes but is not limited to integrity check and correctness check. Among them, the integrity check can be implemented by CRC (Cyclic Redundancy Check), hash check, etc.; the correctness check can be implemented by data format check, data packet sequence check, firmware version check, encryption / decryption check, etc. In the case where the legality check of the firmware upgrade process includes multiple verification methods, the verification order can be determined for the multiple verification methods, and the multiple verification methods are executed in sequence according to the verification order. If the verification fails in any verification method, the legality check fails, and the next verification method is no longer executed; if the verification is successful in all verification methods, the legality check is successful. Of course, in the case where the legality check of the firmware upgrade process includes multiple verification methods, multiple verification methods can also be verified in parallel, and the embodiments of the present application do not limit this.
[0088] If the legitimacy check of the firmware upgrade process succeeds, the terminal device continues to obtain the second data packet according to the first data address to upgrade the target firmware according to the second data packet, such as upgrading the target firmware to the target firmware version. It should be understood that the target firmware version described in the embodiment of the present application refers to the firmware version required for the firmware upgrade, which is not a specific firmware version, or it can be said that the version number of the target firmware version is not a specific version number, and different firmware upgrade processes or different stages of the firmware upgrade process may upgrade the target firmware to different firmware versions.
[0089] If the legitimacy check of the firmware upgrade process fails, the terminal device may send a first error message to the first server to indicate that an error occurred in the firmware upgrade process. The first server may retry or resume the firmware upgrade process in response to the first error message. Optionally, the first error message includes the cause of the error in the firmware upgrade process, and the first server may adopt targeted solutions to retry or resume the firmware upgrade process according to the cause of the error, so as to further improve the success rate and reliability of the firmware upgrade.
[0090] In summary, the firmware upgrade method provided in the embodiment of the present application first performs a validity check on the firmware upgrade process before executing the firmware upgrade. If the validity check is successful, the data packet required for the firmware upgrade is downloaded, and the target firmware in the terminal device is upgraded based on the data packet. By performing a validity check on the firmware upgrade process before the firmware upgrade, the embodiment of the present application can promptly discover errors that may occur during the firmware upgrade process, so as to solve the errors in a timely manner, improve the success rate and reliability of the firmware upgrade, and avoid adverse effects on the device operation of the terminal device.
[0091] Taking the validity check of the firmware upgrade process including the memory space check as an example, in one example, the above step 130 includes the following steps (steps 1311 to 1313):
[0092] Step 1311: The terminal device determines a first memory space required for the second data packet to run according to the first data packet;
[0093] Step 1312: The terminal device obtains the second memory space currently remaining in the terminal device;
[0094] Step 1313: The terminal device compares the sizes of the first memory space and the second memory space; if the first memory space is larger than the second memory space, the legitimacy check of the firmware upgrade process fails.
[0095] In an embodiment of the present application, the size of the memory space required for the operation of the second data packet (the first memory space) can be recorded in the first data packet, and the terminal device can parse the first data packet to obtain the first memory space required for the operation of the second data packet. In addition, the terminal device can obtain the size of its currently remaining memory space (the second memory space). Then, the terminal device compares the first memory space and the second memory space to determine whether the terminal device currently has enough memory space to run the target firmware version of the target firmware.
[0096] If the first memory space is larger than the second memory space, the terminal device currently does not have enough memory space to run the target firmware version of the target firmware, which may cause the firmware upgrade to fail or affect the device operation of the terminal device. Therefore, the legitimacy check of the firmware upgrade process fails. If the first memory space is equal to the second memory space, for considerations such as the stability of device operation, it can be considered that the terminal device does not have enough memory space, and the legitimacy check of the firmware upgrade process can be considered to have failed. Of course, in actual application, if the first memory space is equal to the second memory space, it can also be considered that the terminal device has enough memory space.
[0097] If the first memory space is smaller than the second memory space, it can be considered that the terminal device has enough memory space to run the target firmware version of the target firmware. However, when the first memory space is smaller than the second memory space, it cannot be directly determined whether the legitimacy check of the firmware upgrade process is successful. In the case where the legitimacy check of the firmware upgrade process includes multiple verification methods, the terminal device also needs to combine the verification results of other verification methods to determine whether the legitimacy check of the firmware upgrade process is successful.
[0098] Taking the failure of the legitimacy check due to the first memory space being larger than the second memory space as an example, in one example, the first error information sent by the terminal device to the first server in the above step 140 includes the error cause of the firmware upgrade process, and the error cause includes: insufficient memory space of the terminal device; after the above step 140, the following steps (steps 1411 to 1414) are also included:
[0099] Step 1411: The first server sends a second data address to the terminal device;
[0100] Step 1412: The terminal device obtains a third data packet according to the second data address;
[0101] Step 1413: the terminal device performs a legitimacy check on the firmware upgrade process of the terminal device according to the third data packet;
[0102] Step 1414: If the legitimacy check of the firmware upgrade process is successful, the terminal device obtains a fourth data packet according to the second data address; wherein the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version, and the third memory space required for the fourth data packet to run is smaller than the first memory space required for the second data packet to run.
[0103] In this example, when the legitimacy check fails due to insufficient memory space in the terminal device, the first server can provide a data packet with a smaller memory space required for operation to the terminal device. That is, the first server sends a second data address to the terminal device, and the second data address can be used to download a fourth data packet, and the memory space size required for the operation of the fourth data packet (the third memory space) is smaller than the memory space size required for the operation of the second data packet (the first memory space). It should be understood that the target firmware version corresponding to the fourth data packet and the target firmware version corresponding to the second data packet can be the same firmware version or different firmware versions; or it can be said that the version number of the target firmware version corresponding to the fourth data packet and the version number of the target firmware version corresponding to the second data packet can be the same or different.
[0104] Of course, in order to improve the success rate and reliability of the firmware upgrade, the second data address sent by the first server to the terminal device can also download a third data packet for legitimacy verification. The terminal device first performs a legitimacy verification on the firmware upgrade process based on the third data packet, and then downloads the fourth data packet according to the second data address if the legitimacy verification is successful. It should be understood that when the terminal device determines again that the legitimacy verification of the firmware upgrade process fails according to the third data packet, the terminal device can execute step 140 again until the legitimacy verification of the firmware upgrade process succeeds, or until the number of executions of step 140 reaches the preset maximum number of executions.
[0105] Taking the validity check of the firmware upgrade process including the firmware version check as an example, in one example, the above step 130 includes the following steps (steps 1321 to 1323):
[0106] Step 1321: The terminal device determines the target firmware version corresponding to the second data packet according to the first data packet;
[0107] Step 1322: The terminal device obtains the current firmware version of the target firmware in the terminal device;
[0108] Step 1323: The terminal device determines whether the target firmware version is compatible with the current firmware version; if the target firmware version is not compatible with the current firmware version, the legitimacy check of the firmware upgrade process fails.
[0109] In the embodiment of the present application, the firmware version (target firmware version) corresponding to the second data packet can be indicated in the first data packet. For example, the version number of the target firmware version is recorded in the first data packet, and the terminal device can obtain the target firmware version by parsing the first data packet. In addition, the terminal device can obtain the current firmware version of the target firmware in the terminal device. Then, the terminal device determines whether the target firmware version is compatible with the current firmware version to determine whether the terminal device can correctly run the target firmware version of the target firmware, etc.
[0110] If the target firmware version is incompatible with the current firmware version, installing the target firmware version may cause the firmware upgrade to fail or affect the device operation of the terminal device, so it can be determined that the legitimacy check of the firmware upgrade process has failed.
[0111] If the target firmware version is compatible with the current firmware version, it is not possible to directly determine whether the legitimacy check of the firmware upgrade process is successful. When the legitimacy check of the firmware upgrade process includes multiple verification methods, the terminal device also needs to combine the verification results of other verification methods to determine whether the legitimacy check of the firmware upgrade process is successful.
[0112] Taking the failure of the legitimacy check due to the incompatibility between the target firmware version and the current firmware version as an example, in one example, the first error information sent by the terminal device to the first server in the above step 140 includes the error cause of the firmware upgrade process, and the error cause includes: the firmware version of the target firmware is incompatible; after the above step 140, the following steps (steps 1421 to 1424) are also included:
[0113] Step 1421: The first server sends a third data address to the terminal device;
[0114] Step 1422: The terminal device obtains a fifth data packet according to the third data address;
[0115] Step 1423: the terminal device performs a legitimacy check on the firmware upgrade process of the terminal device according to the fifth data packet;
[0116] Step 1424: If the legitimacy check of the firmware upgrade process is successful, the terminal device obtains a sixth data packet according to the third data address; wherein the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, which is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0117] In this example, when the legitimacy check fails due to incompatible firmware versions of the target firmware (the target firmware version is incompatible with the current firmware version), the first server can provide a transitional firmware version between the target firmware version and the current firmware version to the terminal device. That is, the first server sends a third data address to the terminal device, and the third data address can be used to download a sixth data packet, and the transitional firmware version corresponding to the sixth data packet is between the target firmware version corresponding to the second data packet and the current firmware version of the target firmware. The terminal device can first upgrade the target firmware to the transitional firmware version according to the sixth data packet, and then upgrade the target firmware to the target firmware version according to the second data packet.
[0118] Of course, in order to improve the success rate and reliability of the firmware upgrade, the third data address sent by the first server to the terminal device can also download the fifth data packet for legitimacy verification. The terminal device first performs a legitimacy verification on the firmware upgrade process based on the fifth data packet, and then downloads the sixth data packet according to the third data address if the legitimacy verification is successful. It should be understood that when the terminal device determines again that the legitimacy verification of the firmware upgrade process fails according to the fifth data packet, the terminal device can execute step 140 again until the legitimacy verification of the firmware upgrade process succeeds, or until the number of executions of step 140 reaches the preset maximum number of executions.
[0119] To sum up, the legitimacy check provided in the embodiments of the present application can be performed from multiple dimensions, such as memory space check, firmware version check, data format check, encryption / decryption check, data integrity check, etc., which helps to perform a richer and more complete check on the firmware upgrade process, and further improve the success rate and reliability of the firmware upgrade.
[0120] In one example, the firmware upgrade method further includes the following steps (steps 010 to 020):
[0121] Step 010: The terminal device sends connection indication information to the first server at a first frequency; wherein the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal;
[0122] Step 020: The terminal device sends connection indication information to the first server at a second frequency in response to the first data address from the first server; wherein the second frequency is greater than the first frequency.
[0123] In the embodiment of the present application, a heartbeat mechanism can be executed between the terminal device and the first server to timely detect abnormal communication between the terminal device and the first server. Based on this, the terminal device can send connection indication information to the first server at a certain frequency, and the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal. If the first server does not receive the connection indication information within the expected time, it can be considered that the communication connection between the terminal device and the first server is abnormal. At this time, the first server can execute an alarm mechanism, such as sending an alarm information by email, text message, etc.
[0124] During the firmware upgrade process, the stability requirements for the communication connection will be higher. Based on this, during the firmware upgrade process, the terminal device can send connection indication information to the first server at a higher frequency. For example, during the normal operation time of the terminal device, the terminal device sends the connection indication information at a first frequency, that is, before the above step 120, the terminal device executes step 010, and the terminal device sends the connection indication information to the first server at the first frequency; and when the terminal device executes the firmware upgrade process, the terminal device sends the connection indication information at a second frequency, and the second frequency is greater than the first frequency. Among them, the terminal device responds to the first data address from the first server and can determine to start the firmware upgrade process, that is, the terminal device responds to the first data address from the first server and sends the connection indication information to the first server at the second frequency. Optionally, step 020 can be started at the same time as the above step 120, or before or after the above step 120, and the embodiment of the present application does not limit this. Optionally, after the firmware upgrade is completed, such as after the terminal device successfully installs the target firmware version, the first frequency can be restored to send the connection indication information.
[0125] To sum up, in the firmware upgrade method provided in the embodiment of the present application, during the firmware upgrade process, the terminal device sends connection indication information to the first server at a higher frequency to more promptly detect abnormalities in the communication connection between the terminal device and the first server, thereby avoiding firmware upgrade failures due to unstable communication connections, and further improving the success rate and reliability of the firmware upgrade.
[0126] Below, an example is used to introduce and illustrate the firmware upgrade method provided in an embodiment of the present application.
[0127] Please refer to Figure 3 , which shows a flowchart of a firmware upgrade method provided by an embodiment of the present application. The firmware upgrade method can be applied to Figure 1 In the firmware upgrade system shown in FIG. 1 , for example, the firmware upgrade method may be performed by Figure 1 The terminal device, the first server and the second server in the firmware upgrade system shown in the figure interact with each other. Figure 3 As shown, the firmware upgrade method includes the following steps (steps 101 to 119):
[0128] Step 101: The terminal device sends a communication connection request to the first server; wherein the communication connection request includes a device identification (such as ID) and authentication information of the terminal device;
[0129] Step 102: The first server performs identity authentication on the terminal device according to the communication connection request; if the identity authentication succeeds, the process starts from the following step 103; if the identity authentication fails, the first server may send authentication failure indication information to the terminal device;
[0130] Step 103: The first server sends an identity authentication token to the terminal device; wherein the identity authentication token may include data such as a key;
[0131] Step 104: The second server sends a firmware data packet of the target firmware to the first server; wherein the firmware data packet is used to upgrade the target firmware in the terminal device to the target firmware version;
[0132] Step 105: The second server sends a firmware upgrade request to the first server in response to the firmware upgrade instruction; wherein the firmware upgrade instruction may be input to the second server by a user, or generated by the second server based on a user operation;
[0133] Step 106: The first server sends the first data address to the terminal device;
[0134] Step 107: The terminal device obtains the first data packet according to the first data address;
[0135] Step 108: the terminal device performs a validity check on the firmware upgrade process of the terminal device according to the first data packet; if the validity check fails, the process starts from the following step 109; if the validity check succeeds, the process starts from the following step 111;
[0136] Step 109: If the legitimacy check of the firmware upgrade process fails, the terminal device sends a first error message to the first server; wherein the first error message includes the error cause of the firmware upgrade process;
[0137] Step 110: The first server and the terminal device retry or resume the firmware upgrade process;
[0138] Step 111: If the legitimacy check of the firmware upgrade process succeeds, the terminal device obtains the second data packet according to the first data address;
[0139] Step 112: The terminal device reports download progress information to the first server; wherein the terminal device may report download progress information of the second data packet to the first server once every preset time;
[0140] Step 113: The first server forwards the download progress information to the second server;
[0141] Step 114: the second server prompts the download progress according to the download progress information; for example, the second server may display prompt information of the download progress;
[0142] Step 115: The terminal device upgrades the target firmware to the target firmware version according to the second data packet;
[0143] Step 116: The terminal device reports the firmware upgrade progress to the first server; wherein the terminal device may report the firmware upgrade progress to the first server once every preset time;
[0144] Step 117: The terminal device reports upgrade completion information to the first server; wherein the upgrade completion information is used to indicate that the terminal device has completed the upgrade of the target firmware, and the upgrade completion information may include the current firmware version of the target firmware in the terminal device;
[0145] Step 118: The first server forwards the upgrade completion information to the second server;
[0146] Step 119: the second server prompts that the upgrade is successful according to the upgrade completion information; for example, the second server may display prompt information that the upgrade is successful.
[0147] In this example, the legitimacy check of the firmware upgrade process, the reason for the failure of the legitimacy check, and the method of retrying or resuming the firmware upgrade process may include: data integrity check, data format check, data packet sequence number check, firmware version check, encryption / decryption check, memory space check, etc., as shown below.
[0148] 1. Data integrity check:
[0149] Failure reasons: CRC check error, hash check error, checksum error, etc.
[0150] Solution: The first server can resend the data download address.
[0151] 2. Data format verification:
[0152] Failure reason: The data format does not meet the protocol requirements of the preset protocol;
[0153] Solution: First, the server checks whether the protocol format of the data packet is correct; if the protocol format of the data packet is incorrect, it modifies it and sends the data download address to the terminal device again.
[0154] 3. Data packet sequence number verification:
[0155] Failure reasons: data packet sequence numbers are discontinuous, data packets are lost;
[0156] Solution: The first server resends the lost data packets and ensures that the data packets are sent in the correct order.
[0157] 4. Firmware version verification:
[0158] Failure reason: The target firmware version is incompatible with the current firmware version of the target firmware in the terminal device;
[0159] Solution: First, the server resends a data download address of a transitional firmware version to the terminal device;
[0160] 5. Encryption / decryption verification:
[0161] Failure reason: decryption failure, key mismatch, etc.
[0162] Solution: The first server confirms whether the algorithm and key are configured correctly. If not, it resends the correct key to the terminal device.
[0163] 6. Memory space check:
[0164] Failure reason: The memory space required for the firmware upgrade is greater than the remaining memory space of the terminal device;
[0165] Solution: The first server resends a data download address of a firmware version with a smaller memory space to the terminal device, or the first server prompts the terminal device to clean up the memory space of the terminal device.
[0166] Please refer to Figure 4 In order to better realize the real-time monitoring and alarm functions of the firmware upgrade process, the embodiment of the present application also provides a firmware upgrade management mechanism. Figure 4 As shown, taking the firmware upgrade process based on OTA and MQTT protocol as an example, the firmware upgrade management mechanism can include the following parts: log monitoring, remote monitoring, heartbeat detection, version comparison, firmware verification, etc., as shown below.
[0167] Log monitoring: When the terminal device is performing an OTA upgrade, the server records key information during the firmware upgrade process, such as the upgrade time, the version number of the target firmware version, etc., and saves it in the server's system log. By monitoring the system log in real time, abnormal situations can be discovered in a timely manner, and alarm information can be sent via email or SMS.
[0168] Remote monitoring: The server builds a remote monitoring system to monitor the operating status of terminal devices in real time, including network connection status, upgrade status, etc. If any abnormal situation occurs, an alarm message will be sent immediately.
[0169] Heartbeat detection: The terminal device sends heartbeat packets to the server regularly to ensure that the connection between the terminal device and the server is normal. During the firmware upgrade process, the frequency of sending heartbeat packets can be increased to detect network connection anomalies and other problems in a timely manner.
[0170] Version comparison: When an OTA upgrade is required, the terminal device can request the server to download the data packet required for the upgrade. Before returning the data download address, the server can perform a version comparison to ensure that the firmware version that the terminal device needs to upgrade is consistent with the latest firmware version in the server. If the versions are inconsistent, an alarm message is sent.
[0171] Firmware verification: After the OTA upgrade is completed, the terminal device can perform firmware verification to ensure that the upgraded firmware is complete and correct; if the firmware verification fails, an alarm message will be sent.
[0172] in, Figure 4 The InnerAPI (Inner Application Programming Interface) is an API interface within a software system that is called by other modules.
[0173] One point that needs to be explained is that the above embodiment introduces and explains the firmware upgrade method provided in the embodiment of the present application from the perspective of the interaction between the terminal device, the first server and the second server. In practical applications, the steps performed by the terminal device in the above embodiment can be independently implemented as a firmware upgrade method on the terminal device side; the steps performed by the first server in the above embodiment can be independently implemented as a firmware upgrade method on the first server side; the steps performed by the second server in the above embodiment can be independently implemented as a firmware upgrade method on the second server side.
[0174] Exemplarily, taking the firmware upgrade method on the terminal device side as an example, the steps performed by the terminal device in the above embodiment can be implemented as the following firmware upgrade method:
[0175] In response to a first data address from a first server, obtaining a first data packet according to the first data address;
[0176] Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet;
[0177] If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0178] If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0179] In one example, performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes:
[0180] Determine, according to the first data packet, a first memory space required for the execution of the second data packet;
[0181] Acquire the second memory space currently remaining in the terminal device;
[0182] comparing the sizes of the first memory space and the second memory space;
[0183] If the first memory space is larger than the second memory space, the legitimacy check of the firmware upgrade process fails.
[0184] In one example, performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes:
[0185] Determine a target firmware version corresponding to the second data packet according to the first data packet;
[0186] Obtaining a current firmware version of the target firmware in the terminal device;
[0187] Determining whether the target firmware version is compatible with the current firmware version;
[0188] If the target firmware version is incompatible with the current firmware version, the legitimacy check of the firmware upgrade process fails.
[0189] In one example, the first error information includes an error reason of the firmware upgrade process.
[0190] In one example, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0191] If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes:
[0192] In response to a second data address from the first server, acquiring a third data packet according to the second data address;
[0193] Performing the legitimacy check on the firmware upgrade process of the terminal device according to the third data packet;
[0194] If the legitimacy check of the firmware upgrade process is successful, a fourth data packet is obtained according to the second data address; wherein the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version, and the third memory space required for the fourth data packet to run is smaller than the first memory space required for the second data packet to run.
[0195] In one example, the error causes of the firmware upgrade process include: incompatible firmware versions of the target firmware;
[0196] If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes:
[0197] In response to a third data address from the first server, acquiring a fifth data packet according to the third data address;
[0198] Performing the legitimacy check on the firmware upgrade process of the terminal device according to the fifth data packet;
[0199] If the legitimacy check of the firmware upgrade process is successful, a sixth data packet is obtained according to the third data address; wherein the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, and the transitional firmware version is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0200] In one example, the method further includes:
[0201] Sending connection indication information to the first server at a first frequency; wherein the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal;
[0202] In response to the first data address from the first server, the connection indication information is sent to the first server at a second frequency; wherein the second frequency is greater than the first frequency.
[0203] Exemplarily, taking the firmware upgrade method on the first server side as an example, the steps performed by the first server in the above embodiment can be implemented as the following firmware upgrade method:
[0204] Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0205] Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0206] In one example, the first error information includes an error reason of the firmware upgrade process.
[0207] In one example, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0208] After receiving the first error information from the terminal device, the method further includes:
[0209] A second data address is sent to the terminal device; wherein the second data address is used to obtain a third data packet and a fourth data packet, the third data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version; a third memory space required for the fourth data packet to run is smaller than a first memory space required for the second data packet to run.
[0210] In one example, the error causes of the firmware upgrade process include: incompatible firmware versions of the target firmware;
[0211] After receiving the first error information from the terminal device, the method further includes:
[0212] A third data address is sent to the terminal device; wherein the third data address is used to obtain a fifth data packet and a sixth data packet, the fifth data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, which is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0213] In order to better implement the firmware upgrade method provided in the embodiment of the present application, the embodiment of the present application also provides a firmware upgrade device based on the above firmware upgrade method. The meanings of the terms are the same as those in the above firmware upgrade method, and the specific implementation details can refer to the description in the method embodiment.
[0214] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a firmware upgrade device provided in an embodiment of the present application. The firmware upgrade device has the function of implementing the method example on the terminal device side described above. The function can be implemented by hardware or by hardware executing corresponding software. The firmware upgrade device can be the terminal device described above or can be set in the terminal device. Figure 5As shown, the firmware upgrade device 500 may include: a first acquisition module 510 , a legality verification module 520 , a first sending module 530 and a second acquisition module 540 .
[0215] A first acquisition module 510, configured to respond to a first data address from a first server and acquire a first data packet according to the first data address;
[0216] A legitimacy verification module 520, configured to perform a legitimacy verification on the firmware upgrade process of the terminal device according to the first data packet;
[0217] A first sending module 530, configured to send a first error message to the first server if the legitimacy check of the firmware upgrade process fails; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0218] The second acquisition module 540 is used to acquire a second data packet according to the first data address if the legitimacy check of the firmware upgrade process is successful; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0219] In one example, the legality verification module 520 is further used to:
[0220] Determine, according to the first data packet, a first memory space required for the execution of the second data packet;
[0221] Acquire the second memory space currently remaining in the terminal device;
[0222] comparing the sizes of the first memory space and the second memory space;
[0223] If the first memory space is larger than the second memory space, the legitimacy check of the firmware upgrade process fails.
[0224] In one example, the legality verification module 520 is further used to:
[0225] Determine a target firmware version corresponding to the second data packet according to the first data packet;
[0226] Obtaining a current firmware version of the target firmware in the terminal device;
[0227] Determining whether the target firmware version is compatible with the current firmware version;
[0228] If the target firmware version is incompatible with the current firmware version, the legitimacy check of the firmware upgrade process fails.
[0229] In one example, the first error information includes an error reason of the firmware upgrade process.
[0230] In one example, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0231] The first acquisition module 510 is further configured to: in response to a second data address from the first server, acquire a third data packet according to the second data address;
[0232] The above-mentioned legitimacy verification module 520 is further used to: perform the legitimacy verification on the firmware upgrade process of the terminal device according to the third data packet;
[0233] The above-mentioned second acquisition module 540 is also used to: if the legitimacy check of the firmware upgrade process is successful, obtain a fourth data packet according to the second data address; wherein the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version, and the third memory space required for the operation of the fourth data packet is smaller than the first memory space required for the operation of the second data packet.
[0234] In one example, the error causes of the firmware upgrade process include: incompatible firmware versions of the target firmware;
[0235] The first acquisition module 510 is further configured to: in response to a third data address from the first server, acquire a fifth data packet according to the third data address;
[0236] The above-mentioned legitimacy verification module 520 is further used to: perform the legitimacy verification on the firmware upgrade process of the terminal device according to the fifth data packet;
[0237] The above-mentioned second acquisition module 540 is also used to: if the legitimacy check of the firmware upgrade process is successful, obtain a sixth data packet according to the third data address; wherein the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, and the transitional firmware version is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0238] In one example, the first sending module 530 is further used to:
[0239] Sending connection indication information to the first server at a first frequency; wherein the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal;
[0240] In response to the first data address from the first server, the connection indication information is sent to the first server at a second frequency; wherein the second frequency is greater than the first frequency.
[0241] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of a firmware upgrade device provided in an embodiment of the present application. The firmware upgrade device has the function of implementing the method example on the first server side described above. The function can be implemented by hardware or by hardware executing corresponding software. The firmware upgrade device can be the first server described above, or it can be set in the first server. Figure 6 As shown, the firmware upgrade device 600 may include: a second sending module 610 and a second receiving module 620 .
[0242] A second sending module 610 is used to send a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to perform a legitimacy check on a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0243] The second receiving module 620 is used to receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0244] In one example, the first error information includes an error reason of the firmware upgrade process.
[0245] In one example, the error causes of the firmware upgrade process include: insufficient memory space of the terminal device;
[0246] The above-mentioned second sending module 610 is also used to: send a second data address to the terminal device; wherein the second data address is used to obtain a third data packet and a fourth data packet, the third data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version; the third memory space required for the fourth data packet to run is smaller than the first memory space required for the second data packet to run.
[0247] In one example, the error causes of the firmware upgrade process include: incompatible firmware versions of the target firmware;
[0248] The above-mentioned second sending module 610 is also used to: send a third data address to the terminal device; wherein the third data address is used to obtain a fifth data packet and a sixth data packet, the fifth data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, and the transitional firmware version is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
[0249] Figure 7 It is a schematic diagram of the structure of the communication device of an embodiment of the present application. Figure 7 A dashed line in a box indicates that the unit or module is optional. Figure 7 The communication device 700 in the embodiment may be used to implement the method described in the above method embodiment. The communication device 700 may be a chip, a terminal device or a first server.
[0250] The communication device 700 may include one or more processors 710. The processor 710 may support the communication device 700 to implement the method described in the foregoing method embodiment. The processor 710 may be a general-purpose processor or a special-purpose processor. For example, the processor may be a central processing unit (CPU). Alternatively, the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0251] The communication device 700 may further include one or more memories 720. Computer programs are stored in the memories 720. The memories 720 may be independent of the processor 710 or may be integrated in the processor 710.
[0252] The communication device 700 may further include a transceiver 730. The processor 710 may communicate with other devices or chips through the transceiver 730. For example, the processor 710 may transmit and receive data with other devices or chips through the transceiver 730.
[0253] The computer program in the memory 720 can be executed by the processor 710, so that the processor 710 performs the following steps:
[0254] In response to a first data address from a first server, obtaining a first data packet according to the first data address;
[0255] Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet;
[0256] If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0257] If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0258] Alternatively, the computer program in the memory 720 may be executed by the processor 710, so that the processor 710 performs the following steps:
[0259] Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0260] Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0261] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0262] To this end, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program is loaded by a processor to execute the steps in any one of the firmware upgrade methods provided in the embodiments of the present application.
[0263] For example, the computer program may be loaded by a processor and may execute the following steps:
[0264] In response to a first data address from a first server, obtaining a first data packet according to the first data address;
[0265] Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet;
[0266] If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process;
[0267] If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
[0268] For another example, the computer program may be loaded by the processor and the following steps may be executed:
[0269] Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version;
[0270] Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
[0271] The specific implementation of the above operations / steps can be found in the previous embodiments and will not be repeated here.
[0272] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0273] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the firmware upgrade methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the firmware upgrade methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0274] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the terminal device or the first server reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the terminal device or the first server executes the method provided in various optional implementations in the above embodiments.
[0275] The above is a detailed introduction to a firmware upgrade method, device, equipment, server and storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A firmware upgrade method, characterized in that: Applied to a terminal device, the method comprises: In response to a first data address from a first server, obtaining a first data packet according to the first data address; Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet; If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process; If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
2. The firmware upgrade method according to claim 1, characterized in that: The performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes: Determine, according to the first data packet, a first memory space required for the execution of the second data packet; Acquire the second memory space currently remaining in the terminal device; comparing the sizes of the first memory space and the second memory space; If the first memory space is larger than the second memory space, the legitimacy check of the firmware upgrade process fails.
3. The firmware upgrade method according to claim 1, characterized in that: The performing a validity check on the firmware upgrade process of the terminal device according to the first data packet includes: Determine a target firmware version corresponding to the second data packet according to the first data packet; Obtaining a current firmware version of the target firmware in the terminal device; Determining whether the target firmware version is compatible with the current firmware version; If the target firmware version is incompatible with the current firmware version, the legitimacy check of the firmware upgrade process fails.
4. The firmware upgrade method according to claim 1, characterized in that: The first error information includes the error cause of the firmware upgrade process.
5. The firmware upgrade method according to claim 4, characterized in that: The error reasons in the firmware upgrade process include: insufficient memory space of the terminal device; If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes: In response to a second data address from the first server, acquiring a third data packet according to the second data address; Performing the legitimacy check on the firmware upgrade process of the terminal device according to the third data packet; If the legitimacy check of the firmware upgrade process is successful, a fourth data packet is obtained according to the second data address; wherein the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version, and the third memory space required for the fourth data packet to run is smaller than the first memory space required for the second data packet to run.
6. The firmware upgrade method according to claim 4, characterized in that: The error causes of the firmware upgrade process include: the firmware version of the target firmware is incompatible; If the validity check of the firmware upgrade process fails, after sending the first error information to the first server, the method further includes: In response to a third data address from the first server, acquiring a fifth data packet according to the third data address; Performing the legitimacy check on the firmware upgrade process of the terminal device according to the fifth data packet; If the legitimacy check of the firmware upgrade process is successful, a sixth data packet is obtained according to the third data address; wherein the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, and the transitional firmware version is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
7. The firmware upgrade method according to claim 1, characterized in that: The method further comprises: Sending connection indication information to the first server at a first frequency; wherein the connection indication information is used to determine whether the communication connection between the terminal device and the first server is abnormal; In response to the first data address from the first server, the connection indication information is sent to the first server at a second frequency; wherein the second frequency is greater than the first frequency.
8. A firmware upgrade method, characterized in that: Applied to a first server, the method comprises: Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version; Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
9. The firmware upgrade method according to claim 8, characterized in that: The first error information includes the error cause of the firmware upgrade process.
10. The firmware upgrade method according to claim 9, characterized in that: The error reasons in the firmware upgrade process include: insufficient memory space of the terminal device; After receiving the first error information from the terminal device, the method further includes: A second data address is sent to the terminal device; wherein the second data address is used to obtain a third data packet and a fourth data packet, the third data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the fourth data packet is used to upgrade the target firmware in the terminal device to the target firmware version; a third memory space required for the fourth data packet to run is smaller than a first memory space required for the second data packet to run.
11. The firmware upgrade method according to claim 9, characterized in that: The error causes of the firmware upgrade process include: the firmware version of the target firmware is incompatible; After receiving the first error information from the terminal device, the method further includes: A third data address is sent to the terminal device; wherein the third data address is used to obtain a fifth data packet and a sixth data packet, the fifth data packet is used to perform the legitimacy check on the firmware upgrade process of the terminal device, and the sixth data packet is used to upgrade the target firmware in the terminal device to a transitional firmware version, which is a firmware version between the target firmware version and the current firmware version of the target firmware in the terminal device.
12. A firmware upgrade device, characterized in that: The device comprises: A first acquisition module, configured to respond to a first data address from a first server and acquire a first data packet according to the first data address; A legitimacy verification module, used to perform a legitimacy verification on the firmware upgrade process of the terminal device according to the first data packet; A first sending module, configured to send a first error message to the first server if the legitimacy check of the firmware upgrade process fails; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process; The second acquisition module is used to acquire a second data packet according to the first data address if the legitimacy check of the firmware upgrade process is successful; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
13. A firmware upgrade device, characterized in that: The device comprises: A second sending module, configured to send a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to perform a legitimacy check on a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version; The second receiving module is used to receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
14. A terminal device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps: In response to a first data address from a first server, obtaining a first data packet according to the first data address; Performing a legality check on the firmware upgrade process of the terminal device according to the first data packet; If the legitimacy check of the firmware upgrade process fails, sending a first error message to the first server; wherein the first error message is used to indicate that an error occurs in the firmware upgrade process; If the legitimacy check of the firmware upgrade process is successful, a second data packet is obtained according to the first data address; wherein the second data packet is used to upgrade the target firmware in the terminal device to a target firmware version.
15. A first server, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps: Sending a first data address to a terminal device; wherein the first data address is used to obtain a first data packet and a second data packet, the first data packet is used to verify the legitimacy of a firmware upgrade process of the terminal device, and the second data packet is used to upgrade a target firmware in the terminal device to a target firmware version; Receive first error information from the terminal device; wherein the first error information is used to indicate that an error occurs during the firmware upgrade process.
16. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the firmware upgrade method described in any one of claims 1 to 7, or to execute the steps in the firmware upgrade method described in any one of claims 8 to 11.
Citation Information
Cited By
Controller firmware updating method, electronic equipment and storage medium
CN121411801A
Method for updating controller firmware, electronic device, and storage medium
CN121411801B