Fault-tolerant upgrading method and device based on double working partitions, equipment and medium

By introducing dual working partitions and backup partitions in electronic devices and combining status code recording partitions, the problem of poor robustness during the upgrade process of electronic devices is solved, safe startup and processing when the upgrade fails, and the equipment is improved Stability and reliability.

CN119311287APending Publication Date: 2025-01-14GUANGZHOU KINDLINK INTELLIGENT TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310874030.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-14
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

There is a problem of poor robustness during the upgrade process of existing electronic equipment, which causes the equipment to fail to start normally after the upgrade failure, affecting use.

Method used

The fault-tolerant upgrade method based on dual working partitions is adopted. By guiding the system startup partition and the second startup partition, combining the backup partition and status code to record the partition, we ensure that the failed partition can be safely started and processed when the upgrade fails, and ensure the stable operation of the device.

Benefits of technology

It effectively solves the problem of poor robustness during the electronic device upgrade process, ensures that the failed partition can be started through another working partition when the upgrade fails, ensures the upgrade security and improves the stability and reliability of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311287A_ABST
    Figure CN119311287A_ABST
Patent Text Reader

Abstract

The invention discloses a fault-tolerant upgrading method and device based on double working partitions, equipment and a medium. The invention belongs to the technical field of computers. The method is executed by the electronic equipment, and the electronic equipment comprises a boot system startup partition, a first startup partition, a second startup partition and an upgrade package storage partition. The method comprises the steps that under the condition that the first starting partition works, an upgrade package is received, and the upgrade package is stored in an upgrade package storage partition; upgrading the first startup partition based on the upgrade package, and reading an upgrade result; and if upgrading fails, restarting, and guiding the second startup partition to work through the boot system startup partition. By adopting the technical scheme, the electronic equipment can be effectively started through the double working partitions under the condition that upgrading fails after the upgrading package is downloaded, and the partitions failed in upgrading are correspondingly processed, so that the upgrading safety of the electronic equipment is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and specifically relates to a fault-tolerant upgrade method, device, equipment and medium based on dual working partitions. Background Art

[0002] With the continuous development of the Internet industry, the application demand for electronic devices has gradually increased, and various types of electronic devices have emerged one after another.

[0003] In order to make electronic devices provide better service effects, they often need to be upgraded to add functions or update existing functions to meet the user's usage needs. The existing way of updating electronic devices is often to download data packets, use the data packets to upgrade the electronic devices, and restart after the upgrade is successful to enter the updated system. However, such an update method will have many stability problems. For example, if the electronic device cannot be updated due to integrity problems, version problems, etc. after the data packet is downloaded, the electronic device will not be able to restart normally, causing startup failures and affecting the normal use of the electronic device. Therefore, how to improve the stability of the update process is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a fault-tolerant upgrade method, apparatus, device and medium based on dual working partitions, which can solve the problem of poor robustness during the upgrade process of electronic equipment. Through dual working partitions, when the upgrade fails after the upgrade package is downloaded, the electronic device can be effectively started, and the partition where the upgrade fails can be processed accordingly, thereby ensuring the upgrade safety of the electronic device.

[0005] In a first aspect, an embodiment of the present application provides a fault-tolerant upgrade method based on dual working partitions, the method being executed by an electronic device, the electronic device comprising: a boot system boot partition, a first boot partition, a second boot partition, and an upgrade package storage partition; the method comprising:

[0006] When the first boot partition is working, receiving an upgrade package, and storing the upgrade package in the upgrade package storage partition;

[0007] Upgrading the first boot partition based on the upgrade package, and reading the upgrade result;

[0008] If the upgrade fails, restart and boot the second boot partition through the boot system boot partition.

[0009] Furthermore, the electronic device further comprises: a backup partition; the backup partition is used to store the initial system image;

[0010] Correspondingly, after the second boot partition is booted to work by the boot system boot partition, the method further includes:

[0011] The initial system of the first boot partition is restored by using the initial system image stored in the backup partition.

[0012] Furthermore, the electronic device further comprises: a status code recording partition;

[0013] Before reading the upgrade result, the method further includes:

[0014] The upgrade package is verified to obtain status code data, and the status code data is stored in the status code record partition.

[0015] Further, verifying the upgrade package to obtain status code data, and storing the status code data in the status code record partition, includes:

