Firmware recovery method and device and electronic equipment
By obtaining the number of consecutive restarts in the device boot program, and when the preset times are reached, the firmware version is restored, the technical problem of firmware recovery when the operating system cannot load normally, and the automatic recovery and normal operation of the device are realized .
Patent Information
- Application Number
- CN202411548917.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
AI Technical Summary
When the device's operating system cannot load and run normally, how to restore the firmware has become a technical challenge.
By responding to device startup, start the boot program to obtain the number of times the device currently has a continuous target situation (such as the device restarts within the preset time after boot program startup). When the number of times reaches the preset number, restore the firmware from the current version to Target version.
It realizes automatic firmware version recovery when the device cannot load the operating system normally, ensuring that the device resumes normal operation, with a wider scope of application and simple implementation method.
Smart Images

Figure CN119440898A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to computer technology fields such as data recovery, software-hardware interaction, and more particularly to a firmware recovery method, device, and electronic device. Background Art
[0002] At present, mobile phones, computers, embedded devices, industrial computers and other devices are widely used in production, life and other aspects. Among them, the devices usually include firmware, which is the most important and basic software of the device. It not only determines the function and performance of the device, but also serves as an important bridge for the upper operating system to drive the device.
[0003] During the operation of the device, the firmware may need to be restored due to abnormal reasons such as program abnormalities, configuration errors, firewall tampering, etc. How to restore the firmware when the device's operating system cannot load and run normally is a problem that needs to be solved. Summary of the invention
[0004] The present disclosure provides a firmware recovery method, device and electronic device.
[0005] According to a first aspect of the present disclosure, a firmware recovery method is provided, comprising: in response to device startup, starting a boot program of the device; obtaining, through the boot program, the number of times a target situation has occurred continuously on the device, wherein the target situation includes the device being restarted within a preset time period after the boot program is started; and when the number reaches a preset number, restoring the firmware of the device from a current version to a target version.
[0006] According to a second aspect of the present disclosure, a firmware recovery device is provided, comprising: a startup module, for starting a boot program of the device in response to device startup; an acquisition module, for acquiring, through the boot program, the number of times a target situation has occurred continuously in the device, wherein the target situation includes the device being restarted within a preset time after the boot program is started; and a first processing module, for restoring the firmware of the device from a current version to a target version when the number reaches a preset number.
[0007] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0008] at least one processor; and
[0009] a memory communicatively connected to the at least one processor; wherein,
[0010] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the firmware recovery method as described in the first aspect.
[0011] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the firmware recovery method as described in the first aspect.
[0012] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the firmware recovery method as described in the first aspect.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0015] Figure 1 is a flowchart of a firmware recovery method provided according to an embodiment of the present disclosure;
[0016] Figure 2 is a flowchart of a firmware recovery method provided according to another embodiment of the present disclosure;
[0017] Figure 3 is a flowchart of a firmware recovery method provided according to another embodiment of the present disclosure;
[0018] Figure 4 is a structural diagram of a firmware recovery device provided according to an embodiment of the present disclosure;
[0019] Figure 5 The block diagram of an electronic device used to implement the firmware recovery method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0021] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, comply with the relevant laws and regulations, and do not violate public order and good morals.
[0022] The firmware recovery method in the related art needs to send a message through the application layer to trigger the recovery of the device's firmware version, under the premise that the device's operating system can be loaded and run normally.
[0023] In order to implement firmware recovery when the operating system of the device cannot be loaded and run normally, the embodiments of the present disclosure provide a firmware recovery method, device and electronic device based on software implementation.
[0024] The firmware recovery method, device and electronic device according to the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0025] It should be noted that the executor of the firmware recovery method of this embodiment is a firmware recovery device, which can be implemented by software and / or hardware, and can be an electronic device or configured in an electronic device, and the present disclosure does not limit this.
[0026] Figure 1 It is a flowchart of a firmware recovery method provided according to an embodiment of the present disclosure.
[0027] like Figure 1 As shown, the firmware recovery method includes:
[0028] Step 101, in response to device startup, start a boot program of the device.
[0029] Wherein, when the firmware recovery device is an electronic device or is configured in an electronic device, the device in step 101 is the electronic device.
[0030] Among them, device startup refers to powering on the device.
[0031] The boot program of the device is a computer program used to load the operating system or other system software after the device completes the Power On Self Test (POST). The boot program of the device can be started each time in response to the startup of the device.
[0032] Step 102, obtaining, through the boot program, the number of times the target situation has occurred continuously on the device, wherein the target situation includes the device restarting within a preset time after the boot program is started.
[0033] Among them, the preset duration can be set as needed.
[0034] In one possible implementation form, each time the device is started, the boot program can be used to record the number of times the target situation has occurred consecutively on the device. Thus, after the device is started for the current time, the boot program can be used to obtain the number of times the target situation has occurred consecutively on the device from historical records.
[0035] Step 103: When the number of times reaches a preset number, the firmware of the device is restored from the current version to the target version.
[0036] Among them, the preset number of times can be set as needed, for example, it can be set to 3 times, 5 times, 10 times, etc.
[0037] The target version may be any version of the firmware in the device that can run normally, and the present disclosure does not limit this.
[0038] In one possible implementation, the target version of the firmware can be saved to a preset storage location, so that when the boot program determines that the device has currently encountered the target situation for a preset number of consecutive times, the target version can be obtained from the preset storage location and the current version of the firmware can be restored to the target version.
[0039] It should be noted that when restoring the firmware version, it is necessary to ensure the security and integrity of the data, and it is also necessary to consider compatibility and stability issues with the operating system. In the embodiments of the present disclosure, the firmware version can be restored based on the data recovery technology and software-hardware interaction technology in the relevant technology to ensure the successful recovery of the firmware version and the normal operation of the device.
[0040] Therefore, the firmware recovery method provided by the embodiment of the present disclosure starts the boot program of the device in response to the device startup, and obtains the number of times the target situation has occurred continuously on the device through the boot program, wherein the target situation includes the device restarting within a preset time period after the boot program is started, and when the number reaches the preset number, the firmware of the device is restored from the current version to the target version. When the target situation has occurred continuously for multiple times on the device, the firmware version of the device can be restored to the target version, thereby restoring the normal operation of the device. The method is implemented through the boot program and can be completed before the operating system is loaded. It does not require the device to be able to load and run the operating system normally. It has a wider scope of application and does not need to rely on more software and hardware support except for the boot program of the device. The implementation method is simple.
[0041] In order to clearly explain the process of obtaining the number of times a target situation has occurred continuously on a device through a boot program, an embodiment of the present disclosure also provides a firmware recovery method.
[0042] Figure 2 It is a flowchart of a firmware recovery method provided according to another embodiment of the present disclosure.
[0043] like Figure 2 As shown, the firmware recovery method includes:
[0044] Step 201, in response to device startup, start a boot program of the device.
[0045] Step 202, obtaining a target file through a boot program, wherein the target file includes number indication information, and the number indication information is used to indicate the number of times the device has continuously encountered a target situation, wherein the target situation includes the device restarting within a preset time after the boot program is started.
[0046] Step 203: Obtain the number of times based on the number indication information.
[0047] The target file is used to record the number of times the target situation has occurred continuously on the device.
[0048] The representation method of the number of times indicated by the number indication information can be set as needed. For example, Arabic numerals can be used to directly indicate the number of times the target situation has appeared continuously in the device.
[0049] In a possible implementation form, after each boot program is started, the boot program can be used to determine whether the target file exists. If the target file exists, the number of times indication information can be obtained from the target file, and then based on the number of times indication information, the number of times the target situation has appeared continuously on the device can be obtained. Among them, the number of times indicated by the number of times indication information in the target file obtained after the boot program is started for the last time can be recorded after the boot program was started last time. In this way, it is possible to quickly determine the number of times the target situation has appeared continuously on the device based only on the number of times indication information in the target file.
[0050] If the target file does not exist, the target file can be created by the boot program, and the number indication information can be written into the target file, wherein the number of times indicated by the number indication information can be the second initial number of times. Thus, after the device is started next time, the number indication information can be used in the target file to continue recording the number of times the device has continuously encountered the target situation starting from the second initial number of times.
[0051] The second initial number of times can be set as needed, and is usually less than the preset number of times. For example, when Arabic numerals are used to indicate the number of times the target situation has occurred continuously, if a startup of the device when the target file does not exist is regarded as one of the number of times the target situation has occurred continuously, then the second initial number of times can be 1; if a startup of the device when the target file does not exist is not regarded as one of the number of times the target situation has occurred continuously, then the second initial number of times can be 0.
[0052] Step 204, determine whether the number of times reaches the preset number, if so, execute step 205, otherwise, execute step 206.
[0053] Step 205: restore the device's firmware from the current version to the target version.
[0054] In a possible implementation form, the target version of the firmware can be saved to a preset storage location, so that when the boot program determines that the device has currently encountered the target situation for a preset number of consecutive times, the target version can be obtained from the preset storage location, and the current version of the firmware can be restored to the target version. Thus, when the device has currently encountered the target situation for multiple consecutive times, the firmware version of the device can be restored to the target version, so that the device can resume normal operation.
[0055] In a possible implementation form, it can be understood that if the device repeatedly encounters the following situation: restarting after the boot program is started and before the system files of the device are loaded, then it can be considered that the current firmware version of the device is unavailable and version recovery is required. Then, in the embodiment of the present disclosure, the preset duration can be determined based on the duration between the first moment and the second moment, wherein the first moment is the moment when the boot program is started, and the second moment is the moment when the system files of the device are loaded. For example, as an example, the duration between the first moment and the second moment is determined as the preset duration. Correspondingly, the target situation includes: the device restarts after the boot program is started and before the system files of the device are loaded, so that when the device encounters the above-mentioned target situation repeatedly, it is determined that the current firmware version of the device is unavailable, thereby restoring the firmware version of the device to the target version, so that the device resumes normal operation.
[0056] In a possible implementation form, the target version includes the version of the firmware that was most recently run normally, so that the firmware version of the device can be restored to the latest version of the firmware that can run normally, thereby retaining the latest functions of the firmware and improving user satisfaction.
[0057] Step 206: Add one to the number indicated by the number indication information.
[0058] In the embodiment of the present disclosure, after the number of times indicated by the number indication information is incremented by one, the updated number indication information can be saved in the target file.
[0059] Step 207 , determining whether the device is restarted within a preset time period after the boot program is started, if so, executing step 209 , otherwise, executing step 208 .
[0060] It is understandable that there is no time data in the boot program. Therefore, in order to perform timing, a timing variable can be created through the boot program in response to the boot program starting, wherein the timing variable is used to start timing from the start of the boot program, so that timing can be performed based on the timing variable after the boot program starts, and then based on the timing result, it can be determined whether the device is restarted within a preset time after the boot program starts.
[0061] The timing unit of the timing variable can be set as needed, and the present disclosure does not impose any restrictions on this. For example, it can be set to seconds, that is, the value of the timing variable can increase by 1 per second.
[0062] In a possible implementation form, a duration variable corresponding to a preset duration may be set, and after the boot program is started, the boot program loop may be used to determine whether the value of the timing variable is greater than the value of the duration variable, and whether the device is restarted. If the device still does not restart when the value of the timing variable is greater than the value of the duration variable, it may be determined that the device has not restarted within the preset duration after the boot program is started. If the device restarts when the value of the timing variable is not greater than the value of the duration variable, it may be determined that the device restarts within the preset duration after the boot program is started.
[0063] In a possible implementation form, since the device will be powered off when it is restarted, whether the device is restarted can be determined based on whether the device is powered off. If the device is still powered on when the value of the timing variable is greater than the value of the duration variable, it can be determined that the device has not been restarted within the preset duration after the boot program is started; if the device is powered off when the value of the timing variable is not greater than the value of the duration variable, it can be determined that the device has been restarted within the preset duration after the boot program is started.
[0064] Step 208, setting the processed number of times as the first initial number of times.
[0065] It can be understood that once the device does not restart within the preset time after the boot program is started, the current firmware version of the device can be considered to be usable and there is no need to restore to the target version. The number of times after processing can be set to the first initial number, so that when the target situation occurs after the device is started next time, the number of times the device has encountered the target situation continuously can be re-recorded starting from the first initial number.
[0066] Among them, the first initial number can be set as needed. For example, when Arabic numerals are used to represent the number of times the target situation has appeared continuously in the device, and the number is counted from 0, that is, each consecutive occurrence of the target situation is recorded as 1, then the first initial number can be set to 0.
[0067] The second initial number may be the same as or different from the first initial number, and the present disclosure does not impose any limitation on this.
[0068] Step 209, maintaining the number of times after processing unchanged.
[0069] It is understandable that, when the device is restarted within the preset time after the boot program is started, since the device is powered off when restarting, the number of times after the increment processing in step 206 can remain unchanged. Thus, when the target situation occurs after the device is currently started, the number of times indicated by the number indication information can be incremented by one, so that after the device and the boot program are started next time, the boot program can quickly determine the number of times the target situation has occurred continuously on the device based on the number indication information.
[0070] Among them, the specific implementation forms of steps 201-209 and similar steps in other embodiments can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.
[0071] In summary, the firmware recovery method provided in the embodiment of the present disclosure can restore the firmware version of the device to the target version when the device has currently encountered the target situation for multiple consecutive times, thereby restoring the device to normal operation. The method is implemented through a boot program and can be completed before the operating system is loaded. It does not require the device to be able to load and run the operating system normally. It has a wider scope of application and does not need to rely on more software and hardware support except for the boot program of the device. The implementation method is simple.
[0072] Combine the following Figure 3 , an exemplary description is given of the firmware recovery method provided in the embodiment of the present disclosure.
[0073] Figure 3 It is a flowchart of a firmware recovery method provided according to another embodiment of the present disclosure.
[0074] like Figure 3 As shown, the firmware recovery method includes:
[0075] Step 301, in response to device startup, start a boot program of the device.
[0076] Step 302: Create a timing variable t through a bootstrap program.
[0077] Step 303, check whether the target file exists. If it exists, execute step 305, otherwise, execute step 304.
[0078] Among them, t is a timing variable, which can increase by 1 per second and is used to record the startup time of the boot program.
[0079] Step 304: Create a target file through the boot program, and write a number n in the target file, where the value of n is the second initial number.
[0080] The value of n may represent the number of times the target situation has occurred continuously on the device.
[0081] The initial number of times can be set as needed. For example, a startup of the device when the target file does not exist can be regarded as one of the times that the device has continuously encountered the target situation. Then, the initial value of the number n can be 1.
[0082] Step 305 , determine whether n is greater than or equal to N, if so, execute step 306 , otherwise, execute step 307 .
[0083] Wherein, N represents the preset number of times.
[0084] Step 306: restore the device's firmware from the current version to the most recent version at which the firmware was operating normally.
[0085] Step 307, adding one to n and storing it in the target file.
[0086] Step 308, determine whether t is greater than T, if so, execute step 309, otherwise, execute step 310.
[0087] Wherein, T represents the duration from a first moment to a second moment, wherein the first moment is the moment when the boot program is started, and the second moment is the moment when the system file of the device is loaded.
[0088] Step 309, setting n to the first initial number.
[0089] Step 310, maintain the result of n.
[0090] It can be understood that t is a timing variable used for timing, and its value changes with time. When t is not greater than T, the result of n can be maintained and whether t is greater than T can be re-judged until the device is restarted when t is not greater than T, that is, the device is restarted within T time after the boot program is started. At this time, the result of n is the result stored in step 307, or until the device has not been restarted when t is greater than T, that is, the device has not been restarted within T time after the boot program is started, then n can be set to the first initial number of times.
[0091] Step 311, end.
[0092] Among them, the specific implementation forms of steps 301-311 and similar steps in other embodiments can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.
[0093] In order to implement the above embodiment, the present disclosure also provides a firmware recovery device.
[0094] Figure 4 It is a structural diagram of a firmware recovery device provided according to an embodiment of the present disclosure.
[0095] like Figure 4As shown, the firmware recovery device 400 includes:
[0096] The startup module 401 is used to start the boot program of the device in response to the device startup;
[0097] The acquisition module 402 is used to acquire, through the boot program, the number of times the target situation has occurred continuously on the device, wherein the target situation includes the device restarting within a preset time after the boot program is started;
[0098] The first processing module 403 is configured to restore the firmware of the device from the current version to the target version when the number of times reaches a preset number of times.
[0099] As a possible implementation of the embodiment of the present disclosure, the acquisition module 402 includes:
[0100] A first acquisition unit is used to acquire a target file through a boot program, wherein the target file includes number indication information, and the number indication information is used to indicate the number;
[0101] The second acquiring unit is configured to acquire the number of times based on the number indication information.
[0102] As a possible implementation of the embodiment of the present disclosure, the firmware recovery device 400 further includes:
[0103] The second processing module is used to increase the number indicated by the number indication information by one when the number does not reach the preset number, and set the processed number as the first initial number when it is determined that the device has not been restarted within a preset time after the boot program is started.
[0104] As a possible implementation of the embodiment of the present disclosure, the firmware recovery device 400 further includes:
[0105] The third processing module is used to increase the number indicated by the number indication information by one when the number does not reach the preset number, and maintain the processed number unchanged when it is determined that the device is restarted within a preset time after the boot program is started.
[0106] As a possible implementation of the embodiment of the present disclosure, the firmware recovery device 400 further includes:
[0107] A creation module is used to create a timing variable through the boot program in response to the boot program starting, wherein the timing variable is used to start timing from the boot program starting.
[0108] As a possible implementation of the embodiment of the present disclosure, the firmware recovery device 400 further includes:
[0109] The fourth processing module is used to create a target file through a boot program if the target file does not exist, and write a number indication information into the target file, wherein the number indicated by the number indication information is a second initial number.
[0110] As a possible implementation of the embodiment of the present disclosure, the firmware recovery device 400 further includes:
[0111] A determination module, configured to determine a preset duration based on a duration between a first moment and a second moment;
[0112] The first moment is the moment when the boot program is started, and the second moment is the moment when the system file of the device is loaded.
[0113] As a possible implementation of the embodiment of the present disclosure, the target version includes the version of the firmware that last ran normally.
[0114] It should be noted that the above explanation of the firmware recovery method is also applicable to the firmware recovery device of this embodiment, and will not be repeated here.
[0115] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0116] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0117] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded from a storage unit 505 into a RAM (Random Access Memory) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.
[0118] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 505, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0119] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the firmware recovery method. For example, in some embodiments, the firmware recovery method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 505. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the firmware recovery method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the firmware recovery method in any other suitable manner (eg, by means of firmware).
[0120] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0122] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0125] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0126] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0127] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0128] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A firmware recovery method, comprising: In response to device startup, starting a boot program of the device; Obtaining, through the boot program, the number of times the device has continuously encountered a target situation, wherein the target situation includes the device being restarted within a preset time after the boot program is started; When the number of times reaches a preset number of times, the firmware of the device is restored from the current version to the target version.
2. The method according to claim 1, wherein: The obtaining, through the boot program, the number of times the target situation has occurred continuously on the device currently includes: Obtaining a target file through the boot program, wherein the target file includes number indication information, and the number indication information is used to indicate the number; Based on the number indication information, the number is obtained.
3. The method according to claim 2, wherein: The method further comprises: When the number does not reach the preset number, the number indicated by the number indication information is incremented by one, and when it is determined that the device has not been restarted within the preset time after the boot program is started, the processed number is set as the first initial number.
4. The method according to claim 2, wherein: The method further comprises: When the number does not reach the preset number, the number indicated by the number indication information is incremented by one, and when it is determined that the device is restarted within a preset time after the boot program is started, the processed number is maintained unchanged.
5. The method according to claim 3, wherein: The method further comprises: In response to the booting program starting, a timing variable is created through the booting program, wherein the timing variable is used to count time starting from the booting program starting.
6. The method according to claim 2, wherein: The method further comprises: In the case that the target file does not exist, the target file is created by the boot program, and the number indication information is written into the target file, wherein the number indicated by the number indication information is a second initial number.
7. The method according to any one of claims 1 to 6, wherein: The method further comprises: Determining the preset duration based on the duration between the first moment and the second moment; The first time is the time when the boot program is started, and the second time is the time when the system file of the device is loaded.
8. The method according to any one of claims 1 to 6, wherein: The target version includes the version of the firmware that last ran normally.
9. A firmware recovery device, comprising: A startup module, configured to start a boot program of the device in response to device startup; An acquisition module, used to acquire, through the boot program, the number of times a target situation has occurred continuously on the device, wherein the target situation includes the device being restarted within a preset time after the boot program is started; The first processing module is configured to restore the firmware of the device from a current version to a target version when the number of times reaches a preset number of times.
10. The device according to claim 9, wherein: The acquisition module comprises: A first acquisition unit is used to acquire a target file through the boot program, wherein the target file includes number indication information, and the number indication information is used to indicate the number; A second acquiring unit is configured to acquire the number of times based on the number indication information.
11. The device according to claim 10, wherein: The device also includes: The second processing module is used to increase the number indicated by the number indication information by one when the number does not reach the preset number, and to set the processed number as the first initial number when it is determined that the device has not been restarted within a preset time after the boot program is started.
12. The device according to claim 10, wherein: The device also includes: The third processing module is used to increase the number indicated by the number indication information by one when the number does not reach the preset number, and to maintain the processed number unchanged when it is determined that the device is restarted within the preset time after the boot program is started.
13. The device according to claim 11, wherein: The device also includes: A creation module is used to create a timing variable through the boot program in response to the boot program starting, wherein the timing variable is used to start timing from the boot program starting.
14. The device according to claim 10, wherein: The device also includes: The fourth processing module is used to create the target file through the boot program if the target file does not exist, and write the number indication information into the target file, wherein the number indicated by the number indication information is the second initial number.
15. The device according to any one of claims 9 to 14, wherein: The device also includes: A determination module, configured to determine the preset duration based on the duration between the first moment and the second moment; The first moment is the moment when the boot program is started, and the second moment is the moment when the system file of the device is loaded.
16. The device according to any one of claims 9 to 14, wherein: The target version includes the version of the firmware that last ran normally.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 8.
19. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method for automatic recovery after firmware of MCU goes wrong, and MCU
CN107908496A
System for restoring factory settings by counting system starting times
CN112579188A
System firmware option rollback configuration method and device, equipment and medium
CN114721874A
Firmware exception repairing method and device, electronic equipment and computer storage medium
CN115237647A
Firmware recovery method and device, image forming equipment and storage medium
CN115756939A