A device software upgrade and confirmation method based on encrypted upgrade package
By performing multi-partition division of the storage medium of embedded devices and decrypting and alternating upgrade packages, combined with integrity checksum confirmation rollback strategy for the first time, the problem of unavailability of functions and failure of upgrades during the upgrade of the device software is solved, and the problem of unavailability of functions and failure of upgrades is improved. The equipment operation stability and user experience are provided, and the intellectual property rights of developers are protected.
Patent Information
- Application Number
- CN202210054228.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-01-18
AI Technical Summary
During the upgrade of embedded device software, the device functions are unavailable, which affects the operation, and the software cannot operate normally after the upgrade, resulting in users needing to seek the developer's help, which is time-consuming and labor-intensive, and affects the user experience.
Multi-partition partitioning storage media is used to decrypt and alternate upgrades the encrypted compression upgrade package, combine integrity verification, and confirm that the upgrade is successful or rolled back to the original version when it is first started.
Keep the equipment running stable during the software upgrade process, avoid device failures caused by upgrade errors, improve the usability and user experience of the equipment software, and protect the intellectual property rights of the developer through encryption policies.
Smart Images

Figure CN114398062B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded device software upgrade, and in particular to a device software upgrade and confirmation method based on an encrypted upgrade package. Background Art
[0002] The software running on embedded devices generally provides a corresponding user interface to facilitate the upgrade of the software running on the device. During the upgrade process of most embedded software, some or all functions of the embedded device will be unavailable, affecting the operation of the device. If the upgrade process can minimize or even have no impact on the operation of the current device and the functions provided by the device, this will undoubtedly greatly improve the user experience.
[0003] The software systems running on the devices are the intellectual assets of the developers and need to be protected to a certain extent. They can be protected by using a certain level of encryption and compression. In this way, a corresponding decryption and decompression method is also required. In the actual device upgrade operation, there may be a situation where the embedded device cannot run normally after the software upgrade. When this happens, the user can only ask the device developer to deal with it, which is time-consuming and labor-intensive, and will also have a bad impact on the user. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a device software upgrade and confirmation method based on an encrypted upgrade package to solve the problem of protection and upgrade of the operating system and application software of the embedded device.
[0005] The object of the present invention is achieved by the following technical solution: a device software upgrade and confirmation method based on an encrypted upgrade package, the method comprising:
[0006] S1. Divide the storage medium of the embedded device into multiple partitions, store different data in different partitions, and encrypt and compress the upgrade package;
[0007] S2, decrypt the encrypted upgrade package, perform multi-partition upgrades alternately, and perform integrity verification;
[0008] S3. After the software upgrade is completed, the software is started for the first time to confirm the success of the software upgrade or to roll back if the upgrade fails.
[0009] The specific content of step S1 is to divide the storage medium into four partitions, partition one stores software group one running on the embedded device; partition two stores software group two running on the embedded device; partition three stores public files; partition four stores a startup indication flag file for guiding the boot to start the specified partition and upgrade logic decision.
[0010] The decryption of the encrypted upgrade package, the alternating upgrade of multiple partitions, and the integrity check include:
[0011] S21, storing the received encrypted upgrade package in partition one and partition two respectively, and decrypting and decompressing the upgrade packages of the two partitions using corresponding decryption algorithms and decompression tools;
[0012] S22, boot reads the startup indication flag file in partition four, the startup indication flag file indicates partition one or partition two to start the system, and after boot reads the partition indicated by the startup indication flag file, boots the upgrade package stored in the partition from the designated partition;
[0013] S23, when the device is upgraded, the boot indicator file in the partition 4 is used to determine which partition to flash into, and after the partition is flashed into, the boot indicator file is updated, thereby realizing the alternating upgrade of the two partitions;
[0014] S24, verifying the integrity of the files after the upgrade is flashed into the partition, and updating the corresponding content of the startup indication flag file after the verification passes.
[0015] The specific contents of step S23 include:
[0016] S231, the device is upgraded from partition one, the upgrade package is flashed into partition two, and the corresponding content of the startup indication flag file is updated;
[0017] S232, after the device is started from partition one, multiple upgrades are performed. First, the startup indication flag file is restored to the content before the partition two is upgraded, and then the upgrade package is flashed into the partition two, and the corresponding content of the startup indication flag file is updated;
[0018] S233, the device is upgraded after starting from the partition 2, the upgrade package is flashed into the partition 1, and the corresponding content of the startup indication flag file is updated;
[0019] S234, after the device is started from the partition two, it is upgraded multiple times. First, the startup indicator file is restored to the content before the partition one is upgraded, and then the upgrade package is flashed into the partition one, and the corresponding content of the startup indicator file is updated.
[0020] When the software is started for the first time after the software upgrade is completed, if the software can run normally on the device, then confirmation is performed, or if the software cannot run normally on the device, then rollback is performed, including:
[0021] S31. After the partition 2 is upgraded, the device restarts for the first time to run the upgrade package of partition 2. If the operation is successful, it confirms that the partition 2 upgrade is successful. If the operation fails, the device restarts and rolls back to partition 1 startup;
[0022] S32, or after partition one is upgraded, the device restarts for the first time to run the upgrade package of partition one. If the operation is successful, it confirms that partition one has been upgraded successfully. If the operation fails, the device restarts and rolls back to partition one startup.
[0023] The present invention has the following advantages:
[0024] Processing the storage medium of the device with multiple partitions is beneficial to prevent data from interfering with each other. The two software running partitions can be upgraded alternately without any impact on the current normal operation of the device. A separate partition is used to store the startup flag file used to decide which partition to start from at startup. This file is also used to write the startup flag during the upgrade. At the same time, no matter which partition the device starts running from, it can access another shared partition at the same time, which is beneficial to the retention of device configuration data and the continuity of operation logs.
[0025] The encryption strategy for device upgrade packages also protects the intellectual property rights of device software developers to a certain extent. During the upgrade process, the file list is used to check the integrity of the files for this upgrade, which largely avoids file flashing errors or anomalies caused by certain anomalies during the upgrade process.
[0026] By confirming the success of the first restart of the device after the upgrade is completed, or adopting a rollback strategy if the device fails, and by using the results of the software running in a real device environment as a basis, the availability of the device software is greatly improved, and the bricking of the device due to the flashing of an inappropriate upgrade package is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of the process of the present invention;
[0028] Figure 2 This is a flowchart of the alternate upgrade of dual partitions;
[0029] Figure 3 This is a diagram of the first startup process after the device is upgraded. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application provided below in conjunction with the drawings is not intended to limit the scope of protection of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application. The present invention is further described below in conjunction with the drawings.
[0031] like Figure 1 As shown, the present invention relates to a device software upgrade and confirmation method based on an encrypted upgrade package, the method comprising:
[0032] S1. Divide the storage medium of the embedded device into multiple partitions, store different data in different partitions, and encrypt and compress the upgrade package;
[0033] S2, decrypt the encrypted upgrade package, perform multi-partition upgrades alternately, and perform integrity verification;
[0034] S3. After the software upgrade is completed, the software is started for the first time to confirm the success of the software upgrade or to roll back if the upgrade fails.
[0035] Furthermore, the present invention divides the storage medium into four partitions, partition one stores software group one running on the embedded device; partition two stores software group two running on the embedded device; partition three stores public files, such as user configuration, system configuration and logs, etc.; partition four stores a boot indication flag file, which is used to guide the boot to start the specified partition and upgrade logic decision.
[0036] Furthermore, each sub-file of the original upgrade package is compressed into a compressed upgrade package, and then the compressed upgrade package is encrypted by using the openssl encryption tool to generate an encrypted upgrade package.
[0037] Furthermore, if Figure 2 As shown, decrypting the encrypted upgrade package, upgrading multiple partitions alternately, and checking integrity include:
[0038] S21, storing the received encrypted upgrade package in partition one and partition two respectively, and decrypting and decompressing the upgrade packages of the two partitions using corresponding decryption algorithms and decompression tools;
[0039] Specifically, use the file transfer tool in the current running system of the device to download the encrypted upgrade package and save it in the memory of the device to be run, use the decryption tool to decrypt the encrypted upgrade package into an upgrade compressed package, and then use the decompression tool to decompress the compressed upgrade package into the original upgrade package constituent files; after the decompression is completed, the upgrade package description file decompressed from the upgrade package will be used to check whether the upgrade package is suitable for upgrading the current device;
[0040] S22, boot reads the startup indication flag file in partition four, the startup indication flag file indicates partition one or partition two to start the system, and after boot reads the partition indicated by the startup indication flag file, boots the upgrade package stored in the partition from the designated partition;
[0041] S23, when the device is upgraded, the boot indicator file in the partition 4 is used to determine which partition to flash into, and after the partition is flashed into, the boot indicator file is updated, thereby realizing the alternating upgrade of the two partitions;
[0042] If the device is currently started from partition one, the upgrade package will be flashed into partition two; if the device is currently started from partition two, the upgrade package will be flashed into partition one; when upgrading, use the upgrade gadget in the upgrade package to first decompress the embedded operating system compressed package and release it to the specified partition, and then use the upgrade gadget to decompress the application software compressed package and release it to the specified path of the specified partition;
[0043] S24, verifying the integrity of the files after the upgrade is flashed into the partition, and updating the corresponding content of the startup indication flag file after the verification passes.
[0044] Furthermore, a file integrity check is performed after the upgrade is flashed into the partition. The check list in the upgrade package is used to check the integrity of the files in the flashed partition. Check whether each file under each specified path in the check list exists and whether the file verification is correct. The verification steps can be determined according to different needs, such as whether to verify each upgraded file or only important files.
[0045] Furthermore, the specific contents of step S23 include:
[0046] S231, the device is upgraded from partition one, the upgrade package is flashed into partition two, and the corresponding content of the startup indication flag file is updated;
[0047] S232, after the device is started from partition one, multiple upgrades are performed. First, the startup indication flag file is restored to the content before the partition two is upgraded, and then the upgrade package is flashed into the partition two, and the corresponding content of the startup indication flag file is updated;
[0048] S233, the device is upgraded after starting from the partition 2, the upgrade package is flashed into the partition 1, and the corresponding content of the startup indication flag file is updated;
[0049] S234, after the device is started from the partition two, it is upgraded multiple times. First, the startup indicator file is restored to the content before the partition one is upgraded, and then the upgrade package is flashed into the partition one, and the corresponding content of the startup indicator file is updated.
[0050] Furthermore, if Figure 3 As shown, after the software upgrade is completed and the software is started for the first time, the confirmation of the success of the software upgrade or the rollback of the upgrade failure includes:
[0051] S31. After the partition 2 is upgraded, the device restarts for the first time to run the upgrade package of partition 2. If the operation is successful, it confirms that the partition 2 upgrade is successful. If the operation fails, the device restarts and rolls back to partition 1 startup;
[0052] Specifically include:
[0053] S311, boot reads the startup instruction file, the file indicates to start from partition 2, and the current is the first startup after the upgrade;
[0054] S312, update the startup instruction file: the next startup partition is partition 1, clear the flag that the current startup is the first time, and set a flag that requires confirmation of successful startup;
[0055] S313, boot loads partition 2 to start;
[0056] S314, partition 2 is started successfully, the upgrade is confirmed successfully, and the startup instruction file is updated: the next startup partition is partition 2, and the flag that needs to confirm the successful startup is cleared;
[0057] S315, partition 2 fails to start, and the upgrade fails and rolls back. The device restarts and starts from partition 1 according to the flag set in step S312. Before starting partition 1, the flag that needs to confirm the successful startup is cleared.
[0058] S32, or after partition one is upgraded, the device restarts for the first time to run the upgrade package of partition one. If the operation is successful, it confirms that partition one has been upgraded successfully. If the operation fails, the device restarts and rolls back to partition one startup.
[0059] Specifically include:
[0060] S321, boot reads a startup instruction file, the file indicates starting from partition one, and the current startup is the first time after the upgrade;
[0061] S322, update the startup instruction file: the next startup partition is partition 2, clear the flag that the current startup is the first time, and set a flag that requires confirmation of successful startup;
[0062] S323, boot loading partition once started;
[0063] S324, partition 1 is successfully started, the upgrade is confirmed successfully, and the startup instruction file is updated: the next startup partition is partition 1, and the flag that requires confirmation of successful startup is cleared;
[0064] S325, if partition 1 fails to start, the upgrade fails and rolls back, the device restarts, and starts from partition 2 according to the flag set in step S322, and before starting partition 2, clears the flag that requires confirmation of successful startup.
[0065] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A device software upgrade and confirmation method based on an encrypted upgrade package, characterized in that: The method comprises: S1. Divide the storage medium of the embedded device into multiple partitions, store different data in different partitions, and encrypt and compress the upgrade package; S2, decrypt the encrypted upgrade package, perform multi-partition upgrades alternately, and perform integrity verification; S3, after the software upgrade is completed, when the software is started for the first time, confirm the success of the software upgrade or roll back the upgrade if it fails; The storage medium is divided into four partitions, where partition one stores software group one running on the embedded device; partition two stores software group two running on the embedded device; partition three stores public files; and partition four stores the boot indication flag file, which is used to guide the boot to start the specified partition and upgrade logic decision; The confirmation of successful software upgrade or rollback of failed software upgrade during the first startup after the software upgrade is completed includes: S31. After the partition 2 is upgraded, the device restarts for the first time to run the upgrade package of partition 2. If the operation is successful, it is confirmed that the partition 2 upgrade is successful. If the operation fails, the device restarts and rolls back to the partition 1 startup; specifically, it includes: S311, boot reads the startup instruction file, the file indicates to start from partition 2, and the current is the first startup after the upgrade; S312, update the startup instruction file: the next startup partition is partition 1, clear the flag that the current startup is the first time, and set a flag that requires confirmation of successful startup; S313, boot loads partition 2 to start; S314, partition 2 is started successfully, the upgrade is confirmed successfully, and the startup instruction file is updated: the next startup partition is partition 2, and the flag that needs to confirm the successful startup is cleared; S315: If partition 2 fails to start, the upgrade fails and rolls back. The device restarts and starts from partition 1 according to the flag set in step S312. Before starting partition 1, the flag that needs to confirm the successful startup is cleared. S32, or after partition 1 is upgraded, the device restarts for the first time to run the upgrade package of partition 1. If the operation is successful, it is confirmed that the upgrade of partition 1 is successful. If the operation fails, the device restarts and rolls back to the startup of partition 1; specifically, it includes: S321, boot reads a startup instruction file, the file indicates starting from partition one, and the current startup is the first time after the upgrade; S322, update the startup instruction file: the next startup partition is partition 2, clear the flag that the current startup is the first time, and set a flag that requires confirmation of successful startup; S323, boot loading partition once started; S324, partition 1 is successfully started, the upgrade is confirmed successfully, and the startup instruction file is updated: the next startup partition is partition 1, and the flag that requires confirmation of successful startup is cleared; S325: If partition 1 fails to start, the upgrade fails and rolls back. The device restarts and starts from partition 2 according to the flag set in step S322. Before starting partition 2, the flag that needs to confirm the successful start is cleared. The decryption of the encrypted upgrade package, the alternating upgrade of multiple partitions, and the integrity check include: S21, storing the received encrypted upgrade package in partition one and partition two respectively, and decrypting and decompressing the upgrade packages of the two partitions using corresponding decryption algorithms and decompression tools; S22, boot reads the startup indication flag file in partition four, the startup indication flag file indicates partition one or partition two to start the system, and after boot reads the partition indicated by the startup indication flag file, boots the upgrade package stored in the partition from the designated partition; S23, when the device is upgraded, the boot indicator file in the fourth partition is used to determine which partition to flash into, and after the partition is flashed into, the boot indicator file is updated, thereby realizing the alternating upgrade of the two partitions; S24, verifying the integrity of the files after the upgrade is flashed into the partition, and updating the corresponding content of the startup indication flag file after the verification passes; The specific contents of step S23 include: S231, the device is upgraded from partition one, the upgrade package is flashed into partition two, and the corresponding content of the startup indication flag file is updated; S232, after the device is started from partition one, multiple upgrades are performed. First, the startup indication flag file is restored to the content before the partition two is upgraded, and then the upgrade package is flashed into the partition two, and the corresponding content of the startup indication flag file is updated; S233, the device is upgraded after starting from the partition 2, the upgrade package is flashed into the partition 1, and the corresponding content of the startup indication flag file is updated; S234, after the device is started from the partition two, it is upgraded multiple times. First, the startup indicator file is restored to the content before the partition one is upgraded, and then the upgrade package is flashed into the partition one, and the corresponding content of the startup indicator file is updated.
Citation Information
Patent Citations
Method for upgrading APP running in single-chip microcomputer based on partition alternate storage
CN117270922A