[0016] Performing an integrity check on the upgrade package, if the check passes, generating a first status code and storing it in the status code record partition; if the check fails, generating a second status code and storing it in the status code record partition;

[0017] Performing an adaptability check on the upgrade package, if the check passes, generating a third status code and storing it in the status code record partition; if the check fails, generating a fourth status code and storing it in the status code record partition;

[0018] Performing a startup partition space check on the electronic device based on the upgrade package, generating a fifth status code if the check passes, and storing it in the status code record partition; if the check fails, generating a sixth status code, and storing it in the status code record partition;

[0019] Identify the upgrade type of the upgrade package. If it is the first type, generate a seventh status code and store it in the status code record partition; if it is the second type, generate an eighth status code and store it in the status code record partition.

[0020] Further, upgrading the first boot partition based on the upgrade package and reading the upgrade result includes:

[0021] Read the status code recorded in the status code record partition;

[0022] If it is the first status code, the second status code, the third status code, the fourth status code, the fifth status code or the sixth status code, the upgrade result is determined to be an upgrade failure;

[0023] If it is the seventh status code, erasing the boot sub-partition and the data sub-partition of the first boot partition, rewriting the boot sub-partition and the data sub-partition respectively based on the upgrade package, and determining that the upgrade result is successful;

[0024] If it is the eighth status code, the data sub-partition of the first boot partition is overwritten based on the upgrade package.

[0025] Furthermore, the electronic device further comprises: a status code recording partition;

[0026] Receiving an upgrade package and storing the upgrade package in an upgrade package storage partition, including:

[0027] Receive an upgrade package and obtain a reception time of the upgrade package;

[0028] If the receiving time exceeds the set time threshold, it is determined that the network connection is abnormal, and a network abnormality error code is generated and written into the status code record partition.

[0029] Furthermore, after the second boot partition is booted to work by the boot system boot partition, the method further includes:

[0030] The upgrade packages stored in the upgrade package storage partition are cleared.

[0031] In a second aspect, an embodiment of the present application provides a fault-tolerant upgrade device based on dual working partitions, wherein the device is configured in an electronic device, wherein the electronic device comprises: a boot system boot partition, a first boot partition, a second boot partition, and an upgrade package storage partition; the device comprises:

[0032] An upgrade package storage module, used for receiving an upgrade package and storing the upgrade package in the upgrade package storage partition when the first boot partition is working;

[0033] An upgrade result determination module, configured to upgrade the first boot partition based on the upgrade package and read the upgrade result;

[0034] The backup startup module is used to restart if the upgrade fails, and to boot the second startup partition to work through the boot system startup partition.

[0035] Furthermore, the electronic device further comprises: a backup partition; the backup partition is used to store the initial system image;

[0036] Correspondingly, after the second boot partition is booted to work by the boot system boot partition, the method further includes:

[0037] The initial system of the first boot partition is restored by using the initial system image stored in the backup partition.

[0038] Furthermore, the electronic device further comprises: a status code recording partition;

[0039] Accordingly, the device further comprises:

[0040] The status code recording module is used to verify the upgrade package, obtain status code data, and store the status code data in the status code recording partition.

[0041] Furthermore, the status code recording module is specifically used for:

[0042] Performing an integrity check on the upgrade package, if the check passes, generating a first status code and storing it in the status code record partition; if the check fails, generating a second status code and storing it in the status code record partition;

[0043] Performing an adaptability check on the upgrade package, if the check passes, generating a third status code and storing it in the status code record partition; if the check fails, generating a fourth status code and storing it in the status code record partition;

[0044] Performing a startup partition space check on the electronic device based on the upgrade package, if the check passes, generating a fifth status code and storing it in the status code record partition; if the check fails, generating a sixth status code and storing it in the status code record partition;

[0045] Identify the upgrade type of the upgrade package. If it is the first type, generate a seventh status code and store it in the status code record partition; if it is the second type, generate an eighth status code and store it in the status code record partition.

[0046] Furthermore, the upgrade result determination module is specifically used to:

[0047] Read the status code recorded in the status code record partition;

[0048] If it is the first status code, the second status code, the third status code, the fourth status code, the fifth status code or the sixth status code, the upgrade result is determined to be an upgrade failure;

[0049] If it is the seventh status code, erasing the boot sub-partition and the data sub-partition of the first boot partition, rewriting the boot sub-partition and the data sub-partition respectively based on the upgrade package, and determining that the upgrade result is successful;

