Disclosure of Invention
In order to solve the above problems, the method and apparatus for adjusting the starting sequence of a computer provided by the present invention can adjust the starting sequence of the newly added starting device by adjusting the starting priority information of the starting device, and have the advantages of simple operation and high security.
In a first aspect, the present invention provides a method for adjusting a computer boot sequence, applied to a BIOS, comprising:
acquiring a starting list of a computer, wherein the starting list comprises configuration attribute information of starting equipment in the computer, mark attribute information of the starting equipment and starting priority information of the starting equipment;
judging whether a newly added starting device exists in the computer or not according to the configuration attribute information of the starting device;
and under the condition that the computer has a newly added starting device, reconfiguring the corresponding relation between the mark attribute information of the starting device and the starting priority information of the starting device in the starting list.
Optionally, the determining whether there is a newly added boot device in the computer according to the configuration attribute information of the boot device includes:
traversing the configuration attribute information of all the starting devices, and judging whether the configuration attribute information of the starting devices with null values exists in all the starting devices;
if yes, newly-added starting equipment exists in the computer;
and if not, the computer does not have newly added starting equipment.
Optionally, the reconfiguring a correspondence between the flag attribute information of the initiator and the start priority information of the initiator in the start list when there is a newly added initiator in the computer includes:
additionally arranging a mark bit;
assigning a value to the flag bit under the condition that the newly added starting equipment exists in the computer;
under the condition that the zone bit is assigned, reconfiguring the corresponding relation between the zone attribute information of the starting equipment and the starting priority information of the starting equipment in the starting list;
and saving the reconfigured starting list.
Optionally, after the step of reconfiguring the correspondence between the flag attribute information of the initiator device and the initiation priority information of the initiator device in the initiation list, the method further includes:
and clearing the assignment of the zone bit.
Optionally, after the step of saving the reconfigured start-up list, the method further comprises:
and restarting the BIOS.
In a second aspect, the present invention provides a device for adjusting a computer boot sequence, applied to a BIOS, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is configured to acquire a startup list of a computer, and the startup list comprises configuration attribute information of startup equipment in the computer, mark attribute information of the startup equipment and startup priority information of the startup equipment;
the judging module is configured to judge whether the computer has newly added starting equipment or not according to the configuration attribute information of the starting equipment;
a configuration module configured to reconfigure a correspondence between the flag attribute information of the initiator and the start priority information of the initiator in the start list, when a newly added initiator exists in the computer.
Optionally, the determining module is further configured to traverse configuration attribute information of all the boot apparatuses, and determine whether configuration attribute information of a boot apparatus with an empty value exists in all the boot apparatuses;
if yes, newly-added starting equipment exists in the computer;
and if not, the computer does not have newly added starting equipment.
Optionally, the configuration module includes:
an add sub-module configured to add a flag bit;
the assignment submodule is configured to assign the zone bit under the condition that the newly added starting equipment exists in the computer;
the configuration submodule is configured to reconfigure the corresponding relation between the flag attribute information of the starting device and the starting priority information of the starting device in the starting list under the condition that the flag bit is assigned;
and the saving submodule is configured to save the reconfigured starting list.
Optionally, the apparatus further comprises:
and the clearing module is configured to clear the assignment of the flag bit after the configuration submodule reconfigures the corresponding relationship between the flag attribute information of the starting device and the starting priority information of the starting device in the starting list.
Optionally, after the step of saving the reconfigured startup list, the apparatus further comprises:
and the restarting module is configured to restart the BIOS after the storage submodule stores the reconfigured starting list.
The method and the device for adjusting the computer starting sequence provided by the embodiment of the invention firstly judge whether the computer has newly added starting equipment or not through the configuration attribute information of the starting equipment; and adjusting the starting priority information of the starting equipment under the condition that the newly added starting equipment exists in the computer, so that the starting sequence of the newly added starting equipment can be adjusted by adjusting the starting priority information of the starting equipment according to the starting requirement of the newly added starting equipment, and the method is simple to operate and high in safety.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The embodiments of the present invention, and all other embodiments obtained by a person of ordinary skill in the art without any inventive work, belong to the scope of protection of the present invention.
First, technical terms related to the present invention are explained.
IO equipment: i.e. input and output devices such as a keyboard and a mouse or a serial port.
CMOS: a Complementary Metal Oxide Semiconductor (cmos memory, which is a material used in the manufacture of integrated circuit chips in a large scale), is a readable and writable RAM chip on a microcomputer motherboard, and is mainly used to store the hardware configuration of the current system and the setting of some parameters by an operator.
NVRAM: Non-Volatile Random Access Memory (Non-Volatile Random Access Memory) refers to a Random Access Memory (RAM) capable of maintaining data after power failure.
In a first aspect, the present invention provides a method for adjusting a computer boot sequence, and referring to fig. 1, fig. 1 is a schematic flowchart illustrating an adjusting method for a computer boot device according to an embodiment of the present application, which is applied to a BIOS (Basic input output System), and includes:
step S101: the method comprises the steps of obtaining a starting list of a computer, wherein the starting list comprises configuration attribute information of starting equipment in the computer, mark attribute information of the starting equipment and starting priority information of the starting equipment.
Specifically, the identification of the BOOT device by the BIOS is distinguished by the structure BOOT _ OPTION.
Each BOOT-up device is of a BOOT _ OPTION type, and each BOOT _ OPTION type has configuration attribute information unique to itself, i.e., Tag, BdsIndex, and the like. So the BIOS distinguishes by the configuration attribute information of each boot device. For example: the BIOS confirms that a certain interface is the interface of which starting equipment through the attribute of BOOT _ OPTION. BdsIndex, and the BdsIndex lists the Bus number/equipment number/Function number, namely Bus/Device/Function and the like, which corresponds to the mounting of the starting equipment; the BIOS distinguishes whether the type of boot device is USB, HDD, or other type by a bbsentry.
Step S102: and judging whether the computer has a newly added starting device or not according to the configuration attribute information of the starting device.
In an optional embodiment, the determining, according to the configuration attribute information of the boot device, whether there is a newly added boot device in the computer includes:
traversing the configuration attribute information of all the starting devices, and judging whether the configuration attribute information of the starting devices with null values exists in all the starting devices;
if yes, newly-added starting equipment exists in the computer;
if not, the computer does not have newly-added starting equipment;
specifically, in the BIOS BOOT stage, if a newly added BOOT device is accessed, a BOOT _ OPTION type is added, and at this time, configuration attribute information such as Tag and BdsIndex and the like in the newly added BOOT _ OPTION type is all empty, that is, the numerical value filled in the Tag and the BdsIndex is 0xFFFF and the like. Therefore, when the BOOT _ OPTION type is newly added, the starting list can be subjected to one-time circulating judgment, and as long as the configuration attribute information such as Tag, BdsIndex and the like is 0xFFFF, the newly added starting equipment can be judged to be accessed; and the logic judgment code in the subsequent BIOS assigns the configuration attribute information under the BOOT _ OPTION type according to the attribute of the starting device.
Step S103: and under the condition that the computer has a newly added starting device, reconfiguring the corresponding relation between the mark attribute information of the starting device and the starting priority information of the starting device in the starting list.
Specifically, the flag attribute information is information under a BOOT _ option.description attribute, and a character string of the name of the BOOT device is stored under the BOOT _ option.description attribute, such as "P1: HDD", and the like, where P1 denotes a device under the SATA1 interface, and P0 denotes a device under the SATA0 interface.
Description attribute, then reset the Priority attribute of the device, arrange the values by sequence number. For example, the default saved boot columns of the computer before the adjustment are listed in Table 1. The starting equipment under the SATA3 interface is newly added starting equipment; p3 represents a boot device under SATA3 interface.
TABLE 1
Priority
|
BOOT_OPTION.Description
|
1
|
P0:HDD
|
2
|
P1:HDD
|
3
|
P2:HDD
|
4
|
P3:HDD |
Since the initiator device under the SATA3 interface needs to be started first, the adjusted start-up list is table 2.
TABLE 2
Priority
|
BOOT_OPTION.Description
|
1
|
P3:HDD
|
2
|
P0:HDD
|
3
|
P1:HDD
|
4
|
P2:HDD |
When the BIOS starts the boot devices according to the adjusted boot list, the boot device corresponding to P3 starts first according to the boot priority information corresponding to each boot device.
In the process of finally adjusting the BOOT order of the BOOT devices in the BOOT list, the BIOS compares the BOOT _ OPTION attribute of each BOOT device to determine the BOOT priority, and the newly ordered BOOT list determines the BOOT priority by the BOOT _ OPTION. A smaller value of BOOT _ option represents a higher BOOT priority. When the BIOS is started, the starting list is sorted according to the starting priority information of the starting equipment, and then the starting equipment with the highest priority is started first.
In the process of starting the BIOS, the BIOS modifies the starting priority information of the starting list, then stores the modified starting list in the NVRAM, reads the starting list in the NVRAM when starting next time, and starts corresponding starting equipment according to the sequence of the starting list as long as the BIOS reads the starting list. If the boot list is not read, the BIOS regenerates a new boot list according to the boot priority information, the configuration attribute information and the flag attribute information of the boot device, and then the BIOS boots the corresponding boot devices according to the order of the new boot list.
In an optional embodiment, the reconfiguring, when there is a newly added boot device in the computer, a correspondence between flag attribute information of the boot device in the boot list and boot priority information of the boot device includes:
and additionally arranging a flag bit.
And assigning the flag bit under the condition that the computer has a newly added starting device.
And under the condition that the zone bit is assigned, reconfiguring the corresponding relation between the zone attribute information of the starting equipment and the starting priority information of the starting equipment in the starting list.
And saving the reconfigured starting list.
Specifically, a spare position is randomly selected in the CMOS space as a flag bit, and the flag bit is assigned to indicate that a newly added starting device exists when the newly added starting device exists in the computer. Judging whether the corresponding relation between the mark attribute information of the starting equipment in the starting list and the starting priority information of the starting equipment needs to be reconfigured, wherein the corresponding relation between the mark attribute information of the starting equipment in the starting list and the starting priority information of the starting equipment only needs to be reconfigured by accessing a set mark bit; if the flag bit is not set, it indicates that there is no need to reconfigure the corresponding relationship between the flag attribute information of the initiator and the start priority information of the initiator in the start list.
Therefore, in the restarting process, as no starting equipment is newly added, the flag bit in the CMOS space is not set, so that the data in the starting list for reading the NVRAM can be directly started according to the sequence in the starting list, and the step of judging whether the corresponding relation between the flag attribute information of the starting equipment in the starting list and the starting priority information of the starting equipment needs to be reconfigured is not needed. Even if the BIOS adjusts the boot sequence through IO device control at this time, the CMOS space flag bit will not be set, so that the added code before the boot list is stored in the NVRAM will not run the boot list again, thereby not affecting the artificial control will.
In an optional embodiment, after the step of reconfiguring the correspondence between the flag attribute information of the initiator device and the initiation priority information of the initiator device in the initiation list, the method further includes:
and clearing the assignment of the zone bit.
After the corresponding relation between the mark attribute information of the starting equipment and the starting priority information of the starting equipment is configured, the mark bit in the CMOS space is cleared, so that the corresponding configuration code can be prevented from being run up again when the starting equipment is started next time, and the starting efficiency of the starting list can be improved.
In an optional embodiment, after the step of saving the reconfigured start-up list, the method further comprises:
and restarting the BIOS.
The effect of configuring the startup list is effective after restarting, so that a restart action is added in the last step of adding the code to ensure that the adjusted startup list can be effectively read by the computer.
In a second aspect, the present invention provides a method for adjusting a computer boot sequence, and referring to fig. 2, fig. 2 is a schematic flowchart of a method for adjusting a computer boot device according to an embodiment of the present application, applied to a BIOS, including:
step S201: the method comprises the steps of obtaining a starting list of a computer, wherein the starting list comprises configuration attribute information of starting equipment in the computer, mark attribute information of the starting equipment and starting priority information of the starting equipment.
Step S202: and traversing the configuration attribute information of all the starting devices.
Step S203: and judging whether the configuration attribute information of the starting equipment with an empty value exists in all the starting equipment, if so, executing step S204, and if not, executing step S210.
Step S204: and assigning a value to the zone bit.
In this embodiment, the step of selecting an empty position as a flag bit in the CMOS space, that is, adding the flag bit, may be performed before step S204.
Step S205: and judging whether the flag bit is assigned, if so, executing step S206, and if not, executing step S210.
Step S206: and reconfiguring the corresponding relation between the mark attribute information of the starting equipment in the starting list and the starting priority information of the starting equipment, and assigning the configuration attribute information.
Step S207: and saving the reconfigured starting list.
Step S208: and clearing the assignment of the zone bit.
Step S209: the BIOS is restarted and step S205 is performed.
Step S210: and reading the starting list.
The method comprises the steps of firstly, judging whether a newly added starting device exists in the computer or not through configuration attribute information of the starting device; and finally, adjusting the starting sequence of the newly added starting equipment by adjusting the starting priority information of the starting equipment according to the starting requirement of the newly added starting equipment, wherein the operation is simple and the safety is high, and the flag bit is set for marking whether the newly added starting equipment exists in the computer, so that the operation steps are further simplified, and the starting efficiency of the starting list is improved.
The method for adjusting the computer starting sequence is particularly suitable for adjusting the hard disk starting sequence. Specifically, for example, the computer has a device hard disk a and a data hard disk B, when the device hard disk a as a device is damaged, the newly added physical hard disk C is used to replace the device hard disk a, and the computer sets the physical hard disk C as the first start by the method for adjusting the computer start sequence after starting up, so that the computer can directly enter the newly added physical hard disk C, and thus, the computer can be prevented from directly entering the original data hard disk B after starting up, the computer can display the state without the device hard disk, and the problem that the ordinary user thinks that the computer can not be started up is avoided.
In a third aspect, the present invention provides an apparatus 300 for adjusting a computer boot sequence, and referring to fig. 3, fig. 3 is a schematic block diagram of an adjusting apparatus of a computer boot device according to an embodiment of the present application, applied to a BIOS, including:
an obtaining module 301 configured to obtain a boot list of a computer, where the boot list includes configuration attribute information of boot devices in the computer, flag attribute information of the boot devices, and boot priority information of the boot devices.
A determining module 302, configured to determine whether there is a newly added boot device in the computer according to the configuration attribute information of the boot device.
A configuration module 303, configured to, when there is a newly added boot device in the computer, reconfigure a correspondence between the flag attribute information of the boot device in the boot list and the boot priority information of the boot device.
In an optional embodiment, the determining module 302 is further configured to traverse configuration attribute information of all boot devices, and determine whether configuration attribute information of a boot device with an empty value exists in all boot devices, if yes, a new boot device exists in the computer; and if not, the computer does not have newly added starting equipment.
In an alternative embodiment, the configuration module 303 includes:
an add sub-module configured to add a flag bit.
And the assignment submodule is configured to assign the zone bit under the condition that the newly added starting equipment exists in the computer.
The configuration submodule is configured to reconfigure the corresponding relationship between the flag attribute information of the starting device and the starting priority information of the starting device in the starting list under the condition that the flag bit is assigned.
And the saving submodule is configured to save the reconfigured starting list.
In an alternative embodiment, the apparatus further comprises:
and the clearing module is configured to clear the assignment of the flag bit after the configuration submodule reconfigures the corresponding relationship between the flag attribute information of the starting device and the starting priority information of the starting device in the starting list.
In an optional embodiment, after the step of saving the reconfigured start-up list, the apparatus further comprises:
and the restarting module is configured to restart the BIOS after the storage submodule stores the reconfigured starting list.
The device firstly judges whether a newly added starting device exists in the computer or not according to the configuration attribute information of the starting device; and finally, adjusting the starting sequence of the newly added starting equipment by adjusting the starting priority information of the starting equipment according to the starting requirement of the newly added starting equipment, wherein the operation is simple and the safety is high, and the flag bit is set for marking whether the newly added starting equipment exists in the computer, so that the operation steps are further simplified, and the starting efficiency of the starting list is improved.
According to the method and the device for adjusting the computer starting sequence, whether the newly added starting equipment exists in the computer is judged according to the configuration attribute information of the starting equipment. And adjusting the starting priority information of the starting equipment under the condition that the newly added starting equipment exists in the computer, so that the starting sequence of the newly added starting equipment can be adjusted by adjusting the starting priority information of the starting equipment according to the starting requirement of the newly added starting equipment, and the method is simple to operate and high in safety.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.