Recovery method and device of operating system, electronic equipment and storage medium

By obtaining the target button and operating system status, automatically determine the recovery trigger conditions and use the system image file to restore the operating system, the problems of cumbersome operation and high skill requirements are solved, and fast and convenient operating system recovery is achieved.

CN119782039APending Publication Date: 2025-04-08KYLAND TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411753227.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, operating system recovery has problems such as cumbersome operation and high requirements for personnel skills.

Method used

By obtaining the pressing status of the target button and/or the startup status of the operating system, determine whether the trigger condition to trigger the operating system to recover is currently met, and obtain the pre-set system image file when the conditions are met to restore the operating system.

Benefits of technology

It realizes fast and convenient recovery of the operating system, reduces the requirements for professional skills, and simplifies the operation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782039A_ABST
    Figure CN119782039A_ABST
Patent Text Reader

Abstract

The invention relates to a recovery method and device of an operating system, electronic equipment and a storage medium. The method comprises the steps that the pressing state of a target key and / or the starting state of the operating system are / is obtained; according to the pressing state of the target key and / or the starting state of the operating system, determining whether a triggering condition for triggering the operating system to recover is met at present; and when it is determined that the trigger condition is met currently, obtaining a preset system mirror image file, and recovering the operating system by using the system mirror image file. Therefore, according to the pressing state of the target key and / or the starting state of the operating system, whether the triggering condition for triggering the operating system to recover is met or not at present can be automatically determined, then the operating system is automatically recovered under the condition that the triggering condition is met at present, professional personnel do not need to recover the system with the help of professional tools, and the operation efficiency is improved. And the recovery of the operating system is quicker and more convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for recovering an operating system. Background Art

[0002] In the related art, when an operating system fails, professionals are often required to use professional tools (such as USB flash drives, hard drives, etc.) to restore the system, which results in cumbersome operations and high requirements on personnel skills. Therefore, how to quickly and conveniently restore the operating system has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] The present application provides an operating system recovery method, device, electronic device and storage medium to solve the problem in the related art that operating system recovery is complicated and requires high skills of personnel.

[0004] In a first aspect, an embodiment of the present application provides a method for recovering an operating system, the method comprising:

[0005] Obtaining the pressing status of the target button and / or the startup status of the operating system;

[0006] Determining whether a trigger condition for triggering the operating system to resume is currently met according to the pressing state of the target button and / or the startup state of the operating system;

[0007] When it is determined that the trigger condition is currently met, a preset system image file is obtained, and the operating system is restored using the system image file.

[0008] Optionally, determining whether a triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system includes:

[0009] According to the pressing state of the target button, judging whether the pressing time of the target button is greater than or equal to a preset time, and determining whether the trigger condition is currently satisfied according to the judging result; and / or,

[0010] According to the startup state of the operating system, it is determined whether the number of consecutive startup failures of the operating system is greater than a preset number, and it is determined whether the trigger condition is currently met according to the determination result.

[0011] Optionally, after determining whether a triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system, the method further includes:

[0012] When it is determined that the trigger condition is currently met, the state of the target indicator light is controlled to change according to the recovery state of the operating system.

[0013] Optionally, controlling the state of the target indicator light to change according to the recovery state of the operating system includes:

[0014] When the operating system is not fully restored, controlling the target indicator light to be in a first state;

[0015] When the operating system is restored, the target indicator light is controlled to be in a second state, wherein when the first state is a long-on state, the second state is a long-off state; when the first state is a long-off state, the second state is a long-on state.

[0016] Optionally, controlling the state of the target indicator light to change according to the recovery state of the operating system includes:

[0017] When the operating system is not fully restored, controlling the target indicator light to be in a third state;

[0018] When the operating system recovery is completed, the target indicator light is controlled to be in the second state, wherein the third state is a flashing state.

[0019] Optionally, after obtaining a preset system image file and restoring the operating system using the system image file, the method further includes:

