Firmware upgrade method and apparatus, and storage medium

By redividing the device firmware storage area and introducing a secondary boot module, the problem of insufficient firmware storage area space is solved, and efficient firmware upgrades are achieved to ensure the normal operation of the device.

WO2025200768A1PCT designated stage Publication Date: 2025-10-02HANGZHOU TUYA INFORMATION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/075057
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-27
Filing Date
2025-01-26
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In existing device firmware upgrade methods, the partition space of the firmware storage area is fixed and difficult to modify, resulting in insufficient space during frequent upgrades, making it impossible to continue upgrading and usually requiring hardware replacement to solve the problem.

Method used

By determining whether the current firmware storage area has been repartitioned, a secondary boot module is introduced to store and decompress the upgraded firmware according to the repartitioned partitions, including compressing the application firmware, and optimizing the partition structure of the firmware storage area.

Benefits of technology

This achieves efficient use of firmware storage space, simplifies the upgrade process, ensures normal operation of the device, and avoids the need for hardware replacement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025075057_02102025_PF_FP_ABST
    Figure CN2025075057_02102025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of device software. Provided are a firmware upgrade method and apparatus, and a storage medium. The firmware upgrade method comprises: determining whether a storage area of the current firmware has been repartitioned; acquiring upgrade firmware (300), wherein the upgrade firmware (300) comprises a secondary boot module (310) and compressed application firmware (320); and when the storage area of the current firmware has been repartitioned, on the basis of a partition which is obtained by means of repartitioning and in which the upgrade firmware (300) is located, decompressing the compressed application firmware (320) by means of the secondary boot module (310), so as to complete the upgrade of the current firmware. The embodiments of the present application can solve the problem of partition space being insufficient during firmware upgrade, thereby improving the space utilization rate of a firmware storage area.
Need to check novelty before this filing date? Find Prior Art

Description

Firmware upgrade method, device and storage medium Technical Field

[0001] The present application relates to the field of device software technology, and in particular to a firmware upgrade method, device, and storage medium. Background Art

[0002] Currently, a common method for upgrading device firmware is to partition the Flash memory containing the device firmware into two partitions, A and B, to load the application firmware. This existing upgrade solution requires that the A and B partitions be of equal size and meet the device's operating requirements. Once the firmware storage area is determined, it is difficult to modify it.

[0003] As business evolves, device firmware requires frequent upgrades and optimizations. During these upgrades, the firmware often needs to be upgraded but insufficient space in the running partition of the firmware storage area exists. This can prevent the firmware from being upgraded and ultimately necessitates the introduction of a new hardware solution. Summary of the Invention

[0004] According to one aspect of the present application, a firmware upgrade method is provided, comprising: determining whether a storage area of ​​a current firmware has been repartitioned; obtaining upgrade firmware, the upgrade firmware comprising a secondary boot module and compressed application firmware; and, if the storage area of ​​the current firmware has been repartitioned, decompressing the compressed application firmware through the secondary boot module according to the repartitioned partition where the upgrade firmware is located, to complete the upgrade of the current firmware.

[0005] According to some embodiments, determining whether the storage area of ​​the current firmware has been repartitioned includes: obtaining file header information of the current firmware; determining whether the current firmware is compressed application firmware based on the file header information; if the current firmware is compressed application firmware, determining that the storage area of ​​the current firmware has been repartitioned, and determining the partitions of the repartitioned storage area of ​​the current firmware through the secondary boot module; if the current firmware is not compressed application firmware, determining that the storage area of ​​the current firmware has not been repartitioned.

[0006] According to some embodiments, the storage area of ​​the current firmware includes a first partition and a second partition; the partitions after the storage area of ​​the current firmware is re-divided include a compressed partition and a running partition; obtaining the upgraded firmware includes: if the storage area of ​​the current firmware has been re-divided, storing the upgraded firmware in the compressed partition; if the storage area of ​​the current firmware has not been re-divided, storing the upgraded firmware in the first partition or the second partition.

[0007] According to some embodiments, when the storage area of ​​the current firmware is not repartitioned, the upgraded firmware is stored in the first partition or the second partition, including: when the current firmware is running in the first partition, the upgraded firmware is stored in the second partition; when the current firmware is running in the second partition, the upgraded firmware is stored in the first partition.

[0008] According to some embodiments, when the storage area of ​​the current firmware has been re-partitioned, the compressed application firmware is decompressed through the secondary boot module according to the re-partitioned partition where the upgraded firmware is located to complete the upgrade of the current firmware, including: determining that the boot partition of the system's preset first-level boot module is a compressed partition; after the system restarts, starting the second-level boot module in the compressed partition through the first-level boot module; decompressing the compressed application firmware to the running partition through the second-level boot module; modifying the boot partition of the first-level boot module to the running partition; after the system restarts, executing the application code corresponding to the application firmware obtained after decompression of the compressed application firmware in the running partition through the first-level boot module to complete the upgrade of the current firmware.

