Device recovery method based on double boot partitions
By adopting dual-boot partition design and backup and recovery mechanism in smart home devices, the problem of the device being unable to perform boot upgrades and lack of fault tolerance is solved, and the stability and reliability of the device are improved during the upgrade process.
Patent Information
- Application Number
- CN202411285142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-03
AI Technical Summary
Due to hardware design limitations, smart home devices cannot perform boot partition backup, resulting in failure of boot upgrades and lack of fault tolerance mechanisms, which may cause the device to be unable to use normally.
Adopt dual-boot partition design, set up first-level boot and second-level boot to realize backup and recovery mechanisms. Through strategies such as multi-threading, asynchronous calls, event-driven model and boot sequence optimization, ensure that the device can automatically switch to the backup partition during the upgrade process. run.
It improves the stability and reliability of the equipment during the upgrade process, ensures that the equipment can operate normally even under abnormal conditions, and solves the problem of difficulty in upgrading boot in the traditional upgrade mechanism.
Smart Images

Figure CN119248571A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of communication technology, and in particular relates to a device recovery method based on dual-boot partitions. Background Art
[0002] Most smart home devices in the prior art are limited by hardware design and have only a fixed boot address, which makes it impossible to back up the boot partition. This limits the device's ability to perform necessary upgrades to the boot program during software update iterations.
[0003] When attempting to perform a boot upgrade, if the device loses power or restarts during the upgrade process, the upgrade operation will fail due to the lack of a backup partition, and may cause the device to fail to work properly; the hardware design of smart home devices usually only includes one boot address, which limits the possibility of backing up the boot partition; traditional upgrade mechanisms usually only consider application upgrades, while ignoring the importance of boot upgrades, and do not provide a mechanism to handle abnormal situations during the upgrade process; during the upgrade process, if an abnormal situation such as a power outage or restart occurs, the upgrade operation will fail due to the lack of corresponding fault-tolerant mechanisms, such as backup partitions or rollback mechanisms, and may cause the device to fail to boot.
[0004] In order to solve these problems, a smart home device and an upgrade method that can support boot upgrade and have a fault-tolerant mechanism are needed to ensure that the device can safely and reliably perform boot upgrades during the software update iteration process and can recover to a normal state when an abnormality occurs. Summary of the invention
[0005] In view of this, the present invention aims to provide a device recovery method based on dual-boot partitions, in order to solve at least one of the above-mentioned technical problems.
[0006] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0007] In a first aspect, the present invention proposes a device recovery method based on dual-boot partitions, comprising the following steps:
[0008] Set up primary boot and secondary boot inside the device;
[0009] When the device is powered on, the primary boot performs the hardware initialization process and checks the integrity of the primary secondary boot;
[0010] After the detection is completed, the software initialization and application layer startup operations are performed, and the device enters the normal working state;
[0011] When the primary secondary boot is updated, back up the primary secondary boot content to the backup partition;
[0012] If the update is successful, the backup partition will be updated synchronously; if there is a problem with the update, the primary boot will automatically switch to the backup partition, and the device will continue to start from the backup secondary boot partition.
[0013] Furthermore, during the execution of the hardware initialization process, the initialization process is optimized according to a fast boot strategy; wherein the fast boot strategy includes parallel processing, preloading of common modules, self-check optimization, storage access optimization, and boot sequence optimization.
[0014] Furthermore, the specific process of the parallel processing includes:
[0015] Use multi-threading and process technology to initialize multiple hardware components at the same time;
[0016] For initialization tasks that do not depend on the results of previous executions, asynchronous calls are used, and the initialization boot process executes the remaining initialization tasks synchronously;
[0017] Using an event-driven programming model, when an initialization task is completed, the execution of subsequent tasks is automatically triggered, eliminating the linear waiting process of each task.
[0018] Furthermore, the specific process of preloading the commonly used modules includes:
[0019] Load commonly used driver and library files into memory;
[0020] Define a list of commonly used modules based on the device's usage scenarios, and perform automatic loading operations based on the list of commonly used modules during each initialization boot;
[0021] Monitor user behaviors and operations, and dynamically perform preloading operations based on the monitoring results.
[0022] Furthermore, the specific process of the self-check optimization includes:
[0023] Selectively perform self-checks based on the device's status and usage, and skip checks if the hardware component worked fine during the last boot;
[0024] During initial boot, only necessary components are quickly self-checked, and the remaining components are checked during subsequent operation; wherein the necessary components are user-defined settings.
[0025] Furthermore, the specific process of the storage access optimization includes:
[0026] During the startup process, the file that needs to be loaded next is predicted, read in advance, and loaded into the memory; wherein, in the process of reading the file and loading it into the memory, a read-write program that matches the memory type is used.
[0027] Furthermore, the specific process of the boot sequence optimization includes:
[0028] According to the last boot situation, the loading priority of each module is dynamically adjusted, and the module that was successfully started last time is loaded first; and when the device is powered on, the status of the last boot is recorded, and the corresponding module is started at the next startup.
[0029] In a second aspect, the present invention further provides an electronic device, comprising a processor and a memory communicatively connected to the processor and used to store instructions executable by the processor, wherein the processor is used to execute the method described in the first aspect above.
[0030] In a third aspect, the present invention also provides a server, comprising at least one processor, and a memory communicatively connected to the processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the processor so that the at least one processor executes the method described in the first aspect.
[0031] In a fourth aspect, the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method described in the first aspect.
[0032] Compared with the prior art, the device recovery method based on dual-boot partitions described in the present invention has the following beneficial effects:
[0033] The hierarchical design of Boot solves the problem of difficult boot upgrades in traditional smart devices, provides a more flexible and secure solution for device upgrades and maintenance, and ensures through a backup and recovery mechanism that even if an abnormality occurs during the upgrade process, the device can resume normal operation through the backup partition, greatly improving the stability and reliability of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0035] Figure 1 The present invention is a schematic diagram of a device recovery method based on dual-boot partitions according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0037] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0038] Embodiment 1:
[0039] See also Figure 1 As shown, a device recovery method based on dual boot partitions includes the following steps:
[0040] S1. Set up primary boot and secondary boot inside the device;
[0041] S2. When the device is powered on, the primary boot executes the hardware initialization process and checks the integrity of the primary secondary boot;
[0042] S3. After the detection is completed, the software initialization and application layer startup operations are performed, and the device enters the normal working state;
[0043] S4. When the primary secondary boot is updated, the primary secondary boot content is backed up to the backup partition;
[0044] S5. If the update is successful, the backup partition is updated synchronously; if there is a problem with the update, the primary boot automatically switches to the backup partition, and the device continues to start from the backup secondary boot partition.
[0045] During the execution of the hardware initialization process, the initialization process is optimized according to a fast boot strategy; wherein the fast boot strategy includes parallel processing, preloading of common modules, self-check optimization, storage access optimization, and boot sequence optimization.
[0046] The specific process of the parallel processing includes:
[0047] Use multi-threading and process technology to initialize multiple hardware components at the same time;
[0048] For initialization tasks that do not depend on the results of previous executions, asynchronous calls are used, and the initialization boot process executes the remaining initialization tasks synchronously;
[0049] Using an event-driven programming model, when an initialization task is completed, the execution of subsequent tasks is automatically triggered, eliminating the linear waiting process of each task.
[0050] The specific process of preloading common modules includes:
[0051] Load commonly used driver and library files into memory;
[0052] Define a list of commonly used modules based on the device's usage scenarios, and perform automatic loading operations based on the list of commonly used modules during each initialization boot;
[0053] Monitor user behaviors and operations, and dynamically perform preloading operations based on the monitoring results.
[0054] The specific process of the self-check optimization includes:
[0055] Selectively perform self-checks based on the device's status and usage, and skip checks if the hardware component worked fine during the last boot;
[0056] During initial boot, only necessary components are quickly self-checked, and the remaining components are checked during subsequent operation; wherein the necessary components are user-defined settings.
[0057] The specific process of storage access optimization includes:
[0058] During the startup process, the file that needs to be loaded next is predicted, read in advance, and loaded into the memory; wherein, in the process of reading the file and loading it into the memory, a read-write program that matches the memory type is used.
[0059] The specific process of the boot sequence optimization includes:
[0060] According to the last boot situation, the loading priority of each module is dynamically adjusted, and the module that was successfully started last time is loaded first; and when the device is powered on, the status of the last boot is recorded, and the corresponding module is started at the next startup.
[0061] In some embodiments, the implementation of the device recovery method based on dual boot partitions and its core points are as follows:
[0062] The traditional single boot structure is split into two levels: primary boot and secondary boot.
[0063] Level 1 boot: responsible for the basic initialization of the hardware. This part of the function is usually provided by the chip manufacturer's firmware, and we do not need to modify or pay attention to it. Level 1 boot is fixed and will not be updated. It ensures that the device can correctly initialize the hardware when it starts up and provides the necessary environment for the startup of level 2 boot.
[0064] Secondary boot: responsible for initializing software functions and starting the application layer. This includes the initialization of pure software-related functions and the task of starting the operating system; secondary boot can be updated and upgraded. It contains the software configuration and function settings required for the normal operation of the device.
[0065] Backup and recovery mechanism: In order to solve the problem that the device cannot be started due to abnormalities that may occur during the upgrade of the secondary boot, this technical solution introduces a backup and recovery mechanism.
[0066] Backup: In the storage area of the device, in addition to the primary secondary boot partition, a backup secondary boot partition is also set. When the primary secondary boot partition is updated successfully, the backup partition will also be updated at the same time to ensure that the contents of the two partitions are consistent.
[0067] Recovery: When the primary boot is starting the secondary boot, if it finds that the current primary secondary boot is damaged or cannot be started, it will start the secondary boot from the backup partition instead. In this way, even if an abnormality occurs during the upgrade process, the device can resume normal operation through the backup partition.
[0068] According to the above core ideas, an implementation method of the device recovery method based on dual boot partitions is proposed:
[0069] Hardware platform: This technical solution can be applied to various smart devices based on embedded systems, such as smart home devices, smart wearable devices, etc. These devices usually have enough storage space to support the storage of primary boot, primary secondary boot and backup secondary boot.
[0070] Software implementation: Both primary boot and secondary boot need to be implemented through programming. Primary boot can be developed using the firmware development tools provided by chip manufacturers to ensure compatibility and stability with hardware. Secondary boot can be developed using programming languages commonly used in embedded systems (such as C / C++) and customized according to specific needs.
[0071] Upgrade process: When the secondary boot needs to be upgraded, the device will first download the new secondary boot image from the server and write it to the primary secondary boot partition. During the writing process, the primary boot will monitor the entire upgrade process to ensure the integrity and correctness of the data. If the upgrade is successful, the backup partition will also be updated at the same time. If the upgrade fails, the device will keep the original secondary boot version unchanged, or start the secondary boot from the backup partition according to the specific recovery strategy.
[0072] By adopting this split boot structure and backup and recovery mechanism, the technical solution can effectively solve the problem of difficulty in boot upgrading of smart devices and improve the stability and reliability of the device.
[0073] Embodiment 2:
[0074] An electronic device comprises a processor and a memory which is communicatively connected to the processor and is used to store instructions executable by the processor, wherein the processor is used to execute the method described in the above embodiment.
[0075] Embodiment three:
[0076] A server includes at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the method described in the above embodiment.
[0077] Embodiment 4:
[0078] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the above embodiment is implemented.
[0079] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0080] In the several embodiments provided in the present application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the division of the units described above is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The above-mentioned units may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.
[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A device recovery method based on dual-boot partitions, characterized in that: The steps include: Set up primary boot and secondary boot inside the device; When the device is powered on, the primary boot performs the hardware initialization process and checks the integrity of the primary secondary boot; After the detection is completed, the software initialization and application layer startup operations are performed, and the device enters the normal working state; When the primary secondary boot is updated, back up the primary secondary boot content to the backup partition; If the update is successful, the backup partition will be updated synchronously; If there is a problem with the update, the primary boot automatically switches to the backup partition, and the device continues to boot from the backup secondary boot partition.
2. A device recovery method based on dual boot partitions according to claim 1, characterized in that: During the execution of the hardware initialization process, the initialization process is optimized according to a fast boot strategy; wherein the fast boot strategy includes parallel processing, preloading of common modules, self-check optimization, storage access optimization, and boot sequence optimization.
3. A device recovery method based on dual boot partitions according to claim 2, characterized in that: The specific process of the parallel processing includes: Use multi-threading and process technology to initialize multiple hardware components at the same time; For initialization tasks that do not depend on the results of previous executions, asynchronous calls are used, and the initialization boot process executes the remaining initialization tasks synchronously; Using an event-driven programming model, when an initialization task is completed, the execution of subsequent tasks is automatically triggered, eliminating the linear waiting process of each task.
4. A device recovery method based on dual boot partitions according to claim 2, characterized in that: The specific process of preloading common modules includes: Load commonly used driver and library files into memory; Define a list of commonly used modules based on the device's usage scenarios, and perform automatic loading operations based on the list of commonly used modules during each initialization boot; Monitor user behaviors and operations, and dynamically perform preloading operations based on the monitoring results.
5. The device recovery method based on dual boot partition according to claim 2, characterized in that: The specific process of the self-check optimization includes: Selectively perform self-checks based on the device's status and usage, and skip checks if the hardware component worked fine during the last boot; During initial boot, only necessary components are quickly self-checked, and the remaining components are checked during subsequent operation; wherein the necessary components are user-defined settings.
6. A device recovery method based on dual boot partitions according to claim 2, characterized in that: The specific process of storage access optimization includes: During the startup process, the file that needs to be loaded next is predicted, read in advance, and loaded into the memory; wherein, in the process of reading the file and loading it into the memory, a read-write program that matches the memory type is used.
7. A device recovery method based on dual boot partitions according to claim 2, characterized in that: The specific process of the boot sequence optimization includes: According to the last boot situation, the loading priority of each module is dynamically adjusted, and the module that was successfully started last time is loaded first; and when the device is powered on, the status of the last boot is recorded, and the corresponding module is started at the next startup.
8. An electronic device, comprising a processor and a memory connected to the processor for storing instructions executable by the processor, characterized in that: The processor is configured to execute the method according to any one of claims 1 to 7.
9. A server, characterized in that: The method comprises at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