[0050] If it is the eighth status code, the data sub-partition of the first boot partition is overwritten based on the upgrade package.

[0051] Furthermore, the electronic device further comprises: a status code recording partition;

[0052] The upgrade package storage module is specifically used for:

[0053] Receive an upgrade package and obtain a reception time of the upgrade package;

[0054] If the receiving time exceeds the set time threshold, it is determined that the network connection is abnormal, and a network abnormality error code is generated and written into the status code record partition.

[0055] Furthermore, the device also includes:

[0056] The upgrade package clearing module is used to clear the upgrade packages stored in the upgrade package storage partition.

[0057] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0058] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0059] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0060] In the embodiment of the present application, when the first boot partition is working, an upgrade package is received and the upgrade package is stored in the upgrade package storage partition; the first boot partition is upgraded based on the upgrade package, and the upgrade result is read; if the upgrade fails, the system restarts, and the second boot partition is booted to work through the boot system boot partition. The above-mentioned fault-tolerant upgrade method based on dual working partitions can solve the problem of poor robustness during the upgrade of electronic equipment, because dual working partitions are provided, and in the case of a failure to upgrade after downloading the upgrade package, the electronic equipment can be started and run through another working partition, and the partition that failed to upgrade is processed accordingly to ensure the upgrade safety of the electronic equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a flowchart of a fault-tolerant upgrade method based on dual working partitions provided in an embodiment of the present application;

[0062] Figure 2 It is a flowchart of a fault-tolerant upgrade method based on dual working partitions provided in an embodiment of the present application;

[0063] Figure 3 It is a schematic diagram of the partition design of the electronic device provided in the embodiment of the present application;

[0064] Figure 4 It is a structural diagram of a fault-tolerant upgrade device based on dual working partitions provided in an embodiment of the present application;

[0065] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0067] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0068] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0069] In conjunction with the accompanying drawings, the fault-tolerant upgrade method, device, equipment and medium based on dual working partitions provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.

[0070] Figure 1 1 is a flow chart of a fault-tolerant upgrade method based on dual working partitions provided by an embodiment of the present application. The method is executed by an electronic device, and the electronic device includes: a boot system boot partition, a first boot partition, a second boot partition, and an upgrade package storage partition. Figure 1 As shown, the specific steps include:

[0071] S101, when the first boot partition is working, receiving an upgrade package, and storing the upgrade package in an upgrade package storage partition;

[0072] First, the use scenario of this solution can be a scenario where an electronic device is upgraded through an upgrade package. The electronic device can be a single-chip microcomputer, etc., and the corresponding different partitions can be different Flash partitions. In addition, the electronic device can also be other types of devices with a system on a chip, or other intelligent electronic devices.

[0073] Based on the above usage scenarios, it can be understood that the execution subject of the present application can be the electronic device itself, and no excessive limitations are made here.

[0074] The boot system startup partition included in the electronic device can be used to determine which startup partition to use during the startup of the electronic device. After the boot system startup partition is burned once, it is in a read-only state.

[0075] The first boot partition and the second boot partition may be different Flash partitions or other types of partitions, and both may include a boot sub-partition, a system sub-partition, a user program sub-partition, a data sub-partition, and the like.

[0076] Among them, the boot partition can be used to start the current working partition, the boot partition, and store uboot. Uboot is a type of bootloader, which is used to boot the kernel. Its ultimate goal is to read the kernel from the flash, put it into the memory, and start the kernel. It is initially placed on the flash, and then executed after power is turned on. It will complete hardware initialization, set the processor mode, turn off the watchdog, mask interrupts, initialize SDRAM, set the stack, set the clock, and boot the kernel from the flash to the memory. The execution process and functional effect are the same as the BIOS on the PC.

[0077] The system subpartition is used to store the kernel and file system. The kernel is the core of an operating system. The kernel is the first layer of software expansion based on hardware, providing the most basic functions of the operating system. It is the basis for the operation of the operating system. It is responsible for managing the system's processes, memory, device drivers, files, and network systems, and determines the system's performance and stability.

[0078] The user program and data subpartitions are used to store user programs, libraries, configuration parameters, etc.

