Detailed Description
The technical solution of the present invention will be further described in more detail with reference to the following embodiments. It is to be understood that the described embodiments are merely a few embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a first implementation of an apparatus for positioning and flashing a machine by using a router LED lamp according to an embodiment of the present invention.
The device 100 for positioning and flashing by using the router LED lamp comprises: a bootstrap starting module 110, a flashing parameter obtaining module 120 and a flashing alarm processing module 130.
The bootstrap starting module 110 is configured to start a Uboot bootstrap after performing hardware self-test on the router.
Specifically, Uboot is a device boot program for loading an operating device of the router and is stored in a ROM of the router.
And a flush parameter obtaining module 120, configured to obtain a value of a flush parameter through a Uboot bootstrap program started by the 110 module.
Specifically, the flush parameter is a newly added parameter in the present invention, and is also stored in the ROM of the router, and a default value, that is, an initial value, has been set before the router leaves the factory, for example, the flush parameter is reset, and the initial value is 0. Once the user refreshes, the refresh parameter value is lost or changed.
And the flashing warning processing module 130 is configured to generate warning information and trigger the router LED display module to display the warning information if the module 120 fails to acquire the flashing parameter value or the flashing parameter value acquired by the module 120 is different from the initial value.
And the router LED display module 140 is used for displaying according to the warning information.
Specifically, the flashing warning message may be that the LED lights are on in a specific color, such as blue, yellow, or red, or that the LED lights are on in a specific manner, such as flashing at long and short intervals, flashing rapidly, and flashing for several light cycles. The LED lamp giving the warning information can be an existing data signal lamp of the reuse router, and can also be an existing power indicator lamp of the reuse router.
Different from the prior art, the device for positioning and flashing the router by using the LED lamp of the router provided by the embodiment of the invention has the advantages that after the router is electrified to perform hardware self-test, a Uboot bootstrap program is started; the Uboot bootstrap program obtains the value of the flashing parameter; if the machine refreshing parameter value fails to be acquired or the acquired machine refreshing parameter value is different from the initial value, triggering a router LED lamp to give out equipment machine refreshing warning information; therefore, whether the router is booted or not can be judged in a simple and visual mode, and batch detection of the router is realized.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a second implementation of the apparatus for positioning and flashing a machine by using a router LED lamp according to the embodiment of the present invention.
This utilize device 200 of router LED lamp location flashing includes: a bootstrap starting module 210, a flashing parameter obtaining module 220 and a flashing alarm processing module 230.
The bootstrap starting module 210 is configured to start a Uboot bootstrap after performing hardware self-test on the router. Specifically, Uboot is a device boot program for loading an operating device of the router and is stored in a ROM of the router.
And a flush parameter obtaining module 220, configured to obtain a value of a flush parameter through the Uboot bootstrap. Specifically, the flush parameter is a newly added parameter in the present invention, and is stored in the ROM of the router as the Uboot boot program, and a default value, that is, an initial value, has been set before the router leaves the factory. Once the user refreshes, the refresh parameter value is lost or changed.
And the flashing warning processing module 230 is configured to generate warning information and trigger the router LED display module to display the warning information if the flashing parameter value fails to be obtained or the obtained flashing parameter value is different from the initial value.
And the router LED display module is used for displaying according to the warning information.
Specifically, the flashing warning message may be that the LED lights are on in a specific color, such as red, or that the LED lights are on in a specific manner, such as flashing rapidly. The LED lamp giving the warning information can be an existing data signal lamp of the reuse router, and can also be an existing power indicator lamp of the reuse router.
Further optionally, the flashing warning processing module includes an apparatus normal indication unit 231, configured to trigger a router LED lamp to give apparatus normal indication information if the obtained flashing parameter value is the same as the initial value. Specifically, the normal indication information may be that the LED lights are on in a specific color, such as green, or that the LED lights are on in a specific manner, such as normally on. The LED lamp giving the warning information can be an existing data signal lamp of the reuse router, and can also be an existing power indicator lamp of the reuse router.
Further optionally, the flashing alarm processing module 230 is further configured to give a device flashing alarm sound through a buzzer after the router LED display module 240 is triggered.
Further optionally, the apparatus further includes a flush parameter defining module 250, configured to add the flush parameter in the Uboot bootstrap program before the router is powered on, and set the flush parameter as an initial value; and defining an association rule between the flashing parameter and the router LED lamp indication information. For example, the increased flush parameter in Uboot is reset, and the initial value is 0. Specifically, the defined association rule may be: when the brushing parameter is the same as the initial value, the LED lamp is lightened in a certain specific mode or a certain specific color, and when the brushing parameter is different from the initial value or the brushing parameter cannot be found, the LED lamp is lightened in another specific mode or a specific color, and the LED lamp is used for indicating whether the parameter value is changed or deleted. For example, when the refresh parameter recovery is the same as the initial value, the LED lights green, otherwise red; or when the refresh parameter recovery is the same as the initial value, the LED lamp is on, otherwise, the LED lamp flashes rapidly. Since the flush parameter is included in the Uboot bootstrap program, it is also the ROM stored in the router. Once the user refreshes, the refresh parameter value is lost or changed.
Further optionally, the apparatus further comprises a storage module 260, configured to store the association rule in a specific storage area. Specifically, in order to avoid that the association rule defined by the flashing parameter definition module 250 is cleared in addition to the change of the flashing parameter value when the user flashes, the association rule may be stored in a specific storage area, for example, a storage space in the ROM that is not allowed to be accessed by the user.
Further optionally, the storage module 260 is further configured to store a Uboot error handling program in the specific storage area, where the error handling program triggers an LED lamp to give an equipment flashing warning message when the Uboot bootstrap program is maliciously modified and cannot perform normal processing according to the flashing parameter value.
Specifically, in order to avoid that a user does not only change a flashing parameter value when flashing, but also maliciously modifies the Uboot bootstrap program, so that the bootstrap program does not process the flashing parameters according to preset service logic, for example, the Uboot does not read the flashing parameters at all, and does not trigger the LED lamp to make different indications according to the different values of the flashing parameters, the Uboot error handling program needs to be added and stored in a safe specific storage area, and the Uboot error handling program directly triggers the LED lamp to give out the device flashing warning information after judging that the Uboot bootstrap program is maliciously modified. For example, after the router is powered on for self-checking for a certain time, if the Uboot does not read the association rule in the specific storage area, it is determined that the Uboot is maliciously modified, and the LED is triggered to light up a red light or flash quickly to indicate that the router is flushed.
Different from the prior art, the device for positioning and flashing the router by using the LED lamp of the router provided by the embodiment of the invention has the advantages that after the router is electrified to perform hardware self-test, a Uboot bootstrap program is started; the Uboot bootstrap program obtains the value of the flashing parameter; if the machine refreshing parameter value fails to be acquired or the acquired machine refreshing parameter value is different from the initial value, triggering a router LED lamp to give out equipment machine refreshing warning information; therefore, whether the router is booted or not can be judged in a simple and visual mode, and batch detection of the router is realized.
Referring to fig. 3, fig. 3 is a schematic flowchart of a first implementation manner of a method for locating and flashing a machine by using a router LED lamp according to an embodiment of the present invention.
The method comprises the following steps:
s301: and after the router is powered on to perform hardware self-check, starting a Uboot bootstrap program.
Specifically, the Uboot is a system boot program, is used for loading an operating system of the router, and is stored in the ROM of the router.
S302: the Uboot bootstrap program obtains the values of the flush parameters.
Specifically, the flush parameter is a newly added parameter in the present invention, and is stored in the ROM of the router as the Uboot boot program, and a default value, that is, an initial value, has been set before the router leaves the factory. Once the user refreshes, the refresh parameter value is lost or changed.
S303: and if the machine-refreshing parameter value fails to be acquired or the acquired machine-refreshing parameter value is different from the initial value, generating warning information and triggering a router LED lamp to give out equipment machine-refreshing warning information.
Specifically, the flashing warning message may be that the LED lights are on in a specific color, such as red, or that the LED lights are on in a specific manner, such as flashing rapidly. The LED lamp giving the warning information can be an existing data signal lamp of the reuse router, and can also be an existing power indicator lamp of the reuse router. Optionally, the method further includes: and if the obtained flashing parameter value is the same as the initial value, triggering an LED lamp to give normal indication information of the equipment. Specifically, the normal indication information may be that the LED lights are on in a specific color, such as green, or that the LED lights are on in a specific manner, such as normally on. The LED lamp giving the warning information can be an existing data signal lamp of the reuse router, and can also be an existing power indicator lamp of the reuse router.
Optionally, after step S303, the method further includes: and giving out a flashing warning sound of the equipment through a buzzer.
Optionally, step S301 further includes: adding the flashing parameters in the Uboot bootstrap program, and setting the flashing parameters as initial values; and defining an association rule between the flashing parameters and the LED lamp indication information. Further optionally, the association rule is stored in a specific storage area. Further optionally, a Uboot error handling program is further stored in the specific storage area, and is used for triggering an LED lamp to give an equipment flashing warning message when the Uboot bootstrap program is maliciously modified and cannot perform normal processing according to the flashing parameter value.
For example, the increased flush parameter in Uboot is reset, and the initial value is 0. Specifically, the defined association rule may be: when the brushing parameter is the same as the initial value, the LED lamp is lightened in a certain specific mode or a certain specific color, and when the brushing parameter is different from the initial value or the brushing parameter cannot be found, the LED lamp is lightened in another specific mode or a specific color, and the LED lamp is used for indicating whether the parameter value is changed or deleted. For example, when the refresh parameter recovery is the same as the initial value, the LED lights green, otherwise red; or when the refresh parameter recovery is the same as the initial value, the LED lamp is on, otherwise, the LED lamp flashes rapidly. Since the flush parameter is included in the Uboot bootstrap program, it is also the ROM stored in the router. Once the user refreshes, the refresh parameter value is lost or changed.
Specifically, in order to avoid that the association rule defined by the flashing parameter definition module 250 is cleared in addition to the change of the flashing parameter value when the user flashes, the association rule may be stored in a specific storage area, for example, a storage space in the ROM that is not allowed to be accessed by the user.
Specifically, in order to avoid that a user does not only change a flashing parameter value when flashing, but also maliciously modifies the Uboot bootstrap program, so that the bootstrap program does not process the flashing parameters according to preset service logic, for example, the Uboot does not read the flashing parameters at all, and does not trigger the LED lamp to make different indications according to the different values of the flashing parameters, the Uboot error handling program needs to be added and stored in a safe specific storage area, and the Uboot error handling program directly triggers the LED lamp to give out the device flashing warning information after judging that the Uboot bootstrap program is maliciously modified. For example, after the router is powered on for self-checking for a certain time, if the Uboot does not read the association rule in the specific storage area, it is determined that the Uboot is maliciously modified, and the LED is triggered to light up a red light or flash quickly to indicate that the router is flushed.
Different from the prior art, in the method for locating and flashing the router by using the LED lamp of the router, the Uboot bootstrap program is started after the router is electrified to perform hardware self-test; the Uboot bootstrap program obtains the value of the flashing parameter; if the machine refreshing parameter value fails to be acquired or the acquired machine refreshing parameter value is different from the initial value, triggering a router LED lamp to give out equipment machine refreshing warning information; therefore, whether the router is booted or not can be judged in a simple and visual mode, and batch detection of the router is realized.
The above description is only an implementation manner of the embodiments of the present invention, and not intended to limit the scope of the embodiments of the present invention, and all equivalent structures or equivalent flow transformations made by using the contents of the description and the drawings of the embodiments of the present invention, or directly or indirectly applied to other related technical fields, are included in the scope of the embodiments of the present invention.