[0020] In response to the received system restart instruction, the image system corresponding to the system image file is started.

[0021] Optionally, the system image file and the operating system file are stored in different storage partitions.

[0022] In a second aspect, an embodiment of the present application further provides a device for recovering an operating system, the device comprising:

[0023] An acquisition module, used to acquire the pressing state of the target key and / or the startup state of the operating system;

[0024] A determination module, used to determine whether a triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system;

[0025] The recovery module is used to obtain a preset system image file and use the system image file to recover the operating system when it is determined that the trigger condition is currently met.

[0026] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0027] Memory, used to store computer programs;

[0028] The processor is used to implement the operating system recovery method described in the first aspect when executing the program stored in the memory.

[0029] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the operating system recovery method described in the first aspect.

[0030] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application obtains the pressing state of the target button and / or the startup state of the operating system; determines whether the triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system; obtains the pre-set system image file when it is determined that the triggering condition is currently met, and uses the system image file to recover the operating system. In the above manner, it is possible to automatically determine whether the triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system, and then automatically recover the operating system when it is determined that the triggering condition is currently met, without the need for professionals to recover the system with the help of professional tools, making the operating system recovery faster and more convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0033] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0034] Figure 1A flowchart of a method for restoring an operating system provided in an embodiment of the present application;

[0035] Figure 2 A flowchart of another operating system recovery method provided in an embodiment of the present application;

[0036] Figure 3 A flowchart of another operating system recovery method provided in an embodiment of the present application;

[0037] Figure 4 A flowchart of another operating system recovery method provided in an embodiment of the present application;

[0038] Figure 5 A schematic diagram of the structure of an operating system recovery device provided in an embodiment of the present application;

[0039] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0041] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0042] In order to solve the problem in the related art that operating system recovery is complicated and requires high personnel skills, the present application provides an operating system recovery method, device, electronic device and storage medium, which can quickly and conveniently realize operating system recovery.

[0043] See also Figure 1 , Figure 1 The following is a flow chart of a method for restoring an operating system provided in an embodiment of the present application. Figure 1 As shown, the operating system recovery method may include the following steps:

[0044] Step 101: Obtain the pressing state of a target key and / or the startup state of an operating system.

[0045] Specifically, the target button can be an existing physical button or virtual button on the electronic device, or a newly added physical button or virtual button on the electronic device, which is not specifically limited in this application. The pressing state includes but is not limited to the button being pressed or the button not being pressed. The startup state includes but is not limited to startup success or startup failure.

[0046] As an optional implementation, in order not to affect the functions of the original buttons on the electronic device, a new physical button can be added as the target button based on the original hardware of the electronic device, and the physical button can be used to implement one-key recovery of the operating system. Specifically, the physical button can be a general-purpose input / output (GPIO) of the central processing unit (CPU) in the electronic device, which is set to GPI mode, and the default hardware pull-up is high level. When the button is pressed, the GPIO signal is connected to the ground GND, the GPIO becomes low level, and the built-in counter starts timing.

[0047] Step 102: Determine whether a trigger condition for triggering the operating system to resume is currently met based on the pressing state of the target button and / or the startup state of the operating system.

[0048] In this step, whether the triggering condition for triggering the operating system to recover is currently met can be determined based solely on the pressing state of the target button. For example, whether the target button is pressed, or whether the target button is pressed for a duration greater than or equal to a preset duration, etc., to determine whether the triggering condition for triggering the operating system to recover is currently met; it is also possible to determine whether the triggering condition for triggering the operating system to recover is currently met based solely on the startup state of the operating system. For example, whether the operating system fails to start, or whether the number of consecutive startup failures of the operating system is greater than a preset number, etc., to determine whether the triggering condition for triggering the operating system to recover is currently met; of course, it is also possible to jointly determine whether the triggering condition for triggering the operating system to recover is currently met based on the pressing state of the target button and / or the startup state of the operating system. For example, whether the triggering condition for triggering the operating system to recover is currently met can be jointly determined based on whether the operating system fails to start, and whether the target button is pressed.