[0079] The upgrade package storage partition can set a cache. In the hierarchical structure of the computer storage system, the cache is a high-speed, small-capacity memory between the central processor and the main memory. It and the main memory together form a first-level memory. The scheduling and transmission of information between the cache memory and the main memory is automatically performed by hardware.

[0080] After the above configuration settings are completed, the upgrade package can be received and stored in the upgrade package storage partition when the first boot partition is working;

[0081] It is understandable that after the electronic device is started, it can boot the system boot partition to the first boot partition by default to start working, and receive the upgrade package when it is working. The transmission method of the upgrade package here can be a method of downloading through the network, in addition, it can also be a method of wired transmission.

[0082] The startup process can include the following steps:

[0083] 1. Enter the boot system boot partition bootloader to boot;

[0084] 2. Enter the boot partition to start;

[0085] 3. Enter the system sub-partition and use the System partition to start the system;

[0086] 4. Enter the user program and data subpartition Userdata and run the user program.

[0087] It can be understood that during the receiving process or after the receiving is completed, the upgrade package can be stored in the upgrade package storage partition for use in upgrading the first boot partition.

[0088] S102, upgrading the first boot partition based on the upgrade package, and reading the upgrade result;

[0089] In one embodiment, the upgrade process may include:

[0090] The device starts upgrading;

[0091] The device receives the upgrade package through the network;

[0092] Verify the integrity of the upgrade package;

[0093] If it is incomplete, the upgrade failure message will be returned;

[0094] If complete, check whether the flash partition space is sufficient;

[0095] If the space is insufficient, the upgrade failure message will be returned;

[0096] If the space is sufficient, check whether the upgrade package contains an image;

[0097] If the image is not included, unzip the upgrade package and overwrite the Userdata subpartition;

[0098] If an image is included, the three sub-partitions of boot, system and userdata will be overwritten and the device will be restarted.

[0099] S103, if the upgrade fails, restart and boot the second boot partition through the boot system boot partition.

[0100] If the upgrade result is an upgrade failure, the system can be restarted and the second boot partition can be booted to work through the boot system boot partition.

[0101] In a feasible embodiment, optionally, the electronic device further includes: a backup partition; the backup partition is used to store the initial system image;

[0102] Correspondingly, after the second boot partition is booted to work by the boot system boot partition, the method further includes:

[0103] The initial system of the first boot partition is restored by using the initial system image stored in the backup partition.

[0104] Among them, the backup partition Recovery stores the default version of the image of the first boot partition and the second boot partition. After one burn, it is in read-only state. Here, the default version of the image can be the initial system image, that is, if the upgrade of the first boot partition or the second boot partition fails, it can be started through another boot partition, and the boot partition that failed to upgrade can be restored through the initial system image backed up by the backup partition.

[0105] The benefit of this arrangement of the scheme is that it can realize automatic repair of electronic equipment. In the event of an upgrade failure, it can be automatically restored based on the contents of the backup partition, thereby improving the operational stability of the electronic equipment.

[0106] The technical solution provided in the embodiment of the present application is to receive an upgrade package when the first boot partition is working, and store the upgrade package in the upgrade package storage partition; upgrade the first boot partition based on the upgrade package, and read the upgrade result; if the upgrade fails, restart, and guide the second boot partition to work through the boot system boot partition. The above-mentioned fault-tolerant upgrade method based on dual working partitions can solve the problem of poor robustness during the upgrade of electronic equipment, because dual working partitions are provided, and in the case of a failure to upgrade after downloading the upgrade package, the electronic equipment can be started and run through another working partition, and the partition that failed to upgrade is processed accordingly to ensure the upgrade safety of the electronic equipment.

[0107] Figure 2 1 is a flow chart of a fault-tolerant upgrade method based on dual working partitions provided in an embodiment of the present application. The electronic device further includes: a status code recording partition. Figure 2 As shown, the specific steps include:

[0108] S201, when the first boot partition is working, receiving an upgrade package, and storing the upgrade package in an upgrade package storage partition;

[0109] S202, verify the upgrade package to obtain status code data, and store the status code data in the status code record partition.

[0110] In this solution, the upgrade package is verified, which may include the above-mentioned verification processes, such as integrity verification, verification of whether the version is suitable, and verification of the Flash partition capacity. It can be understood that the corresponding status code can be obtained after each partial verification is completed. Since the order of verification can be set or parallel. However, no matter what the verification order is, if the upgrade package is normal, the final status code must be determined to determine the upgrade type of the upgrade package, that is, whether it contains a mirror. Therefore, after each process is completed, the corresponding status code is written to the status code recording partition, so that when restarting, it can be determined based on the status code whether the first boot partition is upgraded.

