Embedded system upgrading result detection method and device and storage medium
By setting the upgrade detection flag and the number of startup threshold in the embedded system, the bootloader program detects and judges the operation status of the new version, solving the problem of abnormal system recovery after the software upgrade and ensuring the stable operation of the system.
Patent Information
- Application Number
- CN202411182818.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-17
AI Technical Summary
After the embedded system software is upgraded, the kernel crashes, the system cycles restarts or cannot be accessed normally due to defects. The traditional verification mechanism cannot be rolled back to the old version, resulting in system instability.
By setting the upgrade detection flag and the number of startup threshold after upgrading, the bootloader program detects and judges the operation of the new version. If it is abnormal, it will automatically restart until it reaches the threshold and restores to the old version to ensure the stability of the system.
It realizes timely detection and recovery to the previous version after the software is upgraded, improving the stability of the system and avoiding system abnormalities caused by defects in the new version of the software.
Smart Images

Figure CN119149281A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an embedded software upgrade technology, and in particular to an embedded system upgrade result detection method, device and storage medium. Background Art
[0002] Upgrading embedded system software can improve user experience, including introducing new features, fixing errors, and optimizing interfaces. However, problems such as power outages and software defects often occur during the upgrade process, resulting in upgrade failures.
[0003] Currently, upgrade verification is mostly limited to firmware version confirmation and data integrity check, while ignoring the verification of the actual operating status of the system after the upgrade. If there are defects in the upgraded software, it may cause kernel panic, system loop restart or inability to access normally. At this time, the traditional bootloader (the boot loader before the system software starts) mechanism cannot roll back to the old version, and the system will fall into an unstable state.
[0004] Therefore, it is necessary to propose an embedded system upgrade result detection scheme to detect the running status after the software upgrade, so as to solve the problem of abnormal system recovery after the upgrade. Summary of the invention
[0005] The technical problem to be solved by the present invention is to propose an embedded system upgrade result detection method, device and storage medium, so that when an abnormal situation occurs in the system after the software upgrade, the system can be restored to the version before the upgrade in time to improve the system stability.
[0006] The technical solution adopted by the present invention to solve the above technical problems is:
[0007] In a first aspect, the present invention provides a method for detecting an upgrade result of an embedded system, comprising:
[0008] S1. After writing the upgrade software to the flash, start the upgrade detection program, write the upgrade detection flag and clear the upgrade startup times, then the embedded system automatically restarts and enters step S2;
[0009] S2, the system starts the bootloader program, and the bootloader program detects whether there is an upgrade detection flag. If so, it goes to step S3, otherwise, it starts the new software version and goes to step S4;
[0010] S3, determine whether the current upgrade startup count is greater than or equal to the preset startup count threshold, if so, clear the upgrade detection flag and start the software version before the upgrade, and end the process; otherwise, start the new software version, and increase the current upgrade startup count by one, and enter step S4;
[0011] S4, determine whether there is an abnormality in the process of starting the new software version. If so, the embedded system automatically restarts and returns to step S2. Otherwise, determine whether there is an upgrade detection mark. If not, the system startup is completed and the process ends. If there is an upgrade detection mark, go to step S5;
[0012] S5. Start the upgrade detection program. After the upgrade detection program detects the upgrade detection flag, it detects the basic business operation status. If the detection passes, the upgrade detection flag is cleared, the upgrade startup times are cleared, the upgrade detection is exited, and the process ends; otherwise, the upgrade startup times are updated to the preset startup times threshold, and then the embedded system automatically restarts and returns to step S2.
[0013] Furthermore, in step S4, the determining whether there is an abnormality in the process of starting the new software version includes: determining whether there is an abnormality in the kernel or a system hang (deadlock and no response) in the process of starting the new software version.
[0014] Furthermore, in step S5, the basic service operation status includes but is not limited to: whether the WEB, DHCP, WAN and LAN service programs are running normally.
[0015] In a second aspect, the present invention further provides an embedded system upgrade result detection device, which includes a processor and a memory, wherein the memory stores a computer program, and the processor implements the steps of the above method by executing the computer program.
[0016] In a third aspect, the present invention further provides a storage medium having a computer program stored thereon, which implements the steps of the above method when the computer program is executed by a processor.
[0017] The beneficial effects of the present invention are:
[0018] Based on the scheme of the present invention, by setting an upgrade detection flag and the number of upgrade startups, during the startup process of the bootloader program, the number of upgrade startups is determined after the upgrade detection flag is detected. Within the set upgrade startup number threshold, a new software version will be started, and it will be determined whether a system hang or kernel abnormality occurs during the startup of the new version. If so, it will automatically restart and update the upgrade startup number. If no abnormality occurs, the upgrade detection program will be started again to detect the healthy operation of the basic business. If the detection passes, the upgrade detection flag will be cleared, indicating that the new system version can operate normally. If the healthy operation of the basic business fails to pass the detection, the upgrade startup number will be updated to the set threshold, and it will be automatically restarted again. In this way, after the restart, the bootloader program will detect that the upgrade startup number is greater than the threshold, thereby restoring the software version to the version before the upgrade, thereby ensuring the stable operation of the embedded system. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The figure is a flow chart of an embedded system upgrade result detection method in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The present invention aims to provide an embedded system upgrade result detection method, device and storage medium. When the system has an abnormal condition after the software upgrade, it will be restored to the version before the upgrade in time to improve the system stability. The core idea is to set the upgrade detection flag and the upgrade startup times. When the upgrade detection flag exists, the upgrade detection program will be started to detect the operation of the basic business. Only when the basic business operation detection is normal will the flag be cleared to exit the upgrade detection. When the basic business operation is abnormal, it means that the new version of the software may have defects. At this time, the upgrade startup times are directly updated to the set threshold times. The upgrade startup times reflect the number of system restarts during the upgrade detection process. In the scheme of the present invention, if the system hangs or the kernel is abnormal during the startup of the new version of the software, the system will automatically restart. If the set threshold times are reached, the system still cannot start the new version normally, which means that the new version of the software may have defects. At this time, the bootloader program will start the previous old version of the software, thereby ensuring the stable operation of the system.
[0021] Example
[0022] See also Figure 1 , this embodiment provides an embedded system upgrade result detection method, including the following implementation steps:
[0023] S1. After writing the upgrade software to the flash, start the upgrade detection program, write the upgrade detection flag and clear the upgrade startup times, then the embedded system automatically restarts and enters step S2;
[0024] In this step, the upgrade detection program will detect whether the upgrade detection flag exists. After the upgrade software is written to the flash, it is the first time to start the upgrade detection program. At this time, the upgrade detection flag does not exist. The upgrade detection program will automatically write the upgrade detection flag, indicating that the upgrade detection has not been completed, and clear the upgrade startup times, that is, set the upgrade startup times to 0, and then the system will automatically restart and enter the next step.
[0025] S2, the system starts the bootloader program, and the bootloader program detects whether there is an upgrade detection flag. If so, it goes to step S3, otherwise, it starts the new software version and goes to step S4;
[0026] In this step, after the system restarts, the bootloader program will be started first, and the bootloader program will also detect whether there is an upgrade detection flag. If not, it means that the upgrade detection function is not enabled, or the upgrade detection has ended, and the new software version will be directly started. If the upgrade detection flag exists, step S3 will be entered to determine the number of upgrade startup times.
[0027] S3, determine whether the current upgrade startup count is greater than or equal to the preset startup count threshold, if so, clear the upgrade detection flag and start the software version before the upgrade, and end the process; otherwise, start the new software version, and increase the current upgrade startup count by one, and enter step S4;
[0028] In this step, the upgrade startup count will be compared with the preset startup count threshold. If the startup count threshold is not reached, the new software version will be started and the current upgrade startup count will be updated by 1. If the startup count threshold is reached, it means that the new software version has defects. In order to ensure the stability of the system, the old version before the upgrade will be loaded.
[0029] S4, determine whether there is an abnormality in the process of starting the new software version. If so, the embedded system automatically restarts and returns to step S2. Otherwise, determine whether there is an upgrade detection mark. If not, the system startup is completed and the process ends. If there is an upgrade detection mark, go to step S5;
[0030] In this step, during the process of starting the new software version, it is monitored whether there are abnormal conditions such as kernel abnormalities (such as panic, etc.) and system hangs. If they occur, the system automatically restarts and returns to the process of starting the bootloader program in step S2. If these abnormalities do not occur, the software upgrade detection program is started again if there is an upgrade detection mark, and the process goes to step S5. If there is no upgrade detection mark, the system startup is completed and the new software version is used normally.
[0031] S5. Start the upgrade detection program. After the upgrade detection program detects the upgrade detection flag, it detects the basic business operation status. If the detection passes, the upgrade detection flag is cleared, the upgrade startup times are cleared, the upgrade detection is exited, and the process ends; otherwise, the upgrade startup times are updated to the preset startup times threshold, and then the embedded system automatically restarts and returns to step S2.
[0032] In this step, after starting the upgrade detection program, the upgrade detection program detects the upgrade detection flag, indicating that the upgrade detection has not been completed. The upgrade detection program then detects the basic business operation status, such as WEB, DHCP, WAN and LAN business programs. If the detection passes, the upgrade detection flag is cleared, the upgrade startup times are cleared, the upgrade detection is exited, and the process ends; otherwise, the upgrade startup times are updated to the preset startup times threshold, and then the embedded system automatically restarts and returns to step S2.
[0033] Finally, it should be noted that the above embodiments are only preferred implementations and are not intended to limit the present invention. It should be pointed out that for those skilled in the art, several modifications, equivalent replacements, improvements, etc. can be made without departing from the scope of the present invention and the scope of protection of the claims, and all of these should be included in the protection scope of the present invention.
Claims
1. A method for detecting upgrade results of an embedded system, It is characterized in that include: S1. After writing the upgrade software to the flash, start the upgrade detection program, write the upgrade detection flag and clear the upgrade startup times, then the embedded system automatically restarts and enters step S2; S2, the system starts the bootloader program, and the bootloader program detects whether there is an upgrade detection flag. If so, it goes to step S3, otherwise, it starts the new software version and goes to step S4; S3, determining whether the current upgrade startup times are greater than or equal to a preset startup times threshold, if so, clearing the upgrade detection flag and starting the software version before the upgrade, and ending the process; Otherwise, start the new software version, and increase the current upgrade startup count by one, and proceed to step S4; S4, determine whether there is an abnormality in the process of starting the new software version. If so, the embedded system automatically restarts and returns to step S2. Otherwise, determine whether there is an upgrade detection mark. If not, the system startup is completed and the process ends. If there is an upgrade detection mark, go to step S5; S5. Start the upgrade detection program. After the upgrade detection program detects the upgrade detection flag, it detects the basic business operation status. If the detection passes, the upgrade detection flag is cleared, the upgrade startup times are cleared, and the upgrade detection is exited, ending the process. Otherwise, the upgrade startup times are updated to a preset startup times threshold, and then the embedded system automatically restarts, and the process returns to step S2.
2. A method for detecting an embedded system upgrade result as claimed in claim 1, It is characterized in that In step S4, the determining whether there is an abnormality in the process of starting the new software version includes: determining whether there is an abnormality such as a kernel abnormality or a system hang in the process of starting the new software version.
3. A method for detecting an embedded system upgrade result as claimed in claim 1 or 2, It is characterized in that In step S5, the basic service operation status includes: whether the WEB, DHCP, WAN and LAN service programs are running normally.
4. An embedded system upgrade result detection device, comprising a processor and a memory, It is characterized in that The memory stores a computer program, and the processor implements the steps of the embedded system upgrade result detection method as described in any one of claims 1 to 3 by executing the computer program.
5. A storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for detecting upgrade results of an embedded system as described in any one of claims 1 to 3 are implemented.