[0049] For example, assuming that the triggering condition for triggering the operating system to recover is currently met based on whether the number of consecutive startup failures of the operating system is greater than the preset number, it can be determined whether the number of consecutive startup failures of the current operating system is greater than the preset number each time the electronic device is powered on and started. If the number of consecutive startup failures of the current operating system is greater than the preset number, it means that the triggering condition for triggering the operating system to recover is currently met. At this time, it is necessary to clear the number of consecutive startup failures of the current operating system and execute the operating system recovery process in step 103. If the number of consecutive startup failures of the current operating system is less than or equal to the preset number, it means that the triggering condition for triggering the operating system to recover is not met at present. At this time, the startup program can be continued to be executed. If the current startup successfully enters the operating system, the number of consecutive startup failures of the current operating system can be cleared and the number of consecutive startup failures of the operating system can be counted again. If the current startup fails to enter the operating system, the number of consecutive startup failures of the current operating system is increased by 1, and the number of startup failures of the operating system during subsequent power-on startups is continued to be counted until the number of consecutive startup failures of the operating system is cleared when it is greater than the preset number. That is to say, the number of consecutive startup failures of the operating system here will be cleared to zero if the number is greater than the preset number, and if the number is less than or equal to the preset number and the startup is successful, and will be accumulated by 1 if the number is less than or equal to the preset number and the startup fails.

[0050] Step 103: When it is determined that the trigger condition is currently met, a preset system image file is obtained, and the system image file is used to restore the operating system.

[0051] Specifically, the system image file is used to restore the operating system. The system image file can be a backup file of the current operating system of the electronic device (i.e., consistent with the operating system file version), or it can be a file updated and improved on the current operating system (i.e., inconsistent with the operating system file version). The system image file is a usable image file that has been verified in advance.

[0052] When it is determined that the trigger condition is currently met, the preset system image file can be obtained from the preset storage space, and the current operating system file can be overwritten with the system image file, and then the electronic device can be restarted to restore the operating system. Among them, the preset storage space here can be any one of a secure digital card (Secure Digital Card, referred to as SD card), a TF adapter card (TransFlash Card, referred to as TF card), a mini SATA (mini-SATA, referred to as Msata) disk, a serial hard disk (Serial Advanced Technology Attachment hard disk, referred to as SATA), an embedded multimedia card (Embedded Multi Media Card, referred to as EMMC), etc.

[0053] In this embodiment, it is possible to automatically determine whether the triggering conditions for triggering the operating system to recover are currently met based on the pressing state of the target button and / or the startup state of the operating system, and then automatically recover the operating system when it is determined that the triggering conditions are currently met, without the need for professionals to recover the system with the help of professional tools, making operating system recovery faster and more convenient.

[0054] Furthermore, the above step 102, determining whether a triggering condition for triggering the operating system to resume is currently met according to the pressing state of the target button and / or the startup state of the operating system, includes:

[0055] According to the pressing state of the target button, determine whether the target button is pressed for a duration greater than or equal to a preset duration, and determine whether the trigger condition is currently met according to the determination result; and / or,

[0056] According to the startup state of the operating system, it is determined whether the number of consecutive startup failures of the operating system is greater than a preset number, and whether the trigger condition is currently met according to the judgment result.

[0057] As an optional implementation, it is possible to determine whether the target button is pressed for a duration greater than or equal to a preset duration based on the pressing state of the target button. If the target button is pressed for a duration greater than or equal to the preset duration, it is determined that the trigger condition is currently satisfied; if the target button is pressed for a duration less than the preset duration, it is determined that the non-trigger condition is currently satisfied. It should be noted that the preset duration can be set according to actual needs, such as 5 seconds, 10 seconds, etc., and the embodiments of the present application do not make specific limitations. In this way, the user can manually press the target button to perform system recovery according to their own needs, such as when the user wants to upgrade the operating system, replace the operating system, or actively perform system recovery for other reasons.