[0009] According to some embodiments, after the compressed application firmware is decompressed to the running partition through the secondary boot module, when the storage area of ​​the current firmware has been re-partitioned, the compressed application firmware is decompressed through the secondary boot module according to the re-partitioned partition where the upgraded firmware is located to complete the upgrade of the current firmware, and also includes: retaining the secondary boot module and the compressed application firmware in the compressed partition; when the current firmware upgrade is completed, after each system restart, the application firmware in the running partition is verified through the secondary boot module; and when the verification result is normal, the compressed application firmware is no longer decompressed through the secondary boot module.

[0010] According to some embodiments, the storage area of ​​the current firmware includes a first partition and a second partition; when the storage area of ​​the current firmware is not repartitioned, the first partition and the second partition are repartitioned into a compressed partition and a running partition through a secondary boot module; and the current firmware is upgraded based on the compressed partition and the running partition.

[0011] According to some embodiments, when the storage area of ​​the current firmware is not repartitioned, the first partition and the second partition are repartitioned into a compressed partition and a running partition through the secondary boot module, including: when the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the first partition, determining that the boot partition of the first boot module is the second partition; starting the secondary boot module in the second partition through the first boot module; copying the upgraded firmware to the first partition; modifying the boot partition of the first boot module to the first partition; after the system restarts, starting the secondary boot module in the first partition through the first boot module to repartition the first partition and the second partition into a compressed partition and a running partition, wherein the compressed partition is located in the first partition.

[0012] According to some embodiments, when the storage area of ​​the current firmware is not repartitioned, the first partition and the second partition are repartitioned into a compressed partition and a running partition through the secondary boot module, and it also includes: when the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the second partition, determining that the boot partition of the first boot module is the first partition; starting the secondary boot module in the first partition through the first boot module to repartition the first partition and the second partition into a compressed partition and a running partition, wherein the compressed partition is located in the first partition.

[0013] According to some embodiments, the current firmware is upgraded based on the compressed partition and the running partition, including: storing the upgraded firmware in the compressed partition; decompressing the compressed application firmware to the running partition through the secondary boot module; modifying the startup partition of the primary boot module to the running partition; after the system restarts, executing the application code corresponding to the application firmware obtained after decompressing the compressed application firmware in the running partition through the primary boot module to complete the upgrade of the current firmware.

[0014] According to one aspect of the present application, a firmware upgrade device is provided, comprising: a storage area determination unit for determining whether the storage area of ​​the current firmware has been repartitioned; an upgrade firmware acquisition unit for acquiring the upgrade firmware, the upgrade firmware comprising a secondary boot module and compressed application firmware; a firmware upgrade unit for, when the storage area of ​​the current firmware has been repartitioned, decompressing the compressed application firmware through the secondary boot module according to the repartitioned partition where the upgrade firmware is located, so as to complete the upgrade of the current firmware.

[0015] According to one aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method as described above is implemented.

[0016] According to the embodiments of the present application, by re-dividing the original storage area of ​​the device firmware, the storage space and the running space of the firmware can be separated, thereby ensuring the normal power-on operation of the device and improving the utilization rate of the firmware storage area space.

[0017] It should be understood that the foregoing general description and the following detailed description are merely illustrative and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application.

[0019] FIG1 shows a comparative schematic diagram of the re-division of the firmware storage area according to an exemplary embodiment of the present application.

[0020] FIG2 shows a flow chart of an embodiment of a firmware upgrade method according to an example of the present application.

[0021] FIG3 shows a schematic diagram of upgrading firmware according to an exemplary embodiment of the present application.

[0022] FIG4 shows a flowchart of another embodiment of a firmware upgrade method according to an example of the present application.

[0023] FIG5 shows a block diagram of a firmware upgrade device according to an exemplary embodiment of the present application.

[0024] FIG6 shows a block diagram of an electronic device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0025] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. Like reference numerals in the drawings represent like or similar parts, and thus repetitive description thereof will be omitted.

[0026] Described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of these specific details, or other modes, components, materials, devices or operations etc. can be adopted. In these cases, known structures, methods, devices, realizations, materials or operations will not be shown or described in detail.

[0027] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0028] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0029] The present application provides a firmware upgrade method, device, and storage medium, which can improve the space utilization of the firmware storage area and simplify the firmware upgrade process.

