Firmware upgrading method, electronic equipment and computer readable storage medium

By first writing the new firmware to the backup partition during firmware upgrade, and then writing it to the target partition, the problem that the device cannot start due to unexpected circumstances during firmware upgrade is solved, which improves the reliability of firmware upgrades and saves costs.

CN119806571APending Publication Date: 2025-04-11HANGZHOU HUACHENG SOFTWARE TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411756694.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

During the firmware upgrade process, sudden power interruption, network problems or other unexpected situations may cause damage to the original data in the memory and the new data are not saved, causing the device to fail to start and become bricked.

Method used

By writing the new firmware to the backup partition in the target memory first and then writing it to the target partition, in the event of an unexpected situation, the new firmware can be started from the backup partition to prevent the device from being unable to boot.

Benefits of technology

Improve the reliability of firmware upgrades, prevent the device from being unable to start due to unexpected circumstances, and realize firmware backup and upgrade without increasing memory space, saving costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806571A_ABST
    Figure CN119806571A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method, electronic equipment and a computer readable storage medium. The method comprises the steps that new firmware needing to be written into a target partition of a target storage is acquired; wherein the target memory comprises a plurality of partitions, and each partition is used for storing different firmware of the target equipment; writing the new firmware into a backup partition corresponding to the target partition so as to backup the new firmware; wherein the backup partition is at least one other partition except the target partition in the target memory; writing the new firmware into the target partition; and starting new firmware from the target partition to perform firmware upgrading on the target partition. By means of the mode, the reliability of firmware upgrading can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of firmware upgrade, and in particular to a firmware upgrade method, an electronic device, and a computer-readable storage medium. Background Art

[0002] At present, some devices (such as embedded devices) need to perform firmware upgrades from time to time to fix security vulnerabilities of the devices, add new functions to the devices, etc. When upgrading the firmware of a device, it is necessary to read and write the memory where the firmware is stored. However, if there is a sudden power outage, network problem or other unexpected situation when reading and writing the memory, the original data in the memory will be damaged and the new data will not be saved, causing the device to be unable to start and become bricked. Summary of the invention

[0003] The main technical problem solved by the present application is to provide a firmware upgrade method, an electronic device and a computer-readable storage medium, which can improve the reliability of firmware upgrade.

[0004] To solve the above technical problems, a technical solution adopted in the present application is: to provide a firmware upgrade method, the method comprising: obtaining new firmware to be written to a target partition of a target memory; wherein the target memory comprises several partitions, each partition being used to store different firmware of a target device; writing the new firmware to a backup partition corresponding to the target partition to back up the new firmware; wherein the backup partition is at least one other partition in the target memory except the target partition; writing the new firmware to the target partition; and starting the new firmware from the target partition to perform a firmware upgrade on the target partition.

[0005] The target device is an embedded device, the target memory is a non-volatile memory, and the plurality of partitions include a boot partition, a system partition, an application partition, a primary configuration partition, and a backup configuration partition.

[0006] The target partition includes at least one of a boot partition and a system partition, the target partition corresponds to at least one backup partition, and the partition space size of the at least one backup partition is larger than that of the target partition.

[0007] Among them, the target partition includes a boot partition, at least one backup partition includes a target configuration partition, the target configuration partition includes one of a main configuration partition and a backup configuration partition; and / or, the target partition includes a system partition, the new firmware corresponding to the system partition includes new system files and an upgrade program, at least one backup partition includes an application partition and a target configuration partition, the application partition is used to back up the new system files, the target configuration partition is used to back up the upgrade program, the new system files are written to the system partition, the partition space size of the application partition is larger than the system partition, and the upgrade program is used to re-download the new firmware corresponding to the system partition when writing the new system files to the application partition or the system partition fails, and re-execute writing the new firmware to the backup partition corresponding to the target partition or writing the new firmware to the target partition until the new firmware is successfully written to the backup partition corresponding to the target partition or the new firmware is successfully written to the target partition.

[0008] The target partition includes the system partition. The new firmware corresponding to the system partition includes new system files and upgrade programs. The backup upgrade programs are backed up before the new system files. The partition space size of the backup partition used to back up the new system files is larger than the system partition.

[0009] Among them, the target partition includes an application partition, and the new firmware corresponding to the application partition includes a new application file and an upgrade program. The new application file is written to the application partition, and the upgrade program is written to the backup partition. The upgrade program is used to re-download the new firmware corresponding to the application partition when the writing of the new application file to the application partition fails, and re-execute the writing of the new firmware to the target partition until the new firmware is successfully written to the target partition.

[0010] Among them, the target partition also includes a system partition, the new firmware corresponding to the system partition includes an upgrade program, the upgrade order of the system partition precedes the application partition, and when the firmware of the application partition is upgraded, the new firmware is not written to the backup partition corresponding to the target partition to back up the new firmware; and / or, the backup partition includes a target configuration partition, and the target configuration partition includes one of the main configuration partition and the backup configuration partition.

[0011] Before writing the new firmware to the target partition, the firmware upgrade method also includes: determining whether the new firmware is successfully written to the backup partition corresponding to the target partition; writing the new firmware to the target partition includes: in response to successfully writing the new firmware to the backup partition corresponding to the target partition, writing the new firmware to the target partition.

[0012] Among them, after writing the new firmware to the target partition, the firmware upgrade method also includes: determining whether the new firmware is successfully written to the target partition; in response to failure to write the new firmware to the target partition, using the new firmware written to the backup partition to recover the firmware; starting the new firmware from the target partition, including: in response to successfully writing the new firmware to the target partition, starting the new firmware from the target partition.

[0013] The target partition includes a boot partition; and restoring the firmware using the new firmware written into the backup partition includes: writing the new firmware written into the backup partition into the boot partition.

[0014] Among them, the target partition includes the system partition, and the new firmware corresponding to the system partition includes an upgrade program and a new system file; using the new firmware written to the backup partition to perform firmware recovery, including: starting the new system file from the backup partition; and using the upgrade program to re-download the new firmware corresponding to the system partition, and re-execute the writing of the new firmware to the target partition until the new firmware is successfully written to the target partition.

[0015] Among them, the target partition includes an application partition, and the new firmware corresponding to the application partition includes an upgrade program and a new application file; using the new firmware written into the application partition to perform firmware recovery includes: using the upgrade program to re-download the new firmware corresponding to the application partition, and re-executing the writing of the new firmware into the target partition until the new firmware is successfully written into the target partition.

[0016] Among them, other partitions include a main configuration partition and a backup configuration partition, the backup configuration partition is used to back up the main configuration partition, the backup partition includes a target configuration partition, and the target configuration partition includes one of the main configuration partition or the backup configuration partition; before writing the new firmware to the backup partition corresponding to the target partition, the firmware upgrade method also includes: erasing the data in the target configuration partition; after writing the new firmware to the backup partition corresponding to the target partition, the firmware upgrade method also includes: using the configuration partition that is not the target configuration partition to restore the data of the target configuration partition.