[0058] As another optional implementation, it is possible to determine whether the number of consecutive startup failures of the operating system is greater than a preset number of times based on the startup state of the operating system. If the number of consecutive startup failures of the operating system is greater than the preset number of times, it is determined that the trigger condition is currently met; if the number of consecutive startup failures of the operating system is less than or equal to the preset number of times, it is determined that the non-trigger condition is currently met. It should be noted that the preset number of times can be set according to actual needs, such as 5 times, 10 times, etc., and the embodiments of the present application do not make specific limitations. In this way, once an electronic device fails to start multiple times, the electronic device can automatically trigger system recovery. For electronic devices that are not convenient for manual operation, such as electronic devices at sea or on wind turbine towers, there is no need to manually replace the device or manually trigger recovery.

[0059] As another optional implementation, it can be judged based on the pressing state of the target button and the startup state of the operating system. If the target button is pressed for a duration greater than or equal to a preset duration, and the number of consecutive startup failures of the operating system is greater than a preset number, it is determined that the trigger condition is currently met; if the target button is pressed for a duration less than the preset duration, and / or the number of consecutive startup failures of the operating system is less than or equal to a preset number, it is determined that the non-trigger condition is currently met.

[0060] Through the above method, it is possible to accurately determine whether the triggering conditions for triggering the operating system to recover are currently met based on the pressing state of the target button and / or the startup state of the operating system, thereby facilitating subsequent determination of whether the operating system needs to be recovered based on the judgment result.

[0061] Furthermore, after determining whether a trigger condition for triggering the operating system to recover is currently met according to the pressing state of the target key and / or the startup state of the operating system in the above step 102, the method further includes:

[0062] When it is determined that the trigger condition is currently met, the state of the target indicator light is controlled to change according to the recovery state of the operating system.

[0063] In one embodiment, when it is determined that the trigger condition is currently met, the state of the target indicator light can also be controlled to change according to the recovery state of the operating system. It should be noted that the target indicator light here can be an original indicator light on the electronic device, or a newly added indicator light on the electronic device, and this application does not make specific limitations. As an optional implementation, an indicator light can be added to the electronic device as a target indicator light. The target indicator light is a GPIO of the CPU, which is set to GPO mode. The register of the GPIO defaults to 0, which is reflected as a low level to the outside, and the hardware indicator light is off. In this way, during the startup of the electronic device, it is determined whether the target button is pressed. When the target button is pressed, the GPIO register of the target indicator light is set from 0 to 1, which is reflected as a high level to the outside, and the target indicator light is on. At this time, the built-in timer in the electronic device starts timing. When the timing time exceeds the preset duration, the GPIO register of the target indicator light is set from 1 to 0, the target indicator light is off, and the electronic device starts to restore the system image. At this time, the user can release the target button.

[0064] Through the above method, the user can accurately determine the recovery status of the operating system according to the status of the target indicator light, which is convenient for the user to perform corresponding operations.

[0065] Furthermore, the above step of controlling the state of the target indicator light to change according to the recovery state of the operating system includes:

[0066] When the operating system is not fully restored, the target indicator light is controlled to be in the first state;

[0067] When the operating system is restored, the target indicator light is controlled to be in the second state, wherein when the first state is a long-on state, the second state is a long-off state; when the first state is a long-off state, the second state is a long-on state.

[0068] In one embodiment, when the operating system has not been fully recovered, the target indicator light can be controlled to be in a long-on state, and when the operating system has been fully recovered, the target indicator light can be controlled to be in a long-off state; or when the operating system has not been fully recovered, the target indicator light can be controlled to be in a long-off state, and when the operating system has been fully recovered, the target indicator light can be controlled to be in a long-on state.