[0030] A firmware upgrade method, device, and storage medium according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0031] The following terms are used in this application:

[0032] Boot module: also known as bootloader, is the first code executed by the embedded system after power-on. After it completes the initialization of the CPU and related hardware, it loads the operating system image or solidified embedded application into the memory and then jumps to the space where the operating system is located to start the operating system.

[0033] FIG1 shows a comparative schematic diagram of the re-division of the firmware storage area according to an exemplary embodiment of the present application.

[0034] As shown in FIG. 1 , the current firmware storage area 100 includes an original program partition 110 , a current application partition 120 and other partitions 130 , wherein the current application partition 120 includes a first partition 121 and a second partition 122 .

[0035] The original program partition 110 is used to store the primary boot module and driver provided by the chip manufacturer. The primary boot module is used to guide the upgrade and operation of the firmware and cannot be modified.

[0036] The first partition 121 and the second partition 122 in the current application partition 120 are partitions for storing and running firmware in the current firmware storage area 100. The storage space of the first partition 121 and the second partition 122 are the same in size and cannot be modified.

[0037] The current firmware runs on any partition between the first partition 121 and the second partition 122. When the current firmware needs to be upgraded to a new version, a firmware upgrade device (hereinafter referred to as the upgrade device, not shown in FIG1 ) downloads the upgrade firmware to another partition corresponding to the partition where the current firmware runs (i.e., an idle partition between the first partition 121 and the second partition 122) and sets it as the boot partition of the primary boot module.

[0038] For example, when the current firmware is running in the first partition 121 , the upgrade device downloads and stores the upgrade firmware to the second partition 122 , and sets the second partition 122 as the startup partition of the primary boot module in the original program partition 110 .

[0039] After the system is restarted, the upgrading device enters the corresponding boot partition (eg, the second partition 122 ) through the primary boot module and executes the application code corresponding to the upgraded firmware to complete the upgrade of the current firmware.

[0040] The other partitions 130 are used to store parameters, file systems, and other related data required during the operation and upgrade of the firmware.

[0041] The upgrading apparatus merges the first partition 121 and the second partition 122 in the current firmware storage area 100 , and re-partitions the merged partition to obtain the updated firmware storage area 200 .

[0042] According to some embodiments, when a parameter partition (not shown in FIG. 1 ) exists in the first partition 121 and the second partition 122 , the repartitioning of the first partition 121 and the second partition 122 further includes performing parameter migration on the data in the parameter partition.

[0043] The update firmware storage area 200 includes an original factory program partition 210 , an update application partition 220 and other partitions 230 . The update application partition 220 includes a compression partition 221 and a running partition 222 .

[0044] The original program partition 210 is used to store the primary boot module and driver provided by the chip manufacturer. The primary boot module is used to guide the upgrade and operation of the firmware and cannot be modified.

[0045] The compressed partition 221 in the updated application partition 220 is located at the beginning of the first partition 121 in the current application partition 120, and its space is smaller than that of the first partition 121. The compressed partition 221 is used for storage and backup of upgraded firmware.

[0046] The space of the running partition 222 in the updated application partition 220 is larger than the space of the second partition 122 in the current application partition 120. The running partition 222 is adjacent to the compressed partition 221 and maintains 4K alignment with the compressed partition 221. The running partition 222 is used for upgrading and running the firmware.

[0047] According to some embodiments, the space of the compression partition 221 and the running partition 222 may be divided according to the space occupied by the firmware and the code compression ratio.

[0048] After the first partition 121 and the second partition 122 are re-divided to obtain the compressed partition 221 and the running partition 222, if there is still remaining space in the update firmware storage area 200, the upgrade device can additionally set an update parameter partition (not shown in Figure 1) in the update application partition 220 to improve the space utilization of the update firmware storage area 200.

[0049] The other partitions 230 are used to store parameters, file systems, and other related data required during the operation and upgrade of the firmware.

[0050] FIG2 shows a flow chart of an embodiment of a firmware upgrade method according to an example of the present application.

[0051] As shown in FIG. 2 , in step S110 , the upgrading apparatus determines whether the storage area of ​​the current firmware has been repartitioned.

[0052] For example, in step S110 , the upgrading apparatus determines whether the storage area of ​​the current firmware has been repartitioned based on the file header information of the current firmware.

[0053] After receiving the upgrade instruction sent from the cloud, the upgrade device obtains the information of the upgrade firmware corresponding to the current firmware through the upgrade instruction, including the version of the upgrade firmware and the size of the occupied space.

