CN114035818B - Firmware upgrade method, device, computer equipment and storage medium - Google Patents

Firmware upgrade method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN114035818B
CN114035818B CN202111239446.6A CN202111239446A CN114035818B CN 114035818 B CN114035818 B CN 114035818B CN 202111239446 A CN202111239446 A CN 202111239446A CN 114035818 B CN114035818 B CN 114035818B
Authority
CN
China
Prior art keywords
partition
target data
upgrade
firmware
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111239446.6A
Other languages
Chinese (zh)
Other versions
CN114035818A (en
Inventor
詹永杰
陈金福
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Lianzhou International Technology Co ltd
Original Assignee
Chengdu Lianzhou International Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Lianzhou International Technology Co ltd filed Critical Chengdu Lianzhou International Technology Co ltd
Priority to CN202111239446.6A priority Critical patent/CN114035818B/en
Publication of CN114035818A publication Critical patent/CN114035818A/en
Application granted granted Critical
Publication of CN114035818B publication Critical patent/CN114035818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operations
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operations
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

本申请公开了一种固件升级方法、装置、计算机设备和存储介质。该方法包括:与服务器建立连接,并从服务器获取新固件,以及将新固件中包含的第一目标数据、第二目标数据和第三目标数据分别写入嵌入式设备的校验分区、功能分区和升级分区,该新固件用于对嵌入式设备进行固件升级,若在进行固件升级时该嵌入式设备重启,且第一目标数据写入校验分区时未发生异常,以及第三目标数据写入升级分区时发生异常,并且功能分区是否已备份第三目标数据,则根据功能分区备份的第三目标数据对升级分区进行数据恢复,并返回执行与服务器建立连接并从服务器获取新固件的步骤,从而在有效降低升级损坏可能性的同时,节省存储空间的使用,进而降低成本。

The present application discloses a firmware upgrade method, device, computer equipment and storage medium. The method includes: establishing a connection with a server, obtaining new firmware from the server, and writing the first target data, the second target data and the third target data contained in the new firmware into the check partition, the function partition and the upgrade partition of the embedded device respectively, the new firmware is used to perform firmware upgrade on the embedded device, if the embedded device is restarted during the firmware upgrade, and no abnormality occurs when the first target data is written into the check partition, and an abnormality occurs when the third target data is written into the upgrade partition, and whether the function partition has backed up the third target data, then data recovery is performed on the upgrade partition according to the third target data backed up by the function partition, and the steps of establishing a connection with the server and obtaining the new firmware from the server are returned, thereby effectively reducing the possibility of damage during the upgrade while saving the use of storage space, thereby reducing costs.

Description

Firmware upgrading method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a firmware upgrade method, apparatus, computer device, and storage medium.
Background
In recent years, embedded devices have been widely used and rapidly developed due to their low cost, high reliability, rich code, and a series of advantages such as application expandability, portability, etc. With the improvement of requirements on system functions, performance, scale and the like of the embedded equipment, firmware of the embedded equipment needs to be upgraded in the use process of the embedded equipment, so that the system can be maintained and upgraded in time according to the requirements of customers, and the performance of the system is improved.
At present, the embedded device performs firmware upgrade by downloading new firmware from the cloud and then writing the new firmware, so as to avoid the consequences of abnormal writing of the new firmware, data loss and the like caused by sudden power failure and the like in the upgrade process, and the new firmware needs to be backed up so as to restore the firmware upgrade when the situation occurs. However, backing up new firmware requires additional storage space, resulting in increased costs.
Disclosure of Invention
The embodiment of the application provides a firmware upgrading method, a device, computer equipment and a storage medium, which can save storage space while ensuring the stability and reliability of firmware upgrading, thereby reducing cost.
In a first aspect, an embodiment of the present application provides a firmware upgrade method, applied to an embedded device, where the embedded device includes a flash memory, and the flash memory includes a check partition, a functional partition, and an upgrade partition, and the method includes:
Establishing connection with a server, acquiring new firmware from the server, and writing first target data, second target data and third target data contained in the new firmware into the check partition, the functional partition and the upgrade partition respectively, wherein the new firmware is used for carrying out firmware upgrade on the embedded equipment;
If the embedded equipment is restarted when the firmware is upgraded, judging whether the first target data is abnormal when being written into the check partition or not through a boot loader of the embedded equipment;
If no abnormality occurs when the first target data is written into the check partition, judging whether the third target data is abnormal when the third target data is written into the upgrade partition through the boot loader;
If the third target data is abnormal when being written into the upgrading partition, judging whether the functional partition has backed up the third target data or not through the boot loader;
if the functional partition has backed up the third target data, carrying out data recovery on the upgrading partition according to the backed up third target data in the functional partition;
And returning to the step of establishing connection with the server and acquiring new firmware from the server.
In the firmware upgrading method provided in the embodiment of the present application, if no abnormality occurs when the first target data is written into the check partition, the check partition stores the first data identifier of the third target data, and the judging, by the boot loader, whether the abnormality occurs when the third target data is written into the upgrade partition includes:
acquiring a first current data identifier corresponding to first current data in the upgrading partition through the boot loader;
If the first current data identifier is consistent with the first data identifier, determining that the third target data is written into the ascending partition without abnormality or
If the first current data identifier is inconsistent with the first data identifier, determining that the third target data is abnormal when being written into the upgrading partition.
In the firmware upgrading method provided by the embodiment of the present application, the step of determining, by the boot loader, whether the functional partition has backed up the third target data includes:
acquiring a second current data identifier corresponding to second current data in the functional partition;
If the second current data identification is consistent with the first data identification, determining that the functional partition has backed up the third target data, or
And if the second current data identifier is inconsistent with the first data identifier, determining that the functional partition does not backup the third target data.
In the firmware upgrading method provided by the embodiment of the present application, after the determining that the functional partition does not backup the third target data, the method further includes:
And returning to the step of establishing connection with the server and acquiring new firmware from the server.
In the firmware upgrading method provided by the embodiment of the present application, if no abnormality occurs when the first target data is written into the check partition, the check partition further stores a second data identifier corresponding to the second target data, and the method further includes:
if the third target data is written into the ascending partition and is not abnormal, acquiring a third current data identifier corresponding to third current data in the functional partition through the boot loader;
If the third current data identifier is inconsistent with the second data identifier, determining that the second target data is abnormal when being written into the functional partition;
And returning to the step of establishing connection with the server and acquiring new firmware from the server.
In the firmware upgrading method provided by the embodiment of the present application, the determining, by the boot loader of the embedded device, whether an exception occurs when the first target data is written into the check partition includes:
Reading fourth current data in the check partition through the boot loader;
If the fourth current data is in the preset format, determining that no abnormality occurs when the first target data is written into the check partition;
if the fourth current data is not in the preset format, determining that the first target data is abnormal when being written into the check partition.
The firmware upgrading method provided by the embodiment of the application further comprises the following steps:
and if the first target data is abnormal when being written into the check partition, returning to the step of establishing connection with the server and acquiring new firmware from the server.
In a second aspect, an embodiment of the present application further provides a firmware upgrade apparatus, which is applied to an embedded device, where the embedded device includes a flash memory, and the flash memory includes a check partition, a functional partition, and an upgrade partition, and the apparatus includes:
the system comprises an acquisition module, a verification partition, a function partition and an upgrade partition, wherein the acquisition module is used for establishing connection with a server, acquiring new firmware from the server, and writing first target data, second target data and third target data contained in the new firmware into the verification partition, the function partition and the upgrade partition respectively, wherein the new firmware is used for carrying out firmware upgrade on the embedded equipment;
The first judging module is used for judging whether the first target data is abnormal when being written into the check partition through a boot loader of the embedded equipment if the embedded equipment is restarted when the firmware is upgraded;
the second judging module is used for judging whether the first target data is abnormal when being written into the upgrading partition or not through the boot loader if the first target data is not abnormal when being written into the verifying partition;
The third judging module is used for judging whether the functional partition has backed up the third target data through the boot loader if the third target data is abnormal when being written into the upgrading partition;
And the recovery module is used for carrying out data recovery on the upgrading partition according to the backed-up third target data in the functional partition if the functional partition has backed-up the third target data, and returning to the acquisition module and executing the function of the acquisition module.
In a third aspect, an embodiment of the present application further provides a computer device, including a memory, a processor and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect described above when the processor executes the computer program.
In a fourth aspect, embodiments of the present application also provide a storage medium having a computer program stored thereon, wherein the computer program when executed by a processor implements the steps of the method according to the first aspect described above.
The embodiment of the application provides a firmware upgrading method, a device, computer equipment and a storage medium, wherein the upgrading method comprises the steps of establishing connection with a server, acquiring new firmware from the server, writing first target data, second target data and third target data contained in the new firmware into a check partition, a functional partition and an upgrading partition of an embedded device respectively, wherein the new firmware is used for carrying out firmware upgrading on the embedded device, if the embedded device is restarted when the firmware is upgraded, no abnormality occurs when the first target data is written into the check partition, and abnormality occurs when the third target data is written into the upgrading partition, and if the third target data is backed up by the functional partition, carrying out data recovery on the upgrading partition according to the third target data backed up by the functional partition, and returning to execute the steps of establishing connection with the server and acquiring the new firmware from the server. According to the application, the upgrading partition is backed up through the functional partition without additional storage space, so that the possibility of upgrading damage is effectively reduced, the use of the storage space is saved, and the cost is further reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a firmware upgrade method according to an embodiment of the present application.
FIG. 2 is a schematic diagram of a partition of firmware provided by an embodiment of the present application;
FIG. 3 is a process diagram of a firmware upgrade method according to an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a firmware upgrade method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a firmware upgrade apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The embodiment of the application provides a firmware upgrading method, a firmware upgrading device, computer equipment and a storage medium. Specifically, the present embodiment provides a firmware upgrade method applicable to a firmware upgrade apparatus that may be integrated in a computer device.
Referring to fig. 1, fig. 1 shows a flowchart of a firmware upgrade method described in an embodiment of the present application, where the firmware upgrade method is applied to an embedded device, the embedded device includes a flash memory, the flash memory includes a check partition, a functional partition, and an upgrade partition, and the method mainly includes steps 101 to 105, which are described as follows:
For easy understanding, the partition design and the writing design of each partition in the upgrading process provided by the application will be described in detail first.
Referring to fig. 2, fig. 2 is a schematic diagram of a flash partition design according to an embodiment of the present application, which may mainly include a partition that is not modified, an upgrade partition, a functional partition, and a check partition. The partitions which are not modified frequently may include a U-Boot partition, a configuration file partition, a product information partition and the like. The upgrade partition stores a complete upgrade system, including a kernel, files necessary for running a root file system, and files necessary for all firmware upgrades. The functional partition stores a functional system, including all programs and related files, that fulfill the product requirements. And checking the partition, and storing an MD5 (MessageDigestAlgorithmMD, message digest algorithm) value calculated according to the upgrading partition and an MD5 value calculated according to the functional partition, wherein the MD5 value and the MD5 value are used for judging whether the upgrading partition or the functional partition is damaged in the U-Boot.
It will be readily appreciated that the root file system may be split into two parts at release, a first part comprising the files necessary to run the root file system and all the files necessary for firmware upgrade (upgrade system), and a second part comprising all the programs and related files to fulfill the product requirements (functional system). The kernel and the upgrade system are combined together as an upgrade partition when the boot media is made. The U-Boot obtains the size of the kernel by reading the kernel compression header information and the like, so as to calculate the starting address of the upgrade partition, and the starting address is provided for the kernel to construct an MTD (Memory TechnologeDevicec, memory technology device) partition. The functional system is independently stored in a functional partition, the upgrading partition is loaded after the kernel is started, and then whether the functional partition is loaded is determined according to command line parameters transmitted by the U-Boot. If a functional partition is loaded, the functional systems in the loaded functional partition are somehow merged with the upgrade systems in the loaded upgrade partition and then run the programs of the relevant functions of the product requirements. If the functional partition is not loaded, the automatic upgrade software in the upgrade partition is run, and the automatic networking upgrade resumes the firmware.
Referring to fig. 3, fig. 3 shows a schematic diagram of a writing process of each partition in a normal upgrade process, firstly, downloading new firmware from a cloud, then writing a check partition of the new firmware into a check partition (step 1) of a flash (flash), then writing an upgrade partition of the new firmware into a functional partition of the flash as a backup of the upgrade partition (step 2), then writing an upgrade partition of the new firmware into an upgrade partition of the flash (step 3), and then writing a functional partition of the new firmware into a functional partition of the flash (step 4), thereby completing the upgrade.
It should be appreciated that in order to backup the contents of an upgrade partition using a functional partition during an upgrade, the upgrade partition and the functional partition must be kept uniform in size. Or the data content of the upgrade partition can be compressed and backed up to the functional partition under the condition that the upgrade partition is too large and the functional partition is more idle. The compression can be performed when the new firmware is manufactured, so that the file size of the transmitted new firmware can be reduced, and the computing overhead of the compressed file can be saved at the equipment end.
Specifically, before writing the upgrade partition of the new firmware into the upgrade partition of the flash, writing the upgrade partition of the new firmware into the functional partition of the flash for backup, so that if step2 is abnormal, the state before upgrade can be ensured to be maintained in the upgrade partition, and if step3 is abnormal, the content of the upgrade partition of the new firmware backed up in the functional partition in the flash can be used for recovering the content of the upgrade partition in the flash, so that the correct kernel, files necessary for running the root file system and files necessary for upgrading all the firmware are ensured to be always stored in the upgrade partition.
It is noted that for partitions that are not frequently modified, each partition in the new firmware may be marked as new firmware is released to determine whether it needs to be erased. In addition, compared with upgrading partitions and functional partitions, the partitions which are not modified frequently are small in size, high in erasing speed and not easy to cause abnormality. When erasing, erasing is performed according to the data blocks, and when the contents of each data block are compared, the erasing is not needed, so that the erasing speed is increased, and the possibility of occurrence of abnormality is reduced.
According to the partition design provided by the embodiment of the application, the root file system is split into the upgrade partition and the functional partition, then the product function is realized by simply combining the partitions, the partition writing sequence in the upgrade process is skillfully designed, the functional partition is utilized to store the data backup of the upgrade partition, and no extra flash memory space is needed to be added for backup, so that the storage space is saved, and meanwhile, the upgrade recovery system can be started under the condition that the data is damaged due to abnormal power failure in any step in the upgrade process.
And 101, establishing connection with a server, acquiring new firmware from the server, and writing first target data, second target data and third target data contained in the new firmware into a check partition, a functional partition and an upgrade partition respectively, wherein the new firmware is used for upgrading the firmware of the embedded equipment.
The first target data are data in a verification partition in the new firmware, the second target data are data in a functional service in the new firmware, the third target data are data in an upgrade partition in the new firmware, and the sequence of writing the first target data, the second target data and the third target data into the flash memory is strictly written according to the sequence. If no abnormality occurs in the writing process, the upgrading is successful.
Step 102, if the embedded device is restarted when the firmware is upgraded, judging whether an abnormality occurs when the first target data is written into the check partition through a boot loader of the embedded device, if so, executing step 101, and if not, executing step 103.
The Bootloader is a Bootloader commonly used in embedded systems, and the Bootloader is a small section of program executed before the operation system runs, through which, we can initialize hardware devices and build a mapping table of memory space, thereby building a proper software and hardware environment, and preparing for finally calling the kernel of the operation system. The main running task of the BootLoader is to read the kernel image from the hard disk into the RAM, and then jump to the entry point of the kernel to run, i.e. start to start the operating system. The system typically starts executing at address 0x00000000 at power up or reset, and what is typically arranged at this address is the BootLoader program of the system.
As can be seen from the above, the upgrade partition of the flash memory of the embedded device stores the files necessary for running the root file system and the files necessary for upgrading all the firmware, so that it is necessary to ensure that the content stored in the upgrade partition always maintains an operable state, that is, stores correct data before update or correct data after update.
After the upgrade is successful, the embedded device may be restarted automatically, at this time, it may be determined by the boot loader of the embedded device that no exception occurs when the first target data is written into the check partition, and step 103 is executed. If the embedded device is abnormally powered off in the upgrade process, for example, when the power supply is suddenly powered off and the like are encountered, the boot loader judges whether the first target data writing check partition is abnormal or not when the embedded device is restarted, if not, the first target data writing check partition can be considered to be not abnormal, then step 103 is executed, whether the third target data is normally written into the upgrade partition is continuously judged, if the boot loader judges that the first target data writing check partition is abnormal, the upgrade partition can be considered to not be subjected to the write operation, further, the correct data before the upgrade is stored in the upgrade partition, namely, the content stored in the upgrade partition is kept in an operable state, then the execution step 101 is returned to be executed, namely, connection is established again with the server, new firmware is acquired from the server, and firmware upgrade is carried out again.
Specifically, step 102 may mainly include reading, by the boot loader, fourth current data in the check partition, if the fourth current data is in a preset format, determining that no abnormality occurs when the first target data is written into the check partition, and if the fourth current data is not in the preset format, determining that an abnormality occurs when the first target data is written into the check partition.
The check partition stores data identifiers of the upgrade partition and the functional partition, for example, stores an MD5 value calculated according to data of the upgrade partition and the functional partition, the MD5 value is a hexadecimal number string with a certain length, and whether the first target data is abnormal when written into the check partition can be determined by reading current data in the check partition and judging the format of the current data in the check partition.
It is easy to understand that, in the process of writing data, that is, in the process of erasing, if an abnormal power failure occurs in the process of erasing, the length of the current data of the check partition will not conform to the actual length, so it can be determined whether an abnormality occurs when the first target data is written into the check partition by determining whether the length of the current data conforms to the preset length.
For example, if the second target data is "hsolngffbkop-phnnm, i [", the MD5 value calculated from the second target data is "C9A8B387E5CDAF F", the third target data is "gyighuojniojio", and the MD5 value calculated from the third target data is "12111ACCA8B2E394", it can be determined whether or not an abnormality occurs when the first target data is written into the parity partition by determining whether or not the current data of the parity partition is two sixteen bytes of data.
Step 103, judging whether the third target data is abnormal when being written into the upgrade partition through the boot loader, if so, executing step 104, and if not, executing step 101.
It is easy to understand that the check partition in the new firmware stores the first data identifier of the third target data and the second data identifier of the second target data, if the first target data is written into the check partition and is not abnormal, the current check partition stores the first data identifier, and step 103 mainly may include obtaining, by the boot loader, the first current data identifier corresponding to the first current data in the upgrade partition, if the first current data identifier is consistent with the first data identifier, determining that the third target data is not abnormal when being written into the upgrade partition, or if the first current data identifier is inconsistent with the first data identifier, determining that the third target data is abnormal when being written into the upgrade partition.
The first data identifier may be an MD5 value calculated according to the third target data, the second data identifier may be an MD5 value calculated according to the second target data, and similarly, the first current data identifier may also be an MD5 value calculated according to the first current data. Or the first data identifier may be a version number of the third target data, the version number may be carried at the tail of the third target data, and similarly, the first current data identifier may also be a version number carried at the tail of the first current data, if the writing of the third target data into the upgrade partition is completed, the version number obtained by the U-Boot should be consistent with the first data identifier, and if the writing of the third target data into the upgrade partition is not completed or the writing of the third target data into the upgrade partition is not completed, the version number obtained by the U-Boot should be inconsistent with the first data identifier.
It is easy to understand that if the first current data identifier is consistent with the first data identifier, it may be considered that the third target data has been successfully written into the upgrade partition, and at this time, a new complete upgrade system is stored in the upgrade partition, and then step 101 may be directly executed in a return manner, that is, the firmware is obtained by re-networking, so as to perform firmware upgrade again. If the first current data identifier is inconsistent with the first data identifier, it may be considered that the third target data is not successfully written into the upgrade partition, and at this time, it needs to be determined whether to power off when writing or power off when not writing, that is, step 104 is executed.
Step 104, judging whether the functional partition has backed up the third target data or not through the boot loader, if yes, executing step 105, and if not, executing step 101.
Specifically, step 104 may include obtaining a second current data identifier corresponding to the second current data in the functional partition, determining that the functional partition has backed up the third target data if the second current data identifier is consistent with the first data identifier, or determining that the functional partition has not backed up the third target data if the second current data identifier is inconsistent with the first data identifier.
It is easy to understand that the check partition in the new firmware stores the first data identifier of the third target data and the second data identifier of the second target data, and if the first target data written into the check partition is not abnormal, the current check partition stores the first data identifier. If the functional partition is backed up with the third target data, the second current data identifier corresponding to the second current data in the functional partition should be consistent with the first data identifier, and if the functional partition is not backed up with the third target data, the second current data identifier corresponding to the second current data in the functional partition is inconsistent with the first data identifier.
In the above-mentioned manner, under normal conditions, the writing sequence of the data is that the third target data is backed up in the functional partition first, and then the third target data is written into the upgrade partition. Therefore, if it is determined that the functional partition does not backup the third target data, it may be considered that the upgrade partition further stores correct data before the update, that is, the operation-enabled state is maintained, and the process may directly return to step 101, and establish connection with the server again and update again. If it is determined that the functional partition is backed up with the third target data, it can be considered that abnormal power failure occurs when the third target data is written into the upgrade partition, and at this time, the upgrade partition does not store correct data before update or correct data after update, and in a subsequent step, the upgrade partition is restored according to the third target data backed up by the functional partition, and then is re-networked and re-updated.
In some embodiments, if no abnormality occurs when the first target data is written into the check partition, the check partition further stores a second data identifier corresponding to the second target data, and the method may further include obtaining, by the bootloader, a third current data identifier corresponding to third current data in the functional partition if no abnormality occurs when the third target data is written into the ascending partition; if the third current data identifier is inconsistent with the second data identifier, determining that the second target data is abnormal when being written into the functional partition, and returning to execute the step 101.
Specifically, the second data identifier may be an MD5 value calculated according to the second target data, and similarly, the third current data identifier may also be an MD5 value calculated according to the third current data. Or the second data identifier may be a version number of the second target data, the version number may be carried at the tail of the second target data, and similarly, the third current data identifier may also be a version number carried at the tail of the third current data, if the writing function partition of the second target data is completed, the version number obtained by the U-Boot should be consistent with the second data identifier, and if the writing function partition of the second target data is not completed or the writing function partition is not completed, the version number obtained by the U-Boot should be inconsistent with the second data identifier. If the third current data identifier is inconsistent with the second data identifier, it can be considered that an abnormality occurs when the second target data is written into the functional partition, and at this time, the updated correct data is stored in the upgrade partition, and then the process returns to execute step 101, and new firmware is obtained by re-networking, and firmware upgrade is performed again.
It is easy to understand that if the third current data identifier is consistent with the second identifier, it may be determined that the firmware has been upgraded.
Step 105, recovering the data of the upgrade partition according to the third target data backed up in the functional partition, and returning to execute step 101.
Specifically, after the data recovery is performed on the upgrade partition according to the third target data backed up by the functional partition, the upgrade partition stores updated correct data, that is, the upgrade partition is in an executable state, and then the new firmware can be downloaded in a reconnection manner so as to perform firmware upgrade again.
It is easy to understand that when the third target data backed up in the functional partition is used for recovering the data of the upgrade partition, the data blocks can be erased and written, and when the content of each data block is compared with the content of each data block, the erasing and writing are not needed, so that the erasing and writing speed is increased.
Specifically, referring to fig. 4, fig. 4 shows an abnormal situation and a processing manner in the firmware upgrading process, where an upgrade recovery mode is to re-establish a connection with a server and download new firmware to re-upgrade the firmware. As shown in fig. 4, when the upgrade partition is damaged and the functional partition is backed up, the upgrade recovery mode is started after the upgrade partition is recovered by using the functional partition. When the functional partition is damaged or the check partition is damaged, the upgrade recovery mode is directly started. Therefore, when the upgrade partition keeps an operable state, the upgrade partition is connected with the server and firmware upgrade is carried out again, and data of the upgrade partition is not required to be backed up by extra storage space, so that the use of the storage space is saved, and the cost is reduced.
According to the firmware upgrading method provided by the embodiment of the application, the connection is established with the server, the new firmware is acquired from the server, the first target data, the second target data and the third target data contained in the new firmware are respectively written into the check partition, the functional partition and the upgrading partition of the embedded equipment, the new firmware is used for upgrading the firmware of the embedded equipment, if the embedded equipment is restarted when the firmware is upgraded, no abnormality occurs when the first target data is written into the check partition, the abnormality occurs when the third target data is written into the upgrading partition, and whether the functional partition has backed up the third target data or not, the data recovery is carried out on the upgrading partition according to the third target data backed up by the functional partition, and the step of establishing connection with the server and acquiring the new firmware from the server is executed is returned, so that the upgrading partition is backed up through the functional partition without additional storage space, the use of the storage space is saved while the possibility of upgrading damage is effectively reduced, and the cost is reduced.
In order to facilitate better implementation of the firmware upgrading method of the embodiment of the application, the embodiment of the application also provides a firmware upgrading device.
Having described in detail the method embodiments of the present application above, and in connection with fig. 5-6, the apparatus embodiments of the present application will be described in detail, it being understood that the apparatus embodiments correspond to the method embodiments, and similar descriptions can be made with reference to the method embodiments.
Fig. 5 is a schematic structural diagram of a firmware upgrade apparatus 10 according to an embodiment of the present application, the firmware upgrade apparatus 10 is applied to an embedded device including a flash memory including a parity partition, a function partition, and an upgrade partition, and the firmware upgrade apparatus 10 may include:
the obtaining module 11 is configured to establish a connection with a server, obtain new firmware from the server, and write first target data, second target data, and third target data included in the new firmware into a check partition, a functional partition, and an upgrade partition, respectively, where the new firmware is used to upgrade firmware of the embedded device;
A first judging module 12, configured to judge, if the embedded device is restarted when the firmware is upgraded, whether an abnormality occurs when the first target data is written into the check partition through a boot loader of the embedded device;
The second judging module 13 is configured to judge, by using the bootloader, whether an abnormality occurs when the third target data is written into the upgrade partition if the first target data is not abnormal when the first target data is written into the upgrade partition;
A third judging module 14, configured to judge, by the boot loader, whether the functional partition has backed up the third target data if an abnormality occurs when the third target data is written into the upgrade partition;
And the recovery module 15 is used for recovering the data of the upgrade partition according to the backed-up third target data in the functional partition if the functional partition has backed-up the third target data, and returning to the acquisition module and executing the function of the acquisition module.
In some embodiments, if no exception occurs when the first target data is written into the check partition, the check partition stores the first data identifier of the third target data, and the second judging module 13 may be specifically configured to obtain, by the bootloader, the first current data identifier corresponding to the first current data in the upgrade partition, determine that no exception occurs when the third target data is written into the upgrade partition if the first current data identifier is consistent with the first data identifier, or determine that an exception occurs when the third target data is written into the upgrade partition if the first current data identifier is inconsistent with the first data identifier.
Further, the third judging module 14 may be mainly configured to obtain a second current data identifier corresponding to the second current data in the functional partition, determine that the functional partition has backed up the third target data if the second current data identifier is consistent with the first data identifier, or determine that the functional partition has not backed up the third target data if the second current data identifier is inconsistent with the first data identifier.
In some embodiments, after the third determination module 14 determines that the functional partition is not backing up the third target data, it may also be used to return to the acquisition module and perform the functions of the acquisition module.
Further, if no abnormality occurs when the first target data is written into the check partition, the check partition further stores a second data identifier corresponding to the second target data, and the firmware upgrading device 10 may further include a determining module configured to obtain, through the boot loader, a third current data identifier corresponding to the third current data in the functional partition if no abnormality occurs when the third target data is written into the upgrade partition, determine that an abnormality occurs when the second target data is written into the functional partition if the third current data identifier is inconsistent with the second data identifier, and return to perform the steps of establishing connection with the server and obtaining new firmware from the server.
In some embodiments, the first determining module 12 may be specifically configured to read the fourth current data in the check partition through the bootloader, determine that no exception occurs when the first target data is written into the check partition if the fourth current data is in a preset format, and determine that an exception occurs when the first target data is written into the check partition if the fourth current data is not in the preset format.
Further, the first judging module 12 may be further specifically configured to return to the obtaining module 11 to execute the function of the obtaining module 11 if an abnormality occurs when the first target data is written into the check partition.
It should be noted that, the functions of each module in the firmware upgrading apparatus 10 in the embodiment of the present application may be correspondingly referred to the specific implementation manner in each method embodiment, and are not repeated herein.
The respective modules in the firmware upgrade apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In the firmware upgrading apparatus 10 provided in this embodiment of the present application, a connection is established between the obtaining module 11 and a server, and a new firmware is obtained from the server, and first target data, second target data, and third target data included in the new firmware are written into a check partition, a functional partition, and an upgrade partition of an embedded device, respectively, where the new firmware is used to upgrade the firmware of the embedded device, if the embedded device is restarted during firmware upgrade, the first judging module 12 judges whether an abnormality occurs when the first target data is written into the check partition, if no abnormality occurs when the first target data is written into the check partition, the second judging module 13 judges whether an abnormality occurs when the third target data is written into the upgrade partition, if an abnormality occurs when the third target data is written into the upgrade partition, the third judging module 14 judges whether the functional partition has backed up the third target data, if the functional partition has backed up the third target data, the recovering module 15 recovers the upgrade partition according to the third target data that has been backed up in the functional partition, and returns to the obtaining module 11. According to the application, the upgrading partition is backed up through the functional partition without additional storage space, so that the possibility of upgrading damage is effectively reduced, the use of the storage space is saved, and the cost is further reduced.
In addition, the embodiment of the application also provides a computer device which can be an embedded device, and the embedded device can be a terminal device such as a notebook computer, a personal computer (PC, personalComputer), a personal digital assistant (PersonalDigitalAssistant, PDA) and the like. Fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer device 2000 includes a processor 2001 having one or more processing cores, a memory 2002 having one or more computer readable storage media, and a computer program stored on the memory 2002 and executable on the processor. The processor 2001 is electrically connected to the memory 2002. It will be appreciated by those skilled in the art that the computer device structure shown in the figures is not limiting of the computer device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
Processor 2001 is a control center of computer device 2000, and connects various portions of the entire computer device 2000 using various interfaces and lines, performing various functions of computer device 2000 and processing data by running or loading software programs and/or modules stored in memory 2002, and invoking data stored in memory 2002, thereby performing overall monitoring of computer device 2000.
In an embodiment of the present application, the processor 2001 in the computer device 2000 loads instructions corresponding to the processes of one or more application programs into the memory 2002 according to the following steps, and the processor 2001 executes the application programs stored in the memory 2002, thereby implementing various functions:
The method comprises the steps of establishing connection with a server, obtaining new firmware from the server, writing first target data, second target data and third target data contained in the new firmware into a check partition, a functional partition and an upgrade partition respectively, enabling the new firmware to be used for upgrading firmware of the embedded equipment, judging whether the first target data is abnormal when the first target data is written into the check partition through a boot loader of the embedded equipment when the firmware is upgraded, judging whether the third target data is abnormal when the third target data is written into the upgrade partition through the boot loader when the first target data is not abnormal when the first target data is written into the check partition, judging whether the third target data is backed up through the boot loader when the third target data is abnormal when the third target data is written into the upgrade partition, recovering the data of the upgrade partition according to the third target data backed up in the functional partition if the third target data is backed up, returning to execute connection with the server, and obtaining the new firmware from the server.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in FIG. 6, the computer device 2000 further includes a touch display 2003, a radio frequency circuit 2004, an audio circuit 2005, an input unit 2006, and a power supply 2007. The processor 2001 is electrically connected to the touch display 2003, the rf circuit 2004, the audio circuit 2005, the input unit 2006, and the power supply 2007, respectively. It will be appreciated by those skilled in the art that the computer device structure shown in FIG. 6 is not limiting of the computer device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The touch display 2003 may be used to display a graphical user interface and to receive operating instructions generated by a user acting on the graphical user interface. The touch display 2003 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of a computer device, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a liquid crystal display (LCD, liquidCrystalDisplay), an organic light emitting diode (OLED, organicLight-EmittingDiode), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch controller receives touch information from the touch detection device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 2001, and can receive and execute commands sent by the processor 2001. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 2001 to determine the type of touch event, and the processor 2001 then provides a corresponding visual output on the display panel depending on the type of touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 2003 to implement input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch display 2003 may also implement an input function as part of the input unit 2006.
The radio frequency circuitry 2004 may be used to transceive radio frequency signals to establish wireless communications with a network device or other computer device via wireless communications.
Audio circuitry 2005 may be used to provide an audio interface between a user and a computer device through speakers, microphones, and so forth. The audio circuit 2005 may convert received audio data into an electrical signal, transmit the electrical signal to a speaker, and convert the electrical signal to a sound signal for output by the speaker, while the microphone converts the collected sound signal into an electrical signal, receives the electrical signal from the audio circuit 2005, converts the electrical signal into audio data, processes the audio data with the output processor 2001, and sends the audio data to another computer device, for example, via the radio frequency circuit 2004, or outputs the audio data to the memory 2002 for further processing. Audio circuit 2005 may also include an ear bud jack to provide communication of a peripheral headset with a computer device.
The input unit 2006 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), as well as to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
A power supply 2007 is used to power the various components of the computer device 2000. Alternatively, the power supply 2007 may be logically connected to the processor 2001 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. Power supply 2007 may also include one or more of any components, such as a dc or ac power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, etc.
Although not shown in fig. 6, the computer device 2000 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which will not be described herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It can be seen from the foregoing that, in the computer device provided in this embodiment, a connection is established between the computer device and a server, and a new firmware is obtained from the server, and first target data, second target data, and third target data included in the new firmware are written into a check partition, a functional partition, and an upgrade partition, respectively, where the new firmware is used to upgrade the embedded device, if the embedded device is restarted when the firmware is upgraded, the embedded device determines whether an abnormality occurs when the first target data is written into the check partition, if no abnormality occurs when the first target data is written into the check partition, the bootstrap loader determines whether an abnormality occurs when the third target data is written into the upgrade partition, if an abnormality occurs when the third target data is written into the upgrade partition, the bootstrap loader determines whether the functional partition has backed up the third target data, if the functional partition has backed up the third target data, and performs data recovery on the upgrade partition according to the third target data backed up in the functional partition, and returns to the step of establishing a connection with the server, and obtaining the new firmware from the server, thereby effectively reducing the possibility of damage and saving the storage space.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a computer readable storage medium having stored therein a plurality of computer programs that can be loaded by a processor to perform the steps of any of the firmware upgrade methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
establishing connection with a server, acquiring new firmware from the server, and writing first target data, second target data and third target data contained in the new firmware into a check partition, a functional partition and an upgrade partition respectively, wherein the new firmware is used for carrying out firmware upgrade on the embedded equipment;
if the embedded device is restarted when the firmware is upgraded, judging whether the first target data is abnormal when being written into the check partition through a boot loader of the embedded device;
if no abnormality occurs when the first target data is written into the check partition, judging whether the third target data is written into the upgrade partition through the boot loader;
If the third target data is abnormal when being written into the upgrade partition, judging whether the functional partition has backed up the third target data or not through the boot loader;
If the functional partition has backed up the third target data, carrying out data recovery on the upgrading partition according to the third target data backed up in the functional partition;
and returning to the step of establishing connection with the server and acquiring new firmware from the server.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
The storage medium may include read-only memory (ROM, readOnlyMemory), random access memory (RAM, randomAccessMemory), magnetic or optical disk, and the like.
The steps in any firmware upgrading method provided by the embodiment of the present application can be executed by the computer program stored in the storage medium, so that the beneficial effects that any firmware upgrading method provided by the embodiment of the present application can be achieved, and detailed descriptions of the previous embodiments are omitted.
The foregoing describes in detail a firmware upgrading method, apparatus, storage medium and computer device provided in the embodiments of the present application, and specific examples are set forth herein to illustrate the principles and implementations of the present application, and the above description of the embodiments is only for aiding in understanding the method and core concept of the present application, and meanwhile, for those skilled in the art, according to the concept of the present application, there are variations in the specific implementations and application ranges, so that the disclosure should not be construed as limiting the scope of the present application.