[0069] As an optional implementation, during the operating system recovery process, the GPIO register of the target indicator light is always 0, and the target indicator light is always off. When the system image file is restored to the storage area of ​​the operating system, the GPIO register of the target indicator light is set from 0 to 1, and the target indicator light is on, indicating that the system image file recovery is complete, and the electronic device can be restarted or powered off. In this scenario, the operating system recovery method is as follows: Figure 2As shown, the following steps may be specifically included:

[0070] Step 201: Power on the electronic device.

[0071] Step 202: Detect that the target key is pressed.

[0072] Step 203: Start recording the duration of the target key being pressed.

[0073] Step 204: Determine whether the target key is pressed for greater than or equal to 5 seconds.

[0074] If the target key is pressed for more than or equal to 5 seconds, execute step 205; if the target key is pressed for less than 5 seconds, execute step 208.

[0075] Step 205: The control indicator light turns off and the system recovery starts.

[0076] Step 206: System recovery is complete and the indicator light is on.

[0077] Step 207: The electronic device is powered off, then powered on again to enter the newly restored operating system.

[0078] Step 208: Start the existing operating system normally.

[0079] Through the above method, the user can accurately determine the recovery state of the operating system according to the state of the target indicator light, thereby facilitating the user to perform key operations.

[0080] Furthermore, the above step of controlling the state of the target indicator light to change according to the recovery state of the operating system includes:

[0081] When the operating system is not fully restored, the target indicator light is controlled to be in the third state;

[0082] When the operating system recovery is completed, the target indicator light is controlled to be in the second state, wherein the third state is a flashing state.

[0083] In one embodiment, when the operating system is not fully recovered, the target indicator light may be controlled to be in a flashing state, and when the operating system is fully recovered, the target indicator light may be controlled to be in a long-off state or a long-on state.

[0084] As an optional implementation, during the operating system recovery process, the target indicator light is in a flashing state. The electronic device uses the PWM_LED function to repeatedly set the GPIO register of the target indicator light to 0 and 1 at a frequency of 0.5Hz. When the system image file is restored to the storage area of ​​the operating system, the GPIO register of the target indicator light is set to 1, and the indicator light is always on. The user can clearly understand the relevant status of the device. In this scenario, the operating system recovery method is as follows: Figure 3 As shown, the following steps may be specifically included:

[0085] Step 301: Power on the electronic device.

[0086] Step 302: The number of consecutive boot failures of the operating system is calculated by adding 1 to the value of boot_failed_num.

[0087] Step 303: Determine whether the number of consecutive startup failures of the operating system is greater than 5 times.

[0088] If the number of consecutive startup failures of the operating system is greater than 5 times, execute step 304; if the number of consecutive startup failures of the operating system is less than or equal to 5 times, execute step 308.

[0089] Step 304: Control the indicator light to flash at 0.5 Hz to start system recovery.

[0090] Step 305: System recovery is complete and the indicator light is on.

[0091] Step 306: The value of boot_failed_num, the number of consecutive boot failures of the operating system, is cleared to 0.

[0092] Step 307: The electronic device is powered off, then powered on again to enter the newly restored operating system.

[0093] Step 308, continue to execute the startup procedure;

[0094] Step 309: determine whether to start the existing operating system;

[0095] If the existing operating system is started, step 310 is executed; if the existing operating system is not started, step 311 is executed.

[0096] Step 310: The value of boot_failed_num, the number of consecutive boot failures of the operating system, is cleared to 0.

[0097] Step 311, the value of boot_failed_num, the number of consecutive boot failures of the operating system + 1, remains unchanged.

[0098] It should be noted that the number of consecutive boot failures of the operating system boot_failed_num here is realized by setting the function boot_failed_num in the boot program, which is used to record the number of boot failures. The default value is 0. The register corresponding to this function can be the actual physical address on the Flash chip (such as 0x8000xx, etc.), and the value can remain unchanged even when the power is off. When the electronic device is powered on and started, first determine the value of boot_failed_num. When it is less than or equal to 5, the count is automatically increased by 1, and then the boot program continues to execute. After successfully booting into the operating system, the system will call the clear_boot_failed_num interface function to clear the value of boot_failed_num to 0. If the boot fails and the operating system is not entered, the count value remains unchanged at the original value +1. If the boot fails continuously, it will continue to increase by 1.

