CN113641390B - System upgrading method, device, equipment and storage medium - Google Patents

System upgrading method, device, equipment and storage medium Download PDF

Info

Publication number
CN113641390B
CN113641390B CN202111206997.2A CN202111206997A CN113641390B CN 113641390 B CN113641390 B CN 113641390B CN 202111206997 A CN202111206997 A CN 202111206997A CN 113641390 B CN113641390 B CN 113641390B
Authority
CN
China
Prior art keywords
partition
firmware
upgrade
upgrading
current
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
CN202111206997.2A
Other languages
Chinese (zh)
Other versions
CN113641390A (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.)
OP Retail Suzhou Technology Co Ltd
Original Assignee
OP Retail Suzhou 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 OP Retail Suzhou Technology Co Ltd filed Critical OP Retail Suzhou Technology Co Ltd
Priority to CN202111206997.2A priority Critical patent/CN113641390B/en
Publication of CN113641390A publication Critical patent/CN113641390A/en
Application granted granted Critical
Publication of CN113641390B publication Critical patent/CN113641390B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention discloses a system upgrading method, a device, equipment and a storage medium, wherein the method comprises the following steps: if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition; determining the firmware for realizing system upgrading as upgrading firmware, and writing the upgrading firmware into the current upgrading partition; and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition. Therefore, the method and the device have the advantages that the running partition and the upgraded partition are separated in the upgrading process, the normal work of the system in the running partition is not influenced, software does not need to be closed, storage is not unloaded, and the like, and therefore the upgrading efficiency can be effectively improved; and even if abnormal power failure and other conditions occur in the upgrading process, the system can be restarted from the storage partition operated before the firmware is written, the starting of the system cannot be influenced, the product stability is good, and the maintenance difficulty is small.

Description