Claims (10)

1.一种固件升级方法,其特征在于,应用于嵌入式设备,所述嵌入式设备包括闪存,所述闪存包括校验分区、功能分区和升级分区,所述升级分区用于存放升级系统,具体包含内核、运行根文件系统所需的文件和固件升级所需的文件,所述功能分区用于存放功能系统,具体包含实现产品需求的程序及文件,所述校验分区用于保存根据升级分区计算出的MD5值和根据功能分区计算出的MD5值,所述方法包括:1. A firmware upgrade method, characterized in that it is applied to an embedded device, the embedded device includes a flash memory, the flash memory includes a check partition, a function partition and an upgrade partition, the upgrade partition is used to store an upgrade system, specifically including a kernel, files required for running a root file system and files required for firmware upgrade, the function partition is used to store a functional system, specifically including programs and files for implementing product requirements, the check partition is used to save an MD5 value calculated according to the upgrade partition and an MD5 value calculated according to the function partition, the method comprises: 与服务器建立连接,并从所述服务器获取新固件,以及将所述新固件中包含的第一目标数据、第二目标数据和第三目标数据分别写入所述校验分区、功能分区和升级分区,所述新固件用于对所述嵌入式设备进行固件升级;Establishing a connection with a server, obtaining new firmware from the server, and writing first target data, second target data, and third target data contained in the new firmware into the verification partition, the function partition, and the upgrade partition, respectively, wherein the new firmware is used to upgrade the firmware of the embedded device; 若在进行固件升级时所述嵌入式设备重启,则通过所述嵌入式设备的引导加载程序判断所述第一目标数据写入所述校验分区时是否发生异常;If the embedded device is restarted during the firmware upgrade, determining, through the boot loader of the embedded device, whether an abnormality occurs when the first target data is written into the verification partition; 若所述第一目标数据写入所述校验分区时未发生异常,则通过所述引导加载程序判断所述第三目标数据写入所述升级分区时是否发生异常;If no exception occurs when the first target data is written into the verification partition, determining by the boot loader whether an exception occurs when the third target data is written into the upgrade partition; 若所述第三目标数据写入所述升级分区时发生异常,则通过所述引导加载程序判断所述功能分区是否已备份所述第三目标数据;If an exception occurs when the third target data is written into the upgrade partition, determining through the boot loader whether the functional partition has backed up the third target data; 若所述功能分区已备份所述第三目标数据,则根据所述功能分区中已备份的第三目标数据对所述升级分区进行数据恢复;If the functional partition has backed up the third target data, then performing data recovery on the upgrade partition according to the backed up third target data in the functional partition; 返回执行所述与服务器建立连接,并从所述服务器获取新固件的步骤。Return to the step of establishing a connection with the server and obtaining new firmware from the server. 2.根据权利要求1所述的固件升级方法,其特征在于,若所述第一目标数据写入所述校验分区时未发生异常,则所述校验分区存储有所述第三目标数据的第一数据标识,所述通过所述引导加载程序判断所述第三目标数据写入所述升级分区时是否发生异常,包括:2. The firmware upgrade method according to claim 1, characterized in that if no exception occurs when the first target data is written into the verification partition, the verification partition stores a first data identifier of the third target data, and the step of determining whether an exception occurs when the third target data is written into the upgrade partition by the boot loader comprises: 通过所述引导加载程序获取所述升级分区中第一当前数据对应的第一当前数据标识;Acquire, by the boot loader, a first current data identifier corresponding to the first current data in the upgrade partition; 若所述第一当前数据标识与所述第一数据标识一致,则确定所述第三目标数据写入所述升级分区时未发生异常;或者If the first current data identifier is consistent with the first data identifier, it is determined that no abnormality occurs when the third target data is written into the upgrade partition; or 若所述第一当前数据标识与所述第一数据标识不一致,则确定所述第三目标数据写入所述升级分区时发生异常。If the first current data identifier is inconsistent with the first data identifier, it is determined that an exception occurs when the third target data is written into the upgrade partition. 3.根据权利要求2所述的固件升级方法,其特征在于,所述通过所述引导加载程序判断所述功能分区是否已备份所述第三目标数据,包括:3. The firmware upgrade method according to claim 2, wherein the step of determining whether the functional partition has backed up the third target data by the boot loader comprises: 获取所述功能分区中第二当前数据对应的第二当前数据标识;Obtaining a second current data identifier corresponding to the second current data in the functional partition; 若所述第二当前数据标识与所述第一数据标识一致,则确定所述功能分区已备份所述第三目标数据;或者If the second current data identifier is consistent with the first data identifier, it is determined that the functional partition has backed up the third target data; or 若所述第二当前数据标识与所述第一数据标识不一致,则确定所述功能分区未备份所述第三目标数据。If the second current data identifier is inconsistent with the first data identifier, it is determined that the functional partition does not back up the third target data. 4.根据权利要求3所述的固件升级方法,其特征在于,在所述确定所述功能分区未备份所述第三目标数据之后,还包括:4. The firmware upgrade method according to claim 3, characterized in that after determining that the functional partition does not back up the third target data, it also includes: 返回执行所述与服务器建立连接,并从所述服务器获取新固件的步骤。Return to the step of establishing a connection with the server and obtaining new firmware from the server. 5.根据权利要求2所述的固件升级方法,其特征在于,若所述第一目标数据写入所述校验分区时未发生异常,则所述校验分区还存储有所述第二目标数据对应的第二数据标识,所述方法还包括:5. The firmware upgrade method according to claim 2, characterized in that if no exception occurs when the first target data is written into the verification partition, the verification partition also stores a second data identifier corresponding to the second target data, and the method further comprises: 若所述第三目标数据写入所述升级分区时未发生异常,则通过所述引导加载程序获取所述功能分区中第三当前数据对应的第三当前数据标识;If no exception occurs when the third target data is written into the upgrade partition, obtaining, through the boot loader, a third current data identifier corresponding to the third current data in the functional partition; 若所述第三当前数据标识与所述第二数据标识不一致,则确定所述第二目标数据写入所述功能分区时发生异常;If the third current data identifier is inconsistent with the second data identifier, it is determined that an exception occurs when the second target data is written into the functional partition; 返回执行所述与服务器建立连接,并从所述服务器获取新固件的步骤。Return to the step of establishing a connection with the server and obtaining new firmware from the server. 6.根据权利要求1所述的固件升级方法,其特征在于,所述通过所述嵌入式设备的引导加载程序判断所述第一目标数据写入所述校验分区时是否发生异常,包括:6. The firmware upgrade method according to claim 1, wherein the step of determining whether an abnormality occurs when the first target data is written into the verification partition by a boot loader of the embedded device comprises: 通过所述引导加载程序读取所述校验分区中的第四当前数据;Reading fourth current data in the verification partition by the boot loader; 若所述第四当前数据为预设格式,则确定所述第一目标数据写入所述校验分区时未发生异常;If the fourth current data is in a preset format, determining that no abnormality occurs when the first target data is written into the verification partition; 若所述第四当前数据不为预设格式,则确定所述第一目标数据写入所述校验分区时发生异常。If the fourth current data is not in a preset format, it is determined that an exception occurs when the first target data is written into the verification partition. 7.根据权利要求6所述的固件升级方法,其特征在于,还包括:7. The firmware upgrade method according to claim 6, further comprising: 若所述第一目标数据写入所述校验分区时发生异常,则返回执行所述与服务器建立连接,并从所述服务器获取新固件的步骤。If an exception occurs when writing the first target data into the verification partition, the process returns to the step of establishing a connection with the server and obtaining new firmware from the server. 8.一种固件升级装置,其特征在于,应用于嵌入式设备,所述嵌入式设备包括闪存,所述闪存包括校验分区、功能分区和升级分区,所述升级分区用于存放升级系统,具体包含内核、运行根文件系统所需的文件和固件升级所需的文件,所述功能分区用于存放功能系统,具体包含实现产品需求的程序及文件,所述校验分区用于保存根据升级分区计算出的MD5值和根据功能分区计算出的MD5值,所述装置包括:8. A firmware upgrade device, characterized in that it is applied to an embedded device, the embedded device includes a flash memory, the flash memory includes a check partition, a function partition and an upgrade partition, the upgrade partition is used to store an upgrade system, specifically including a kernel, files required to run a root file system and files required for firmware upgrade, the function partition is used to store a functional system, specifically including programs and files to implement product requirements, the check partition is used to save an MD5 value calculated according to the upgrade partition and an MD5 value calculated according to the function partition, the device includes: 获取模块,用于与服务器建立连接,并从所述服务器获取新固件,以及将所述新固件中包含的第一目标数据、第二目标数据和第三目标数据分别写入所述校验分区、功能分区和升级分区,所述新固件用于对所述嵌入式设备进行固件升级;an acquisition module, configured to establish a connection with a server, acquire new firmware from the server, and write the first target data, the second target data, and the third target data contained in the new firmware into the verification partition, the function partition, and the upgrade partition, respectively, wherein the new firmware is used to perform firmware upgrade on the embedded device; 第一判断模块,用于若在进行固件升级时所述嵌入式设备重启,则通过所述嵌入式设备的引导加载程序判断所述第一目标数据写入所述校验分区时是否发生异常;A first judgment module, configured to judge, through a boot loader of the embedded device, whether an abnormality occurs when the first target data is written into the verification partition if the embedded device is restarted during a firmware upgrade; 第二判断模块,用于若所述第一目标数据写入所述校验分区时未发生异常,则通过所述引导加载程序判断所述第三目标数据写入所述升级分区时是否发生异常;a second judgment module, configured to judge, through the boot loader, whether an abnormality occurs when the third target data is written into the upgrade partition if no abnormality occurs when the first target data is written into the verification partition; 第三判断模块,用于若所述第三目标数据写入所述升级分区时发生异常,则通过所述引导加载程序判断所述功能分区是否已备份所述第三目标数据;A third judgment module, configured to judge whether the functional partition has backed up the third target data through the boot loader if an exception occurs when the third target data is written into the upgrade partition; 恢复模块,用于若所述功能分区已备份所述第三目标数据,则根据所述功能分区中已备份的第三目标数据对所述升级分区进行数据恢复;返回所述获取模块并执行所述获取模块的功能。The recovery module is used to restore the data of the upgrade partition according to the backed-up third target data in the functional partition if the functional partition has backed up the third target data; return to the acquisition module and execute the function of the acquisition module. 9.一种计算机设备,其特征在于,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述方法的步骤。9. A computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program. 10.一种存储介质,其特征在于,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述方法的步骤。10. A storage medium, characterized in that a computer program is stored therein, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
CN202111239446.6A 2021-10-25 2021-10-25 Firmware upgrade method, device, computer equipment and storage medium Active CN114035818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111239446.6A CN114035818B (en) 2021-10-25 2021-10-25 Firmware upgrade method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111239446.6A CN114035818B (en) 2021-10-25 2021-10-25 Firmware upgrade method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114035818A CN114035818A (en) 2022-02-11
CN114035818B true CN114035818B (en) 2025-05-09