[0099] Through the above method, the user can accurately determine the recovery status of the operating system according to the status of the target indicator light, thereby facilitating the user to perform related operations.

[0100] Furthermore, after the above step 03, obtaining a preset system image file, and using the system image file to restore the operating system, the method further includes:

[0101] In response to the received system restart instruction, the image system corresponding to the system image file is started.

[0102] In one embodiment, after the operating system is restored using the system image file, a system restart instruction triggered by a user can also be received, and after receiving the system restart instruction, the image system corresponding to the system image file is started, so that the electronic device can enter the successful image system and use it.

[0103] Furthermore, the system image files and the operating system files are stored in different storage partitions.

[0104] In one embodiment, the system image file and the operating system file need to be stored in different storage partitions. This is because during the operating system recovery process, all data in the partition corresponding to the operating system file will be refreshed, so the system image file cannot be placed in the running system partition. For example, suppose that the operating system file A is placed in the C drive of the electronic device, and the system image file B is placed in the D drive of the electronic device. The operating system recovery process is as follows: Figure 4 As shown, the following steps are included:

[0105] Step 401: Power on the electronic device.

[0106] Step 402: Determine whether the value of the GPIO register of the target button is 0.

[0107] If the value of the GPIO register of the target key is 0, it means that the target key is pressed, and step 403 is executed; if the value of the GPIO register of the target key is 1, it means that the target key is not pressed, and step 407 is executed.

[0108] Step 403: Determine whether the target button is pressed for a time period greater than or equal to 5 seconds.

[0109] If the target key is pressed for a duration greater than or equal to 5 seconds, execute step 404 ; if the target key is pressed for a duration less than 5 seconds, execute step 407 .

[0110] Step 404: copy the system image file B in the D disk to the C disk, overwriting the operating system file A. At this time, the target indicator light goes out.

[0111] Step 405: System recovery is complete and the target indicator light is on.

[0112] Step 406: The electronic device is powered on again and boots into the newly restored operating system from the C drive.

[0113] Step 407: Start normally from the C drive and enter the original operating system.

[0114] Through the above method, the operation of personnel can be simplified, the difficulty of operation can be reduced, and the efficiency of system recovery can be improved; moreover, users can also flexibly update the software system of the device and restore a new system with one click, not just restoring the original default settings. In addition, the system can also be automatically restored if it is damaged.

[0115] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an operating system recovery device provided in an embodiment of the present application. Figure 5 As shown, the operating system recovery device 500 includes:

[0116] An acquisition module 501 is used to acquire the pressing state of a target key and / or the startup state of an operating system;

[0117] A determination module 502, configured to determine whether a trigger condition for triggering the operating system to resume is currently satisfied according to the pressing state of the target key and / or the startup state of the operating system;

[0118] The recovery module 503 is used to obtain a preset system image file and use the system image file to recover the operating system when it is determined that the trigger condition is currently met.

[0119] Further, the determination module 502 includes:

[0120] A first determination submodule is used to determine whether the target key is pressed for a duration greater than or equal to a preset duration according to the pressing state of the target key, and determine whether a trigger condition is currently met according to the determination result; and / or,

[0121] The second determination submodule is used to determine whether the number of consecutive startup failures of the operating system is greater than a preset number according to the startup state of the operating system, and determine whether the trigger condition is currently met according to the judgment result.

[0122] Furthermore, the device 500 also includes:

[0123] The control module is used to control the state of the target indicator light to change according to the recovery state of the operating system when it is determined that the trigger condition is currently met.

[0124] Furthermore, the control module includes:

[0125] A first control submodule, used for controlling the target indicator light to be in a first state when the operating system has not been fully restored;

