A system upgrade method, device and system
By establishing a mirror backup list and upgrade task list in the recovery mode of the IoT terminal device, the differential data of the system upgrade task is backed up in real time, and the problem of difficult data integrity during the system upgrade process is solved, and a safe and reliable system upgrade is achieved, suitable for large-scale applications and low cost.
Patent Information
- Application Number
- CN202111643662.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In the prior art, IoT terminal devices cannot effectively ensure the integrity of important partition data during system upgrade, especially in the case of external interference or accidental power outage, which can easily lead to errors in equipment upgrades or system damage and inability to start.
After the device enters recovery mode, it establishes a mirror backup list and upgrade task list, and backup data of the system upgrade task is backed up in real time to the mirror backup object, and decides to retain or delete the backup data based on the backup level and execution status to ensure the integrity of the data and the stability of the system.
It ensures data integrity during system upgrade without adding partitions and hardware storage resources, and avoids device crashes or downtime. It is suitable for large-scale applications and is low-cost and suitable for deployed IoT devices.
Smart Images

Figure CN114489717B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a system upgrading method, device and system. Background Art
[0002] IoT terminal devices usually use Over-the-Air Technology (OTA) to upgrade the system firmware. In order to ensure that the device can start and run normally after the system upgrade, some necessary mechanisms will be adopted during the upgrade process to avoid data errors during the upgrade process.
[0003] The traditional OTA upgrade solution in single-partition Recovery mode uses Hash data verification to verify data integrity, that is, during the upgrade process, the data packets downloaded via OTA are independently verified by Hash to ensure the integrity of the data written to each partition. Although this method performs Hash verification when writing data and adds a rollback mechanism for some non-critical partitions, during the upgrade process related to some important partitions (such as the system partition), if an unexpected power outage or forced human interference occurs and the upgrade is launched, this will inevitably cause the device upgrade to fail and the system to be damaged and unable to start.
[0004] In order to avoid the problems existing in the above-mentioned upgrade scheme, an upgrade scheme that improves the above-mentioned scheme has also appeared in the prior art, namely, a backup and recovery scheme based on AB partitions. This scheme increases the backup capacity of the device from the hardware, opens two independent partitions, and does not interfere with each other before and after the upgrade, so that the device can be restored to the state before the upgrade in the event of any error. Although the upgrade scheme based on AB partitions can effectively ensure that the device can be rolled back to the version before the upgrade in any state, and the upgrade will not destroy the stability of the device or cause the device to crash, this scheme must rely on the improvement of hardware resources, and has relatively high requirements for the storage, memory and CPU processing performance of the device. The device storage resource requirement is at least twice that of the non-AB partition case. It is not suitable for IoT terminal devices that require large-scale applications and have high cost control requirements, especially in IoT systems that have already deployed a large number of non-AB terminal devices. It must change the hardware to carry out a systematic upgrade to support the AB scheme, and its universality in IoT systems is low.
[0005] In summary, judging from the existing system upgrade solutions, for low-end IoT terminal devices, there is no reliable OTA upgrade solution that can ensure the integrity of data written to the device during the OTA upgrade process without increasing partitions and storage resources in the absence of any external interference. Summary of the invention
[0006] In view of the above problems, the present invention is proposed to provide a system upgrading method, device and system that overcome the above problems or at least partially solve the above problems.
[0007] An embodiment of the present invention provides a system upgrade method, including:
[0008] Based on entering recovery mode, create an image backup list and upgrade task list;
[0009] Importing the system upgrade tasks included in the system upgrade package into the upgrade task list, and associating each upgrade task with the image backup object in the image backup list;
[0010] During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object.
[0011] In some optional embodiments, the establishing of the image backup list and the upgrade task list includes:
[0012] Constructing an image backup list including at least one image backup object, wherein the length of the image backup list is the number of partitions, and the size of the image backup list is determined based on differential data of partition blocks, and each image backup object includes an image backup name, a partition name, and a physical address of the image backup;
[0013] An upgrade task list including multiple upgrade tasks is constructed, wherein the upgrade task list includes a task ID, a partition name to which the task belongs, an associated image backup object, and a backup level of the task.
[0014] In some optional embodiments, associating each upgrade task with the image backup object in the image backup list includes:
[0015] Detecting idle image backup objects in the image backup list, and associating an image backup object in the image backup list with each upgrade task based on the number of idle image backup objects being not less than the number of upgrade tasks;
[0016] Since the number of idle image backup objects is less than the number of upgrade tasks, image backup objects are associated with upgrade tasks that are earlier in the execution order each time according to the execution order of the upgrade tasks, until an image backup object is associated with each upgrade task.
[0017] In some optional embodiments, the process of executing the system upgrade task further includes:
[0018] Monitor the execution of the upgrade task in real time, and determine whether to retain or delete the backup data in the corresponding image backup object according to the backup level of the task and the execution of the task; and / or
[0019] When an exception occurs, the backup data is obtained from the corresponding mirror backup object according to the currently executed task information, and the system key data is restored based on the obtained backup data.
[0020] In some optional embodiments, determining whether to retain or delete the backup data in the corresponding mirror backup object according to the backup level of the task and the execution status of the task includes:
[0021] The task-based backup level is the first level. After the upgrade task of the current partition is completed, the backup data in the corresponding image backup object is deleted;
[0022] The task-based backup level is the second level. After the currently executed upgrade task is completed, the backup data in the corresponding image backup object is deleted;
[0023] The task-based backup level is the third level. During the system upgrade process, the backup data in all mirror backup objects is retained until the system upgrade is successful, and then the backup data is deleted.
[0024] In some optional embodiments, before establishing the image backup list and the upgrade task list based on entering the recovery mode, the following steps are also included:
[0025] Get the system upgrade package;
[0026] Perform integrity check on the system upgrade package;
[0027] If the verification is successful and the device is restarted, the device enters recovery mode.
[0028] In some optional embodiments, the step of establishing an image backup list and an upgrade task list based on entering the recovery mode includes:
[0029] Based on entering the recovery mode, read the recovery flag and the pre-set flag supporting image backup upgrade;
[0030] Based on the recovery flag and the flag supporting image backup and upgrade, an image backup list and an upgrade task list are established.
[0031] In some optional embodiments, the above method further includes:
[0032] When the system is initially installed or upgraded for the first time, set the flag to support image backup upgrade.
[0033] An embodiment of the present invention provides a system upgrade device, including:
[0034] Virtual backup system VBS module, used to establish a mirror backup list based on entering recovery mode;
[0035] The data protection strategy module DPSM is used to establish an upgrade task list based on entering the recovery mode;
[0036] The execution module is used to import the system upgrade tasks included in the system upgrade package into the upgrade task list, and associate each upgrade task with the image backup object in the image backup list; during the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated image backup object.
[0037] The embodiment of the present invention also provides an Internet of Things system, including a terminal device and a server;
[0038] The terminal device is provided with the above-mentioned system upgrade device;
[0039] The server is used to push the system upgrade package to the terminal device.
[0040] An embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and when the computer executable instructions are executed by a processor, the above-mentioned system upgrade method is implemented.
[0041] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:
[0042] When the device system is upgraded, after the system upgrade package is downloaded and the device enters the recovery mode, an image backup list and an upgrade task list are established, and data of the system upgrade task is backed up during the upgrade process; when the system is upgraded through the system upgrade package, an image backup object in the image backup list is associated with each upgrade task, and in the process of executing the system upgrade task, the differential data of the system upgrade task is backed up to the associated image backup object in real time, and the differential data of the upgrade task is backed up and saved through the associated image backup object. When an abnormality occurs during the upgrade process, the critical data of the system can be restored at any time through the backed-up data to ensure the integrity of the data during the system upgrade process and avoid freezing and downtime during the system upgrade process. Through the image backup mechanism established during the upgrade process and the intelligent control strategy of the upgrade task adopted, a safe and reliable system upgrade is achieved without increasing partitions and device storage resources. It is suitable for large-scale applications and will not increase equipment costs. It can also be applied to IoT devices that have been deployed on a large scale and has strong versatility.
[0043] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0044] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0046] Figure 1 This is a flow chart of a system upgrade method in Embodiment 1 of the present invention;
[0047] Figure 2 This is a flowchart of a system upgrade with a preset upgrade flag in Embodiment 2 of the present invention;
[0048] Figure 3 This is a flowchart of a system upgrade based on mirror backup in Embodiment 2 of the present invention;
[0049] Figure 4 Schematic diagram of the structure of the system upgrade device in an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0051] In order to solve the problem that there is no reliable OTA system upgrade solution in the process of IoT terminal device system upgrade in the prior art, and the integrity of the data written to the device cannot be effectively guaranteed, the embodiment of the present invention provides a system upgrade method, which implements system upgrade based on the mirror backup mechanism and intelligent upgrade control strategy, and can achieve safe and reliable system upgrade without increasing partitions and hardware storage resources, and ensure the integrity of the upgrade data. Among them, the integrity protection of the upgrade data generally refers to the integrity of the data during the process of transmission and writing to the device, and ensuring the integrity of the upgrade data generally refers to ensuring the consistency of the data written to the device and the data on the OTA server.
[0052] Embodiment 1
[0053] Embodiment 1 of the present invention provides a system upgrade method, the process of which is as follows: Figure 1 As shown, the following steps are included:
[0054] Step S101: upon entering recovery mode, establishing an image backup list and an upgrade task list.
[0055] Before entering recovery mode, you can use OTA to download the system upgrade package and perform an integrity check on the system upgrade package. If the check passes and the device restarts, the device enters recovery mode.
[0056] In the traditional upgrade method, after the device enters the recovery mode, the system upgrade package will be decompressed to perform the corresponding upgrade operation on the system. In the method provided in this embodiment, after the device enters the recovery mode, an image backup list and an upgrade task list will be established to implement the image backup strategy and the intelligent upgrade strategy. The pre-built image backup list and upgrade task list can be initialized, or a new image backup list and upgrade task list can be built after entering the recovery mode.
[0057] The data backup and management during the upgrade process are realized through the image backup list. Specifically, an image backup list including at least one image backup object can be constructed. The length of the image backup list is the number of partitions, and its size is determined based on the differential data of the partition blocks. Each image backup object includes the image backup name, partition name and physical address of the image backup.
[0058] By managing the upgrade tasks in the upgrade task list and associating the image backup objects in the image backup list, data backup of the upgrade tasks can be achieved. Specifically, an upgrade task list including multiple upgrade tasks can be constructed, and the upgrade task list includes the task ID, the partition name to which the task belongs, the associated image backup object, and the backup level of the task.
[0059] Step S102: importing the system upgrade tasks included in the system upgrade package into the upgrade task list, and associating each upgrade task with the image backup object in the image backup list.
[0060] After initializing the upgrade task list and image backup list, unzip the system upgrade package and import the system upgrade task in the system upgrade package into the initialized upgrade task list. Then associate the image backup object in the image backup list with each upgrade task so that data can be backed up through the image backup object. When associating an upgrade task with an image backup object, select an idle image backup object for association, so that you can monitor and detect idle image backup objects in real time.
[0061] Step S103: During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object.
[0062] During the execution of the system upgrade task, the data image that needs to be modified is backed up to the corresponding image backup object. When an exception occurs, the abnormal task can be quickly locked, and the image backup data can be obtained from the corresponding image backup object according to the task information in the task list. The backed-up data is used to restore all the critical data that can be restored to ensure that the device will not freeze or shut down due to exceptions, or the upgrade will be interrupted or failed.
[0063] In the above method of this embodiment, when the device system is upgraded, after the system upgrade package is downloaded and the device enters the recovery mode, an image backup list and an upgrade task list are established. When the system is upgraded through the system upgrade package, an image backup object in the image backup list is associated with each upgrade task. During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated image backup object. When an abnormality occurs during the upgrade process, the critical data of the system can be restored at any time through the backup data to ensure the integrity of the data during the system upgrade process and avoid system freezes and downtime during the system upgrade process. Through the image backup mechanism established during the upgrade process and the intelligent control strategy for the upgrade tasks adopted, a safe and reliable system upgrade is achieved without increasing partitions or device storage resources. This is suitable for large-scale applications and does not increase equipment costs. It is also applicable to IoT devices that have been deployed on a large scale and has strong versatility.
[0064] In some optional embodiments, the above method can be considered that the system supports the image backup upgrade method, so that after obtaining the system upgrade package, the above method can be directly executed. In some optional embodiments, for some devices that originally do not support or are uncertain whether to support the above image backup upgrade solution, a flag supporting image backup upgrade can be preset in the misc partition when the system is initially installed or the system is upgraded for the first time. In the subsequent system upgrade process, the flag supporting image backup upgrade is read to determine that the system supports the image backup upgrade solution, and then the above upgrade solution is executed.
[0065] Embodiment 2
[0066] Embodiment 2 of the present invention provides a specific implementation of the above-mentioned system upgrade method, and describes it by taking the case where a flag supporting image backup upgrade is not written when the device pre-sets the system as an example. In this case, a flag supporting image backup upgrade can be written during the first system upgrade. In this case, the process of the first system upgrade and the process of subsequent system upgrades are different, and are described separately below.
[0067] like Figure 2 The figure shows the process of the first system upgrade, that is, the system upgrade process with the flag of supporting image backup upgrade preset, including the following steps:
[0068] Step S201: Start OTA and download the system upgrade package.
[0069] The system upgrade package downloaded here is a system upgrade package that supports the image backup upgrade algorithm, such as the updata.zip file.
[0070] Step S202: Perform HASH verification on the system upgrade package to check the integrity of the data package.
[0071] Step S203: Check whether the verification is passed. If so, proceed to step S204; otherwise, proceed to step S207.
[0072] Step S204: based on entering the recovery mode, the system is upgraded.
[0073] When the system is upgraded, the recovery partition information to be updated is saved to the device, and the upgrade recovery partition flag is written to the misc partition. Generally speaking, the misc partition of the device has a bootloader control block (BCB), which is mainly used to store recovery boot information.
[0074] Step S205: Check whether the upgrade is successful in recovery mode. If yes, go to step S206; otherwise, go to step S207.
[0075] Step S206: After the system upgrade is successful, the device restarts to complete the system update, and writes a flag supporting image backup upgrade into the misc partition.
[0076] The device will read the recovery partition upgrade flag in the misc partition during the startup process and complete the recovery partition upgrade. After the recovery partition upgrade is completed, the device will write the flag supporting image backup upgrade to the specified location of the misc partition. During subsequent startups, the flag can be detected to determine whether the image backup upgrade method is supported.
[0077] Optionally, after restarting the device, determine whether to upgrade the recovery partition. If so, update the recovery partition and write a flag supporting image backup upgrade to a specified location of the misc partition. Otherwise, execute step S207.
[0078] Step S207: Report an error and write the error information into a log.
[0079] The above is the process of the first upgrade for a system that does not originally support the image backup upgrade method. It is compatible with the upgrade in the traditional recovery mode and can upgrade the recovery partition of the IoT device so that the upgraded system can support the image backup upgrade method.
[0080] like Figure 3 The following is the process of subsequent system upgrade, that is, the system upgrade process based on image backup, including the following steps:
[0081] Step S301: Start OTA and download the system upgrade package.
[0082] Use OTA to download system upgrade packages, such as the image file update.zip.
[0083] Step S302: Perform integrity check on the system upgrade package.
[0084] Perform HASH verification on the system upgrade package to check the integrity of the data package. If the verification passes, execute the subsequent steps. If the verification fails, you can download it again or use other traditional processing methods to handle it.
[0085] Step S303: The device restarts and enters recovery mode.
[0086] Step S304: based on entering the recovery mode, reading the recovery flag and the pre-set flag for supporting image backup upgrade.
[0087] The recovery flag and the flag supporting image backup upgrade are read from the misc partition. If the recovery flag and the flag supporting image backup upgrade are read, it is confirmed that the device supports the image backup upgrade mode, and step S305 can be executed to enter the image backup upgrade mode.
[0088] If the flag that supports image backup upgrade is not read, it is considered that the device does not support the image backup upgrade method. In this case, the traditional method can be used for upgrade, which is not described here.
[0089] Step S305: based on the read recovery flag and the flag supporting image backup upgrade, an image backup list and an upgrade task list are established.
[0090] Referring to step S102, after obtaining the flag that supports image backup upgrade to confirm that the system supports the image backup upgrade method, load the system upgrade package, establish the image backup list and the upgrade task list. Specifically, the image backup and intelligent upgrade strategy can be implemented through the virtual backup system (VBS) module and the data protection strategy module (DPSM). At this time, the image backup list and the upgrade task list are established by initializing the VBS module and DPSM. VBS is a virtual backup subsystem based on the partition bottom layer in recovery mode, and DPSM is a module used to implement the OTA upgrade data protection strategy in recovery mode.
[0091] Initialize the VBS module, specifically initialize the mirror backup list of the VBS partition key data patch: List_pkm = new {Lpkm_n} (n < 16, Lpkm_n = mirror_size, max (mirro_size) = 1k, Lpkm_n = {name, addr}). That is, in the VBS module, a mirror backup list with a length of n partitions and a size of mirror_size will be established according to the partition table. Mirror_size is the size of the compressed difference patch of the corresponding partition block (block) calculated based on the difference algorithm. The maximum limit value can be set, such as 1k or other sizes. Each mirror backup object Lpkm_n contains the following parameters: mirror backup name (name), partition name, mirror backup physical address (can be represented by addr).
[0092] Initialize DPSM. This module is mainly responsible for policy execution. It executes relevant policies according to the added upgrade tasks. During the initialization process, it constructs an upgrade task list List_task=new{Tn}, where Tn={id, partition_name, sub_id, List_pkm_name, grade}, where n<16, id represents the ID of the upgrade task, partition_name represents the name of the partition to which the task belongs, sub_id represents the task id of the partition to which it belongs, List_pkm_name represents the image backup object in the associated VBS module, and grade represents the backup level of the task. For example, the highest level is 3, which means that backup protection is required until the upgrade is successfully started; level 2 means that the data in the corresponding image backup object in VBS can be destroyed after the current task is completed; level 1 means that the data in the corresponding image backup object in VBS can be destroyed after the upgrade task of the current partition is completed. You can set different backup levels for different partitions. For example, the highest level of partitions system, dtbo, boot, and kernel is 3, which means that backup protection is required until the upgrade is successfully started. The backup level of each partition can be configured. For example, the default initialization is 2, which means that the mirror backup data backed up in VBS can be destroyed after the current task is completed. It can also be configured to 1, which means that the mirror backup data backed up in VBS can be destroyed after the current sub_id task is completed.
[0093] Step S306: import the system upgrade tasks included in the system upgrade package into the upgrade task list, and associate each upgrade task with the image backup object in the image backup list.
[0094] Unzip the system upgrade package and import the upgrade task (task) into the upgrade task list of DPSM. It is mainly to initialize the upgrade task list List_task constructed according to the upgrade task information specified in the system upgrade package. After completing the initialization of List_task, DPSM will associate a VBS image backup object for each upgrade task and automatically retrieve free and available VBS objects.
[0095] That is to say, when associating image backup objects with upgrade tasks, you can select idle image backup objects. Specifically, detect idle image backup objects in the image backup list, and associate the image backup objects in the image backup list with each upgrade task based on the fact that the number of idle image backup objects is not less than the number of upgrade tasks; based on the fact that the number of idle image backup objects is less than the number of upgrade tasks, each time according to the execution order of the upgrade tasks, preferentially associate the image backup objects with the upgrade tasks that come earlier in the execution order, and continue to detect idle image backup objects until the image backup objects are associated with each upgrade task.
[0096] Step S307: Execute the system upgrade task.
[0097] Perform system upgrade according to the upgrade task specified in the script in the system upgrade package.
[0098] Step S308: During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object.
[0099] According to the backup grade control strategy in DPSM, when the upgrade task is executed, the data image that needs to be modified is backed up to the VBS object corresponding to the protection partition. At the same time, the execution of the upgrade task is monitored in real time. According to the backup grade control strategy, it is decided whether to remove the data image backup from the image backup object of VBS or retain it until the next block is completed or the entire device upgrade is completed. The execution of this process is an independent thread step S307 executed in parallel until the upgrade is completed.
[0100] That is to say. During the execution of the upgrade task, the key data in the upgrade process will be backed up in real time, and the backup data in the mirror backup partition can be retained or removed according to the preset backup level. Specifically, the execution of the upgrade task can be monitored in real time, and the retention or deletion of the backup data in the corresponding mirror backup object can be determined according to the backup level of the task and the execution of the task. The task-based backup level is the first level. After the upgrade task of the current partition is completed, the backup data in the corresponding mirror backup object is deleted; the task-based backup level is the second level. After the currently executed upgrade task is completed, the backup data in the corresponding mirror backup object is deleted; the task-based backup level is the third level. During the system upgrade process, the backup data in all mirror backup objects is retained until the system upgrade is successful, and then the backup data is deleted.
[0101] Step S309: Is there an abnormality during the system upgrade? If yes, execute step S310; otherwise, execute step S311.
[0102] Step S310: Acquire backup data from the corresponding mirror backup object according to the currently executed task information, and restore system key data based on the acquired backup data.
[0103] When an exception occurs during the system upgrade process, DPSM will lock the abnormal task and then restore all recoverable critical data from VBS based on the task information in the upgrade task list to ensure that the device does not crash.
[0104] Step S311: After the upgrade is completed, restart the device.
[0105] When the upgrade is complete, you can write the corresponding information in the misc partition according to the system upgrade status and the flag information in the VBS, and restart the device to complete the upgrade.
[0106] The above-mentioned method of this embodiment realizes the mirror protection of key data based on intelligent strategy during the upgrade process. The method is established on the basis of the traditional OTA system upgrade scheme under single partition recovery mode. The first upgrade is carried out through the traditional OTA upgrade method, and the recovery partition of the upgraded device is updated, and the device recovery partition upgrade processing program is updated to support the OTA system upgrade scheme provided by this scheme. After completing the first upgrade and update, the device enters the recovery mode again for upgrade, and the OTA upgrade scheme that supports the mirror backup strategy will be executed to upgrade the device system.
[0107] Based on the same inventive concept, an embodiment of the present invention further provides a system upgrade device, which can be arranged in a terminal device. The structure of the device is as follows: Figure 4 As shown, including:
[0108] A virtual backup system (VBS) module 11 is used to establish a mirror backup list after entering the recovery mode;
[0109] A data protection policy module (DPSM) 12, for establishing an upgrade task list based on entering the recovery mode;
[0110] The execution module 13 is used to import the system upgrade tasks included in the system upgrade package into the upgrade task list, and associate each upgrade task with the mirror backup object in the mirror backup list; during the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object.
[0111] Optionally, the VBS module 11 is specifically used to construct an image backup list including at least one image backup object, the length of the image backup list is the number of partitions, the size of which is determined based on the differential data of the partition blocks, and each image backup object includes an image backup name, a partition name and a physical address of the image backup;
[0112] Optionally, the DPSM 12 is specifically used to construct an upgrade task list including multiple upgrade tasks, wherein the upgrade task list includes a task ID, a partition name to which the task belongs, an associated mirror backup object, and a backup level of the task.
[0113] Optionally, the above-mentioned execution module 13 is specifically used to detect idle image backup objects in the image backup list, and based on the number of idle image backup objects being not less than the number of upgrade tasks, associate the image backup objects in the image backup list with each upgrade task; based on the number of idle image backup objects being less than the number of upgrade tasks, each time according to the execution order of the upgrade tasks, the image backup objects are associated with the upgrade tasks that are earlier in the execution order, until an image backup object is associated with each upgrade task.
[0114] Optionally, the above-mentioned execution module 13 is also used to monitor the execution status of the upgrade task in real time, and determine whether to retain or delete the backup data in the corresponding image backup object according to the backup level of the task and the execution status of the task; and / or when an abnormality occurs, obtain the backup data from the corresponding image backup object according to the currently executed task information, and restore the system key data based on the obtained backup data.
[0115] Optionally, the above-mentioned execution module 13 is specifically used for the task-based backup level of the first level. After the upgrade task of the current partition is completed, the backup data in the corresponding image backup object is deleted; the task-based backup level is the second level. After the currently executed upgrade task is completed, the backup data in the corresponding image backup object is deleted; the task-based backup level is the third level. During the system upgrade process, the backup data in all image backup objects is retained until the system upgrade is successful, and then the backup data is deleted.
[0116] Optionally, the above-mentioned system upgrade device also includes: an OTA module 14, which is also used to obtain a system upgrade package before entering the recovery mode and establishing an image backup list and an upgrade task list; perform integrity verification on the system upgrade package; based on the verification passing and the device restarting, the device enters the recovery mode.
[0117] Optionally, the above-mentioned execution module 13 is also used to read the recovery flag and the pre-set flag for supporting image backup upgrade based on entering the recovery mode; accordingly, the VBS module is specifically used to establish an image backup list based on the recovery flag and the flag for supporting image backup upgrade read by the execution module, and the DPSM module is specifically used to establish an upgrade task list based on the recovery flag and the flag for supporting image backup upgrade read by the execution module.
[0118] Optionally, the execution module 13 is further used to set a flag supporting image backup upgrade when the system is initially installed or the system is upgraded for the first time. The flag supporting image backup upgrade can be preset in the misc partition.
[0119] The embodiment of the present invention also provides an Internet of Things system, including a terminal device and a server;
[0120] The above-mentioned system upgrade device is provided in the terminal device;
[0121] Server, used to push system upgrade packages to terminal devices.
[0122] An embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and when the computer executable instructions are executed by a processor, the system upgrade method according to any one of claims 1 to 7 is implemented.
[0123] Regarding the system upgrade device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0124] The above-mentioned method and device of the embodiment of the present invention can be applied to the OTA system upgrade process of the IoT smart terminal device to realize the protection of the upgrade data integrity. The OT system A upgrade technology currently used in the IoT smart terminal usually performs hash verification after the OTA system upgrade package is downloaded to the device end and during the writing process to ensure the integrity of the data. However, this method can only make a judgment after the download is completed or before writing, and cannot ensure the integrity of the upgraded data. As a result, the current IoT smart terminal device has the probability of partial data loss or error after completing the OTA system upgrade, and even some key system data is damaged and the device cannot be started.
[0125] The above method introduces key data mirroring protection and intelligent policy synchronization solutions based on the traditional recovery single-partition OTA system upgrade. It can also be used for low-end IoT smart terminal devices that are deployed in large quantities in existing IoT systems. It only needs to be used when upgrading the currently installed system for the first time. Figure 2 The process shown in the figure can be used for subsequent upgrades. Figure 3 The upgrade process shown can effectively ensure the integrity of data during the OTA system upgrade process, and effectively resist the problem of system crashes caused by data errors during the OTA system upgrade process. When using this method to upgrade the device system, in the case of a single partition, the OTA system upgrade can be terminated at any time during the update of any partition, and key data recovery will not be damaged, so as to ensure that any errors in the device during the upgrade process can be recovered during the next startup process, so as to ensure the data integrity of the device during the OTA system upgrade process, and avoid the problem of device upgrade failure and crash caused by accidental interruption or damage to the upgrade.
[0126] This method is easy to use and introduces key data mirroring protection and intelligent policy synchronization solutions to achieve data integrity protection at extremely low hardware overhead costs, avoiding accidental interruptions or damage to the upgrade that may cause the device upgrade to fail and crash. It is also compatible with traditional OTA system upgrade solutions in single-partition recovery mode. In low-end IoT terminal systems, there is no need to modify the original OTA solution of the IoT system and it can be updated via OTA, allowing all devices to support the OTA system upgrade solution provided in this application.
[0127] The method has the characteristics of simple integration and good compatibility. It is compatible with the traditional OTA system upgrade solution in the single-partition recovery mode. It can easily support the upgrade method of the present application through the traditional OTA system upgrade method and be applied to the terminal equipment of the Internet of Things system. It can strengthen the OTA system upgrade solution of the traditional Internet of Things terminal system in a low-cost manner. It is more stable than the OTA system upgrade solution in the traditional single-partition recovery mode. It can effectively avoid problems such as data anomalies and crashes that cannot be recovered during device upgrades, improve the robustness of OTA system upgrades, have broad application prospects and deep commercial value, and can also specifically include the following beneficial effects and scenarios:
[0128] In the IoT system of low-end terminal devices, the application of this solution can effectively improve the stability of OTA device upgrades and avoid data corruption and device crashes during device upgrades.
[0129] The update cost is low and the solution can be deployed through traditional OTA system upgrade methods without changing the hardware, thereby improving the stability and reliability of OTA system upgrades of terminal devices in the entire IoT system.
[0130] The hardware configuration requirements are low, and this solution can be deployed on most low-end IoT smart terminal platforms. Compared with the AB upgrade solution, it is more cost-effective.
[0131] This method greatly improves the stability of the IoT system built on low-end smart devices during the OTA system upgrade process. By quickly deploying without changing the hardware, it enhances the reliability and stability of the OTA system upgrade of the terminal device, ensures the data integrity of the OTA system upgrade device, and avoids crashes caused by abnormal data after the upgrade.
[0132] Unless otherwise specifically stated, terms such as processing, computing, calculating, determining, displaying, etc. may refer to the actions and / or processes of one or more processing or computing systems, or similar devices, which operate and convert data represented as physical (e.g., electronic) quantities within registers or memories of a processing system into other data similarly represented as physical quantities within memories, registers, or other such information storage, transmission, or display devices of the processing system. Information and signals may be represented using any of a variety of different techniques and methods. For example, data, instructions, commands, information, signals, bits, symbols, and chips mentioned throughout the above description may be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, light fields or particles, or any combination thereof.
[0133] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.
[0134] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.
[0135] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein can all be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above around their functions. Whether such functions are implemented as hardware or software depends on specific applications and the design constraints imposed on the entire system. A skilled person can implement the described functions in an alternative manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of the present disclosure.
[0136] The steps of the method or algorithm described in conjunction with the embodiments herein may be directly embodied as hardware, a software module executed by a processor, or a combination thereof. The software module may be located in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and the storage medium may also be present in a user terminal as discrete components.
[0137] For software implementation, the techniques described in this application can be implemented with modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or outside the processor. In the latter case, it is coupled to the processor in a communication manner via various means, which are well known in the art.
[0138] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".
Claims
1. A system upgrade method, characterized in that: include: Based on entering recovery mode, create an image backup list and upgrade task list; Importing the system upgrade tasks included in the system upgrade package into the upgrade task list, and associating each upgrade task with the image backup object in the image backup list; During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object; The associating each upgrade task with the image backup object in the image backup list includes: Detecting idle image backup objects in the image backup list, and associating an image backup object in the image backup list with each upgrade task based on the number of idle image backup objects being not less than the number of upgrade tasks; Since the number of idle image backup objects is less than the number of upgrade tasks, image backup objects are associated with upgrade tasks that are earlier in the execution order each time according to the execution order of the upgrade tasks, until an image backup object is associated with each upgrade task.
2. The method according to claim 1, characterized in that The step of establishing the image backup list and the upgrade task list includes: Constructing an image backup list including at least one image backup object, wherein the length of the image backup list is the number of partitions, and the size of the image backup list is determined based on differential data of partition blocks, and each image backup object includes an image backup name, a partition name, and a physical address of the image backup; An upgrade task list including multiple upgrade tasks is constructed, wherein the upgrade task list includes a task ID, a partition name to which the task belongs, an associated image backup object, and a backup level of the task.
3. The method according to claim 1, characterized in that The process of executing the system upgrade task also includes: Monitor the execution of the upgrade task in real time, and determine whether to retain or delete the backup data in the corresponding image backup object according to the backup level of the task and the execution of the task; and / or When an exception occurs, the backup data is obtained from the corresponding mirror backup object according to the currently executed task information, and the system key data is restored based on the obtained backup data.
4. The method according to claim 3, characterized in that The step of determining whether to retain or delete the backup data in the corresponding mirror backup object according to the backup level of the task and the execution status of the task includes: The task-based backup level is the first level. After the upgrade task of the current partition is completed, the backup data in the corresponding image backup object is deleted; The task-based backup level is the second level. After the currently executed upgrade task is completed, the backup data in the corresponding image backup object is deleted; The task-based backup level is the third level. During the system upgrade process, the backup data in all image backup objects is retained until the system upgrade is successful, and then the backup data is deleted.
5. The method according to any one of claims 1 to 4, characterized in that: Before entering the recovery mode and creating the image backup list and upgrade task list, the following steps are also required: Get the system upgrade package; Perform integrity check on the system upgrade package; If the verification is successful and the device is restarted, the device enters recovery mode; and / or The step of establishing an image backup list and an upgrade task list based on entering the recovery mode includes: Based on entering the recovery mode, read the recovery flag and the pre-set flag supporting image backup upgrade; Based on the recovery flag and the flag supporting image backup and upgrade, an image backup list and an upgrade task list are established.
6. The method according to any one of claims 1 to 4, characterized in that: Also includes: When the system is initially installed or upgraded for the first time, set the flag to support image backup upgrade.
7. A system upgrade device, characterized in that: include: Virtual backup system VBS module, used to establish a mirror backup list based on entering recovery mode; The data protection strategy module DPSM is used to establish an upgrade task list based on entering the recovery mode; An execution module, used for importing the system upgrade tasks included in the system upgrade package into the upgrade task list, and associating each upgrade task with the image backup object in the image backup list; During the execution of the system upgrade task, the differential data of the system upgrade task is backed up in real time to the associated mirror backup object; The associating each upgrade task with the image backup object in the image backup list includes: Detecting idle image backup objects in the image backup list, and associating an image backup object in the image backup list with each upgrade task based on the number of idle image backup objects being not less than the number of upgrade tasks; Since the number of idle image backup objects is less than the number of upgrade tasks, image backup objects are associated with upgrade tasks that are earlier in the execution order each time according to the execution order of the upgrade tasks, until an image backup object is associated with each upgrade task.
8. An Internet of Things system, comprising a terminal device and a server; The terminal device is provided with the system upgrade device as claimed in claim 7; The server is used to push the system upgrade package to the terminal device.
9. A computer storage medium, characterized in that The computer storage medium stores computer executable instructions, and when the computer executable instructions are executed by the processor, the system upgrade method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Firmware upgrade method and firmware upgrade device for embedded system
CN104572229A
Instance system, cloud system and upgrading or recovery method of instance system
CN106201773A