[0017] After starting the new firmware from the target partition, the firmware upgrade method further includes: erasing the original firmware in the target partition; and erasing at least part of the data of the new firmware in the backup partition.

[0018] Wherein, the target partition includes one of a boot partition, a system partition and an application partition; erasing at least part of the data of the new firmware in the backup partition includes: erasing all the data of the new firmware in the backup partition; or, the target partition includes a system partition and an application partition, the upgrade order of the system partition precedes that of the application partition, the new firmware corresponding to the system partition includes an upgrade program and a new system file, and the new system file is written to the system partition, the new firmware corresponding to the application partition includes an upgrade program and a new application file, and the new application file is written to the application partition, and the upgrade of the application partition is not performed to write the new firmware to the backup partition corresponding to the target partition to back up the new firmware; erasing at least part of the data of the new firmware in the backup partition includes: in response to successfully starting the new system file from the system partition, erasing the new system file in the backup partition corresponding to the system partition; in response to successfully starting the new application file from the application partition, erasing the upgrade program in the backup partition corresponding to the system partition.

[0019] The target partition includes a boot partition, a system partition and an application partition. The boot partition, the system partition and the application partition are sequentially executed in a preset order to obtain the new firmware of the target partition to be written into the target memory and the subsequent steps.

[0020] In order to solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, the electronic device includes a memory and a processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the above firmware upgrade method.

[0021] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a computer-readable storage medium, which is used to store program instructions, and the program instructions can be executed to implement the above firmware upgrade method.

[0022] The above technical solution, after obtaining the new firmware to be written into the target partition of the target memory, first writes the new firmware into the backup partition and then writes the new firmware into the target partition. Therefore, before writing the new firmware into the target partition, the new firmware will be backed up to achieve firmware backup upgrade, improve the reliability of firmware upgrade, avoid the situation that the new and old firmware are damaged by power failure when directly writing into the target partition, and thus avoid the situation that the target device cannot be started and becomes bricked.

[0023] The backup partition corresponding to the target partition is at least one other partition in the target memory except the target partition. Therefore, during the firmware upgrade process of the target partition, the existing partition in the target memory is used to temporarily free up the backup storage space of the target partition for the backup storage of the new firmware, rather than adding the target memory space as the backup storage space of the target partition; that is, by dynamically adjusting the partition usage of the target memory, the firmware backup upgrade is achieved without increasing the target memory space, thereby improving the reliability of the firmware upgrade and saving costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a flowchart of an embodiment of a firmware upgrade method provided by the present application;

[0025] Figure 2 It is a structural diagram of an embodiment of a firmware upgrade device provided by the present application;

[0026] Figure 3 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;

[0027] Figure 4 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION

[0028] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0029] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0030] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0031] See also Figure 1 , Figure 1 1 is a flowchart of an embodiment of the firmware upgrade method provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment includes:

[0032] Step S11: Obtain new firmware to be written to the target partition of the target memory.

[0033] Upgrading the firmware of the target device can, firstly, fix known security vulnerabilities and program errors (bugs), which, if not fixed, may cause the device to be attacked, crash, or behave abnormally; secondly, it can add new features or improve existing features, which helps to maintain the competitiveness of the target device and provide users with a better experience; thirdly, it can optimize the performance of the target device, reduce resource consumption, improve response speed, and enhance the stability of the target device; fourthly, it can ensure that the target device is compatible with the new environment; fifthly, it can ensure that the target device meets specific requirements and avoid compliance issues; fifthly, it can improve the user interface and increase the fluency of user interaction.

[0034] The firmware of the target device is stored in the target memory, which allows multiple rewrites, which means that the firmware of the target device can be updated and upgraded during the life cycle of the device. Of course, there are other reasons for storing the firmware of the target device in the target memory, such as the fast reading speed and high reliability of the target memory, which will not be described in detail here.

[0035] The target device may be an embedded device, and the target memory may be a non-volatile memory.

[0036] In this embodiment, new firmware to be written to a target partition of a target memory is obtained, wherein the target memory includes a plurality of partitions, each partition being used to store different firmware of a target device. By obtaining the new firmware to be written to the target partition of the target memory, the new firmware is subsequently successfully written to the partition corresponding to the target memory and the new firmware is successfully started and run, so as to realize the firmware upgrade of the target partition.

[0037] It should be noted that the target memory is divided into multiple partitions, and different partitions are used to store different firmware of the target device. By performing partition management on the target memory, the storage space can be used more efficiently to avoid waste.

[0038] In one embodiment, the target device is an embedded device, the target memory is a non-volatile memory, and the plurality of partitions include a boot (Universal Boot Loader, uboot) partition, a system partition, an application partition, a main configuration partition, and a backup configuration partition. The boot partition is used to store the boot loader, i.e., Uboot. Uboot is the first program loaded when the embedded system starts. It is responsible for initializing hardware devices, loading kernel images into memory, and starting the operating system, etc. The system partition is used to store system files. The application partition is used to store application programs. The main configuration partition is used to store configuration data. The backup configuration partition is used to back up configuration data. If the main configuration partition is damaged, the configuration data backed up in the backup configuration partition is used to restore the main configuration partition.

[0039] In one embodiment, when constructing new firmware for the target partition, a partition identification bit is set in the new firmware to identify the partition corresponding to the new firmware; that is, the constructed new firmware for the target partition includes the partition identification bit and the upgrade data required to upgrade the target partition.

[0040] In one specific implementation, the partition identification bit can be set before the upgrade data required for upgrading the target partition. Of course, in other specific implementations, the partition identification bit can also be set after the upgrade data required for upgrading the target partition, which is not limited here.

[0041] Step S12: writing the new firmware into the backup partition corresponding to the target partition to back up the new firmware.

[0042] In the process of writing the new firmware of the target partition to the target partition for firmware upgrade, if there is a sudden power outage, network problem or other unexpected situation, the new firmware will fail to be written, resulting in the failure of the firmware upgrade; in addition, the original firmware in the target partition of the target storage will be damaged, and the original firmware in other partitions of the target storage will not be damaged. Therefore, if the new firmware of the target partition to be written to the target storage is obtained, the new firmware is directly written to the target partition. At this time, if there is a power outage, network problem or other unexpected situation, the new firmware will fail to be written to the target partition, and the original firmware in the target partition will also be damaged, and the firmware related to the target partition cannot be started, resulting in the target device being unable to start and becoming bricked. If the new firmware of the target partition to be written to the target storage is obtained, the new firmware is first written to the backup partition. At this time, even if there is a power outage, network problem or other unexpected situation, it will only cause the new firmware to fail to write to the backup partition, and the data in the backup partition will be damaged, while the original firmware in the target partition will not be damaged, and the original firmware in the target partition can still be started, so it will not cause the target device to be unable to start and become bricked, but the firmware upgrade of the target partition has failed. If after obtaining the new firmware to be written to the target partition of the target storage, the new firmware is successfully written to the backup partition first, and then the new firmware is written to the target partition, even if there is a power outage, network problem or other unexpected situation, which causes the failure of writing the new firmware to the target partition, and the original firmware in the target partition is damaged, because the new firmware has been successfully written to the backup partition, the new firmware can be started from the backup partition, and the firmware related to the target partition will not be unable to start, and the target device will not be unable to start and become bricked; subsequently, without affecting the normal operation of the target device, the new firmware of the target partition is re-obtained and the new firmware is continued to be written to the target partition until the new firmware is successfully written to the target partition, thereby realizing the firmware upgrade of the target partition.