[0054] 3 , upgrade firmware 300 includes a secondary boot module 310, compressed application firmware 320, and file header information 330. File header information 330 includes current firmware status information, such as whether it is compressed firmware, the size of the firmware occupied space, and verification information.

[0055] According to some embodiments, when the upgrading device has been upgraded by upgrading the firmware, the upgrading device replaces the file header information of the current firmware with the file header information of the upgraded firmware through the secondary boot module.

[0056] The upgrading device determines whether the current firmware is the compressed application firmware in the upgrading firmware through the file header information of the current firmware.

[0057] In the case that the current firmware is not the compressed application firmware, the upgrading device determines that the storage area of ​​the current firmware has not been repartitioned. If the storage area of ​​the current firmware has not been repartitioned, the storage area of ​​the current firmware includes a first partition and a second partition.

[0058] If the current firmware is compressed application firmware, the upgrade device detects the file header information through the secondary boot module to determine whether the storage area of ​​the current firmware has been repartitioned. Furthermore, the upgrade device determines through the secondary boot module that the repartitioned storage area of ​​the current firmware includes a compressed partition and a running partition.

[0059] In step S120 , the upgrading device obtains the upgrading firmware.

[0060] For example, in step S120, the upgrading device obtains the upgrading firmware and stores the upgrading firmware in a corresponding partition according to the storage area of ​​the current firmware.

[0061] After obtaining the upgrade firmware through the network or the serial port, the upgrade device determines the storage location of the upgrade firmware according to the status of the storage area of ​​the current firmware.

[0062] In a case where the storage area of ​​the current firmware has been re-divided into a compression partition and a running partition, the upgrading device stores the upgraded firmware in the compression partition.

[0063] In a case where the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the first partition, the upgrading device stores the upgraded firmware in the second partition.

[0064] Likewise, when the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the second partition, the upgrading device stores the upgraded firmware in the first partition.

[0065] In step S130, when the storage area of ​​the current firmware has been repartitioned, the upgrading apparatus decompresses the compressed application firmware through the secondary boot module according to the repartitioned partition where the upgraded firmware is located, to complete the upgrade of the current firmware.

[0066] For example, in step S130, when the storage area of ​​the current firmware has been repartitioned, the upgrading apparatus decompresses the compressed application firmware to the corresponding repartitioned partitions through the secondary boot module to complete the upgrading of the current firmware.

[0067] When the storage area of ​​the current firmware has been re-divided into a compressed partition and a running partition, the upgraded firmware is stored in the compressed partition, the current firmware runs in the running partition, and the upgrading device determines that the startup partition of the primary boot module is the compressed partition.

[0068] According to some embodiments, the first-level boot module is a system preset program provided by a chip manufacturer.

[0069] After determining that the compressed partition is the boot partition of the primary boot module, the upgrade device restarts the system and starts the secondary boot module in the upgrade firmware in the compressed partition through the primary boot module after the system restarts.

[0070] The upgrade device decompresses the compressed application firmware in the upgrade firmware through the secondary boot module, and stores the application firmware obtained after decompression into the running partition.

[0071] According to some embodiments, the upgrade device decompresses the compressed application firmware from the compressed partition to the running partition through the secondary boot module, and retains the secondary boot module and the compressed application firmware in the compressed partition as a backup for the current firmware upgrade.

[0072] After decompressing the upgrade firmware, the upgrade device modifies the startup partition of the primary boot module into the running partition through the secondary boot module and performs a system restart.

[0073] After the system is restarted, the upgrade device executes the application code corresponding to the application firmware obtained after decompression of the compressed application firmware in the running partition through the first-level boot module to upgrade the current firmware until the upgrade is completed.

[0074] According to some embodiments, after the current firmware upgrade is complete, the upgrade device verifies the application firmware in the running partition via the secondary boot module each time the system restarts. If the verification result is normal, the upgrade device jumps to the upgraded application firmware via the primary boot module. If the verification result is abnormal, the upgrade device determines whether the compressed application firmware in the compressed partition is complete via the secondary boot module. If the compressed application firmware is complete, the secondary boot module decompresses the compressed application firmware in the compressed partition back to the running partition, thereby restoring the application firmware in the running partition.

[0075] According to some embodiments, when the upgrade of the current firmware is completed and the verification result of the application firmware in the running partition is normal, the upgrade device no longer decompresses the compressed application firmware in the compressed partition through the secondary boot module.

[0076] According to the embodiments of the present application, the original firmware storage area can be repartitioned, and a secondary boot module can be introduced to upgrade the firmware, thereby solving the problems of insufficient partition space and low partition utilization in the original firmware storage area due to multiple upgrades.

