Disclosure of Invention
The invention provides a factory setting recovery method and system based on UEFI firmware, which overcome the defects of the prior art and can effectively solve the problems of low safety factor and high cost of the existing factory setting recovery method of UEFI firmware.
One of the technical schemes of the invention is realized by the following measures: a factory setting restoration method based on UEFI firmware, comprising:
before selecting whether to enter a UEFI firmware configuration interface, acquiring a factory setting restoration instruction of the UEFI firmware;
keeping the historical configuration value of the UEFI firmware consistent with the factory configuration value;
and acquiring a historical configuration value of the UEFI firmware, and carrying out UEFI firmware configuration before selecting whether to enter a UEFI firmware configuration interface according to the historical configuration value to finish restoring factory settings.
The following are further optimizations and/or improvements to the above-described inventive solution:
the keeping the historical configuration value of the UEFI firmware consistent with the factory configuration value thereof comprises the following steps:
judging whether the historical configuration value of the UEFI firmware is consistent with the factory configuration value;
responding to the failure, calling a factory configuration value stored by the UEFI firmware, and erasing the factory configuration value into a historical configuration value;
in response, then, the historical configuration values of the UEFI firmware remain unchanged.
Before selecting whether to enter the UEFI firmware configuration interface, the acquiring a factory setting restoration instruction of the UEFI firmware includes:
before whether to enter a UEFI firmware configuration interface or not is selected, a factory setting restoration flag bit of the UEFI firmware is obtained;
judging whether the reset factory setting flag bit is true or not;
in response, executing a factory reset of the UEFI firmware;
and if not, the factory setting does not need to be restored, and the UEFI firmware configuration is directly carried out before whether the UEFI firmware configuration interface is selected to be accessed or not according to the historical configuration value.
The obtaining the historical configuration value of the UEFI firmware, completing the configuration of the UEFI firmware before selecting whether to enter the configuration interface of the UEFI firmware according to the historical configuration value, judging whether to generate configuration modification after entering the configuration interface of the UEFI firmware, and storing the configuration value when exiting the configuration interface in response to the configuration modification, including:
when the configuration interface is withdrawn, judging whether the configuration value is modified at the configuration interface;
if yes, saving the modified configuration value and starting the operating system;
and in response to the failure, the configuration value does not need to be saved, and the operating system is started.
The second technical scheme of the invention is realized by the following measures: a UEFI firmware-based factory reset system comprising:
the system comprises a firmware factory setting recovery identification module, a firmware history configuration value access module and a firmware factory configuration value backup module;
the firmware factory setting restoration identification module is used for acquiring factory setting restoration instructions of the UEFI firmware before selecting whether to enter the UEFI firmware configuration interface;
the firmware factory configuration value backup module is used for storing factory configuration values of UEFI firmware and only providing read-only operation;
the firmware history configuration value access module is used for accessing the history configuration value of the UEFI firmware, keeping the history configuration value of the UEFI firmware consistent with the factory configuration value of the UEFI firmware, obtaining the history configuration value of the UEFI firmware, and carrying out the configuration of the UEFI firmware before selecting whether to enter the configuration interface of the UEFI firmware according to the history configuration value to finish restoring the factory configuration.
The following are further optimizations and/or improvements to the above-described inventive solution:
the firmware configuration data detection module is used for judging whether the historical configuration value of the UEFI firmware is consistent with the factory configuration value of the UEFI firmware or not, and sending a judging result to the firmware historical configuration value access module; and the firmware historical configuration value access module receives a judging result, if the judging result is negative, the factory configuration value stored by the UEFI firmware is called, the factory configuration value is rewritten into the historical configuration value, and if the judging result is positive, the historical configuration value of the UEFI firmware is kept unchanged.
The system also comprises a UEFI driving and UEFI firmware architecture basic function module;
the UEFI driver is used for supporting normal operation of UEFI firmware and an operating system;
and the UEFI firmware architecture basic function module is used for constructing an operating environment conforming to the UEFI specification for the UEFI driver.
The invention completes the whole process of restoring the UEFI firmware to factory setting before selecting whether to enter the UEFI firmware configuration interface, and ensures that an operating system is loaded when the UEFI firmware configuration interface is loaded and displayed by using the perfected historical configuration value or the UEFI firmware configuration interface is not entered. Compared with a method for restoring factory settings by losing data after power failure of a CMOS chip, the method improves the safety coefficient of UEFI firmware and is suitable for a host with higher information safety requirements. Compared with a method for restoring factory settings of double chips of hardware, the method reduces hardware cost and reduces the cost of mutual maintenance and mutual protection between the chips of the double chips.
Detailed Description
The present invention is not limited by the following examples, and specific embodiments can be determined according to the technical scheme and practical situations of the present invention.
The invention is further described below with reference to examples and figures:
as shown in fig. 1, the embodiment of the invention discloses a factory setting restoration method based on UEFI firmware, which comprises the following steps:
s1, before selecting whether to enter a UEFI firmware configuration interface, acquiring a factory setting restoration instruction of the UEFI firmware;
s2, keeping the historical configuration value of the UEFI firmware consistent with the factory configuration value of the UEFI firmware;
s3, acquiring a history configuration value of the UEFI firmware, and carrying out UEFI firmware configuration before selecting whether to enter a UEFI firmware configuration interface according to the history configuration value to finish restoring factory settings.
The invention completes the whole process of restoring the UEFI firmware to factory setting before selecting whether to enter the UEFI firmware configuration interface, and ensures that an operating system is loaded when the UEFI firmware configuration interface is loaded and displayed by using the perfected historical configuration value or the UEFI firmware configuration interface is not entered. Compared with a method for restoring factory settings by losing data after power failure of a CMOS chip, the method improves the safety coefficient of UEFI firmware and is suitable for a host with higher information safety requirements. Compared with a method for restoring factory settings of double chips of hardware, the method reduces hardware cost and reduces the cost of mutual maintenance and mutual protection between the chips of the double chips.
In the technical scheme, the historical configuration value and the factory configuration value of the UEFI firmware are stored in the UEFI firmware chip (for example, respectively stored in the variable area of the UEFI firmware chip), so that the factory setting recovery function and the daily configuration modification function can be effectively realized, and each function can be stably operated.
In the above technical solution, in the process of implementing the factory setting restoration of the UEFI firmware, the host is powered on and started, and runs the UEFI firmware program, and before selecting whether to enter the UEFI firmware configuration interface, the factory setting restoration instruction of the UEFI firmware is obtained, where the factory setting restoration instruction may be, but is not limited to, in the form of a firmware factory setting restoration flag bit; after a factory setting restoration instruction of the UEFI firmware is obtained, a factory setting restoration process is executed before the UEFI firmware configuration interface is entered, namely, the historical configuration value of the UEFI firmware is kept consistent with the factory configuration value of the UEFI firmware, wherein the consistency maintenance can be realized by replacing the historical configuration value of the UEFI firmware with the factory configuration value of the UEFI firmware, so that the historical configuration value of the UEFI firmware is kept consistent with the factory configuration value of the UEFI firmware, and the configuration of the UEFI firmware is carried out before whether the UEFI firmware configuration interface is selected or not is entered according to the historical configuration value, so that factory setting restoration is completed.
The technical scheme of the embodiment of the invention can be further optimized or/and improved according to actual needs:
as shown in fig. 2, in the foregoing embodiment, keeping the historical configuration value of the UEFI firmware consistent with the factory configuration value thereof, the factory setting restoration method based on the UEFI firmware in this implementation, keeping the historical configuration value of the UEFI firmware consistent with the factory configuration value thereof may further include:
s21, acquiring a historical configuration value and a factory configuration value of UEFI firmware;
s22, judging whether the historical configuration value of the UEFI firmware is consistent with the factory configuration value of the UEFI firmware or not;
s23, responding to the failure, calling a factory configuration value stored by the UEFI firmware, and erasing the factory configuration value into a historical configuration value;
s24, responding to the response, and keeping the historical configuration value of the UEFI firmware unchanged.
According to the technical scheme, the historical configuration values and the factory configuration values of the UEFI firmware are stored in the UEFI firmware chip (for example, the historical configuration values and the factory configuration values are respectively stored in the variable area of the UEFI firmware chip), so that the historical configuration values of the UEFI firmware can be compared with the factory configuration values of the UEFI firmware, whether the historical configuration values are consistent or not is judged, if the historical configuration values are inconsistent, the factory configuration values of the UEFI firmware are called and are rewritten into the historical configuration values, the historical configuration values of the UEFI firmware are consistent with the factory configuration values of the UEFI firmware, and the factory configuration recovery is conveniently completed according to the historical configuration values.
As shown in fig. 3, in the above embodiment, before selecting whether to enter the UEFI firmware configuration interface, acquiring the factory-restoration-setting instruction of the UEFI firmware, where the acquiring the factory-restoration-setting instruction of the UEFI firmware based on the factory-restoration-setting method of the UEFI firmware in this embodiment may further include:
s11, before whether the UEFI firmware configuration interface is selected to be entered or not, acquiring a factory setting restoration flag bit of the UEFI firmware;
s12, judging whether the reset factory setting flag bit is true or not;
s13, responding to the response, and executing factory setting restoration of the UEFI firmware;
s14, responding to the response, and directly carrying out UEFI firmware configuration according to the history configuration value before selecting whether to enter a UEFI firmware configuration interface without restoring factory settings.
In the technical scheme, whether the corresponding UEFI firmware needs to be started to restore factory setting or not is determined by identifying whether the factory setting restoring flag bit is true, if not, the UEFI firmware does not need to restore factory setting, the historical configuration value of the UEFI firmware does not need to be consistent with the factory configuration value of the UEFI firmware, the historical configuration value of the UEFI firmware is directly called to carry out daily configuration of the UEFI firmware before whether the UEFI firmware configuration interface is selected, wherein whether the UEFI firmware configuration interface is selected comprises entering the UEFI firmware configuration interface and not entering the UEFI firmware configuration interface, and the operation system is directly started to enter.
As shown in fig. 4, in the above embodiment, a historical configuration value of the UEFI firmware is obtained, according to the historical configuration value, before whether to enter the UEFI firmware configuration interface is selected, the UEFI firmware configuration is completed, and factory setting is restored.
S41, judging whether the configuration value is modified at the configuration interface when the configuration interface is withdrawn;
s42, if yes, saving the modified configuration value and starting the operating system;
s43, responding to the no, without storing the configuration value, and starting the operating system.
Through the technical scheme, after the configuration interface realizes the factory setting restoration function and the daily configuration modification function, the configuration value is saved according to the judgment of whether the configuration value is modified at the configuration interface when the configuration interface is withdrawn, so that the configuration value becomes the historical configuration value of the UEFI firmware, and the UEFI firmware is conveniently called for configuration when the host is started normally next time, and the operating system is started.
As shown in fig. 5, correspondingly, the embodiment of the invention also discloses a factory-setting recovery system based on the UEFI firmware, which comprises a firmware factory-setting recovery identification module, a firmware historical configuration value access module and a firmware factory configuration value backup module;
the firmware factory setting restoration identification module is used for acquiring factory setting restoration instructions of the UEFI firmware before selecting whether to enter the UEFI firmware configuration interface;
the firmware factory configuration value backup module is used for storing factory configuration values of UEFI firmware and only providing read-only operation;
the firmware history configuration value access module is used for accessing the history configuration value of the UEFI firmware, keeping the history configuration value of the UEFI firmware consistent with the factory configuration value of the UEFI firmware, obtaining the history configuration value of the UEFI firmware, and carrying out UEFI firmware configuration before selecting whether to enter a UEFI firmware configuration interface according to the history configuration value to finish restoring the factory configuration.
In the system structure, the firmware factory setting restoration identification module can judge whether to perform factory setting restoration operation or not by identifying the firmware factory setting restoration flag bit, and if the factory setting restoration operation is performed, the factory setting restoration instruction of the UEFI firmware is obtained.
The firmware factory setting restoration identification module acquires a factory setting restoration instruction of the UEFI firmware, and specifically comprises the following steps: acquiring a factory setting restoration flag bit of the UEFI firmware when whether to enter a UEFI firmware configuration interface is selected; judging whether the reset factory setting flag bit is true or not; responding to the command, acquiring a factory setting restoration command of the UEFI firmware; and if not, the firmware history configuration value access module does not need to restore factory settings, and the firmware history configuration value access module directly carries out UEFI firmware configuration according to the history configuration value before selecting whether to enter a UEFI firmware configuration interface.
In the system structure, the firmware factory configuration value backup module does not provide writing operation, so that the factory configuration value stored in the firmware factory configuration value backup module is ensured to be a clean factory configuration value.
In the above system structure, the firmware history configuration value access module is used for storing, reading and writing the history configuration value; the stored historical configuration data is configuration data modified after configuration is modified at the UEFI firmware configuration interface after the power-on; when the factory setting is restored by the UEFI firmware, the historical configuration value in the firmware historical configuration value access module is obtained, the historical configuration value is compared with the factory configuration value, if the historical configuration value is different, the factory configuration value is rewritten into the historical configuration value, and then the UEFI firmware is configured before the UEFI firmware configuration interface is selected to enter according to the historical configuration value, so that the factory setting is restored; when the whole starting process has no configuration data modification and no factory setting restoration, the module only provides the historical configuration value reading and the configuration work in the starting process.
The technical scheme of the embodiment of the invention can be further optimized or/and improved according to actual needs:
as shown in fig. 5, in the above embodiment, the factory-restoration setting system based on the UEFI firmware includes a firmware factory-restoration setting identification module, a firmware history configuration value access module, and a firmware factory configuration value backup module, and the factory-restoration setting system based on the UEFI firmware in this embodiment may further include a firmware configuration data detection module, where the firmware configuration data detection module is configured to determine whether the history configuration value of the UEFI firmware is consistent with the factory configuration value thereof, and send a determination result to the firmware history configuration value access module; and the firmware historical configuration value access module receives a judging result, if the judging result is negative, the factory configuration value stored by the UEFI firmware is called, the factory configuration value is rewritten into the historical configuration value, and if the judging result is positive, the historical configuration value of the UEFI firmware is kept unchanged.
As shown in fig. 5, the factory setting restoring system based on the UEFI firmware in the embodiment may further include a UEFI driver and a basic function module of the UEFI firmware architecture;
the UEFI driver is used for supporting normal operation of UEFI firmware and an operating system;
the UEFI firmware architecture basic function module is used for constructing an operation environment which accords with the UEFI standard for UEFI driving.
In the above technical solution, the UEFI firmware architecture base function module refers to a code executed from a first line of code running after the processor is powered up to a stage of preparing the UEFI driving running environment. The method is mainly used for configuring the CPU running state, configuring the Cache, configuring the memory, configuring the interrupt, providing the architecture service according to the UEFI specification, and finally preparing a UEFI driving running environment which accords with the UEFI specification.
In the technical scheme, the UEFI driver comprises a hard disk driver, a display card driver, a keyboard driver and the like. The display card and the keyboard driver are used for supporting input and output under the UEFI firmware, and the hard disk driver is used for loading an operating system.
The technical characteristics form the optimal embodiment of the invention, have stronger adaptability and optimal implementation effect, and can increase or decrease unnecessary technical characteristics according to actual needs so as to meet the requirements of different situations.