[0111] S203, read the upgrade result.

[0112] In this solution, whether the upgrade is successful can be determined based on the status code in the status code record partition. That is, after reading the result, if all verifications have been passed and the upgrade type has been determined, the upgrade is determined to be successful. If the upgrade type has not been determined, the upgrade is determined to have failed.

[0113] It should be noted here that the reason for the upgrade failure may be a problem with the upgrade package, a problem with the first boot partition of the device, or a power failure of the device itself.

[0114] S204: If the upgrade fails, restart and boot the second boot partition through the boot system boot partition.

[0115] This technical solution, by providing a status code record partition, can write the status code of each stage in the upgrade process, so as to determine whether the upgrade is successful based on the status code during the upgrade process, so as to monitor the entire upgrade process.

[0116] Figure 3 Schematic diagram of the partition design of the electronic device provided in the embodiment of the present application. Figure 3 As shown, the electronic device may include the following partitions:

[0117] Bootlaoder: Boot the system startup partition. After burning once, it will be in read-only state afterwards.

[0118] Parameter: Status code record partition, used to store the status parameters of the flash erase process, the default value is 0;

[0119] Boot_a: boot sub-partition of the first boot partition, used to store uboot;

[0120] System_a: The system subpartition of the first boot partition, used to store the kernel and file system;

[0121] Userdata_a: user programs and data sub-partitions of the first boot partition, used to store user programs, libraries, configuration parameters, etc.

[0122] Boot_b: The boot sub-partition of the second boot partition, used to store uboot (similar to the backup of Boot_a);

[0123] System_b: The system subpartition of the second boot partition, used to store the kernel and file system (similar to the backup of System_a);

[0124] Userdata_b: User programs and data subpartitions of the second boot partition, used to store user programs, libraries, configuration parameters, etc. (similar to the backup of Userdata_a);

[0125] Recovery: backup partition, storing the default version images of Boot_a, System_a, Userdata_a, Boot_b, System_b, and Userdata_b. After one flash, it is in read-only state;

[0126] Cache: Upgrade package storage partition, used to store upgrade backup partitions of upgrade packages.

[0127] This solution can improve the robustness of the system during the upgrade process by designing the first boot partition and the second boot partition.

[0128] Here, the system startup and upgrade process is as follows:

[0129] 1. Enter the bootloader to boot;

[0130] 2. Enter boot_a to start (if it cannot start normally, enter boot_b);

[0131] 3. Enter the system_a partition to start the system (if there is a problem with boot_a, jump directly to system_b);

[0132] 4. Enter Userdata_a and run the user program (if there is a problem with boot_a, jump directly to Userdata_b);

[0133] 5. Perform a system check. If it is determined that a partition is damaged, read the default image from Recovery to restore the corresponding damaged partition.

[0134] On the basis of the above technical solution, optionally, verifying the upgrade package to obtain status code data, and storing the status code data in the status code record partition includes:

[0135] Performing an integrity check on the upgrade package, if the check passes, generating a first status code and storing it in the status code record partition; if the check fails, generating a second status code and storing it in the status code record partition;

[0136] Performing an adaptability check on the upgrade package, if the check passes, generating a third status code and storing it in the status code record partition; if the check fails, generating a fourth status code and storing it in the status code record partition;

[0137] Performing a startup partition space check on the electronic device based on the upgrade package, if the check passes, generating a fifth status code and storing it in the status code record partition; if the check fails, generating a sixth status code and storing it in the status code record partition;

[0138] Identify the upgrade type of the upgrade package. If it is the first type, generate a seventh status code and store it in the status code record partition; if it is the second type, generate an eighth status code and store it in the status code record partition.

[0139] In this solution, status codes for different stages can be defined. For example:

[0140] Define upgrade process error codes

[0141] #define UPGRADE_ERROR_NO_TIMEOUT, (-1), network transmission process timed out;

[0142] #define UPGRADE_ERROR_NO_PackageError, (-2), the upgrade package is incomplete;

[0143] #define UPGRADE_ERROR_NO_SoCError, (-3), the upgrade package does not match the current SoC solution;