[0077] FIG4 shows a flowchart of another embodiment of a firmware upgrade method according to an example of the present application.

[0078] As shown in FIG4 , in step S210 , when the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the first partition, the upgrading apparatus copies the upgraded firmware from the second partition to the first partition.

[0079] When the storage area of ​​the current firmware is not repartitioned and the current firmware runs in the first partition, the upgrading device stores the acquired upgraded firmware in the second partition and determines that the startup partition of the first-level boot module is the second partition.

[0080] The upgrading device starts the secondary boot module in the upgraded firmware in the second partition through the primary boot module.

[0081] After the secondary boot module detects that it is running in the second partition, the upgrade device copies the upgrade firmware stored in the second partition to the first partition.

[0082] In step S211 , the upgrading apparatus modifies the boot partition of the primary boot module to the first partition.

[0083] For example, in step S211, the upgrading apparatus modifies the boot partition of the primary boot module into the first partition through the secondary boot module.

[0084] After copying the upgrade firmware to the first partition, the upgrade device modifies the startup partition of the first boot module to the first partition through the second boot module, and performs a system restart.

[0085] In step S220 , the upgrading apparatus repartitions the first partition and the second partition into a compressed partition and a running partition.

[0086] For example, in step S220, the upgrading apparatus re-partitions the first partition and the second partition into a compressed partition and a running partition through the secondary boot module.

[0087] In the case that the current firmware runs in the first partition, the upgrading device determines that the startup partition of the first-level boot module is the second partition.

[0088] After copying the upgrade firmware from the second partition to the first partition, the upgrade device modifies the startup partition of the first boot module to the first partition through the second boot module and performs a system restart.

[0089] After the system restarts, the upgrade device uses the primary boot module to start the secondary boot module in the first partition and merge the first and second partitions. The upgrade device then uses the secondary boot module to re-partition the merged partition into a compressed partition and a running partition and update system parameters.

[0090] According to some embodiments, the location of the repartitioned compressed partition is in the first partition.

[0091] When the current firmware is running in the second partition, the upgrading apparatus determines that the boot partition of the primary boot module is the first partition.

[0092] The upgrade device starts the secondary boot module in the first partition through the primary boot module and merges the first partition and the second partition through the secondary boot module. Then, the upgrade device re-divides the merged partition into a compressed partition and a running partition through the secondary boot module and updates the system parameters.

[0093] In step S230 , the upgrading apparatus decompresses the compressed application firmware from the compression partition to the running partition.

[0094] For example, in step S230, the upgrading device decompresses the compressed application firmware from the compression partition to the running partition through the secondary boot module.

[0095] After the first partition and the second partition of the current firmware are re-divided into a compression partition and a running partition, the upgrading device stores the upgraded firmware in the compression partition.

[0096] The upgrade device decompresses the compressed application attachments in the upgrade firmware to the running partition through the secondary boot module, and obtains the decompressed application firmware.

[0097] In step S240, the upgrading apparatus modifies the boot partition of the primary boot module into a running partition.

[0098] For example, in step S240, the upgrading device modifies the boot partition of the primary boot module through the secondary boot module.

[0099] After decompressing the compressed application firmware to the running partition, the upgrading device modifies the startup partition of the primary boot module from the first partition to the running partition through the secondary boot module, and performs a system restart.

[0100] In step S250 , the upgrading apparatus performs an upgrade of the current firmware.

[0101] For example, in step S250, the upgrading apparatus performs an upgrade of the current firmware according to the application code corresponding to the application firmware.

[0102] After the boot partition of the primary boot module is modified to the running partition and the system is restarted, the upgrade device executes the application code corresponding to the application firmware obtained by decompressing the compressed application firmware in the running partition through the primary boot module to complete the upgrade of the current firmware.

[0103] According to some embodiments, after the current firmware upgrade is complete, the upgrade device verifies the application firmware in the running partition via the secondary boot module each time the system restarts. If the verification result is normal, the upgrade device jumps to the upgraded application firmware via the primary boot module. If the verification result is abnormal, the upgrade device determines whether the compressed application firmware in the compressed partition is complete via the secondary boot module. If the compressed application firmware is complete, the secondary boot module decompresses the compressed application firmware in the compressed partition back to the running partition, thereby restoring the application firmware in the running partition.

[0104] According to some embodiments, when the upgrade of the current firmware is completed and the verification result of the application firmware in the running partition is normal, the upgrade device no longer decompresses the compressed application firmware in the compressed partition through the secondary boot module.

[0105] According to the embodiment of the present application, the modification of the system can be pre-processed by the secondary boot module, so that the process of re-dividing the storage area of ​​the current firmware and upgrading the current firmware is more flexible and efficient.

