Method and system for recovering gateway factory configuration under uboot
By clearing the flash partition where the rootfs system configuration file is located in uboot, the problem of the gateway being unable to restore the factory configuration caused by the rootfs system crash is solved, and the gateway factory configuration is seamlessly restored under uboot, improving the reliability and recoverability of the gateway.
Patent Information
- Application Number
- CN202510100300.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-09
AI Technical Summary
When the existing technology restores the factory configuration of the gateway based on the rootfs system, the rootfs system may crash due to user configuration or code bugs, and the factory configuration of the gateway cannot be successfully restored.
In uboot, use the flash driver code to find the flash partition stored in the rootfs system configuration file, clear all files generated during use by the gateway in the corresponding partition, and restore the gateway to the factory configuration state. This process is completely executed under uboot, avoiding the risk of rootfs system failure.
It realizes seamless recovery of the gateway factory configuration under uboot, avoids recovery failure caused by rootfs system crash, and ensures the reliability and recoverability of the gateway in the event of failure.
Smart Images

Figure CN119966815A_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical field of computer systems, and in particular to a method and system for restoring factory configuration of a gateway under uboot. Background Art
[0002] With the rapid development of Internet broadband and the popularization of broadband of various operators, home gateways, as broadband access devices, provide users with a variety of business functions such as Internet, IPTV, VOIP, etc. Usually, if a gateway fails, it is often accompanied by the situation that the gateway cannot access the Internet, so the method of controlling the gateway through the remote management platform is not feasible. At the same time, after the failure, it can also be manifested as the situation that the web, telnet, and ssh cannot access the gateway. The method of locating the problem through the local area network or even upgrading the software version is also impossible. Especially if the gateway cannot start normally after being used for a period of time or the user configures certain parameters, a way is needed to restore the gateway to the factory state and then reconfigure it or re-upgrade the version.
[0003] There are two common practices currently used: 1. Detect the reset button during the uboot process, then pass the information to the subsequent rootfs, and finally implement the factory restore time function in the rootfs system; 2. Directly detect the reset button in the roots system and implement factory restore. The above two common practices both involve the application of the rootfs system. The problem is: since the rootfs system may crash due to user configuration or code bugs, the rootfs still cannot be started normally after power off and restart, resulting in the above two methods of restoring the factory configuration are not applicable. Summary of the invention
[0004] Technical Problems to be Solved by the Invention
[0005] A method and system for restoring the factory configuration of a gateway under uboot are provided to solve the problem that the factory configuration of the gateway cannot be successfully restored due to the crash of the rootfs system when restoring the factory configuration based on the roots system.
[0006] The technical solution adopted by the present invention to solve the above technical problems
[0007] On the one hand, the present invention provides a method for restoring the factory configuration of a gateway under uboot, the method comprising: powering on the gateway, starting uboot, detecting whether there is an instruction to restore the factory configuration, if not, starting the gateway normally, if yes, finding the flash partition where the roots system configuration file is stored through the flash driver code in uboot, clearing all files generated during the use of the gateway in the corresponding flash partition, and restoring the gateway to the factory configuration.
[0008] Furthermore, the instruction to restore the factory configuration is triggered by a reset button.
[0009] Furthermore, a prompt signal is set to prompt the user that the gateway enters the process of restoring the factory configuration state.
[0010] Furthermore, the process of setting a prompt signal to prompt the user that the gateway enters the factory configuration restoration state specifically includes: setting an LED light, when the gateway enters the factory configuration restoration process, outputting a control signal to make the LED light flash, and after the gateway completes the factory configuration restoration process, outputting a control signal to make the LED light always on.
[0011] On the other hand, the present invention also provides a system for restoring the factory configuration of a gateway under uboot, the system comprising: a factory configuration restoration signal trigger module, a factory configuration restoration execution module and a signal prompt module;
[0012] The factory configuration restoration signal trigger module is used to issue an instruction to trigger the gateway to restore the factory configuration;
[0013] The factory configuration recovery execution module is used to find the flash partition where the roots system configuration file is stored through the flash driver code in uboot after receiving the gateway factory configuration recovery instruction issued by the factory configuration recovery signal trigger module, and clear all files generated during the use of the gateway in the corresponding flash partition;
[0014] The signal prompt module is used to prompt the user when the gateway enters the factory configuration restoration process and ends the factory configuration restoration process.
[0015] Furthermore, the signal prompt module is an LED light.
[0016] Beneficial effects of the present invention
[0017] The method and system for restoring the factory configuration of a gateway under uboot of the present invention find the flash partition where the roots system configuration file is stored through the flash driver code in uboot, clear all files generated during the use of the gateway in the corresponding flash partition, and restore the gateway to the factory configuration. The entire process of restoring the factory configuration is completely executed under uboot, and the situation where uboot cannot be started due to user configuration or environmental reasons will not occur. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 The present invention is a flowchart of a method for restoring a gateway factory configuration under uboot. DETAILED DESCRIPTION
[0019] The present invention discloses a method for restoring the factory configuration of a gateway under uboot, such as Figure 1 As shown, the specific steps include:
[0020] Step S1: The gateway is powered on, enters the uboot startup process, and then goes to step S2;
[0021] Step S2: After uboot is started, immediately detect whether the gateway has received the factory configuration restoration instruction issued by the factory configuration restoration signal trigger module. If yes, proceed to step S3; otherwise, proceed to step S6;
[0022] The instruction for restoring the factory configuration in this embodiment is a level signal triggered by the reset button. After uboot detects that the reset button is pressed, it determines that the gateway needs to enter the uboot factory restoration process;
[0023] Step S4: The factory configuration recovery execution module finds the flash partition where the roots system configuration file is stored through the flash driver code in uboot, clears all files generated during the use of the gateway in the corresponding flash partition, and restores the gateway to the factory configuration;
[0024] Preferably, the present invention is further provided with a signal prompt module to send a prompt signal to prompt the user gateway to enter the factory configuration recovery process;
[0025] In this embodiment, the signal prompt module is an LED light, and the specific process of setting a prompt signal to prompt the user gateway to enter the factory configuration recovery state specifically includes: when the gateway enters the factory configuration recovery process, outputting a control signal to make the LED light flash;
[0026] Step S5: When the uboot factory recovery process is successfully executed, the LED light is controlled to be always on, informing the user that the uboot factory recovery process has been successfully executed, and waiting for the user to power on the gateway again;
[0027] Step S6: The gateway starts normally.
Claims
1. The method for restoring the factory configuration of the gateway under uboot is characterized by: The method comprises: powering on the gateway, starting uboot, detecting whether there is a signal to restore the gateway to factory configuration, if not, starting the gateway normally, if yes, finding the flash partition where the roots system configuration file is stored through the flash driver code in uboot, clearing all files generated during the use of the gateway in the corresponding flash partition, and restoring the gateway to factory configuration.
2. According to the method for restoring the factory configuration of the gateway under uboot according to claim 1, it is characterized in that: The command to restore the factory configuration is triggered by the reset button.
3. The method for restoring the factory configuration of the gateway under uboot according to claim 1 or 2, characterized in that: Set a reminder signal to prompt the user that the gateway enters the factory configuration recovery state process.
4. According to the method for restoring the factory configuration of the gateway under uboot according to claim 3, it is characterized in that: The process of setting a prompt signal to prompt the user that the gateway enters the factory configuration restoration state specifically includes: setting an LED light, when the gateway enters the factory configuration restoration process, outputting a control signal to make the LED light flash, and after the gateway completes the factory configuration restoration process, outputting a control signal to make the LED light always on.
5. A system for restoring the factory configuration of a gateway under uboot, used to implement the method for restoring the factory configuration of a gateway under uboot as claimed in any one of claims 1 to 4, characterized in that: The system includes: a factory configuration restoration signal triggering module, a factory configuration restoration execution module and a signal prompting module; The factory configuration restoration signal trigger module is used to issue an instruction to trigger the gateway to restore the factory configuration; The factory configuration recovery execution module is used to find the flash partition where the roots system configuration file is stored through the flash driver code in uboot after receiving the gateway factory configuration recovery instruction issued by the factory configuration recovery signal trigger module, and clear all files generated during the use of the gateway in the corresponding flash partition; The signal prompt module is used to prompt the user when the gateway enters the factory configuration restoration process and ends the factory configuration restoration process.
6. According to the system for restoring the factory configuration of the gateway under uboot according to claim 5, the signal prompt module is an LED light.