[0126] The second control submodule is used to control the target indicator light to be in the second state when the operating system recovery is completed, wherein when the first state is a long-on state, the second state is a long-off state; when the first state is a long-off state, the second state is a long-on state.

[0127] Furthermore, the control module includes:

[0128] A third control submodule, used to control the target indicator light to be in a third state when the operating system is not fully restored;

[0129] The fourth control submodule is used to control the target indicator light to be in the second state when the operating system recovery is completed, wherein the third state is a flashing state.

[0130] Furthermore, the device 500 also includes:

[0131] The startup module is used to start the image system corresponding to the system image file in response to the received system restart instruction.

[0132] Furthermore, the system image files and the operating system files are stored in different storage partitions.

[0133] It should be noted that the operating system recovery device 500 can implement the operating system recovery method provided by any of the aforementioned method embodiments and can achieve the same technical effects, which will not be described in detail herein.

[0134] like Figure 6As shown, the embodiment of the present application further provides an electronic device, including a processor 611, a communication interface 612, a memory 613 and a communication bus 614, wherein the processor 611, the communication interface 612, and the memory 613 communicate with each other through the communication bus 614.

[0135] Memory 613, used for storing computer programs;

[0136] In one embodiment of the present application, the processor 611 is used to implement the operating system recovery method provided by any of the aforementioned method embodiments when executing the program stored in the memory 613.

[0137] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the operating system recovery method provided by any of the aforementioned method embodiments is implemented.

[0138] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0139] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0140] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0141] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for recovering an operating system, characterized in that: The method comprises: Obtaining the pressing status of the target button and / or the startup status of the operating system; Determining whether a trigger condition for triggering the operating system to resume is currently met according to the pressing state of the target button and / or the startup state of the operating system; When it is determined that the trigger condition is currently met, a preset system image file is obtained, and the operating system is restored using the system image file.

2. The method according to claim 1, characterized in that: The determining whether a triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system includes: According to the pressing state of the target button, judging whether the pressing time of the target button is greater than or equal to a preset time, and determining whether the trigger condition is currently satisfied according to the judging result; and / or, According to the startup state of the operating system, it is determined whether the number of consecutive startup failures of the operating system is greater than a preset number, and it is determined whether the trigger condition is currently met according to the determination result.

3. The method according to claim 1, characterized in that After determining whether a trigger condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system, the method further includes: When it is determined that the trigger condition is currently met, the state of the target indicator light is controlled to change according to the recovery state of the operating system.

4. The method according to claim 3, characterized in that The controlling the state of the target indicator light to change according to the recovery state of the operating system includes: When the operating system is not fully restored, controlling the target indicator light to be in a first state; When the operating system is restored, the target indicator light is controlled to be in a second state, wherein when the first state is a long-on state, the second state is a long-off state; when the first state is a long-off state, the second state is a long-on state.

5. The method according to claim 4, characterized in that The controlling the state of the target indicator light to change according to the recovery state of the operating system includes: When the operating system is not fully restored, controlling the target indicator light to be in a third state; When the operating system recovery is completed, the target indicator light is controlled to be in the second state, wherein the third state is a flashing state.

6. The method according to claim 1, characterized in that After obtaining the preset system image file and restoring the operating system using the system image file, the method further includes: In response to the received system restart instruction, the image system corresponding to the system image file is started.

7. The method according to any one of claims 1 to 6, characterized in that The system image file and the operating system file are stored in different storage partitions.

8. A recovery device for an operating system, characterized in that: The device comprises: An acquisition module, used to acquire the pressing state of the target key and / or the startup state of the operating system; A determination module, used to determine whether a triggering condition for triggering the operating system to recover is currently met according to the pressing state of the target button and / or the startup state of the operating system; The recovery module is used to obtain a preset system image file and use the system image file to recover the operating system when it is determined that the trigger condition is currently met.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the operating system recovery method according to any one of claims 1 to 7 when executing a program stored in a memory.

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