[0106] FIG5 shows a block diagram of a firmware upgrade device according to an exemplary embodiment of the present application.

[0107] As shown in FIG. 5 , the upgrading apparatus 400 includes a storage area determining unit 410 , an upgrading firmware obtaining unit 420 , and a firmware upgrading unit 430 .

[0108] After receiving the upgrade instruction sent from the cloud, the storage area determination unit 410 obtains information of the upgrade firmware corresponding to the current firmware through the upgrade instruction.

[0109] The storage area determination unit 410 obtains file header information of the current firmware, and determines whether the current firmware is the compressed application firmware in the upgrade firmware based on the file header information of the current firmware.

[0110] In a case where the current firmware is not the compressed application firmware, the storage area determining unit 410 determines that the storage area of ​​the current firmware is not repartitioned.

[0111] If the current firmware is compressed application firmware, the storage area determination unit 410 detects the file header information through the secondary boot module to determine that the storage area of ​​the current firmware has been repartitioned. Furthermore, the storage area determination unit 410 determines through the secondary boot module that the repartitioned storage area of ​​the current firmware includes a compressed partition and a run partition.

[0112] After acquiring the upgrade firmware, the upgrade firmware acquisition unit 420 determines the storage location of the upgrade firmware according to the status of the storage area of ​​the current firmware.

[0113] According to some embodiments, the upgrade firmware obtaining unit 420 may obtain the upgrade firmware via a network or a serial port.

[0114] In the case that the storage area of ​​the current firmware has been re-divided into a compression partition and a running partition, the upgrade firmware obtaining unit 420 stores the upgrade firmware in the compression partition.

[0115] In the case that the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the first partition, the upgrade firmware obtaining unit 420 stores the upgrade firmware in the second partition.

[0116] In a case where the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the second partition, the upgrade firmware obtaining unit 420 stores the upgrade firmware in the first partition.

[0117] When the storage area of ​​the current firmware has been re-divided into a compressed partition and a running partition, the upgraded firmware is stored in the compressed partition and the current firmware runs in the running partition. The firmware upgrade unit 430 determines that the boot partition of the primary boot module is a compressed partition.

[0118] After determining that the compressed partition is the boot partition of the primary boot module, the firmware upgrade unit 430 performs a system restart and starts the secondary boot module in the upgraded firmware in the compressed partition through the primary boot module after the system restarts.

[0119] The firmware upgrade unit 430 decompresses the compressed application firmware in the upgrade firmware through the secondary boot module, and stores the decompressed application firmware in the running partition.

[0120] After decompressing the upgraded firmware, the firmware upgrade unit 430 modifies the boot partition of the primary boot module into a running partition through the secondary boot module, and performs a system restart.

[0121] After the system is restarted, the firmware upgrade unit 430 executes the application code corresponding to the application firmware obtained by decompressing the compressed application firmware in the running partition through the first-level boot module to upgrade the current firmware until the upgrade is completed.

[0122] If the storage area of ​​the current firmware is not repartitioned and the current firmware runs in the first partition, the firmware upgrade unit 430 stores the acquired upgrade firmware in the second partition and determines that the startup partition of the first-level boot module is the second partition.

[0123] The firmware upgrade unit 430 starts the secondary boot module in the upgraded firmware in the second partition through the primary boot module.

[0124] After the secondary boot module detects that it is running in the second partition, the firmware upgrade unit 430 copies the upgrade firmware stored in the second partition to the first partition.

[0125] After copying the upgraded firmware to the first partition, the firmware upgrade unit 430 modifies the boot partition of the primary boot module to the first partition through the secondary boot module and performs a system restart.

[0126] After the system restarts, the firmware upgrade unit 430 uses the primary boot module to start the secondary boot module in the first partition and merges the first partition and the second partition through the secondary boot module. The firmware upgrade unit 430 then uses the secondary boot module to re-partition the merged partition into a compressed partition and a running partition and updates the system parameters.

[0127] In the case that the current firmware is running in the second partition, the firmware upgrade unit 430 determines that the boot partition of the primary boot module is the first partition.

[0128] The firmware upgrade unit 430 starts the secondary boot module in the first partition through the primary boot module and merges the first partition and the second partition through the secondary boot module. Then, the firmware upgrade unit 430 re-divides the merged partition into a compressed partition and a running partition through the secondary boot module and updates the system parameters.

[0129] After the first partition and the second partition of the current firmware are re-divided into a compression partition and a running partition, the firmware upgrading unit 430 stores the upgraded firmware in the compression partition.

