Remote upgrading method, server, device end and system of device
By generating basic and differential packets, upgrade packages are sent to the device in a targeted manner, which solves the upgrade failure problem caused by MCU version inconsistency and improves the upgrade efficiency of smart devices.
Patent Information
- Application Number
- CN202511607086.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-05
AI Technical Summary
When multiple smart devices are upgraded simultaneously, inconsistent MCU versions may lead to firmware version incompatibility due to inconsistent MCU versions, resulting in upgrade failure and reduced upgrade efficiency.
By obtaining the current firmware version information and target version information from the device, a base packet and a differential packet are generated. The differential packet is then sent to the corresponding device for upgrade, improving upgrade efficiency.
It enables efficient device upgrades, avoids upgrade failures due to version incompatibility, and improves upgrade efficiency.
Smart Images

Figure CN121050755B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of firmware upgrade technology, and in particular to a remote upgrade method, server, device, and system for a device. Background Technology
[0002] Currently, smart devices typically have multiple built-in microcontroller units (MCUs). These MCUs work together to achieve various functions of the smart device. When the smart device's functions are iterated, the upgrade firmware is transmitted to the smart device via Over-The-Air (OTA) technology, and then the firmware of the multiple MCUs is updated to optimize the device's functions.
[0003] When multiple identical smart devices are upgraded simultaneously, the same upgrade package is sent to multiple smart devices via broadcast upgrade mode. However, since the MCU versions of different smart devices may be different, sending a uniform upgrade package may cause firmware version incompatibility, leading to upgrade failure and reducing upgrade efficiency. Summary of the Invention
[0004] To address the aforementioned technical issues, embodiments of this application provide a remote upgrade method, server, device, and system for a device, capable of sending differential packets in a targeted manner to perform upgrades based on these packets, thereby improving the upgrade efficiency of the device.
[0005] To address the aforementioned technical problems, the embodiments of this application provide the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a method for remotely upgrading a device, applied to a server, wherein the server is connected to multiple device terminals, and the method includes:
[0007] Obtain the current firmware version and target firmware version information from multiple devices;
[0008] A base package is generated based on the current and target firmware version information from multiple devices.
[0009] Based on the base package and the current version information, a differential package is generated, in which each device corresponds to one differential package.
[0010] The base packet is sent to all devices, and the differential packet is sent to the corresponding devices so that the devices can upgrade based on the base packet and the differential packet.
[0011] In some embodiments, the current version information corresponds to the first version file, and the target version information corresponds to the target version file;
[0012] Based on the current firmware version information and target version information from multiple devices, a base package is generated, including:
[0013] Determine the longest common subsequence in the first version file and the target version file corresponding to each device;
[0014] Based on the longest common subsequence and a preset instruction stream, a patch file is generated for each device.
[0015] A base package is generated based on the patch file corresponding to each device.
[0016] In some embodiments, a patch file is generated based on the longest common subsequence and a preset instruction stream, and a patch file is generated for each device, including:
[0017] Based on the longest common subsequence and the preset instruction stream, the common segments between the first version file and the target version file, and the different segments between the first version file and the target version file are determined;
[0018] Based on the same fragments, different fragments, the current version information of the device, and the target version information, a patch file corresponding to each device is generated. The patch file includes the same fragments between the first version file and the target version file, and the different fragments between the first version file and the target version file.
[0019] In some embodiments, the difference fragments include new fragments, and a base package is generated based on the patch file corresponding to each device, including:
[0020] New fragments are extracted from the patch file corresponding to each device to generate a base package, which includes the new fragments from the patch file corresponding to each device.
[0021] In some embodiments, a differential package is generated based on the base package and the current version information, including:
[0022] Based on the base package, the first version file, and the quaternary instruction stream, a quaternary instruction set is generated to obtain a differential package, which includes the quaternary instruction set.
[0023] In some embodiments, the quaternary instruction stream includes:
[0024] The first instruction is used to instruct that the same content be read from the first version file as that in the target version file;
[0025] The second instruction is used to indicate whether to skip newly added segments in the base package that are unrelated to the first version file;
[0026] The third instruction is used to instruct the reading of new fragments from the corresponding patch file on the device side from the base package;
[0027] The fourth instruction is used to instruct that certain bytes of content in the first version file be skipped.
[0028] In some embodiments, a base packet is sent to all devices, and a differential packet is sent to the corresponding devices so that the devices can upgrade based on the base packet and the differential packet, including:
[0029] The base package is broadcast to multiple devices, and the differential package is sent to the corresponding devices via targeted transmission. This allows the devices to obtain the same content from the first version file as the target version file based on the differential package, and to obtain the new fragments from the base package for upgrading.
[0030] Secondly, embodiments of this application provide a remote upgrade method for a device, applied to a device connected to a server, the method comprising:
[0031] Send an upgrade request to the server to obtain the base package and differential package of the target version firmware file on the device. The base package includes the changes, and the differential package includes a quaternion instruction set.
[0032] Based on the quaternion instruction set, the same content as the target version file is obtained from the current version file of the firmware on the device, and the changed content is obtained from the base package, so as to upgrade the current version of the firmware on the device to the target version.
[0033] Thirdly, embodiments of this application provide a server, including:
[0034] At least one first processor; and,
[0035] A first memory communicatively connected to at least one first processor; wherein,
[0036] The first memory stores instructions that can be executed by at least one first processor, the instructions being executed by at least one first processor to enable at least one first processor to perform the method as described in the first aspect.
[0037] Fourthly, embodiments of this application provide a device, including:
[0038] At least one second processor; and,
[0039] A second memory communicatively connected to at least one second processor; wherein,
[0040] The second memory stores instructions that can be executed by at least one second processor to enable the at least one second processor to perform the method as described in the second aspect.
[0041] Fifthly, embodiments of this application provide a remote upgrade system for a device, comprising:
[0042] Such as a third-party server;
[0043] Multiple devices, such as the fourth one, communicate with the server.
[0044] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a remote upgrade method for a device. This method obtains the initial version information and target version information of the firmware on the device, generates a base package based on the initial version information and target version information, obtains the current version information of the firmware of multiple devices, and generates a differential package based on the current version information and target version information. Each device corresponds to one differential package. The base package is sent to all devices, and the differential package is sent to the corresponding device. This enables the device to upgrade based on the base package and the differential package, and allows for targeted sending of the differential package to upgrade based on the differential package, thereby improving the upgrade efficiency of the device. Attached Figure Description
[0045] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0046] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;
[0047] Figure 2 This is a flowchart illustrating a remote upgrade method for a device provided in an embodiment of this application;
[0048] Figure 3 yes Figure 2 A detailed flowchart of step S202 in the process;
[0049] Figure 4 This is an example schematic diagram of a file corresponding to the firmware on the device side provided in an embodiment of this application;
[0050] Figure 5 yes Figure 3 A detailed flowchart of step S2022 in the process;
[0051] Figure 6 This is a schematic diagram illustrating a connection example between a server and a device, provided in an embodiment of this application.
[0052] Figure 7 This is an example schematic diagram of a file corresponding to the firmware on the device side provided in an embodiment of this application;
[0053] Figure 8 This is an example schematic diagram of a file corresponding to the firmware on the device side provided in an embodiment of this application;
[0054] Figure 9 yes Figure 2 A detailed flowchart of step S203 in the process;
[0055] Figure 10 yes Figure 2 A detailed flowchart of step S204 in the process;
[0056] Figure 11 This is an example schematic diagram of a broadcast transmission base packet provided in an embodiment of this application;
[0057] Figure 12 This is an example schematic diagram of a targeted transmission of differential packets provided in an embodiment of this application;
[0058] Figure 13 This is a flowchart illustrating a remote upgrade method for a device provided in an embodiment of this application;
[0059] Figure 14 This is a schematic diagram of the structure of a remote upgrade system for a device provided in an embodiment of this application;
[0060] Figure 15 This is a schematic diagram of the structure of a server provided in an embodiment of this application;
[0061] Figure 16 This is a schematic diagram of the device side structure provided in an embodiment of this application.
[0062] Explanation of icon numbers:
[0063] Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0065] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. In addition, the terms "first" and "second" used in this application do not limit the data, but only distinguish the same or similar items with basically the same function and effect.
[0066] Before introducing the embodiments of this application, a brief introduction will be given to the remote upgrade method of the device known to the inventor of this application, so as to facilitate the understanding of the embodiments of this application later.
[0067] Currently, smart devices typically have multiple built-in MCUs. When multiple smart devices exist, and these devices include multiple MCUs of the same type, the firmware to be upgraded is usually sent to all devices via broadcast upgrade to upgrade the firmware on the devices, or the firmware is upgraded via differential upgrade.
[0068] However, when upgrading via broadcast, the entire upgrade file needs to be sent to the smart device each time to overwrite the old version file. This requires updating all the content, increasing time and storage costs. When upgrading via differential, if the MCU versions in multiple smart devices are inconsistent, sending a unified upgrade package may cause compatibility conflicts if some MCU versions do not require certain changes in the upgrade package, leading to upgrade failure or device malfunction, thus reducing upgrade efficiency.
[0069] To address the aforementioned issues, this application provides a remote device upgrade method. This method involves obtaining the current firmware version and target version information of the device, generating a base package based on these information, and generating a differential package for each device based on the base package and the current version information. The base package is then sent to all devices, while the differential packages are sent to the corresponding devices to perform upgrades on multiple devices. The ability to send differential packages in a targeted manner improves the upgrade efficiency of the device.
[0070] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0071] Example 1
[0072] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application.
[0073] like Figure 1 As shown, the application environment 100 includes: a server 10 and multiple device terminals 20. The server 10 communicates with the multiple device terminals 20 through a wireless network or a wired network. The wireless network includes 2G, 3G, 4G, 5G, wireless LAN, Bluetooth and other wireless networks, and the wired network includes serial cables, network cables and other wired networks.
[0074] In this embodiment, server 10 is used to manage the upgrade packages required by device 20. When device 20 needs to upgrade its firmware, it sends an upgrade request to server 10 to obtain the upgrade package and upgrades the firmware in device based on the upgrade package.
[0075] In this embodiment, server 10 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Device 20 includes energy storage power supplies, smartwatches, smartphones, automobiles, and smart home appliances (such as air conditioners).
[0076] Example 2
[0077] Please see Figure 2 , Figure 2 This is a flowchart illustrating a remote upgrade method for a device provided in an embodiment of this application.
[0078] The remote upgrade method of the device is applied to the server. Specifically, the execution subject of the remote upgrade method of the device is one or at least two first processors of the server.
[0079] The server communicates with multiple devices.
[0080] like Figure 2 As shown, the remote upgrade method for this device includes:
[0081] Step S201: Obtain the current version information and target version information of the firmware from multiple devices.
[0082] In this embodiment, the device includes multiple microcontroller units (MCUs), each corresponding to a firmware. The firmware is the underlying software burned into the device's memory, responsible for directly driving and controlling hardware actions and implementing the device's basic functions. For example, the basic functions of the energy storage power supply include battery charging and discharging management, precise control of output voltage / current, LCD screen information display, and communication protection with the BMS (Battery Management System), all of which are guaranteed and executed by the underlying firmware.
[0083] In this embodiment of the application, when the device needs to upgrade the firmware corresponding to multiple MCUs, it sends an upgrade request to the server. The upgrade request includes the current version information of the multiple firmwares on the device, and the current version information includes the firmware version number.
[0084] In this embodiment of the application, the server includes a database for storing upgrade files of the firmware corresponding to the device, and storing the original files of each version of the firmware corresponding to the device.
[0085] Specifically, after receiving an upgrade request from a device, the server retrieves the latest version information for each firmware version from multiple devices. This latest version information refers to the target version information and includes the latest version number.
[0086] Step S202: Generate a base package based on the current version information and target version information of the firmware on multiple devices.
[0087] In this embodiment of the application, the current version information of the firmware on the device corresponds to the first version file, the target version information corresponds to the target version file, and the target version file is the latest version file of the firmware. The first version file is the file corresponding to the current version of the firmware on the device.
[0088] In this embodiment of the application, after obtaining the target version information, the version number of the firmware on the device is compared with the latest version number. If they are the same, the upgrade process on the device ends. If they are different, the firmware package corresponding to the target version of the firmware on the device is calculated. The firmware package includes a base package.
[0089] Specifically, if the firmware version number on the device is different from the latest version number, a comparison algorithm is used to determine the longest common subsequence between the first version file and the target version file on the device. Based on the longest common subsequence and a preset instruction stream, a base package is generated. For details on the process of generating the base package, please refer to [link to documentation]. Figure 3 .
[0090] In the embodiments of this application, the comparison algorithm includes, but is not limited to, the bsdiff algorithm and the HDiffPatch algorithm, and the longest common subsequence is the same content segment in the first version file and the target version file.
[0091] In this embodiment, the preset instruction stream includes an Add instruction (ADD), a Copy instruction (COPY), a Retain instruction (EXTRA), and a Skip instruction (JUMP). The Add instruction indicates adding bytes to the current firmware version, where the added bytes are data that does not exist in the current firmware version relative to the target firmware version. The Copy instruction indicates copying bytes from the current firmware version, where the copied bytes are the same data in the current firmware version relative to the target firmware version. The Retain instruction indicates copying bytes from the current firmware version, where the content of these bytes does not match the target version but needs to be retained. The Skip instruction indicates skipping bytes in the current firmware version, where the data that does not match the target version needs to be discarded.
[0092] Please see Figure 3 , Figure 3 yes Figure 2 A detailed flowchart of step S202 in the process.
[0093] like Figure 3 As shown, step S202 includes:
[0094] Step S2021: Determine the longest common subsequence in the first version file and the target version file corresponding to each device.
[0095] Specifically, the first version file and the target version file are compared byte by byte to determine the longest common subsequence in the first version file and the target version file on each device.
[0096] In the embodiments of this application, the first version file of the firmware of each device may be different. For example, there are three devices of the same type, namely device 1, device 2 and device 3. Each device has a firmware, and the firmware version includes 01, 02, 03, 04, 05 and 06. The firmware version of device 1 is 01, the firmware version of device 2 is 02 and the firmware version of device 3 is 05.
[0097] In the embodiments of this application, the longest common subsequence is different for different versions of firmware on the same type of device.
[0098] Please see Figure 4 , Figure 4 This is an example schematic diagram of a file corresponding to the firmware on the device side provided in an embodiment of this application.
[0099] like Figure 4 As shown, assuming the current firmware version file on the device is a binary file of version 01, and the target version file is a binary file of version 06, where X0-X47 represent the byte data stored in the binary file, each byte corresponds to an address. To determine the longest common subsequence between the first and target version files, the first and target version files are compared byte by byte, and the longest common subsequence is [X0, X1, X2]. X3, X4, X5, X6, X7, X8, X9, X11, X12, X13, X14, X15, X16, X17, X18, X19, X20, X21, X22, X23, X25, X26, X27, X28, X29, X30, X31, X32, X33, X34, X35, X40, X41, X42, X43, X44, X45, X46, X47] During the comparison process, mismatched bytes were skipped.
[0100] In this embodiment, the longest common subsequence is used to represent the same content segments in the first version file and the target version file. By identifying the longest common subsequence, the differences between the first version file and the target version file are determined. During data transmission, only the different content is transmitted, avoiding the repeated transmission of the same content and improving upgrade efficiency.
[0101] Step S2022: Generate a patch file for each device based on the longest common subsequence and the preset instruction stream.
[0102] Specifically, based on the longest common subsequence, the common content segments between the first version file and the target version file on the device are located. Based on a preset instruction stream, the bytes that need to be retained in the first version file are determined byte by byte, as are the bytes added to the target version file relative to the first version file, and the bytes that need to be skipped in the first version file, to obtain the patch file corresponding to each device. For the detailed process of generating patch files, please refer to [link to relevant documentation]. Figure 5 .
[0103] Please see Figure 5 , Figure 5 yes Figure 3 A detailed flowchart of step S2022 in the process.
[0104] like Figure 5 As shown, step S2022 includes:
[0105] Step S2221: Based on the longest common subsequence and the preset instruction stream, determine the common segments between the first version file and the target version file, and the different segments between the first version file and the target version file.
[0106] Specifically, based on the longest common subsequence, the common segments between the first version file and the target version file are identified.
[0107] Specifically, based on the new instruction in the preset instruction stream, the new segment is extracted from the target version file, and the offset and length of the new segment are determined; based on the copy instruction in the preset instruction stream, the same segment in the first version file and the target version file is extracted, and the offset and length of the same segment are determined; based on the retain instruction in the preset instruction stream, the data in the first version file that does not match the target version but needs to be retained is extracted, and the offset and length of the retained data are determined; based on the skip instruction, the bytes in the first version file that need to be skipped are determined, and the offset and length of the bytes that need to be skipped are determined.
[0108] In this embodiment of the application, the difference fragments include new fragments in the target version file relative to the first version file.
[0109] Step S2222: Based on the same fragment, different fragment, current version information of the device, and target version information, generate a patch file corresponding to each device.
[0110] Specifically, the current version information on the device side includes the current version number, and the target version information includes the target version number. Based on the same fragments, different fragments, the current version number, and the target version number, a patch file corresponding to each device side is generated.
[0111] In the embodiments of this application, the patch file includes the same segment between the first version file and the target version file, the different segment between the first version file and the target version file, the current version number, the target version number, the offset and length of the same segment, and the offset and length of the different segment.
[0112] In this embodiment of the application, the server connects to multiple devices. When multiple devices are of the same type, for example, all devices are of the same type of battery pack, and the firmware of the devices has multiple versions, the firmware versions of the same type of devices may be different, then the corresponding patch files of each device are different.
[0113] Please see Figure 6 , Figure 6 This is a schematic diagram illustrating a connection example between a server and a device provided in an embodiment of this application.
[0114] like Figure 6 As shown, the server connects to n devices, all of which are of the same type. Each device includes multiple MCUs. The versions of the MCUs of the same type may differ among different devices. For example, each device may include MCU1 and MCU2. The version of MCU1 on the first device is version 01, the version of MCU1 on the second device is version 02, and the version of MCU1 on the nth device is version 05. The latest version of MCU1 is version 06. When generating patch files, the patch file for the first device is generated based on the files of version 01 and version 06, the patch file for the second device is generated based on the files of version 02 and version 06, and the patch file for the nth device is generated based on the files of version 05 and version 06.
[0115] In this embodiment of the application, the server is connected to n devices, where n is greater than or equal to 2.
[0116] Please refer to the following: Figure 4 , Figure 7 , Figure 8 , Figure 4 , Figure 7 , Figure 8These are all example schematic diagrams of files corresponding to firmware on the device side provided in the embodiments of this application.
[0117] like Figure 4 As shown, assuming the firmware version corresponding to the device is version 01 and the latest firmware version is version 06, X0-X47 represent the byte data stored in the binary file. Each byte data corresponds to a storage address, for example, X0 corresponds to storage address 0 and X1 corresponds to storage address 1. Given the longest common subsequence between the version 06 file and the version 01 file, based on a preset instruction stream, generate the patch file corresponding to the version 01 file. Starting from byte 0, bytes 0-10 of the version 01 file and bytes 0-10 of the version 06 file... If the content of each section is the same (10 identical bytes), the corresponding instruction is COPY(0, 10). The 06 version file modifies the 11th byte of the 01 version file, so the corresponding instruction is ADD(Y10). Bytes 11-15 of the 01 version file are identical to those of the 11th-15th bytes of the 06 version file (5 identical bytes), so the corresponding instruction is COPY(11, 5). The 06 version file adds new data N1 after the 15th byte, so the corresponding instruction is ADD(N1). In version 01, bytes 16-23 are identical to bytes 17-24 in version 06, totaling 8 identical bytes. The corresponding instruction is COPY(16, 8). Version 06 modifies the content of byte 24 in version 01, so the corresponding instruction is ADD(Y24). Bytes 25-35 in version 01 are identical to bytes 26-36 in version 06, totaling 11 identical bytes. The corresponding instruction is COPY(25, 11). Version 06... This file skips bytes 36-38 of the version 01 file, with the corresponding instruction being JUMP(36, 3). Bytes 39-47 of the version 01 file are identical to bytes 37-45 of the version 06 file, totaling 9 identical bytes, so the corresponding instruction is COPY(39, 9). The version 06 file adds new data N2, N3, N4, N5, N6, N7 after byte 47 of the version 01 file, so the corresponding instruction is ADD(N2, N3, N4, N5, N6, N7).
[0118] Based on the preset instruction stream, the first version file (version 01 file), and the target version file (version 06 file), a patch file is generated. The patch file corresponding to the version 01 file is {VER(06B01),COPY(0,10),ADD(Y10),COPY(11,5),ADD(N1),COPY(16,8),ADD(Y24),COPY(25,11),JUMP(36,3),COPY(39,9),ADD(N2,N3,N4,N5,N6,N7)}.
[0119] like Figure 7 As shown, assuming the firmware version corresponding to the device is version 02 and the latest firmware version is version 06, X0-X45 represent the byte data stored in the binary file. Each byte data corresponds to a storage address, for example, X0 corresponds to storage address 0, and X1 corresponds to storage address 1. Given the longest common subsequence between the version 06 file and the version 02 file, based on a preset instruction stream, a patch file corresponding to the version 02 file is generated. Starting from byte 0, bytes 0-10 of the version 02 file have the same content as bytes 0-10 of the version 06 file, a total of 10 identical bytes. The corresponding instruction is COPY(0, 10). The version 06 file modifies the content of the 11th byte of the version 02 file, so the corresponding instruction is ADD(Y1, 10). 0), Bytes 11-24 of the 02 file are identical to those of the 06 file, totaling 14 identical bytes, so the corresponding instruction is COPY(11, 14). The 06 file modifies the content of byte 25 of the 02 file, so the corresponding instruction is ADD(Y24). Bytes 25-45 of the 01 file are identical to those of the 06 file, totaling 20 identical bytes, so the corresponding instruction is COPY(25, 20). The 06 file adds new data N2, N3, N4, N5, N6, N7 after byte 46 of the 02 file, so the corresponding instruction is ADD(N2, N3, N4, N5, N6, N7).
[0120] Based on the preset instruction stream, the first version file (version 02 file), and the target version file (version 06 file), a patch file is generated. The patch file corresponding to the version 02 file is {VER(06B02),COPY(0,10),ADD(Y10),COPY(11,14),ADD(Y24),COPY(25,20),ADD(N2,N3,N4,N5,N6,N7)}.
[0121] like Figure 8As shown, assuming the firmware version corresponding to the device is version 05 and the latest firmware version is version 06, X0-X45 represent the byte data stored in the binary file. Each byte data corresponds to a storage address. For example, the storage address corresponding to X0 is 0 and the storage address corresponding to X1 is 1. Given the longest common subsequence between the version 06 file and the version 05 file, a patch file corresponding to the version 05 file is generated based on the preset instruction stream. Starting from the 0th byte, the contents of bytes 0-46 in the version 05 file are the same as those in the version 06 file, a total of 46 identical bytes. The corresponding instruction is COPY(0, 46). New data N2, N3, N4, N5, N6, N7 are added after the 46th byte in the version 05 file in the version 06 file. The corresponding instruction is ADD(N2, N3, N4, N5, N6, N7).
[0122] Based on the preset instruction stream, the first version file (version 05 file), and the target version file (version 06 file), a patch file is generated. The patch file corresponding to the version 05 file is {VER(06B05), COPY(0, 46), ADD(N2, N3, N4, N5, N6, N7)}.
[0123] Step S2023: Generate a base package based on the patch file corresponding to each device.
[0124] Specifically, the patch file for each device includes a difference fragment, which in turn includes a new fragment. The new fragment is extracted from the patch file for each device to generate a base package, which includes the new fragment from the patch file for each device.
[0125] For example, there are three devices of the same type, namely device 1, device 2, and device 3. The patch file for device 1 is {VER(06B01),COPY(0,10),ADD(Y10),COPY(11,5),ADD(N1),COPY(16,8),ADD(Y24),COPY(25,11),JUMP(36,3),COPY(39,9),ADD(N2,N3,N4,N5,N6,N7)}. The patch file for device 2 is {VER(06B02),COPY(0,10),ADD(N1),COPY(N2),COPY(N3),COPY(N4),N5,N6,N7)}. (Y10), COPY(11, 14), ADD(Y24), COPY(25, 20), ADD(N2, N3, N4, N5, N6, N7)}, the patch file corresponding to the third device is {VER(06B05), COPY(0, 46), ADD(N2, N3, N4, N5, N6, N7)}, the newly added fragments in the patch files of the first device, the second device, and the third device are obtained respectively, and the patch file of the base package is {ADD(Y10), ADD(N1), ADD(Y24), ADD(N2, N3, N4, N5, N6, N7)}.
[0126] In this embodiment, a preset instruction stream is defined to determine the change information of the target version file relative to the first version file based on the preset instruction stream, so as to generate a base package. This ensures that the base package only includes the change information, which reduces the size of the base package and reduces the network bandwidth consumption and storage usage during device download. Furthermore, the preset instruction stream can accurately describe the differences between the target version file and the first version file, so that the device does not need to download the complete upgrade file. It only needs to copy the existing local data and concatenate the new content according to the instructions, which improves the efficiency of building the target version file and thus improves the upgrade efficiency of the device.
[0127] Step S203: Generate a differential package based on the base package and the current version information.
[0128] In this embodiment, the base package includes change information for all versions. For some version files, when upgrading the current version of the device firmware, it is not necessary to use some change information in the base package. For example, there are two devices of the same type, namely device 1 and device 2. The firmware version of device 1 is version 01, and the firmware version of device 2 is version 05. It is necessary to upgrade the firmware of device 1 and device 2 to version 06. The patch file corresponding to the firmware of device 1 is {VER(06B01),COPY(0,10),ADD(Y10),COPY(11,5),ADD(N1),COPY(16,8),ADD(Y24),ADD(Y24),CO} The patch file for the second device is {VER(06B05), COPY(0,46), ADD(N2, N3, N4, N5, N6, N7)}, and the patch file for the base package is {ADD(Y10), ADD(N1), ADD(Y24), ADD(N2, N3, N4, N5, N6, N7)}. It can be seen that the second device does not need to use the information of ADD(Y10), ADD(N1), and ADD(Y24). Therefore, in order to avoid processing redundant information, some redundant information in the base package needs to be skipped.
[0129] Specifically, based on the quaternary instruction stream, the base packet, and the first version file corresponding to the firmware of each device, a one-to-one differential packet is generated for each device, so that each device corresponds to a one-to-one differential packet. The differential packet includes indication information, which includes information such as the source of the data and the length of the data.
[0130] In this embodiment, the quaternion instruction stream (X, Y1, Y2, Z) includes a first instruction, a second instruction, a third instruction, and a fourth instruction. X corresponds to the first instruction, Y1 corresponds to the second instruction, Y2 corresponds to the third instruction, and Z corresponds to the fourth instruction. The first instruction is used to instruct the reading of the same content as the target version file from the first version file. The second instruction is used to instruct whether to skip newly added segments in the base package that are unrelated to the first version file. The third instruction is used to instruct the reading of newly added segments in the patch file corresponding to the device side from the base package. The fourth instruction is used to instruct the skipping of some bytes in the first version file.
[0131] In this embodiment, the differential packet is used to upgrade the device's firmware to the target version.
[0132] Please see Figure 9 , Figure 9 yes Figure 2 A detailed flowchart of step S203 is shown.
[0133] like Figure 9 As shown, step S203 includes:
[0134] Step S231: Based on the base package, the first version file, and the quaternary instruction stream, generate a quaternary instruction set to obtain a differential package.
[0135] Specifically, based on the change information in the base package, the first version file, and the quaternary instruction stream, the difference information between the base package and the first version file is determined, and a quaternary instruction set is generated to obtain the differential package. The differential package includes the quaternary instruction set, which is the instruction information.
[0136] Please refer to this again. Figure 4 , Figure 7 , Figure 8 Suppose there are three devices of the same type, namely device 1, device 2, and device 3. The firmware that device 1, device 2, and device 3 need to upgrade to is the same type of firmware, and the latest version of this firmware is version 06. The current version of the firmware of device 1 is version 01, the current version of the firmware of device 2 is version 02, and the current version of the firmware of device 3 is version 05. The firmware of device 1, device 2, and device 3 needs to be upgraded to version 06. Before the upgrade, a corresponding differential packet is generated for each device. The basic packet is known to be {ADD(Y10), ADD(N1), ADD(Y24), ADD(N2, N3, N4, N5, N6, N7)}.
[0137] For example, based on the quaternion instruction stream, the base package, and the version 01 file, a differential packet is generated for the first device. The differential packet corresponding to the first device is {(10, 0, 1, 1), (5, 0, 1, 0), (8, 0, 1, 1), (11, 0, 0, 3), (9, 0, 6, 0)}, where:
[0138] The first quaternion instruction (10, 0, 1, 1) means that 10 reads data X0-X9 (a total of 10 bytes) from the 01 version file, 0 indicates that there is no data to skip in the base package, the first 1 means to get one byte from the base package, that is, to get the data corresponding to the 10th byte (i.e., to get the content of ADD(Y10)), which corresponds to the 06 version file modifying the data of the 10th byte in the 01 version file (that is, to change X10 in the original 01 version to Y10 read from the base package), and the second 1 means to skip the data corresponding to the 10th byte in the 01 version file (that is, to delete X10 and replace X10 with Y10).
[0139] The second quaternion instruction (5, 0, 1, 0) means that 5 indicates reading data X11-X15 (a total of 5 bytes) from the 01 version file, the first 0 indicates that there is no content to be skipped in the current base package, 1 indicates that one byte of data is obtained from the base package, that is, the newly added data N1 (i.e., the content of ADD(N1) is obtained), and the second 0 indicates that there is no data to be skipped at the current position.
[0140] The third quaternion instruction (8, 0, 1, 1) means that 8 indicates reading data X16-X23 (a total of 8 bytes) from the 01 version file, 0 indicates that there is no content to skip in the current base package, the first 1 indicates obtaining the data corresponding to the 24th byte from the base package (i.e., obtaining ADD(Y24)), which corresponds to the modification of the 24th byte data in the 01 version file in the 06 version file (i.e., changing X24 in the original 01 version to Y24 read from the base package), and the second 1 indicates skipping the data corresponding to the 24th byte in the 01 version file (i.e., deleting X24 and replacing X24 with Y24).
[0141] The fourth quaternion instruction (11, 0, 0, 3) means that 11 reads data X25-X35 (a total of 11 bytes) from the 01 version file, the first 0 indicates that there is no content to be skipped in the current base package, the second 0 indicates that there is no newly added or modified data at the current position, so there is no need to get data from the base package, and 3 indicates that the three bytes of data X36, X37, and X38 in the 01 version file are skipped.
[0142] The fifth quaternion instruction (9, 0, 6, 0) means that 9 indicates reading data X39-X47 (11 bytes in total) from the 01 version file, the first 0 indicates that there is no content to be skipped in the current base packet, 6 indicates that 6 bytes of content should be obtained from the base packet, i.e., obtaining ADD (N2, N3, N4, N5, N6, N7) to supplement N2, N3, N4, N5, N6, N7 after the 47th byte in the original 01 version file, and the second 0 indicates that there is no data to be skipped at the current position.
[0143] Based on the above five quaternion instructions, data is read from the 01 version file and the base package respectively to quickly build the complete 06 version file.
[0144] For example, based on the quaternion instruction stream, the base packet, and the version 02 file, a differential packet is generated for the second device. The differential packet corresponding to the second device is {(10, 0, 1, 1), (14, 1, 1, 1), (20, 0, 6, 0)}, where:
[0145] The first quaternion instruction (10, 0, 1, 1) means that 10 reads data X0-X9 (a total of 10 bytes) from the 02 version file, 0 indicates that there is no data to skip in the base package, the first 1 means to get one byte of data from the base package, that is, to get the data corresponding to the 10th byte (i.e., to get the content of ADD(Y10)), which corresponds to the 06 version file modifying the data of the 10th byte in the 02 version file (that is, to change X10 in the original 02 version file to Y10 read from the base package), and the second 1 means to skip the data corresponding to the 10th byte in the 02 version file (that is, to delete X10 and replace X10 with Y10).
[0146] The second quaternion instruction (14, 1, 1, 1) means that 14 reads data (14 bytes in total) from the 02 version file, specifically X11-X15, N1, and X16-X23. The first 1 indicates that one byte of content in the base package needs to be skipped, i.e., skipping ADD (N1) in the base package. Since ADD (N1) is not used in the 02 version file, this part of the content in the base package needs to be skipped. The second 1 indicates that one byte of content is obtained from the base package, i.e., obtaining ADD (Y24). This corresponds to the modification of the 25th byte of data in the 02 version file in the 06 version file (i.e., changing X24 in the original 02 version file to Y24 read from the base package). The third 1 indicates that the data corresponding to the 25th byte in the 02 version file is skipped, i.e., (delete X24 and replace X24 with Y24).
[0147] The third quaternion instruction (20, 0, 6, 0) means that 20 bytes of data (X25-X35, X39-X47) are read from the 02 version file. The first 0 indicates that there is no data to skip in the base package. The 6 indicates that 6 bytes of data are obtained from the base package, that is, the N2, N3, N4, N5, N6, and N7 corresponding to ADD (N2, N3, N4, N5, N6, N7) are obtained to supplement the 46th byte of data in the 02 version file. The second 0 indicates that there is no data to skip after the 46th byte in the 02 version file.
[0148] For example, based on the base package and the 05 version file, a differential packet is generated for the third device. The differential packet corresponding to the third device is {(46, 3, 6, 0)}, where:
[0149] The first quaternion instruction (46, 3, 6, 0) means that 46 indicates reading 0-45 bytes of data from the 05 version file (i.e., reading X0-X9, Y10, X11-X15, N1, X16-X23, Y24, X25-X35, X39-X47), and 3 indicates skipping three bytes of data in the base package, specifically skipping ADD(Y10), ADD(N1), and ADD(Y24) (a total of 3 bytes) in the base package. Since in the 05 version file... If ADD(Y10), ADD(N1), and ADD(Y24) are not used, then this part of the base package needs to be skipped. 6 indicates that 6 bytes of data are obtained from the base package, that is, the N2, N3, N4, N5, N6, and N7 corresponding to ADD(N2, N3, N4, N5, N6, N7) are obtained, so that these 6 bytes of data are added after the 46th byte of data in the 05 version file. 0 indicates that there is no data to be skipped after X47 in the 05 version file.
[0150] In this embodiment of the application, differential packets are generated to further compress the amount of data required for the upgrade, thereby increasing the data transmission speed and improving the efficiency of firmware upgrades.
[0151] Step S204: Send the basic packet to all devices and send the differential packet to the corresponding devices so that the devices can upgrade based on the basic packet and the differential packet.
[0152] Specifically, the basic packet is broadcast to all devices, and the differential packet is sent to the corresponding devices via targeted transmission, enabling the devices to upgrade based on the basic packet and the corresponding differential packet.
[0153] In this embodiment, the basic packet is broadcast to all devices. The server only needs to send the basic packet once, avoiding the repeated transmission of the same data and reducing the server bandwidth usage. Furthermore, by sending the packet in a targeted manner, each device only needs to receive its own version of the differential packet, so that unnecessary data in the basic packet can be skipped based on the differential packet, thus avoiding the processing of redundant data.
[0154] In this embodiment of the application, the base packet corresponds to a packet header and verification information. The packet header corresponding to the base packet includes fixed fields, target version information, base packet size, etc. The fixed fields are used to identify the type of packet. For example, if the broadcast address is 0xff, then the fixed field is 0xff 0x00. 0xff 0x00 is encapsulated in the packet header. When the base packet is sent to the device, the packet header and verification information are sent to the device together. Among them, 0x00 is used to identify that the type of the packet currently sent or received is a base packet.
[0155] In this embodiment of the application, a differential packet corresponds to a packet header and verification information. The packet header corresponding to the differential packet includes fixed fields, the size of the differential packet, etc. The fixed fields are used to identify the type of the packet and determine the identification number of the device. For example, the fixed field is 0x01 0x01. The first 0x01 is used to indicate that the current packet type is a differential packet, and the second 0x01 is the identification number of the first device. When sending a differential packet, the packet header and verification information corresponding to the differential packet are sent together to the corresponding device.
[0156] In the embodiments of this application, the verification information of both the base packet and the differential packet includes a check code. The check code is used to verify the integrity of the base packet or the differential packet to avoid errors in the base packet or the differential packet during transmission (such as partial data loss or data tampering). The check code includes, but is not limited to, Cyclic Redundancy Check (CRC), hash-based check codes (such as MD5 check code, SHA-256), etc.
[0157] In this embodiment of the application, after receiving the base packet and the differential packet, the device verifies the base packet and the differential packet respectively. If the verification is successful, it is determined that neither the base packet nor the differential packet has been lost or tampered with, and the upgrade operation continues. If the verification fails, the device sends an exception message to the server and stops the upgrade operation on the device.
[0158] In this embodiment of the application, before the server sends the base packet and the differential packet to the device, it compresses the base packet and the differential packet respectively using a compression algorithm to obtain the compressed base packet and the compressed differential packet. Then, the compressed base packet and the compressed differential packet are sent to the device respectively to improve the data transmission speed. The compression algorithm includes, but is not limited to, the BZIP2 algorithm and the LZMA2 algorithm.
[0159] Please see Figure 10 , Figure 10 yes Figure 2 A detailed flowchart of step S204 is shown.
[0160] like Figure 10 As shown, step S204 includes:
[0161] Step S241: The base packet is broadcast to multiple devices, and the differential packet is sent to the corresponding devices via a targeted sending method, so that the devices can obtain the same content as the target version file from the first version file based on the differential packet, and obtain the new fragment from the base packet to upgrade according to the new fragment.
[0162] In this embodiment of the application, after receiving the base packet and the differential packet, the device obtains the same content as the target version file from the first version file based on the differential packet, and obtains the new fragment from the base packet. The device then upgrades based on the new fragment, thereby constructing the target version file based on the indication information in the differential packet, the same content as the target version file, and the new fragment. The target version file then overwrites the first version file, thereby achieving the firmware upgrade of the device.
[0163] Please see Figure 11 , Figure 11 This is an example schematic diagram of a broadcast transmission base packet provided in an embodiment of this application.
[0164] like Figure 11 As shown, after the server generates the base package, it sends the base package to multiple devices via broadcast.
[0165] Please see Figure 12 , Figure 12 This is an example schematic diagram of a targeted transmission of differential packets provided in an embodiment of this application.
[0166] like Figure 12 As shown, after the server generates the differential packet, it sends the differential packet to the corresponding device.
[0167] In this embodiment, a combination of broadcast upgrade and differential upgrade is achieved by sending a basic packet via broadcast and sending a differential packet via a targeted method. This reduces the upgrade time of the same firmware in parallel systems, i.e., reduces the upgrade time of the same firmware in multiple identical devices, thereby improving the upgrade efficiency of the devices.
[0168] Example 3
[0169] Please see Figure 13 , Figure 13 This is a flowchart illustrating a remote upgrade method for a device provided in an embodiment of this application.
[0170] The remote upgrade method for this device is applied to the device itself. Specifically, the execution entity of the remote upgrade method is one or at least two second processors on the device side.
[0171] The device communicates with the server.
[0172] like Figure 13 As shown, the remote upgrade method for this device includes:
[0173] Step S1301: Send an upgrade request to the server to obtain the base package and differential package of the target version file of the firmware on the device.
[0174] In this embodiment of the application, the upgrade request includes the current version information of the device and the target version information. The current version information of the device includes the firmware version number of the device and the target version information includes the target version number. The upgrade request is used to instruct the current device to upgrade the current firmware version to the target version in order to obtain the corresponding base package and differential package of the device. Each version of the file corresponds to a differential package.
[0175] In this embodiment of the application, after receiving the upgrade request, the server sends the basic packet to the device via broadcast and the differential packet to the device via targeted transmission.
[0176] In this embodiment of the application, the base package includes the changes made to the current version file of each device relative to the target version file. The changes include specific modifications or additions made to the target version file compared to the first version file of the firmware on the device.
[0177] In this embodiment of the application, the current version information on the device corresponds to the first version file (i.e., the current version file), and the target version information corresponds to the target version file.
[0178] In this embodiment of the application, the differential packet includes a quaternion instruction group (X, Y1, Y2, Z), which includes a first instruction, a second instruction, a third instruction, and a fourth instruction. X corresponds to the first instruction, Y1 corresponds to the second instruction, Y2 corresponds to the third instruction, and Z corresponds to the fourth instruction. The first instruction is used to instruct the reading of the same content as the target version file from the first version file. The second instruction is used to instruct whether to skip newly added segments in the base packet that are unrelated to the first version file. The third instruction is used to instruct the reading of newly added segments in the patch file corresponding to the device side from the base packet. The fourth instruction is used to instruct the skipping of some bytes in the first version file.
[0179] Step S1302: Based on the quaternion instruction set, obtain the same content as the target version file from the current version file of the firmware on the device side, and obtain the changed content from the base package to upgrade the current version of the firmware on the device side to the target version.
[0180] Specifically, based on the quaternion instruction set, the same content as the target version file is obtained from the current version file of the firmware on the device side, and the changed content is obtained from the base package, so that the target version file overwrites the current version file, thereby upgrading the current version of the firmware on the device side to the target version.
[0181] In this embodiment, the same and different contents of the current version file and the target version file on the current device are accurately located by the quaternion instruction group, so as to improve the firmware upgrade efficiency.
[0182] Example 4
[0183] Please see Figure 14 , Figure 14 This is a schematic diagram of the structure of a remote upgrade system for a device provided in an embodiment of this application.
[0184] like Figure 14 As shown, the remote upgrade system 1400 of the device includes a server 10 and multiple device terminals 20, with the server 10 communicating with the multiple device terminals 20.
[0185] Server 10 is used to store files for all versions of firmware of device 20, and to generate firmware packages for multiple device 20. The firmware package includes a base package and a differential package. The base package includes changes, which include specific modifications or additions to the target version file relative to the current version file of the firmware on the device. The differential package includes a quaternion instruction set, which is an instruction information used to guide the device to build the target version file. The instruction information includes information such as the source of the data and the length of the data.
[0186] In this embodiment, server 10 sends upgrade notifications to multiple devices 20. After receiving the upgrade notification, each device 20 determines whether its firmware is the latest version. If the firmware is the latest version, no upgrade operation is performed. If the firmware is not the latest version, the device 20 sends its current version information to server 10. After receiving the current version information, server 10 generates a base package and a differential package based on the version file corresponding to the current version information and the latest version file. Each version file corresponds to a differential package, which is then used to upgrade the base package. The server 10 compresses the base packet and the differential packet to obtain a compressed base packet and a compressed differential packet. The server 10 broadcasts the compressed base packet to multiple devices 20 and sends the compressed differential packet to the corresponding devices 20 via targeted transmission. After receiving the compressed base packet and the compressed differential packet, the devices 20 compress the base packet and the differential packet respectively to obtain the base packet and the differential packet. Based on the base packet, the differential packet, and the current version file of the device 20, the device 20 constructs a target version file to overwrite the current version file of the device 20, thereby upgrading the firmware of the device 20.
[0187] In this embodiment of the application, by generating a base package and a differential package, it is avoided to send the complete latest version file to each device, thereby reducing the amount of data transmitted, reducing the consumption of server bandwidth, reducing the storage pressure on the device, and generating a corresponding differential package for each device, which can ensure that each device only processes the changes it needs, avoid cross-version upgrade errors, improve the reliability of batch upgrades of devices, and improve the firmware upgrade efficiency of the device.
[0188] Example 5
[0189] Please see Figure 15 , Figure 15 This is a schematic diagram of the structure of a server provided in an embodiment of this application.
[0190] like Figure 15 As shown, the server 10 includes one or more first processors 11 and a first memory 12. Wherein, Figure 15 Take a first processor 11 as an example.
[0191] The first processor 11 and the first memory 12 can be connected via a bus or other means. Figure 15 Taking the example of a connection between China and Israel via a bus.
[0192] The first processor 11 is used to execute the remote upgrade method for the device in Embodiment 2 of this application, including: obtaining initial version information and target version information of the firmware on the device side; generating a base package based on the initial version information and target version information; obtaining current version information of the firmware on multiple device sides; generating a differential package based on the current version information and target version information, wherein each device side corresponds to one differential package; sending the base package to all device sides; and sending the differential package to the corresponding device side in a targeted manner, so that the device side upgrades based on the base package and the differential package.
[0193] By obtaining the current and target firmware version information of the device, a base package is generated based on the current and target version information. Based on the base package and the current version information, a differential package is generated for each device. The base package is sent to all devices, and the differential package is sent to the corresponding device to upgrade multiple devices. The ability to send differential packages in a targeted manner and upgrade based on differential packages improves the upgrade efficiency of the device.
[0194] The first memory 12, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the remote upgrade method of the device in the embodiments of the present invention. The first processor 11 executes various functional applications and data processing of the terminal by running the non-volatile software programs, instructions, and modules stored in the first memory 12, thereby realizing the remote upgrade method of the device in the second embodiment of the above method.
[0195] The first memory 12 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the first memory 12 may optionally include memory remotely located relative to the first processor 11. Examples of the above-described networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0196] One or more modules are stored in the first memory 12. When executed by one or more first processors 11, they perform the remote upgrade method of the device in any of the above method embodiments, for example, the method described above. Figure 2 The steps shown.
[0197] Example 6
[0198] Please see Figure 16 , Figure 16 This is a schematic diagram of the device side structure provided in an embodiment of this application.
[0199] like Figure 16 As shown, the device 20 includes one or more second processors 21 and a second memory 22. Wherein, Figure 16 Take a second processor 21 as an example.
[0200] The second processor 21 and the second memory 22 can be connected via a bus or other means. Figure 16 Taking the example of a connection between China and Israel via a bus.
[0201] The second processor 21 is used to execute the remote upgrade method of the device in Embodiment 3 of this application, including: sending an upgrade request to a server to obtain a base package and a differential package of the target version file of the firmware on the device, wherein the base package includes changed content, the differential package includes a quaternion instruction set, and based on the quaternion instruction set, obtaining the same content as the target version file from the current version file of the firmware on the device, and obtaining the changed content from the base package, so as to upgrade the current version of the firmware on the device to the target version.
[0202] By using quaternion instruction sets, the same and different contents of the current version file and the target version file on the current device can be accurately located, so as to improve the firmware upgrade efficiency.
[0203] The second memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the remote upgrade method of the device in the embodiments of the present invention. The second processor 21 executes various functional applications and data processing of the terminal by running the non-volatile software programs, instructions, and modules stored in the second memory 22, thereby realizing the remote upgrade method of the device in the third embodiment of the above method.
[0204] The second memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the second memory 22 may optionally include memory remotely located relative to the second processor 21. Examples of the above-described networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0205] One or more modules are stored in the second memory 22. When executed by one or more second processors 21, they perform the remote upgrade method for the device described in the third embodiment of the above method, for example, performing the above-described method. Figure 13 The steps shown.
[0206] This application also provides a computer program product, which includes one or more lines of program code stored in a non-volatile computer-readable storage medium. The processor of the terminal reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the steps of the remote upgrade method for the device provided in the above embodiments.
[0207] Based on the above description of the embodiments, those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0208] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The non-volatile computer-readable storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0209] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for remotely upgrading equipment, characterized in that, Applied to a server, which is connected to multiple devices, the method includes: Obtain the current firmware version and target firmware version information from multiple devices; Based on the current version information and target version information of the firmware from multiple devices, a base package is generated, wherein the current version information corresponds to the first version file and the target version information corresponds to the target version file. Based on the base package and the current version information, a differential package is generated, wherein each device corresponds to one differential package. The base packet is sent to all devices, and the differential packet is sent to the corresponding devices so that the devices can upgrade based on the base packet and the differential packet. The base package is generated based on the current and target version information of the firmware from multiple devices, including: Determine the longest common subsequence in the first version file and the target version file corresponding to each of the device ends; Based on the longest common subsequence and the preset instruction stream, a patch file is generated for each device. The patch file includes the same segment between the first version file and the target version file, and the difference segment between the first version file and the target version file. The difference segment includes newly added segments. The base package is generated based on the patch file corresponding to each of the aforementioned devices; The process of generating the base package based on the patch file corresponding to each of the aforementioned devices includes: The new fragments are extracted from the patch file corresponding to each device to generate the base package, wherein the base package includes the new fragments from the patch file corresponding to each device. The step of generating a differential package based on the base package and the current version information includes: Based on the base package, the first version file, and the quaternary instruction stream, a quaternary instruction group is generated to obtain the differential package. The differential package includes the quaternary instruction group, which is instruction information used to guide the device to build the target version file.
2. The method according to claim 1, characterized in that, The step of generating a patch file for each device based on the longest common subsequence and a preset instruction stream includes: Based on the longest common subsequence and the preset instruction stream, the same segments between the first version file and the target version file, and the different segments between the first version file and the target version file are determined. Based on the identical fragments, the different fragments, the current version information of the device, and the target version information, a patch file corresponding to each device is generated.
3. The method according to claim 1, characterized in that, The quaternion instruction stream includes: The first instruction is used to instruct that the same content be read from the first version file as that in the target version file; The second instruction is used to indicate whether to skip newly added segments in the base package that are unrelated to the first version file; The third instruction is used to instruct the reading of the newly added fragment from the patch file corresponding to the device side from the base package; The fourth instruction is used to instruct that certain bytes of content in the first version file be skipped.
4. The method according to claim 3, characterized in that, The step of sending the base packet to all devices and the step of sending the differential packet to the corresponding devices so that the devices can upgrade based on the base packet and the differential packet includes: The base packet is broadcast to multiple devices, and the differential packet is sent to the corresponding devices via a targeted transmission method. This allows the devices to obtain the same content from the first version file as the target version file based on the differential packet, and to obtain the new fragment from the base packet for upgrading based on the new fragment.
5. A method for remotely upgrading a device, characterized in that, Applied to a device connected to a server, the method includes: An upgrade request is sent to the server to obtain the base package and differential package of the target version file of the firmware on the device. The base package includes the changes of the current version file of each device relative to the target version file. The differential package includes a quaternion instruction set. The current version information corresponds to the first version file, and the target version information corresponds to the target version file. Based on the quaternion instruction set, the same content as the target version file is obtained from the current version file of the firmware on the device side, and the changed content is obtained from the base package, so as to upgrade the current version of the firmware on the device side to the target version. The base package is generated based on the current version information and target version information of the firmware of multiple devices, including: determining the longest common subsequence in the first version file and the target version file corresponding to each device; generating a patch file for each device based on the longest common subsequence and a preset instruction stream; and generating the base package based on the patch file corresponding to each device. The differential package is generated based on the base package and the current version information, including: generating a quaternary instruction group based on the base package, the first version file, and the quaternary instruction stream to obtain the differential package, wherein the differential package includes the quaternary instruction group, which is indication information used to guide the device to build the target version file.
6. A server, characterized in that, include: At least one first processor; as well as, A first memory communicatively connected to the at least one first processor; wherein, The first memory stores instructions executable by the at least one first processor, which, when executed by the at least one first processor, enables the at least one first processor to perform the method as described in any one of claims 1-4.
7. A device terminal, characterized in that, include: At least one second processor; as well as, A second memory communicatively connected to the at least one second processor; wherein, The second memory stores instructions that can be executed by the at least one second processor to enable the at least one second processor to perform the method as described in claim 5.
8. A remote upgrade system for equipment, characterized in that, include: The server as described in claim 6; Multiple devices as described in claim 7 are communicatively connected to the server.
Citation Information
Patent Citations
Local area network inner container upgrading method, device and apparatus and readable medium
CN113641451A
Manufacturing method of firmware upgrading total package and firmware upgrading method
CN119292628A