System upgrading method, device, equipment and storage medium
Technical Field
The present invention relates to the field of artificial intelligence technology, and more particularly, to a system upgrade method, apparatus, device, and storage medium.
Background
In the prior art, when a system is upgraded, it is usually necessary to first shut down software of the system, unload a storage in which the system runs, and the like, and then write firmware into the system to upgrade the system, and then restart the system after the upgrade is completed. Therefore, in the prior art, the upgrading efficiency is low due to the fact that operations such as software shutdown and storage uninstallation are needed in the upgrading process, and if the firmware is not normally written in due to abnormal power failure and the like in the upgrading process, the starting of the system is affected, the product stability is poor, and the maintenance difficulty is high.
Disclosure of Invention
The invention aims to provide a system upgrading method, a system upgrading device, equipment and a storage medium, which can effectively improve the system upgrading efficiency, improve the system stability and reduce the maintenance difficulty.
In order to achieve the above purpose, the invention provides the following technical scheme:
a system upgrade method, comprising:
acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain the environment variable partition and at least two partitions capable of being used as upgrading partitions; wherein the environment variable partition is used for storing the partition information, the version information of the firmware in the storage area where the system currently runs and a starting command for starting the system from the corresponding partition;
if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition;
determining the firmware for realizing the system upgrade as an upgrade firmware, and writing the upgrade firmware into the current upgrade partition;
and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition.
Preferably, after determining that the firmware for implementing the system upgrade is the upgrade firmware, the method further includes:
reading a check value contained in the upgrading firmware to be a current check value, and reading a data part contained in the upgrading firmware to be a first data part;
and calculating the data in the first data part to obtain a corresponding check value as a first check value, comparing the first check value with the current check value, if the comparison result is consistent, executing the step of writing the upgrade firmware into the current upgrade partition, otherwise, determining that the system cannot be upgraded based on the upgrade firmware.
Preferably, after determining that the first check value is consistent with the current check value, the method further includes:
reading the version information contained in the upgraded firmware as first version information, and reading the version information of the firmware in the storage area where the system currently operates as second version information;
and comparing the first version information with the second version information, if the comparison result is consistent, determining that the system is not required to be upgraded based on the upgrade firmware, otherwise, executing the step of writing the upgrade firmware into the current upgrade partition.
Preferably, after the writing of the upgraded firmware is successful, the method further includes:
reading a data part contained in the upgrading firmware in the current upgrading partition as a second data part, and calculating data in the second data part to obtain a corresponding check value as a second check value;
and comparing the second check value with the current check value, if the comparison result is consistent, executing the step of restarting the system from the current upgrading partition, otherwise, determining that the system cannot be restarted from the current upgrading partition.
Preferably, before writing the upgraded firmware into the current upgraded partition, the method further includes:
and erasing the data stored in the current upgrading partition.
Correspondingly, after restarting the system from the current upgrade partition, the method further includes:
and updating the version information and the starting command in the environment variable partition.
Preferably, the system includes a kernel and a file system, and the partition capable of serving as an upgrade partition includes two partitions capable of serving as upgrade partitions of the kernel and two partitions capable of serving as upgrade partitions of the file system.
A system upgrade apparatus, comprising:
a determination module to: if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition;
a write module to: determining the firmware for realizing the system upgrade as an upgrade firmware, and writing the upgrade firmware into the current upgrade partition;
a restart module to: after the upgrade firmware is written successfully, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition;
a partitioning module to: acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain the environment variable partition and at least two partitions capable of being used as upgrading partitions; wherein the environment variable partition is used for storing the partition information, the version information of the firmware in the storage area where the system currently runs and a start command for starting the system from the corresponding partition.
A system upgrade apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the system upgrade method as described in any one of the above when executing the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of a system upgrade method as claimed in any one of the preceding claims.
The invention provides a system upgrading method, a device, equipment and a storage medium, wherein the method comprises the following steps: if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition; determining the firmware for realizing the system upgrade as an upgrade firmware, and writing the upgrade firmware into the current upgrade partition; and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition. According to the method and the device, at least two partitions capable of achieving system upgrading operation are set, then when the system needs upgrading, the firmware used for upgrading is written into the partition which is not operated by the system at present, then the system is restarted from the partition in which the firmware is written successfully after the firmware is written successfully, so that the system is upgraded, when the system needs upgrading next time, the firmware used for upgrading is still written into the partition which is not operated by the system at present, and the like. Therefore, the method and the device have the advantages that the running partition and the upgraded partition are separated in the upgrading process, the normal work of the system in the running partition is not influenced, software does not need to be closed, storage is not unloaded, and the like, and therefore the upgrading efficiency can be effectively improved; even if abnormal power failure and other conditions occur in the upgrading process, the system can be restarted from the storage partition operated before the firmware is written, the starting of the system cannot be influenced, the product stability is good, and the maintenance difficulty is small; in conclusion, the system upgrading efficiency is effectively improved, meanwhile, the system stability can be improved, and the maintenance difficulty is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a system upgrade method according to an embodiment of the present invention;
fig. 2 is a distribution diagram of memory partitions in a system upgrading method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a system upgrading apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart of a system upgrade method according to an embodiment of the present invention is shown, which specifically includes:
s11: and if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition.
With the improvement of the technology level and the improvement of the chip manufacturing process, the chip cost is lower and lower, so that the embedded device can use a large memory, a large flash memory and the like, the system in the embodiment of the application can be a system in the embedded device, and of course, other settings carried out according to the requirements are also within the protection scope of the invention; the system may be an operating system or other systems set according to actual needs, and the storage partition is a part of a physical disk and functions as a physical partition unit. If the system needs to be upgraded in the running process of the system, the storage partition where the system currently runs and the storage partition where the system does not run can be determined first, and the storage partitions are all the storage partitions capable of achieving the upgrading and running of the system, that is, in the embodiment of the present application, at least two storage partitions capable of achieving the upgrading and running of the system can be set, and then at the same time, the system runs on the storage partition capable of achieving the upgrading and running of the system, and the system does not run on the storage partition capable of achieving the upgrading and running of the system.
S12: and determining the firmware for realizing system upgrading as upgrading firmware, and writing the upgrading firmware into the current upgrading partition.
When system upgrade is needed to be realized in the embodiment of the application, the latest firmware (firmware can be an upgrade package) is written into the corresponding storage partition, and then the system is restarted from the storage partition in which the firmware is written, so that the upgrade of the system is realized; and during the process of realizing system upgrade (before the system is successfully restarted after firmware writing), the system still continues to run in the currently running memory partition. According to the method and the device, any storage partition where the system does not operate currently is used as the current upgrading partition, and then the firmware for achieving system upgrading is written into the current upgrading partition when the system upgrading is achieved, so that the system is restarted from the current upgrading partition after the writing is successful, and the system operates in the current upgrading partition after being restarted.
S13: and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition.
Briefly, when two storage partitions capable of implementing system upgrade operation are respectively denoted as partition a and partition B, if the system needs to be upgraded, switching is performed between partition a and partition B, for example, when the system is currently running in partition a, firmware used for upgrade is written into partition B, the system is restarted from partition B after the writing is successful, and firmware used for upgrade is written into partition a in the next upgrade, and so on.
The method and the device have the advantages that the number of the storage partitions capable of achieving system upgrading operation is at least two, then when the system needs upgrading, the firmware used for upgrading is written into the storage partitions which are not operated by the system at present, then the system is restarted from the storage partitions in which the firmware is successfully written after the firmware is successfully written, the system is upgraded, the firmware used for upgrading is still written into the storage partitions which are not operated by the system at present when the system needs upgrading next time, and the like. Therefore, the method and the device have the advantages that the running storage partition and the upgraded storage partition are separated, so that the normal work of the running storage partition of the system is not influenced in the upgrading process, software does not need to be closed, storage is not unloaded, and the like, and the upgrading efficiency can be effectively improved; even if abnormal power failure and other conditions occur in the upgrading process, the system can be restarted from the storage partition operated before the firmware is written, the starting of the system cannot be influenced, the product stability is good, and the maintenance difficulty is small; in conclusion, the system upgrading efficiency is effectively improved, meanwhile, the system stability can be improved, and the maintenance difficulty is reduced.
The system upgrading method provided by the embodiment of the present invention, after determining that the firmware for implementing system upgrading is upgraded firmware, may further include:
reading a check value contained in the upgrading firmware to be a current check value, and reading a data part contained in the upgrading firmware to be a first data part;
and calculating the data in the first data part to obtain a corresponding check value as a first check value, comparing the first check value with the current check value, if the comparison result is consistent, executing the step of writing the upgrade firmware into the current upgrade partition, otherwise, determining that the system cannot be upgraded based on the upgrade firmware.
After the upgrading instruction is received, the embodiment of the application can determine that the system needs to be upgraded, and then upgrade the corresponding system. In order to ensure the accuracy of the firmware upgrading, the embodiment of the application can firstly verify the firmware upgrading; specifically, the verification value may be read from the upgrade firmware header portion, and the verification value of the data in the upgrade firmware data portion may be calculated, and then the two are compared, and if the two are the same, the verification is passed, otherwise, the verification is failed. The check value may specifically be a CRC checksum, and the firmware used for upgrading may be a corresponding firmware image.
In the system upgrading method provided in the embodiment of the present invention, after determining that the first check value is consistent with the current check value, the method may further include:
reading version information contained in the upgraded firmware as first version information, and reading the version information of the firmware in a storage area where the system currently operates as second version information;
and comparing the first version information with the second version information, if the comparison result is consistent, determining that the system is not required to be upgraded based on the upgraded firmware, otherwise, executing the step of writing the upgraded firmware into the current upgraded subarea.
In order to further ensure that the upgraded firmware is the latest version of firmware, the embodiment of the application can verify the version of the upgraded firmware; specifically, the version information of the firmware header portion may be read, the version information may be compared with the version information of the stored firmware read in the storage partition in which the system currently operates, if the version information is different from the version information of the stored firmware read in the storage partition, the system needs to be updated, the updated firmware is the latest version of firmware, and otherwise, it is determined that the system is not to be updated based on the updated firmware. The version information may be a version number.
The system upgrading method provided by the embodiment of the present invention, after the firmware is successfully written in and upgraded, may further include:
reading a data part contained in the upgrading firmware in the current upgrading partition as a second data part, and calculating data in the second data part to obtain a corresponding check value as a second check value;
and comparing the second check value with the current check value, if the comparison result is consistent, executing the step of restarting the system from the current upgrading partition, and otherwise, determining that the system cannot be restarted from the current upgrading partition.
In order to further ensure the accuracy of updating the firmware, the embodiment of the application can also perform read-back verification; specifically, in the embodiment of the application, data in a data portion of firmware can be read from a storage partition in which upgrade firmware is written, the read data is calculated to obtain a corresponding check value, the check value read from the upgrade firmware before the upgrade firmware is written is compared with the check value calculated here, if the two check values are the same, it is indicated that the upgrade firmware written into the current upgrade partition has no problem, and therefore the system can be restarted from the current upgrade partition, and otherwise, it is indicated that the upgrade firmware written into the current upgrade partition has a problem, and therefore the system cannot be restarted from the current upgrade partition.
Before writing the upgrade firmware into the current upgrade partition, the system upgrade method provided in the embodiment of the present invention may further include:
and erasing the data stored in the current upgrading partition.
In order to further ensure effective implementation of upgrading, in the application, before the upgrade firmware is written in, data stored in the current upgrade partition can be erased, and then the upgrade firmware is written in the current upgrade partition, so that storage of invalid data is avoided, and further errors in restarting of the system are avoided.
The system upgrading method provided by the embodiment of the invention can further comprise the following steps:
acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain the environment variable partition and at least two partitions capable of being used as upgrading partitions; the environment variable partition is used for storing partition information, version information of firmware in a storage area where the system currently runs and a starting command used for starting the system from the corresponding partition;
correspondingly, after restarting the system from the current upgrade partition, the method may further include:
updating version information and a starting command in the environment variable partition;
the system may include a kernel and a file system, and the partition capable of being an upgrade partition may include two partitions capable of being upgrade partitions of the kernel and two partitions capable of being upgrade partitions of the file system.
The address information in the embodiment of the application may be a Flash physical address. The method and the device for processing the Env partition can preset the Flash physical address of the Env partition to be partitioned, and read partition information, version number and starting command from the Flash physical address corresponding to the Env partition to be partitioned; the starting command records whether the current system runs in a storage partition A (Kernel-A, Rootfs-A) or a partition B (Kernel-B, Rootfs-B) (Bootcmd parameters in the starting command record the current system running in the storage partition, for example, if the current system runs in the storage partition A, the current system also distinguishes the storage partition before the partition is not partitioned by recording the address form); accordingly, the other memory partition where the start command is not recorded is the "current upgrade partition". Thus, in practice, the physical addresses of 8 memory partitions are planned before being divided into 8 memory partitions.
The distribution situation shown in fig. 2 can be obtained by partitioning the storage space (which may be a storage space of SPI Nand Flash, and the total capacity of the storage space is 128 MB) according to the partition information, and the storage partitions include 8 storage partitions, namely an Env partition (an environment variable partition), an Uboot partition (a boot partition), a Conf partition (a configuration partition), a Data partition (a Data partition), and Kernel-A, Rootfs-A, Kernel-B, Rootfs-B; the Uboot partition is responsible for starting the whole system, and when the Uboot partition is started, the whole Kernel (Kernel) can be started according to a starting command in the Env partition, partition information is transmitted to the Kenrel to carry out system partitioning, and the whole Flash is divided into 8 partitions; the Env partition stores partition information and information necessary for starting the system, including version numbers, starting commands and the like; the Rootfs (file system) adopts a Squashfs read-only file system, so that the system file is prevented from being read and written randomly, and the system is prevented from being damaged; the Conf partition is mainly used for storing configuration files of the system, and after the system is started, each service module can read out configuration information from the system; the Data partition is used to store user files such as snap pictures, video clips, and the like.
In a specific implementation manner, for a case that a storage partition includes an Env partition, an Uboot partition, a Conf partition, a Data partition, and a Kernel-A, Rootfs-A, Kernel-B, Rootfs-B, a system upgrade method provided in an embodiment of the present application may include:
1) reading an upgrading instruction, and upgrading the Kernel region;
2) checking the upgrade package, reading CRC (cyclic redundancy check) sums from the header part of the Kernel mirror image in the upgrade package, simultaneously calculating the CRC sums of the data part, comparing the CRC sums with the CRC sums, and if the CRC sums are consistent, indicating that the check is correct;
3) reading the header part version number of the Kernel image of the upgrade package, comparing the version number with the version number in the Env partition (version parameter in the Env), and if the version numbers are not consistent, indicating that the upgrade is needed;
4) starting upgrading, erasing data in the current upgrading partition and writing mirror image data; it should be noted that, in the present invention, the "erase" action is an optimization scheme for ensuring that "dirty data" does not occur in the partition, for example, the system version of the past partition is V1.0, which occupies 1.8MB of memory, the system version that needs to be upgraded currently is V1.1, which occupies 1.5MB of memory, and if the erase is not performed, then 0.3MB of dirty data exists, which directly results in a failure of system upgrade. It is acknowledged that if the current system version needing to be upgraded is V1.2, the occupied memory size is 2MB, the whole memory area can be completely covered, and the system can not be erased.
5) Read-back verification, namely reading data from the current upgrade partition, calculating CRC (cyclic redundancy check) sums, comparing the CRC sums of the header parts of the Kernel images of the upgrade package, and if the CRC sums are consistent, indicating that the data is correctly written;
6) after the Kernel region is upgraded, calling the same program modules from the step 2) to the step 5) to upgrade the Rootfs;
7) and updating the partition information, the version number and the starting command in the Env partition.
Therefore, compared with the traditional single-partition upgrading method, the method for partitioning and upgrading the embedded equipment system separates the running partition from the upgrading partition, does not affect the normal work of the running partition in the upgrading process, does not need to close software, unload the partition and other operations, writes abnormal in the upgrading partition even if abnormal power failure occurs in the upgrading process, does not affect the work of the running partition after restarting, and greatly improves the upgrading efficiency and stability.
In addition, the invention optimizes the partition of the Flash storage space, divides the Flash storage space into eight storage partitions, presets the Flash physical address of the environment variable partition to be partitioned, and stores all parameters needing to be called, namely partition information, version number and starting command, in the corresponding physical address storage partition, and can quickly read the required parameters from the Flash physical address of the environment variable partition for upgrading when upgrading operation is carried out.
An embodiment of the present invention further provides a system upgrading apparatus, as shown in fig. 3, which may include:
a determining module 11, configured to: if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition;
a write module 12 for: determining the firmware for realizing system upgrading as upgrading firmware, and writing the upgrading firmware into the current upgrading partition;
a restart module 13 configured to: and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition.
The system upgrading device provided by the embodiment of the invention can further comprise:
a first verification module to: after determining that the firmware for realizing system upgrading is upgraded firmware, reading a check value contained in the upgraded firmware as a current check value, and reading a data part contained in the upgraded firmware as a first data part; and calculating the data in the first data part to obtain a corresponding check value as a first check value, comparing the first check value with the current check value, if the comparison result is consistent, executing the step of writing the upgrade firmware into the current upgrade partition, otherwise, determining that the system cannot be upgraded based on the upgrade firmware.
The system upgrading device provided by the embodiment of the invention can further comprise:
a second check module to: after the first check value is determined to be consistent with the current check value, reading version information contained in the upgraded firmware as first version information, and reading the version information of the firmware in a storage area where the system currently operates as second version information; and comparing the first version information with the second version information, if the comparison result is consistent, determining that the system is not required to be upgraded based on the upgraded firmware, otherwise, executing the step of writing the upgraded firmware into the current upgraded subarea.
The system upgrading device provided by the embodiment of the invention can further comprise:
a third verification module to: after the upgrade firmware is written successfully, reading a data part contained in the upgrade firmware in the current upgrade partition as a second data part, and calculating data in the second data part to obtain a corresponding check value as a second check value; and comparing the second check value with the current check value, if the comparison result is consistent, executing the step of restarting the system from the current upgrading partition, and otherwise, determining that the system cannot be restarted from the current upgrading partition.
The system upgrading device provided by the embodiment of the invention can further comprise:
an erase module to: before the upgrade firmware is written into the current upgrade partition, erasing the data stored in the current upgrade partition.
The system upgrading device provided by the embodiment of the invention can further comprise:
a partitioning module to: acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain the environment variable partition and at least two partitions capable of being used as upgrading partitions; the environment variable partition is used for storing partition information, version information of firmware in a storage area where the system currently runs and a starting command used for starting the system from the corresponding partition;
an update module to: and after the system is restarted from the current upgrading partition, updating the version information and the starting command in the environment variable partition.
The system upgrading device provided by the embodiment of the invention can comprise a kernel and a file system, and the partitions capable of being used as upgrading partitions comprise two partitions capable of being used as upgrading partitions of the kernel and two partitions capable of being used as upgrading partitions of the file system.
An embodiment of the present invention further provides a system upgrade device, which may include:
a memory for storing a computer program;
a processor for implementing the steps of the system upgrade method as described above when executing the computer program.
The embodiment of the invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the system upgrading method can be implemented as described above.
It should be noted that, for the description of the relevant parts in the system upgrading device, the apparatus and the storage medium provided in the embodiment of the present invention, reference is made to the detailed description of the corresponding parts in the system upgrading method provided in the embodiment of the present invention, and details are not repeated herein. In addition, parts of the technical solutions provided in the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail, so as to avoid redundant description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for system upgrade, comprising:
acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain at least two partitions capable of being used as upgrading partitions; wherein the environment variable partition is used for storing the partition information, the version information of the firmware in the storage area where the system currently runs and a starting command for starting the system from the corresponding partition; the partition information records the starting addresses and the partition sizes of all storage partitions, and the starting command records the storage partition to which the current system belongs;
if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition;
determining the firmware for realizing the system upgrade as an upgrade firmware, and writing the upgrade firmware into the current upgrade partition;
and after the upgrade firmware is successfully written, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition.
2. The method of claim 1, wherein after determining that the firmware implementing the system upgrade is upgraded firmware, further comprising:
reading a check value contained in the upgrading firmware to be a current check value, and reading a data part contained in the upgrading firmware to be a first data part;
and calculating the data in the first data part to obtain a corresponding check value as a first check value, comparing the first check value with the current check value, if the comparison result is consistent, executing the step of writing the upgrade firmware into the current upgrade partition, otherwise, determining that the system cannot be upgraded based on the upgrade firmware.
3. The method of claim 2, wherein determining that the first parity value is consistent with the current parity value further comprises:
reading the version information contained in the upgraded firmware as first version information, and reading the version information of the firmware in the storage area where the system currently operates as second version information;
and comparing the first version information with the second version information, if the comparison result is consistent, determining that the system is not required to be upgraded based on the upgrade firmware, otherwise, executing the step of writing the upgrade firmware into the current upgrade partition.
4. The method of claim 3, wherein after writing the upgraded firmware is successful, further comprising:
reading a data part contained in the upgrading firmware in the current upgrading partition as a second data part, and calculating data in the second data part to obtain a corresponding check value as a second check value;
and comparing the second check value with the current check value, if the comparison result is consistent, executing the step of restarting the system from the current upgrading partition, otherwise, determining that the system cannot be restarted from the current upgrading partition.
5. The method of claim 4, wherein prior to writing the upgraded firmware into the current upgraded partition, further comprising:
and erasing the data stored in the current upgrading partition.
6. The method of claim 1, further comprising, after restarting the system from the current upgraded partition: and updating the version information and the starting command in the environment variable partition.
7. The method of claim 4, wherein the system comprises a kernel and a file system, and wherein the partitions capable of being upgraded partitions comprise two partitions capable of being upgraded partitions of the kernel and two partitions capable of being upgraded partitions of the file system.
8. A system upgrade apparatus, comprising:
a determination module to: if the system needs to be upgraded in the running process of the system, determining any storage partition which is not currently operated in the system as a current upgrading partition;
a write module to: determining the firmware for realizing the system upgrade as an upgrade firmware, and writing the upgrade firmware into the current upgrade partition;
a restart module to: after the upgrade firmware is written successfully, restarting the system from the current upgrade partition so that the system runs in the current upgrade partition;
a partitioning module to: acquiring address information of a preset environment variable partition, reading partition information from a position in a storage space corresponding to the address information, and partitioning the storage space according to the partition information to obtain the environment variable partition and at least two partitions capable of being used as upgrading partitions; wherein the environment variable partition is used for storing the partition information, the version information of the firmware in the storage area where the system currently runs and a starting command for starting the system from the corresponding partition; the partition information records the starting addresses and the partition sizes of all the storage partitions, and the starting command records the storage partition to which the current system belongs.
9. A system upgrade apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the system upgrade method according to any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the system upgrade method according to any one of claims 1 to 7.
CN202111206997.2A 2021-10-18 2021-10-18 System upgrading method, device, equipment and storage medium Active CN113641390B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111206997.2A CN113641390B (en) 2021-10-18 2021-10-18 System upgrading method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111206997.2A CN113641390B (en) 2021-10-18 2021-10-18 System upgrading method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113641390A CN113641390A (en) 2021-11-12
CN113641390B true CN113641390B (en) 2022-03-22