[0144] #define UPGRADE_ERROR_NO_FlashLimit, (-4), insufficient flash space;

[0145] Define the status code of the upgrade process

[0146] #define UPGRADE_STATE_NO_OK, (0), non-upgrade state;

[0147] #define UPGRADE_STATE_NO_TransmissionCompleted, (1), Upgrade package transmission completed;

[0148] #define UPGRADE_STATE_NO_CheckedPackage, (2), the integrity check of the upgrade package is completed;

[0149] #define UPGRADE_STATE_NO_CheckedSoC, (3), the upgrade package SoC matching check is completed;

[0150] #define UPGRADE_STATE_NO_CheckedFlash, (4), the upgrade package Flash space size check is completed;

[0151] #define UPGRADE_STATE_NO_ErasedFlash, (5), the partition is erased and written;

[0152] #define UPGRADE_STATE_NO_CopiedOverlay, (6), copy overlay completed;

[0153] Define the return value after the upgrade is completed

[0154] #define UPGRADE_SUCCESSFUL, (0), upgrade successful;

[0155] #define UPGRADE_FAILED, (X), upgrade failed (the return value is an error code or status code).

[0156] This solution sets different status codes for different verification stages. During the inspection of the upgrade package, the node with the problem can be determined. The subsequent processing strategy can also be determined based on the status code, thereby improving the controllability of the electronic equipment upgrade process.

[0157] Based on the above technical solution, optionally, upgrading the first boot partition based on the upgrade package and reading the upgrade result includes:

[0158] Read the status code recorded in the status code record partition;

[0159] If it is the first status code, the second status code, the third status code, the fourth status code, the fifth status code or the sixth status code, the upgrade result is determined to be an upgrade failure;

[0160] If it is the seventh status code, erasing the boot sub-partition and the data sub-partition of the first boot partition, rewriting the boot sub-partition and the data sub-partition respectively based on the upgrade package, and determining that the upgrade result is successful;

[0161] If it is the eighth status code, the data sub-partition of the first boot partition is overwritten based on the upgrade package.

[0162] It is understandable that if the seventh status code and the eighth status code are, it is determined that the upgrade is successful, and the first boot partition is upgraded using the corresponding upgrade type. If it is the second status code, the fourth status code or the sixth status code, it is determined that the verification failed in the corresponding verification phase, and the upgrade result is determined to be a failure. If it is the first status code, the third status code or the fifth status code, although it indicates that the verification phase verification is successful, it has not reached the process of finally determining the upgrade type, it can also be determined as an upgrade failure. It is understandable that the reason for this upgrade failure is likely to be caused by the power failure of the electronic equipment. This is also the most difficult problem in the field of monitoring and handling of upgrade failures.

[0163] Through such a setting, this solution can determine the upgrade results based on different status codes, and can also determine different processing strategies and clarify the reasons for upgrade failure. Based on this data foundation, the upgrade of electronic equipment can be designed more accurately, improving the stability of electronic equipment hardware upgrades.

[0164] On the basis of the above technical solutions, optionally, the electronic device further includes: a status code recording partition;

[0165] Receiving an upgrade package and storing the upgrade package in an upgrade package storage partition, including:

[0166] Receive an upgrade package and obtain a reception time of the upgrade package;

[0167] If the receiving time exceeds the set time threshold, it is determined that the network connection is abnormal, and a network abnormality error code is generated and written into the status code record partition.

[0168] From the above examples, we can see that this solution not only performs multiple stages of verification after the upgrade package is received, but also verifies the reception time during the upgrade package reception process. If it exceeds the set time threshold, such as 10 minutes, the current network is determined to be abnormal, and the corresponding network abnormality error code can also be generated and written to the status code record partition.

[0169] Through such a design, this solution can determine the timeout status during the upgrade process, prevent network disconnection, and avoid the device being in the upgrade process for a long time.

[0170] Based on the above technical solutions, optionally, after the second boot partition is booted by the boot system boot partition, the method further includes:

[0171] The upgrade packages stored in the upgrade package storage partition are cleared.

[0172] It can be understood that by clearing the upgrade package storage partition, it is possible to prevent the upgrade package storage partition from continuously occupying a large amount of storage space.

[0173] The solution is designed in this way, so that the electronic device can detect the upgrade status when it is turned on, clean up the remaining upgrade packages from the last failed upgrade, and avoid the problem of occupying too much space.