[0043] Therefore, in this embodiment, the new firmware is written to the backup partition corresponding to the target partition to back up the new firmware. After obtaining the new firmware to be written to the target partition of the target memory, the new firmware is backed up first to achieve firmware backup upgrade, improve the reliability of firmware upgrade, avoid the situation where the new and old firmware are damaged by power failure due to direct writing to the target partition, and thus avoid the situation where the target device cannot be started and becomes bricked.

[0044] In addition, in this embodiment, the backup partition corresponding to the target partition is at least one other partition in the target memory except the target partition. That is, during the firmware upgrade process of the target partition, the existing partition in the target memory is used to temporarily vacate the backup storage space of the target partition for the backup storage of the new firmware, instead of adding the target memory space as the backup storage space of the target partition; that is, by dynamically adjusting the partition usage of the target memory, the firmware backup upgrade is realized without increasing the target memory space, thereby improving the reliability of the firmware upgrade and saving costs.

[0045] In one embodiment, the target partition includes at least one of a boot partition and a system partition, the target partition corresponds to at least one backup partition, and the partition space size of the at least one backup partition is larger than the target partition. Among the boot partition, system partition, application partition, main configuration partition, and backup configuration partition included in the target memory, the boot partition and the system partition are not the partitions with the largest partition space size, so there is a backup storage space corresponding to the boot partition and the system partition that can be temporarily vacated in the target memory for backup storage of the new firmware.

[0046] In a specific embodiment, the target partition includes a boot partition, and at least one backup partition includes a target configuration partition, and the target configuration partition includes one of a main configuration partition and a backup configuration partition. That is, when the boot partition is upgraded with firmware, the partition space of one of the main configuration partition and the backup configuration partition that already exists in the target memory is vacated to form a backup storage space corresponding to the boot partition for backup storage of the new firmware; that is, by dynamically adjusting the purpose of the target configuration partition of the target memory, the firmware backup upgrade of the boot partition is realized. The partition space size of the main configuration partition or the backup configuration partition is larger than the boot partition, so the partition space of the main configuration partition or the backup configuration partition can vacate the backup storage space of the new firmware corresponding to the boot partition for backup storage of the new firmware, thereby realizing the backup of the new firmware of the boot partition. In addition, during the firmware upgrade process, the configuration data stored in the main configuration partition or the backup configuration partition will not be read or written, so the main configuration partition or the backup configuration partition is in an idle state, and the backup storage space of the new firmware corresponding to the boot partition can be vacated to form a backup storage space for the new firmware. Furthermore, the primary configuration partition stores configuration data, while the backup configuration partition backs up the configuration data. Therefore, by freeing up the partition space of one of the primary configuration partition and the backup configuration partition as the backup storage space of the boot partition, even if a power outage, network problem or other unexpected situation occurs when writing the new firmware of the boot partition to the primary configuration partition or the backup configuration partition, causing the configuration data in the primary configuration partition or the backup configuration partition to be damaged, the configuration data of the target configuration partition can be restored by using the configuration partition that is not the target configuration partition. In other words, the configuration partition that is not the target configuration partition also stores configuration data, and the configuration data will not be actually damaged.

[0047] It should be noted that the target configuration partition itself stores configuration data. If the remaining partition space of the target configuration partition is not large enough to accommodate the new firmware of the boot partition, the configuration data stored in the target configuration partition will be erased first, so that the partition space of the target configuration partition is large enough to accommodate the new firmware of the boot partition, so that the new firmware of the boot partition can be backed up. Since both the primary configuration partition and the backup configuration partition store configuration data, after the firmware upgrade of the boot partition is completed, the configuration data of the target configuration partition can be restored by using the configuration partition that is not the target configuration partition. In other words, the configuration partition that is not the target configuration partition also stores configuration data, so temporarily erasing the configuration data stored in the target configuration partition will not affect the operation of the target device.

[0048] In a specific embodiment, the target partition includes a system partition, the new firmware corresponding to the system partition includes new system files and an upgrade program, at least one backup partition includes an application partition and a target configuration partition, the application partition is used to back up the new system files, the target configuration partition is used to back up the upgrade program, the new system files are written to the system partition, the partition space size of the application partition is larger than the system partition, and the upgrade program is used to re-download the new firmware corresponding to the system partition when writing the new system files to the application partition or the system partition fails, and re-execute writing the new firmware to the backup partition corresponding to the target partition or writing the new firmware to the target partition until the new firmware is successfully written to the backup partition corresponding to the target partition or the new firmware is successfully written to the target partition.

[0049] That is to say, when the system partition is upgraded with firmware, the partition space of one of the main configuration partition and the backup configuration partition that already exist in the target memory is used to make room for the backup storage space of the upgrade program corresponding to the system partition, which is used for the backup storage of the upgrade program in the new firmware; and the partition space of the application partition that already exists in the target memory is used to make room for the backup storage space of the new system files corresponding to the system partition, which is used for the backup storage of the new system files in the new firmware. That is, by dynamically adjusting the purpose of the target configuration partition and the application partition of the target memory, the new system files and the upgrade program are backed up and stored respectively, thereby realizing the firmware backup upgrade of the system partition. The partition space of the application partition is much larger than that of the system partition, so the partition space of the application partition can make room for the backup storage space of the new system files corresponding to the system partition, which is used for the backup storage of the new system files in the new firmware, thereby realizing the backup of the new system files. The upgrade program only contains the upgrade function and occupies little space. Therefore, the partition space of the main configuration partition or the backup configuration partition is sufficient to serve as the backup storage space of the upgrade program corresponding to the system partition, and is used for the backup storage of the upgrade program in the new firmware. The upgrade program is used to re-acquire the new firmware and restore the firmware upgrade of the system partition when writing the new system file fails, thereby meeting the need for a small space and "backing up" the system partition.

[0050] It should be noted that the target configuration partition itself stores configuration data. If the remaining partition space of the target configuration partition is not large enough to accommodate the upgrade program in the new firmware of the system partition, the configuration data stored in the target configuration partition will be erased first, so that the partition space of the target configuration partition is large enough to accommodate the upgrade program in the new firmware of the system partition, so as to realize the backup of the upgrade program in the new firmware of the system partition. Since both the primary configuration partition and the backup configuration partition store configuration data, after the firmware upgrade of the system partition is completed, the configuration data of the target configuration partition can be restored by using the configuration partition that is not the target configuration partition. In other words, the configuration partition that is not the target configuration partition also stores configuration data, so temporarily erasing the configuration data stored in the target configuration partition will not affect the operation of the target device.