Family

ID=78427279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111206997.2A Active CN113641390B (en) 2021-10-18 2021-10-18 System upgrading method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113641390B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114691180A (en) * 2022-03-24 2022-07-01 洛阳热感科技有限公司 Software upgrading method and device for processor chip, processor and processor system
CN115904450A (en) * 2022-11-02 2023-04-04 易科奇通信技术(深圳)有限公司 Embedded equipment firmware upgrading device and method, embedded equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018032757A1 (en) * 2016-08-17 2018-02-22 中兴通讯股份有限公司 Method and device for updating component
CN112363749A (en) * 2020-09-04 2021-02-12 中核武汉核电运行技术股份有限公司 Safe starting and upgrading method of MIPS architecture system
CN112882743A (en) * 2021-02-09 2021-06-01 上海金脉电子科技有限公司 Software upgrading method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020865B (en) * 2016-05-10 2020-07-10 百度在线网络技术(北京)有限公司 System upgrading method and device
CN111142907B (en) * 2019-12-25 2022-07-29 声耕智能科技(西安)研究院有限公司 Partition upgrading method for off-line keyword recognition system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018032757A1 (en) * 2016-08-17 2018-02-22 中兴通讯股份有限公司 Method and device for updating component
CN112363749A (en) * 2020-09-04 2021-02-12 中核武汉核电运行技术股份有限公司 Safe starting and upgrading method of MIPS architecture system
CN112882743A (en) * 2021-02-09 2021-06-01 上海金脉电子科技有限公司 Software upgrading method