[0130] The firmware upgrade unit 430 decompresses the compressed application attachments in the upgrade firmware to the running partition through the secondary boot module, and obtains the decompressed application firmware.

[0131] After decompressing the compressed application firmware into the running partition, the firmware upgrade unit 430 modifies the boot partition of the primary boot module from the first partition to the running partition through the secondary boot module, and performs a system restart.

[0132] After the boot partition of the first-level boot module is modified to the running partition and the system restart is completed, the firmware upgrade unit 430 executes the application code corresponding to the application firmware obtained by decompressing the compressed application firmware in the running partition through the first-level boot module to complete the upgrade of the current firmware.

[0133] According to some embodiments, when the upgrade of the current firmware is completed, the firmware upgrade unit 430 verifies the application firmware in the running partition through the secondary boot module each time the system is restarted. If the verification result is normal, the firmware upgrade unit 430 jumps to the upgraded application firmware through the primary boot module. If the verification result is abnormal, the firmware upgrade unit 430 determines whether the compressed application firmware in the compressed partition is complete through the secondary boot module. If the compressed application firmware is complete, the compressed application firmware in the compressed partition is re-decompressed to the running partition through the secondary boot module to restore the application firmware in the running partition.

[0134] According to some embodiments, when the upgrade of the current firmware is completed and the verification result of the application firmware in the running partition is normal, the firmware upgrade unit 430 no longer decompresses the compressed application firmware in the compressed partition through the secondary boot module.

[0135] FIG6 shows a block diagram of an electronic device according to an exemplary embodiment of the present application.

[0136] As shown in FIG6 , the electronic device 600 is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0137] As shown in Figure 6, electronic device 600 is presented in the form of a general-purpose computing device. Components of electronic device 600 may include, but are not limited to, at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including storage unit 620 and processing unit 610), a display unit 640, and the like. The storage unit stores program code, which can be executed by processing unit 610, causing processing unit 610 to perform the methods described in this specification according to various exemplary embodiments of the present application. For example, processing unit 610 may perform the method shown in Figure 2.

[0138] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0139] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0140] Bus 630 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0141] The electronic device 600 can also communicate with one or more external devices 700 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 650. Furthermore, the electronic device 600 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 660. The network adapter 660 can communicate with other modules of the electronic device 600 via the bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the electronic device 600, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0142] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. The technical solution according to the embodiment of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal or a network device, etc.) to execute the method according to the embodiment of the present application.

[0143] The software product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0144] Computer-readable storage media may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0145] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, and the like, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0146] The computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the computer-readable medium implements the aforementioned functions.

[0147] Those skilled in the art will appreciate that the modules described above can be distributed in the device according to the description of the embodiment, or can be modified accordingly to be used in one or more devices that are different from the embodiment. The modules of the above embodiment can be combined into one module or further divided into multiple submodules.

[0148] According to some embodiments of the present application, the technical solution of the present application can realize the redivision of the original storage area of ​​the firmware and introduce a secondary boot module, thereby optimizing the firmware upgrade process, improving the utilization rate of the firmware storage area space, and ensuring the normal power-on operation of the device.

[0149] The above embodiments of the present application are described in detail. The description of the above embodiments is only intended to help understand the method and core concept of the present application. At the same time, changes or modifications made by those skilled in the art based on the concept of the present application, the specific implementation methods and the scope of application of the present application, all fall within the scope of protection of the present application. In summary, the contents of this specification should not be understood as limiting the present application.

Claims

1. A method for upgrading firmware, characterized in that: include: Determine whether the storage area of ​​the current firmware has been repartitioned; Obtaining upgrade firmware, wherein the upgrade firmware includes a secondary boot module and compressed application firmware; In the case that the storage area of ​​the current firmware has been repartitioned, the compressed application firmware is decompressed by the secondary boot module according to the repartitioned partition where the upgrade firmware is located, so as to complete the upgrade of the current firmware.

2. The method according to claim 1, characterized in that Determine whether the current firmware's storage area has been repartitioned, including: Obtaining file header information of the current firmware; determining, according to the file header information, whether the current firmware is the compressed application firmware; In a case where the current firmware is the compressed application firmware, determining that the storage area of ​​the current firmware has been repartitioned, and determining the partitions of the repartitioned storage area of ​​the current firmware through the secondary boot module; In a case where the current firmware is not the compressed application firmware, it is determined that the storage area of ​​the current firmware is not repartitioned.

3. The method according to claim 2, characterized in that The storage area of ​​the current firmware includes a first partition and a second partition; the partitions after the storage area of ​​the current firmware is re-divided include a compression partition and a running partition; Get the upgraded firmware, including: If the storage area of ​​the current firmware has been repartitioned, storing the upgraded firmware in the compressed partition; When the storage area of ​​the current firmware is not repartitioned, the upgraded firmware is stored in the first partition or the second partition.