[0174] Figure 4 1 is a schematic diagram of the structure of a fault-tolerant upgrade device based on dual working partitions provided in an embodiment of the present application. The device is configured in an electronic device, and the electronic device includes: a boot system boot partition, a first boot partition, a second boot partition, and an upgrade package storage partition; Figure 4 As shown, specifically including the following:

[0175] The upgrade package storage module 401 is used to receive the upgrade package and store the upgrade package in the upgrade package storage partition when the first boot partition is working;

[0176] An upgrade result determination module 402, configured to upgrade the first boot partition based on the upgrade package and read the upgrade result;

[0177] The backup startup module 403 is used to restart if the upgrade fails, and to boot the second startup partition to work through the boot system startup partition.

[0178] Furthermore, the electronic device further comprises: a backup partition; the backup partition is used to store the initial system image;

[0179] Correspondingly, after the second boot partition is booted to work by the boot system boot partition, the method further includes:

[0180] The initial system of the first boot partition is restored by using the initial system image stored in the backup partition.

[0181] Furthermore, the electronic device further comprises: a status code recording partition;

[0182] Accordingly, the device further comprises:

[0183] The status code recording module is used to verify the upgrade package, obtain status code data, and store the status code data in the status code recording partition.

[0184] Furthermore, the status code recording module is specifically used for:

[0185] Performing an integrity check on the upgrade package, if the check passes, generating a first status code and storing it in the status code record partition; if the check fails, generating a second status code and storing it in the status code record partition;

[0186] Performing an adaptability check on the upgrade package, if the check passes, generating a third status code and storing it in the status code record partition; if the check fails, generating a fourth status code and storing it in the status code record partition;

[0187] Performing a startup partition space check on the electronic device based on the upgrade package, if the check passes, generating a fifth status code and storing it in the status code record partition; if the check fails, generating a sixth status code and storing it in the status code record partition;

[0188] Identify the upgrade type of the upgrade package. If it is the first type, generate a seventh status code and store it in the status code record partition; if it is the second type, generate an eighth status code and store it in the status code record partition.

[0189] Furthermore, the upgrade result determination module 402 is specifically configured to:

[0190] Read the status code recorded in the status code record partition;

[0191] If it is the first status code, the second status code, the third status code, the fourth status code, the fifth status code or the sixth status code, the upgrade result is determined to be an upgrade failure;

[0192] If it is the seventh status code, erasing the boot sub-partition and the data sub-partition of the first boot partition, rewriting the boot sub-partition and the data sub-partition respectively based on the upgrade package, and determining that the upgrade result is successful;

[0193] If it is the eighth status code, the data sub-partition of the first boot partition is overwritten based on the upgrade package.

[0194] Furthermore, the electronic device further comprises: a status code recording partition;

[0195] The upgrade package storage module 401 is specifically used for:

[0196] Receive an upgrade package and obtain a reception time of the upgrade package;

[0197] If the receiving time exceeds the set time threshold, it is determined that the network connection is abnormal, and a network abnormality error code is generated and written into the status code record partition.

[0198] Furthermore, the device also includes:

[0199] The upgrade package clearing module is used to clear the upgrade packages stored in the upgrade package storage partition.

[0200] In the embodiment of the present application, when the first boot partition is working, an upgrade package is received and the upgrade package is stored in the upgrade package storage partition; the first boot partition is upgraded based on the upgrade package, and the upgrade result is read; if the upgrade fails, the system restarts, and the second boot partition is booted to work through the boot system boot partition. The above-mentioned fault-tolerant upgrade method based on dual working partitions can solve the problem of poor robustness during the upgrade of electronic equipment, because dual working partitions are provided, and in the case of a failure to upgrade after downloading the upgrade package, the electronic equipment can be started and run through another working partition, and the partition that failed to upgrade is processed accordingly to ensure the upgrade safety of the electronic equipment.

[0201] The fault-tolerant upgrade device based on dual working partitions in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0202] The fault-tolerant upgrade device based on dual working partitions in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0203] The fault-tolerant upgrade device based on dual working partitions provided in the embodiment of the present application can implement each process implemented in the above method embodiment. To avoid repetition, it will not be repeated here.