Also Published As

Publication number Publication date
CN113641390A (en) 2021-11-12

Similar Documents

Publication Publication Date Title
US7290097B2 (en) Nonvolatile memory
JP4371771B2 (en) Power management block used in non-volatile memory system
US7818556B2 (en) Storage apparatus, control method, and control device which can be reliably started up when power is turned on even after there is an error during firmware update
CN113641390B (en) System upgrading method, device, equipment and storage medium
US8527730B2 (en) Data updating method, memory system and memory device
US7426633B2 (en) System and method for reflashing disk drive firmware
CN101650662B (en) Memory device of embedded system and staring method and upgrading of firmware
US7313682B2 (en) Method and system for updating boot memory that stores a fail-safe reset code and is configured to store boot code and boot updater code
US20110004871A1 (en) Embedded electronic device and firmware updating method thereof
CN111562934B (en) Software system upgrading method based on hot patch, terminal and storage medium
US11474805B2 (en) System capable of upgrading firmware in background and method for upgrading firmware in background
CN109582332B (en) System upgrading method and device for Internet camera
CN114398087B (en) Method for improving running stability of singlechip after program updating and singlechip
CN112908390B (en) Data storage method, device, electronic equipment and storage medium
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN114356653A (en) Power-down protection method and device for industrial control firewall
CN117270914B (en) System upgrading method, device, equipment and medium of terminal equipment
CN112905112B (en) Data processing method and system of embedded equipment
JP3951808B2 (en) Hard disk drive subsystem
WO2023060976A1 (en) File reading and writing method for embedded file system, and electronic device and storage medium
CN115686919A (en) Nonvolatile storage device, firmware damage processing method and upgrading method
CN117608491A (en) Solid state disk configuration method, electronic equipment and storage medium
CN115525315A (en) FPGA (field programmable Gate array) upgrading method and device and computer readable storage medium
CN116484327A (en) Memory operating system program write protection method and device and electronic equipment
CN111522568A (en) Method for verifying upgrade file under boot

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: 20220215

Address after: No. 209, Zhuyuan Road, Suzhou hi tech Zone, Suzhou, Jiangsu, 215011

Applicant after: SUZHOU WANDIANZHANG NETWORK TECHNOLOGY Co.,Ltd.

Address before: 215125 Creative Industrial Park 21-a301, No. 328, Xinghu street, Suzhou Industrial Park, Suzhou, Jiangsu

Applicant before: Suzhou wandianzhang Software Technology Co.,Ltd.

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