[0051] The purpose of writing the new system files in the new firmware into the application partition is to back up the new system files in the new firmware corresponding to the system partition. Therefore, when writing the new system files into the application partition fails, it indicates that the backup of the new system files in the new firmware corresponding to the system partition has failed. However, since the upgrade program in the new firmware corresponding to the system partition has been backed up, and the upgrade program can re-download the new firmware corresponding to the system partition from the local or cloud; therefore, the backup upgrade program will be used to re-download the new firmware corresponding to the system partition from the local or cloud, and re-execute the steps of writing the new firmware into the backup partition corresponding to the target partition and its subsequent steps until the firmware of the target partition is upgraded.

[0052] Performing a firmware upgrade on a system partition is actually to upgrade the original system files stored in the system partition, so it is only necessary to write the new system files in the new firmware to the system partition. Writing the new system files in the new firmware corresponding to the system partition is to upgrade the original system files in the system partition, so when writing the new system files to the system partition fails, it indicates that the firmware upgrade to the system partition has failed. However, since the upgrade program in the new firmware corresponding to the system partition is backed up, and the upgrade program can re-download the new firmware corresponding to the system partition from the local or cloud; therefore, the backup upgrade program will be used to re-download the new firmware corresponding to the system partition from the local or cloud, and re-execute the writing of the new firmware to the target partition and its subsequent steps until the firmware upgrade to the target partition is performed. In other embodiments, when writing the new system files to the system partition fails, it indicates that the firmware upgrade to the system partition has failed, and the new system files backed up in the application partition can also be used to write to the target partition and execute subsequent steps.

[0053] It should be noted that the failure to write the new system files corresponding to the system partition to the application partition may be due to power outages, network problems or other unexpected situations. At this time, the original firmware in the application partition will also be damaged. Therefore, the backup upgrade program will be used to re-download the firmware corresponding to the application partition from the local or cloud, and write the firmware corresponding to the application partition to the application partition. Otherwise, even if the firmware upgrade of the system partition is successful, the firmware in the application partition will be damaged and the target device will still be unable to start and become bricked.

[0054] Take the target partition as the system partition, the new firmware includes the upgrade program and the new system file, the backup partition for backing up and storing the upgrade program as the target configuration partition, and the backup partition for backing up and storing the new system file as the application partition as an example: if after obtaining the new firmware to be written to the system partition, the new system file in the new firmware of the system partition is first written to the corresponding backup partition-application partition, at this time, if there is a power outage, network problem or other unexpected situation, it will cause the new system file corresponding to the system partition to fail to be written to the corresponding backup partition-application partition, and the original firmware in the corresponding backup partition-application partition will also be damaged, and the firmware related to the system partition cannot be started, resulting in the target device being unable to start and becoming bricked; in addition, since the new system file in the new firmware of the system partition is backed up first, and the upgrade program in the new firmware of the system partition has not been backed up, it is impossible to re-download the new firmware of the system partition, and the firmware upgrade of the system partition cannot continue and terminates. That is, if after obtaining the new firmware to be written to the system partition, the order of backing up the new system file precedes the upgrade program, on the one hand, it may cause the target device to be unable to start and become bricked, and on the other hand, it may cause the upgrade of the system partition to fail. If, after obtaining the new firmware to be written to the system partition, the upgrade program in the new firmware of the system partition is first written into the corresponding backup partition-target configuration partition, and then the new system files in the new firmware of the system partition are written into the corresponding backup partition-application partition; if a power outage, network problem or other unexpected situation occurs when writing the new system files in the new firmware of the system partition into the corresponding backup partition-application partition, the writing of the new system files corresponding to the system partition into the corresponding backup partition-application partition will fail, and the original firmware in the corresponding backup partition-application partition will also be damaged. However, since the upgrade program in the new firmware of the system partition has been backed up first, the backed-up upgrade program can be used to re-download the new firmware of the system partition and the firmware of the application partition, so as to restore the firmware of the application partition and re-backup and upgrade the new firmware of the system partition.

[0055] Therefore, in a specific implementation, the target partition includes the system partition, the new firmware corresponding to the system partition includes new system files and an upgrade program, the order of backing up the upgrade program precedes the new system files, and the partition space size of the backup partition used to back up the new system files is larger than the system partition. In other words, when the system partition is upgraded with firmware, the new firmware of the system partition will be backed up first to achieve firmware backup and upgrade, improve the reliability of the firmware upgrade, avoid the situation where the new and old firmware are damaged due to power failure when directly writing to the system partition, and thus avoid the situation where the target device cannot be started and becomes bricked. In addition, when the new firmware corresponding to the system partition includes both new system files and an upgrade program, the upgrade program is backed up first to improve the reliability of the firmware upgrade.

[0056] In addition, the upgrade program only contains the upgrade function and takes up little space. Therefore, the new system files take up more space in the new firmware. Therefore, only when the partition space of the backup partition used to back up the new system files is larger than the system partition, there will be enough partition space for backing up and storing the new system files.

[0057] In other specific embodiments, the target partition includes a system partition, the new firmware corresponding to the system partition only includes new system files, and at least one backup partition includes an application partition. When the system partition is upgraded with firmware, the partition space of the application partition that already exists in the target memory is used to make room for backup storage space for new system files corresponding to the system partition, which is used for backup storage of new system files in the new firmware. That is, by dynamically adjusting the purpose of the application partition of the target memory to perform backup storage of new system files, the firmware backup upgrade of the system partition is achieved. The partition space of the application partition is much larger than that of the system partition, so the partition space of the application partition can make room for backup storage space for new system files corresponding to the system partition, which is used for backup storage of new system files in the new firmware, thereby achieving backup of new system files.

[0058] It should be noted that the new firmware corresponding to the system partition only includes the new system files, but there is also an upgrade program. The upgrade program is already stored in the system partition or the application partition, and is not issued through each firmware upgrade. Therefore, when writing the new system file to the application partition or the system partition fails, the upgrade program stored in the system partition or the application partition can be used to re-download the new firmware corresponding to the system partition, and re-execute writing the new firmware to the backup partition corresponding to the target partition or writing the new firmware to the target partition until the new firmware is successfully written to the backup partition corresponding to the target partition or the new firmware is successfully written to the target partition.

[0059] In one embodiment, the target partition includes an application partition, and the new firmware corresponding to the application partition includes a new application file and an upgrade program. The new application file is written to the application partition, and the upgrade program is written to the backup partition. The upgrade program is used to re-download the new firmware corresponding to the application partition when the writing of the new application file to the application partition fails, and re-execute the writing of the new firmware to the target partition until the new firmware is successfully written to the target partition.