[0204] Figure 5 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 5 As shown, an embodiment of the present application also provides an electronic device 500, including a processor 501, a memory 502, and a program or instruction stored in the memory 502 and executable on the processor 501. When the program or instruction is executed by the processor 501, each process of the above-mentioned fault-tolerant upgrade method embodiment based on dual working partitions is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0205] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0206] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned fault-tolerant upgrade method embodiment based on dual working partitions are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0207] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0208] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned fault-tolerant upgrade method embodiment based on dual working partitions, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0209] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0210] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0212] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0213] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A fault-tolerant upgrade method based on dual working partitions, characterized in that: The method is executed by an electronic device, the electronic device comprising: a boot system boot partition, a first boot partition, a second boot partition and an upgrade package storage partition; the method comprises: When the first boot partition is working, receiving an upgrade package, and storing the upgrade package in the upgrade package storage partition; Upgrading the first boot partition based on the upgrade package, and reading the upgrade result; If the upgrade fails, the system is restarted and the second boot partition is booted to work through the boot system boot partition.

2. The method according to claim 1, characterized in that The electronic device further comprises: a backup partition; the backup partition is used to store the initial system image; Correspondingly, after the second boot partition is booted to work by the boot system boot partition, the method further includes: The initial system of the first boot partition is restored by using the initial system image stored in the backup partition.

3. The method according to claim 1, characterized in that: The electronic device further comprises: a status code recording partition; Before reading the upgrade result, the method further includes: The upgrade package is verified to obtain status code data, and the status code data is stored in the status code record partition.

4. The method according to claim 3, characterized in that Verifying the upgrade package to obtain status code data, and storing the status code data in the status code record partition, including: Performing an integrity check on the upgrade package, if the check passes, generating a first status code and storing it in the status code record partition; if the check fails, generating a second status code and storing it in the status code record partition; Performing an adaptability check on the upgrade package, if the check passes, generating a third status code and storing it in the status code record partition; if the check fails, generating a fourth status code and storing it in the status code record partition; Performing a startup partition space check on the electronic device based on the upgrade package, if the check passes, generating a fifth status code and storing it in the status code record partition; if the check fails, generating a sixth status code and storing it in the status code record partition; Identify the upgrade type of the upgrade package. If it is the first type, generate a seventh status code and store it in the status code record partition; if it is the second type, generate an eighth status code and store it in the status code record partition.

5. The method according to claim 4, characterized in that Upgrading the first boot partition based on the upgrade package and reading the upgrade result includes: Read the status code recorded in the status code record partition; If it is the first status code, the second status code, the third status code, the fourth status code, the fifth status code or the sixth status code, the upgrade result is determined to be an upgrade failure; If it is the seventh status code, erasing the boot sub-partition and the data sub-partition of the first boot partition, rewriting the boot sub-partition and the data sub-partition respectively based on the upgrade package, and determining that the upgrade result is successful; If it is the eighth status code, the data sub-partition of the first boot partition is overwritten based on the upgrade package.

6. The method according to claim 1, characterized in that The electronic device further comprises: a status code recording partition; Receiving an upgrade package and storing the upgrade package in an upgrade package storage partition, including: Receive an upgrade package and obtain a reception time of the upgrade package; If the receiving time exceeds the set time threshold, it is determined that the network connection is abnormal, and a network abnormality error code is generated and written into the status code record partition.

7. The method according to claim 1, characterized in that After the second boot partition is booted by the boot system boot partition, the method further includes: The upgrade packages stored in the upgrade package storage partition are cleared.

8. A fault-tolerant upgrade device based on dual working partitions, characterized in that: The device is configured in an electronic device, and the electronic device comprises: a boot system boot partition, a first boot partition, a second boot partition and an upgrade package storage partition; the device comprises: An upgrade package storage module, used for receiving an upgrade package and storing the upgrade package in the upgrade package storage partition when the first boot partition is working; An upgrade result determination module, configured to upgrade the first boot partition based on the upgrade package and read the upgrade result; The backup startup module is used to restart if the upgrade fails, and to boot the second startup partition to work through the boot system startup partition.

9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein when the program or instruction is executed by the processor, the steps of the fault-tolerant upgrade method based on dual working partitions are implemented as described in any one of claims 1 to 7.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the fault-tolerant upgrade method based on dual working partitions as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • On-orbit upgrading method and device of satellite-borne platform and satellite-borne platform

    CN122547390A