4. The method according to claim 3, characterized in that When the storage area of ​​the current firmware is not repartitioned, storing the upgraded firmware in the first partition or the second partition includes: When the current firmware is running in the first partition, storing the upgraded firmware in the second partition; When the current firmware is running in the second partition, the upgraded firmware is stored in the first partition.

5. The method according to claim 3, characterized in that In a case where the storage area of ​​the current firmware has been repartitioned, decompressing the compressed application firmware by the secondary boot module according to the repartitioned partition where the upgrade firmware is located to complete the upgrade of the current firmware includes: Determine that the boot partition of the system's preset first-level boot module is the compressed partition; After the system is restarted, the secondary boot module is started in the compressed partition through the primary boot module; Decompressing the compressed application firmware to the running partition through the secondary boot module; Modifying the boot partition of the primary boot module to the running partition; After the system is restarted, the application code corresponding to the application firmware obtained by decompressing the compressed application firmware is executed in the running partition by the primary boot module to complete the upgrade of the current firmware.

6. The method according to claim 5, characterized in that After the compressed application firmware is decompressed into the running partition by the secondary boot module, if the storage area of ​​the current firmware has been repartitioned, the compressed application firmware is decompressed by the secondary boot module according to the repartitioned partition where the upgrade firmware is located, so as to complete the upgrade of the current firmware, further comprising: retaining the secondary boot module and the compressed application firmware in the compressed partition; When the current firmware upgrade is completed, after each system restart, the application firmware in the running partition is verified by the secondary boot module; and If the verification result is normal, the compressed application firmware is no longer decompressed by the secondary boot module.

7. The method according to claim 1, characterized in that The storage area of ​​the current firmware includes a first partition and a second partition; the method further includes: In a case where the storage area of ​​the current firmware is not repartitioned, repartitioning the first partition and the second partition into a compression partition and a running partition by the secondary boot module; The current firmware is upgraded based on the compressed partition and the running partition.

8. The method according to claim 7, characterized in that In a case where the storage area of ​​the current firmware is not repartitioned, repartitioning the first partition and the second partition into a compressed partition and a running partition by the secondary boot module includes: If the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the first partition, determining that the boot partition of the primary boot module is the second partition; Starting the secondary boot module in the second partition through the primary boot module; Copying the upgraded firmware to the first partition; Modify the boot partition of the first-level boot module to the first partition; After the system restarts, the secondary boot module is started in the first partition through the primary boot module to re-divide the first partition and the second partition into the compressed partition and the running partition, wherein the compressed partition is located in the first partition.

9. The method according to claim 7, characterized in that In a case where the storage area of ​​the current firmware is not repartitioned, repartitioning the first partition and the second partition into a compressed partition and a running partition by the secondary boot module further includes: If the storage area of ​​the current firmware is not repartitioned and the current firmware is running in the second partition, determining that the boot partition of the primary boot module is the first partition; The secondary boot module is started in the first partition through the primary boot module to repartition the first partition and the second partition into the compressed partition and the running partition, wherein the compressed partition is located in the first partition.

10. The method according to claim 8 or 9, characterized in that Upgrading the current firmware based on the compressed partition and the running partition includes: Storing the upgraded firmware in the compressed partition; Decompressing the compressed application firmware to the running partition through the secondary boot module; Modifying the boot partition of the primary boot module to the running partition; After the system is restarted, the application code corresponding to the application firmware obtained by decompressing the compressed application firmware is executed in the running partition by the primary boot module to complete the upgrade of the current firmware.

11. A firmware upgrade device, characterized in that: include: a storage area determination unit, configured to determine whether the storage area of ​​the current firmware has been repartitioned; An upgrade firmware acquisition unit, configured to acquire upgrade firmware, wherein the upgrade firmware includes a secondary boot module and compressed application firmware; The firmware upgrade unit is used to decompress the compressed application firmware through the secondary boot module according to the re-partitioned partition where the upgrade firmware is located, so as to complete the upgrade of the current firmware when the storage area of ​​the current firmware has been re-partitioned.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Method and system for remote upgrade supporting firmware automatic recovery function

    CN107247603A

  • Firmware upgrading method and device for embedded equipment, terminal and storage medium

    CN113225397A

  • System firmware upgrading method and device and server

    CN116932010A

  • Firmware upgrading method, electronic equipment and storage medium

    CN116974617A

  • Firmware upgrading method and device and storage medium

    CN118034754A