Family

ID=80141875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111239446.6A Active CN114035818B (en) 2021-10-25 2021-10-25 Firmware upgrade method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114035818B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114780122A (en) * 2022-04-11 2022-07-22 乐鑫信息科技(上海)股份有限公司 Embedded equipment firmware updating method and embedded equipment
CN114780127A (en) * 2022-05-09 2022-07-22 乐鑫信息科技(上海)股份有限公司 Embedded equipment firmware updating method, embedded equipment and development end equipment
CN115952564B (en) * 2023-03-01 2023-08-15 荣耀终端有限公司 Data writing method and terminal equipment
CN116932010B (en) * 2023-09-14 2024-01-19 首都信息科技发展有限公司 System firmware upgrading method, device and server

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032846A (en) * 2018-08-08 2018-12-18 京信通信系统(中国)有限公司 Equipment remote backup upgrade method, device, computer storage medium and equipment
CN110134426A (en) * 2019-04-18 2019-08-16 深圳市致宸信息科技有限公司 A kind of embedded system upgrade method, device and terminal device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189451A (en) * 2018-10-25 2019-01-11 京信通信系统(中国)有限公司 A kind of firmware upgrade method and device
CN113064604B (en) * 2021-03-18 2022-06-21 瑞芯微电子股份有限公司 Firmware upgrading method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032846A (en) * 2018-08-08 2018-12-18 京信通信系统(中国)有限公司 Equipment remote backup upgrade method, device, computer storage medium and equipment
CN110134426A (en) * 2019-04-18 2019-08-16 深圳市致宸信息科技有限公司 A kind of embedded system upgrade method, device and terminal device