[0060] The partition space of the application partition is relatively large, and the partition space size of the existing partitions in the target memory is not enough to accommodate the new application files in the new firmware of the application partition, so the new application files in the new firmware of the application partition cannot be backed up. However, the upgrade program in the new firmware of the application partition has few functions, and the partition space required for its backup is small. When the failure to write the new application file to the application partition causes both the new and old firmware in the application partition to be damaged, the application partition can be restored by using the upgrade program, thereby "backing up" the application partition while satisfying the small space requirement. In other words, unlike the firmware upgrade of the boot partition and the system partition, the backup of the new firmware of the application partition does not back up the new application files in the new firmware, but backs up the upgrade program in the new firmware, thereby realizing the "backup" of the application partition using a small space.

[0061] When performing a firmware upgrade on an application partition, the existing partition space in the target memory is used to make room for the backup storage space of the upgrade program corresponding to the application partition, which is used for the backup storage of the upgrade program in the new firmware. That is, by dynamically adjusting the partition usage of the target memory, the upgrade program in the new firmware of the application partition is backed up and stored, thereby realizing the firmware backup upgrade of the application partition. The upgrade program only contains the upgrade function, and the program occupies little space. Therefore, the partition space of other partitions in the target memory is sufficient to serve as the backup storage space of the upgrade program corresponding to the application partition, which is used for the backup storage of the upgrade program in the new firmware; the upgrade program is used to re-acquire the new firmware and thus restore the firmware upgrade of the application partition when writing a new application file fails.

[0062] To perform a firmware upgrade on an application partition is actually to upgrade the original application files stored in the application partition, so only the new application files in the new firmware need to be written to the application partition. The purpose of writing the new application files in the new firmware corresponding to the application partition is to upgrade the original application files in the application partition, so when writing the new application files to the application partition fails, it indicates that the firmware upgrade to the application partition has failed. However, since the upgrade program in the new firmware corresponding to the application partition is backed up, and the upgrade program can re-download the new firmware corresponding to the application partition from the local or cloud; therefore, the backed-up upgrade program will be used to re-download the new firmware corresponding to the application partition from the local or cloud, and re-execute the steps of writing the new firmware to the target partition and its subsequent steps until the firmware upgrade of the target partition is performed.

[0063] In a specific embodiment, the backup partition corresponding to the application partition is the target configuration partition, and the target configuration partition includes one of the main configuration partition and the backup configuration partition. That is, when the application partition is upgraded with firmware, the partition space of one of the main configuration partition and the backup configuration partition that already exists in the target memory is used to vacate the backup storage space corresponding to the application partition, which is used for the backup storage of the upgrade program in the new firmware; that is, the firmware backup upgrade of the application partition is realized by dynamically adjusting the purpose of the target configuration partition of the target memory. The function of the upgrade program requires a small partition space, so the partition space of the main configuration partition or the backup configuration partition can vacate the backup storage space of the upgrade program in the new firmware corresponding to the application partition, which is used for the backup storage of the upgrade program in the new firmware, and the backup of the upgrade program in the new firmware of the application partition is realized. In addition, during the firmware upgrade process, the configuration data stored in the main configuration partition or the backup configuration partition will not be read and written, so the main configuration partition or the backup configuration partition is in an idle state, and the backup storage space of the upgrade program in the new firmware corresponding to the application partition can be vacated, which is used for the backup storage of the upgrade program in the new firmware. Furthermore, the primary configuration partition stores configuration data, while the backup configuration partition backs up the configuration data. Therefore, by freeing up the partition space of one of the primary configuration partition and the backup configuration partition as backup storage space for the application partition, even if a power outage, network problem or other unexpected situation occurs when writing new firmware of the application partition to the primary configuration partition or the backup configuration partition, causing the configuration data in the primary configuration partition or the backup configuration partition to be damaged, the configuration data of the target configuration partition can be restored by using the configuration partition that is not the target configuration partition. In other words, the configuration partition that is not the target configuration partition also stores configuration data, and the configuration data will not actually be damaged.

[0064] It should be noted that the target configuration partition itself stores configuration data. If the remaining partition space of the target configuration partition is not large enough to accommodate the upgrade program in the new firmware of the application partition, the configuration data stored in the target configuration partition will be erased first, so that the partition space of the target configuration partition is large enough to accommodate the upgrade program in the new firmware of the application partition, so as to realize the backup of the upgrade program in the new firmware of the application partition. Since both the primary configuration partition and the backup configuration partition store configuration data, after the firmware upgrade of the application partition is completed, the configuration data of the target configuration partition can be restored by using the configuration partition that is not the target configuration partition, or in other words, the configuration partition that is not the target configuration partition also stores configuration data, so temporarily erasing the configuration data stored in the target configuration partition will not affect the operation of the target device.

[0065] In a specific implementation, the target partition also includes a system partition, and the new firmware corresponding to the system partition includes an upgrade program. The upgrade order of the system partition precedes that of the application partition. When the application partition is upgraded, the new firmware is not written into the backup partition corresponding to the target partition to back up the new firmware. That is to say, when the system partition and the application partition need to be upgraded in sequence, if the upgrade program is backed up when the system partition is upgraded, then when the application partition is upgraded, there is no need to back up the upgrade program; and the firmware backup of the application partition is actually to back up the upgrade program in the new firmware of the application partition; therefore, when the application partition is upgraded, there is no need to perform the backup process, that is, there is no need to perform the process of writing the new firmware into the backup partition corresponding to the target partition to back up the new firmware.

[0066] In a specific implementation, the new firmware corresponding to the application partition only includes new application files, but there is also an upgrade program, which is already stored in the system partition or the application partition, and is not issued through each firmware upgrade. As for the firmware backup of the application partition, it is actually to back up the upgrade program in the new firmware of the application partition. When there is no upgrade program that needs to be backed up, there is no need to perform the backup process, that is, there is no need to perform the process of writing the new firmware to the backup partition corresponding to the target partition to back up the new firmware.

[0067] Step S13: Write the new firmware into the target partition.

[0068] In this embodiment, the new firmware is written to the target partition. After the new firmware to be written to the target partition of the target memory is obtained, the new firmware is first written to the backup partition, and then the new firmware is written to the target partition; therefore, even if there is a power outage, network problem or other unexpected situation, which causes the failure of writing the new firmware to the target partition, and the original firmware in the target partition is damaged, the new firmware has been written to the backup partition in advance, so the new firmware can be started from the backup partition to ensure the normal startup of the firmware related to the target partition, so that the target device will not be unable to start and become bricked.

[0069] In one embodiment, before writing the new firmware to the target partition, it is determined whether the new firmware is successfully written to the backup partition corresponding to the target partition; at this time, writing the new firmware to the target partition is specifically: in response to successfully writing the new firmware to the backup partition corresponding to the target partition, writing the new firmware to the target partition. That is, after successfully writing the new firmware of the target partition to the backup partition corresponding to the target partition, the new firmware of the target partition is written to the target partition, that is, after successfully backing up the new firmware of the target partition, the new firmware of the target partition is written to the target partition, so as to perform a firmware upgrade on the target partition and improve the reliability of the firmware upgrade.

[0070] In one embodiment, after the new firmware is written to the target partition, it is further determined whether the new firmware is successfully written to the target partition, and in response to a failure to write the new firmware to the target partition, the firmware is restored using the new firmware written to the backup partition. That is, in the case where the new firmware is not successfully written to the target partition, the firmware is restored using the new firmware written to the backup partition until the new firmware is successfully written to the target partition, so as to upgrade the firmware of the target partition.

[0071] In a specific embodiment, the target partition includes a boot partition; in this case, the new firmware written to the backup partition is used to perform firmware recovery, specifically: the new firmware written to the backup partition is written to the boot partition. For the firmware upgrade of the boot partition, since the new firmware of the boot partition has been backed up, if the new firmware is not successfully written to the target partition, the new firmware can be started from the backup partition, and the target device will not be unable to start and become bricked. In addition, since the new firmware of the boot partition has been backed up, the new firmware written to the backup partition is written to the boot partition to recover the new firmware that was damaged due to the previous failure to write to the boot partition.

[0072] In a specific embodiment, the target partition includes a system partition, and the new firmware corresponding to the system partition includes an upgrade program and a new system file; at this time, the new firmware written into the backup partition is used to perform firmware recovery, specifically: starting the new system file from the backup partition; and re-downloading the new firmware corresponding to the system partition using the upgrade program, and re-executing the writing of the new firmware into the target partition until the new firmware is successfully written into the target partition. For the firmware upgrade of the system partition, since the new system file in the new firmware of the system partition has been backed up, if the new system file in the new firmware of the system partition is not successfully written into the system partition, the new system file in the new firmware can be started from the backup partition, and the target device will not be unable to start and become bricked. In addition, since the upgrade program in the new firmware of the system partition has been backed up, the new firmware corresponding to the system partition can be re-downloaded using the backup upgrade program, so that the new new system file can be obtained and continued to be written into the system partition, until the new system file is successfully written into the system partition, thereby realizing the firmware upgrade of the system partition.

[0073] In a specific implementation, the target partition includes an application partition, and the new firmware corresponding to the application partition includes an upgrade program and a new application file; at this time, the new firmware written into the backup partition is used to perform firmware recovery, specifically: the new firmware corresponding to the application partition is re-downloaded using the upgrade program, and the new firmware is re-written into the target partition until the new firmware is successfully written into the target partition. For the firmware upgrade of the application partition, since the upgrade program in the new firmware of the application partition has been backed up, the new firmware corresponding to the application partition can be re-downloaded using the backup upgrade program, so that the new application file can be obtained and the new application file can be continued to be written into the application partition until the new application file is successfully written into the application partition, thereby realizing the firmware upgrade of the application partition.

[0074] It should be noted that when the target partition includes both the application partition and the system partition, and the new firmware corresponding to the system partition includes an upgrade program, the new firmware corresponding to the application partition is re-downloaded using the upgrade program backed up when the system partition is upgraded.

[0075] Step S14: boot the new firmware from the target partition to upgrade the firmware of the target partition.

[0076] In this embodiment, the new firmware is started from the target partition to upgrade the firmware of the target partition. That is, after the new firmware is written to the target partition, it can be started from the target partition, indicating that the firmware upgrade of the target partition is successfully performed.

[0077] In one embodiment, in response to successfully writing the new firmware to the target partition, the new firmware is started from the target partition. That is, after successfully writing the new firmware to the target partition, the new firmware can be successfully started from the target partition, indicating that the firmware upgrade of the target partition is successful.

[0078] In one embodiment, the target partition includes a boot partition, a system partition, and an application partition, and the steps of obtaining the new firmware of the target partition to be written into the target memory and the subsequent steps are performed on the boot partition, the system partition, and the application partition in sequence according to a preset order. That is, when the boot partition, the system partition, and the application partition all need to be upgraded in firmware, the boot partition, the system partition, and the application partition are upgraded in firmware in sequence according to a preset order.

[0079] In a specific implementation, the target partition includes a boot partition, a system partition, and an application partition. The firmware of the boot partition is upgraded first, then the firmware of the system partition is upgraded, and finally the firmware of the application partition is upgraded.

[0080] In one embodiment, after the new firmware is started from the target partition, the original firmware in the target partition is also erased; and at least part of the data of the new firmware in the backup partition is erased. After the firmware upgrade of the target partition is successfully performed, the original firmware in the target partition is no longer useful, so the original firmware in the target partition needs to be erased to release the partition space of the target partition. In addition, after the firmware upgrade of the target partition is successfully performed, at least part of the data in the new firmware backed up in the backup partition is also no longer useful, so at least part of the data of the new firmware in the backup partition needs to be erased to release the partition space of the backup partition.

[0081] In a specific embodiment, the target partition includes one of a boot partition, a system partition and an application partition; at this time, at least part of the data of the new firmware in the backup partition is erased, specifically: all data of the new firmware in the backup partition is erased; or, the target partition includes a system partition and an application partition, the upgrade order of the system partition precedes that of the application partition, the new firmware corresponding to the system partition includes an upgrade program and a new system file, and the new system file is written to the system partition, the new firmware corresponding to the application partition includes an upgrade program and a new application file, and the new application file is written to the application partition, and the upgrade of the application partition does not execute the writing of the new firmware to the backup partition corresponding to the target partition to back up the new firmware; at this time, at least part of the data of the new firmware in the backup partition is erased, specifically: in response to successfully starting the new system file from the system partition, the new system file in the backup partition corresponding to the system partition is erased; in response to successfully starting the new application file from the application partition, the upgrade program in the backup partition corresponding to the system partition is erased.

[0082] That is to say, when only one of the boot partition, system partition, and application partition is upgraded, all data of the new firmware in the backup partition will be erased after the firmware upgrade is successfully performed. When the system partition and the application partition are upgraded in sequence, after the system partition is upgraded successfully, only the new system files backed up in the backup partition are erased, and the upgrade program backed up in the backup partition is not erased. This is because the backup upgrade program needs to be used in the subsequent firmware upgrade of the application partition. After the application partition is successfully upgraded, the upgrade program is no longer needed, so the upgrade program in the backup partition corresponding to the system partition will be erased.

[0083] See also Figure 2 , Figure 2It is a structural diagram of an embodiment of a firmware upgrade device provided by the present application. The firmware upgrade device 20 includes an acquisition module 21, a first writing module 22, a second writing module 23 and a startup module 24. The acquisition module 21 is used to acquire the new firmware to be written to the target partition of the target memory; wherein the target memory includes a plurality of partitions, each partition is used to store different firmware of the target device; the first writing module 22 is used to write the new firmware to the backup partition corresponding to the target partition to back up the new firmware; wherein the backup partition is at least one other partition in the target memory except the target partition; the second writing module 23 is used to write the new firmware to the target partition; the startup module 24 is used to start the new firmware from the target partition to perform a firmware upgrade on the target partition.

[0084] The target device is an embedded device, the target memory is a non-volatile memory, and the plurality of partitions include a boot partition, a system partition, an application partition, a primary configuration partition, and a backup configuration partition.

[0085] The target partition includes at least one of a boot partition and a system partition. The target partition corresponds to at least one backup partition, and the partition space size of the at least one backup partition is larger than that of the target partition.

[0086] Among them, the above-mentioned target partition includes a boot partition, at least one backup partition includes a target configuration partition, and the target configuration partition includes one of a main configuration partition and a backup configuration partition; and / or, the above-mentioned target partition includes a system partition, and the new firmware corresponding to the system partition includes a new system file and an upgrade program, at least one backup partition includes an application partition and a target configuration partition, the application partition is used to back up the new system file, the target configuration partition is used to back up the upgrade program, the new system file is written to the system partition, the partition space size of the application partition is larger than the system partition, and the upgrade program is used to re-download the new firmware corresponding to the system partition when writing the new system file to the application partition or the system partition fails, and re-execute writing the new firmware to the backup partition corresponding to the target partition or writing the new firmware to the target partition until the new firmware is successfully written to the backup partition corresponding to the target partition or the new firmware is successfully written to the target partition.

[0087] Among them, the above-mentioned target partition includes a system partition, and the new firmware corresponding to the system partition includes new system files and upgrade programs. The order of backing up the upgrade programs precedes the new system files, and the partition space size of the backup partition used to back up the new system files is larger than that of the system partition.

[0088] Among them, the above-mentioned target partition includes an application partition, and the new firmware corresponding to the application partition includes a new application file and an upgrade program. The new application file is written to the application partition, and the upgrade program is written to the backup partition. The upgrade program is used to re-download the new firmware corresponding to the application partition when the writing of the new application file to the application partition fails, and re-execute the writing of the new firmware to the target partition until the new firmware is successfully written to the target partition.

[0089] Among them, the above-mentioned target partition also includes a system partition, the new firmware corresponding to the system partition includes an upgrade program, the upgrade order of the system partition precedes the application partition, and when the firmware of the application partition is upgraded, the new firmware is not written to the backup partition corresponding to the target partition to back up the new firmware; and / or, the above-mentioned backup partition includes a target configuration partition, and the target configuration partition includes one of the main configuration partition and the backup configuration partition.

[0090] Among them, the second writing module 23 is used to determine whether the new firmware is successfully written into the backup partition corresponding to the target partition before writing the new firmware into the target partition; the second writing module 23 is used to write the new firmware into the target partition, including: in response to successfully writing the new firmware into the backup partition corresponding to the target partition, writing the new firmware into the target partition.

[0091] Among them, the second writing module 23 is used to determine whether the new firmware is successfully written to the target partition after the new firmware is written to the target partition; in response to the failure to write the new firmware to the target partition, the firmware is restored using the new firmware written to the backup partition; the startup module 24 is used to start the new firmware from the target partition, including: in response to the successful writing of the new firmware to the target partition, the new firmware is started from the target partition.

[0092] The target partition includes a boot partition. The second writing module 23 is used to perform firmware recovery using the new firmware written into the backup partition, including: writing the new firmware written into the backup partition into the boot partition.

[0093] Among them, the above-mentioned target partition includes a system partition, and the new firmware corresponding to the system partition includes an upgrade program and a new system file; the second writing module 23 is used to use the new firmware written into the backup partition to perform firmware recovery, including: starting the new system file from the backup partition; and, using the upgrade program to re-download the new firmware corresponding to the system partition, and re-execute the writing of the new firmware into the target partition until the new firmware is successfully written into the target partition.

[0094] Among them, the above-mentioned target partition includes an application partition, and the new firmware corresponding to the application partition includes an upgrade program and a new application file; the second writing module 23 is used to use the new firmware written into the application partition to perform firmware recovery, including: using the upgrade program to re-download the new firmware corresponding to the application partition, and re-execute the writing of the new firmware into the target partition until the new firmware is successfully written into the target partition.

[0095] Among them, the above-mentioned other partitions include a main configuration partition and a backup configuration partition, the backup configuration partition is used to back up the main configuration partition, the backup partition includes a target configuration partition, and the target configuration partition includes one of the main configuration partition or the backup configuration partition; the firmware upgrade device 20 also includes an erasing module 25, the erasing module 25 is used to erase the data in the target configuration partition before writing the new firmware to the backup partition corresponding to the target partition; the erasing module 25 is used to restore the data of the target configuration partition using the configuration partition that is not used as the target configuration partition after writing the new firmware to the backup partition corresponding to the target partition.

[0096] The erasing module 25 is used to erase the original firmware in the target partition after starting the new firmware from the target partition; and erase at least part of the data of the new firmware in the backup partition.

[0097] Among them, the above-mentioned target partition includes one of the boot partition, the system partition and the application partition; the erasing module 25 is used to erase at least part of the data of the new firmware in the backup partition, including: erasing all data of the new firmware in the backup partition; or, the above-mentioned target partition includes the system partition and the application partition, the upgrade order of the system partition precedes the application partition, the new firmware corresponding to the system partition includes an upgrade program and a new system file, and the new system file is written to the system partition, and the new firmware corresponding to the application partition includes an upgrade program and a new application file, and the new application file is written to the application partition. The upgrade of the application partition does not execute the writing of the new firmware to the backup partition corresponding to the target partition to back up the new firmware; the erasing module 25 is used to erase at least part of the data of the new firmware in the backup partition, including: in response to successfully starting the new system file from the system partition, erasing the new system file in the backup partition corresponding to the system partition; in response to successfully starting the new application file from the application partition, erasing the upgrade program in the backup partition corresponding to the system partition.

[0098] The target partition includes a boot partition, a system partition and an application partition. The boot partition, the system partition and the application partition are sequentially executed in a preset order to obtain the new firmware of the target partition to be written into the target memory and the subsequent steps.

[0099] See also Figure 3 , Figure 3 : is a structural diagram of an embodiment of an electronic device provided by the present application. The electronic device 30 includes a memory 31 and a processor 32 coupled to each other, and the processor 32 is used to execute program instructions stored in the memory 31 to implement the steps of any of the above firmware upgrade method embodiments. In a specific implementation scenario, the electronic device 30 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 30 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0100] Specifically, the processor 32 is used to control itself and the memory 31 to implement the steps of any of the above-mentioned firmware upgrade method embodiments. The processor 32 can also be called a CPU (Central Processing Unit). The processor 32 may be an integrated circuit chip with signal processing capabilities. The processor 32 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 32 can be implemented by an integrated circuit chip.

[0101] See also Figure 4 , Figure 4 It is a structural diagram of an embodiment of a computer-readable storage medium provided by the present application. The computer-readable storage medium 40 of the embodiment of the present application stores a program instruction 41, and when the program instruction 41 is executed, it implements the method provided by any embodiment of the image fusion method or defect detection method of the present application and any non-conflicting combination. Among them, the program instruction 41 can form a program file and be stored in the above-mentioned computer-readable storage medium 40 in the form of a software product, so that a computer device (which can be a personal computer, a server, or a network device, etc.) executes all or part of the steps of each implementation method of the present application. The aforementioned computer-readable storage medium 40 includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, or a terminal device such as a computer, a server, a mobile phone, and a tablet.

[0102] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0103] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A firmware upgrade method, characterized in that: The method comprises: Obtain new firmware to be written to a target partition of a target memory; wherein the target memory includes a plurality of partitions, each of the partitions is used to store different firmware of the target device; Writing the new firmware into a backup partition corresponding to the target partition to back up the new firmware; wherein the backup partition is at least one other partition in the target memory except the target partition; Writing the new firmware into the target partition; The new firmware is started from the target partition to upgrade the firmware of the target partition.

2. The method according to claim 1, characterized in that The target device is an embedded device, the target memory is a non-volatile memory, and the plurality of partitions include a boot partition, a system partition, an application partition, a main configuration partition, and a backup configuration partition.

3. The method according to claim 1, characterized in that The target partition includes at least one of a boot partition and a system partition. The target partition corresponds to at least one backup partition, and a partition space size of at least one backup partition is larger than that of the target partition.

4. The method according to claim 3, characterized in that The target partition comprises a boot partition, the at least one backup partition comprises a target configuration partition, the target configuration partition comprises one of a primary configuration partition and a backup configuration partition; And / or, the target partition includes a system partition, the new firmware corresponding to the system partition includes new system files and an upgrade program, the at least one backup partition includes an application partition and the target configuration partition, the application partition is used to back up the new system files, the target configuration partition is used to back up the upgrade program, the new system files are written to the system partition, the partition space size of the application partition is larger than the system partition, and the upgrade program is used to re-download the new firmware corresponding to the system partition when writing the new system files to the application partition or the system partition fails, and re-execute the writing of the new firmware to the backup partition corresponding to the target partition or the writing of the new firmware to the target partition until the new firmware is successfully written to the backup partition corresponding to the target partition or the new firmware is successfully written to the target partition.

5. The method according to claim 3, characterized in that: The target partition includes the system partition, the new firmware corresponding to the system partition includes new system files and an upgrade program, the order of backing up the upgrade program precedes the new system files, and the partition space size of the backup partition used to back up the new system files is larger than the system partition.

6. The method according to claim 1, characterized in that The target partition includes an application partition, and the new firmware corresponding to the application partition includes a new application file and an upgrade program. The new application file is written to the application partition, and the upgrade program is written to the backup partition. The upgrade program is used to re-download the new firmware corresponding to the application partition when writing the new application file to the application partition fails, and re-execute the writing of the new firmware to the target partition until the new firmware is successfully written to the target partition.

7. The method according to claim 6, characterized in that The target partition also includes a system partition, the new firmware corresponding to the system partition includes the upgrade program, the upgrade order of the system partition is prior to the application partition, and when the firmware of the application partition is upgraded, the step of writing the new firmware into the backup partition corresponding to the target partition is not performed to back up the new firmware; And / or, the backup partition includes a target configuration partition, and the target configuration partition includes one of a primary configuration partition and a backup configuration partition.

8. The method according to claim 1, characterized in that Before writing the new firmware into the target partition, the method includes: Determining whether the new firmware is successfully written into the backup partition corresponding to the target partition; Writing the new firmware into the target partition comprises: In response to successfully writing the new firmware into the backup partition corresponding to the target partition, writing the new firmware into the target partition.

9. The method according to claim 1, characterized in that: After writing the new firmware into the target partition, the method further includes: Determining whether the new firmware is successfully written into the target partition; In response to failure to write the new firmware into the target partition, performing firmware recovery using the new firmware written into the backup partition; The starting the new firmware from the target partition comprises: In response to successfully writing the new firmware to the target partition, the new firmware is booted from the target partition.

10. The method according to claim 9, characterized in that The target partition includes a boot partition; and the firmware recovery using the new firmware written into the backup partition includes: The new firmware written to the backup partition is written to the boot partition.

11. The method according to claim 9, characterized in that The target partition includes a system partition, and the new firmware corresponding to the system partition includes an upgrade program and a new system file; and the firmware recovery using the new firmware written into the backup partition includes: Start the new system file from the backup partition; And, the new firmware corresponding to the system partition is re-downloaded using the upgrade program, and the writing of the new firmware into the target partition is re-executed until the new firmware is successfully written into the target partition.

12. The method according to claim 9, characterized in that The target partition includes an application partition, and the new firmware corresponding to the application partition includes an upgrade program and a new application file; and the firmware recovery using the new firmware written into the application partition includes: The new firmware corresponding to the application partition is re-downloaded using the upgrade program, and the step of writing the new firmware into the target partition is re-executed until the new firmware is successfully written into the target partition.

13. The method according to claim 1, characterized in that The other partitions include a main configuration partition and a backup configuration partition, the backup configuration partition is used to back up the main configuration partition, the backup partition includes a target configuration partition, and the target configuration partition includes one of the main configuration partition or the backup configuration partition; Before writing the new firmware into the backup partition corresponding to the target partition, the method further includes: Erasing data in the target configuration partition; After writing the new firmware into the backup partition corresponding to the target partition, the method further includes: The data of the target configuration partition is restored by using the configuration partition that is not the target configuration partition.

14. The method according to claim 1, characterized in that After booting the new firmware from the target partition, the method further includes: Erasing the original firmware in the target partition; And, erasing at least part of the data of the new firmware in the backup partition.

15. The method according to claim 14, characterized in that The target partition includes one of a boot partition, a system partition, and an application partition; and erasing at least part of the data of the new firmware in the backup partition includes: Erasing all data of the new firmware in the backup partition; Alternatively, the target partition includes the system partition and the application partition, the upgrade order of the system partition precedes that of the application partition, the new firmware corresponding to the system partition includes an upgrade program and a new system file, the new system file is written to the system partition, the new firmware corresponding to the application partition includes the upgrade program and a new application file, the new application file is written to the application partition, and the upgrade of the application partition does not perform the step of writing the new firmware to the backup partition corresponding to the target partition to back up the new firmware; and erasing at least part of the data of the new firmware in the backup partition includes: In response to successfully starting the new system file from the system partition, erasing the new system file in the backup partition corresponding to the system partition; In response to successfully starting the new application file from the application partition, erasing the upgrade program in the backup partition corresponding to the system partition.

16. The method according to claim 1, characterized in that The target partition includes a boot partition, a system partition and an application partition. The steps of obtaining the new firmware of the target partition to be written into the target memory and subsequent steps are performed on the boot partition, the system partition and the application partition in sequence according to a preset order.

17. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the firmware upgrade method according to any one of claims 1-16.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program instructions, and the program instructions can be executed to implement the firmware upgrade method according to any one of claims 1 to 16.

Citation Information

Cited By

  • Upgrade recovery method and device of electronic equipment, electronic equipment and storage medium

    CN121143719A

  • Equipment upgrading method, equipment upgrading device and computer storage medium

    CN121233147A