Also Published As

Publication number Publication date
CN114035818A (en) 2022-02-11

Similar Documents

Publication Publication Date Title
CN114035818B (en) Firmware upgrade method, device, computer equipment and storage medium
US10860425B2 (en) Method for recovering basic input/output system image file of a computer system and the computer system
US10866623B2 (en) Information handling system and method to detect and recover from no power/no post failures
KR101861724B1 (en) Selective power management for pre-boot firmware updates
CN109542744B (en) Method, device, storage medium and terminal for detecting abnormal starting problem of terminal
KR20200100958A (en) Electronic device and method for prefetching application
CN111651185B (en) Software upgrading method and device
CN115048147B (en) A firmware upgrade method, device, equipment, and storage medium
CN105573864A (en) Terminal system recovery method and system
CN113515291A (en) Equipment online upgrade method and device
CN118349290B (en) Dual storage chip startup upgrade system, method, device, medium and product
US9218249B2 (en) Electronic apparatus, method of restoring guid partition table (GPT) and computer-readable recording medium
CN113778496A (en) Firmware upgrading method and device, electronic equipment and storage medium
WO2025179881A1 (en) Fault diagnosis driver loading method and apparatus, electronic device, and storage medium
CN115509578A (en) System upgrading method and device, electronic equipment and storage medium
CN115113905A (en) Firmware upgrading method and firmware upgrading device
CN113220324B (en) CPLD remote updating method, system and medium
CN111399874A (en) A system upgrade method, device, storage medium and smart wearable device
KR102274668B1 (en) Apparatus and method for controlling updating software of AVN system in vehicle
CN115309435A (en) Equipment firmware upgrading method and device and electronic equipment
CN117033084B (en) Virtual machine backup method and device, electronic equipment and storage medium
CN112783535A (en) Firmware upgrading method, embedded device and storage medium
CN113127029A (en) Firmware updating method and device, electronic equipment and storage medium
US20090265537A1 (en) Computer system, bios structure and boot method thereof
WO2020210955A1 (en) Application program starting method and apparatus, and electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220810

Address after: Floor 12-17, Unit 1, Building 2, No. 466, Xinyu Road, Chengdu High-tech Zone, Chengdu, Sichuan 610213

Applicant after: Chengdu Lianzhou International Technology Co.,Ltd.

Address before: 518109 floor 5, fulizhen building, No. 1, Kefa Road, high tech park, Nanshan District, Shenzhen, Guangdong Province

Applicant before: Shenzhen Lianzhou International Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant