GRUB is a multi-power management tool that can be used to launch many job systems such as Linux, BSD, OS / 2, Beos and Windows95 / 98 / NT. GRUB is a boot program that is independent of the operating system, not like Lilo Relying on Linux to set and maintain, it also provides a command column mode similar to BASH, allowing users to easily set GRUB.
Get and install GRUB:
Grub's original code compressed file can go to the GNU's FTP station (
ftp://alpha.gnu.org/gnu/grub/) Download the latest version, and save it after downloading and decompress it:
CP grub.tar.gz / usr / local / src /
Tar zxvf grub.tar.gz
In the GRUB's directory, make the configure file, make all the make install, as follows:
./configure
Make
Make Install
When Make Install is completed, the GRUB has been successfully installed, and three instruction gears are also installed in the system: GRUB, GRUB-INSTALL and MBCHK. The relevant archives of GRUB are usually installed to / usr / local / share / grub's directory.
Next, it is assumed that the hard disk splits is as follows:
HDA1: Windows98 (HD0, 0)
HDA2: SLACKWARE Linux (HD0, 1)
HDB1: Mandrake Linux (HD1, 0)
Note that the GRUB herd is not the same as Linux. The first IDE hard drive in Linux is HDA (SCSI: SDA), and the grub will treat the first IDE hard disk as HD0. SCSI: SD0) Pushing in this class; the first division area of the first IDE hard disk in Linux is HDA1 (SCSI: SDA1), and the GRUB will represent the first divided area of the first IDE hard disk. To HD0, 0 (SCSI: SD0, 0) is pushed.
Making a GRUB startup magnetic sheet:
Making a GRUB startup magnetic sheet is not difficult. First, you need two necessary files, which are Stage1 and Stage2, which can find these two files in the i386-PC directory in GRUB installation directory, and a formatted clean magnetic sheet. Then, the startup magnetic sheet of GRUB can then be produced according to the following production steps:
CD / USR / local / share / grub / i386-PC /
DD if = stage1 of = / dev / fd0 bs = 512 count = 1
DD if = stage2 of = / dev / fd0 bs = 512 seek = 1
After making GRUB's boot magnetic sheet, you can try to use GRUB to start booting for multiple operating systems.
Using the GRUB boot magnetic launch system:
Then restart the system and set the BIOS by the magnetic sheet, then you can see the command column of the GRUB>, which is the command column environment of GRUB, indicating that the GRUB has been smoothly loaded from the startup magnetic sheet and works normally. . Now, it is assumed that the above SLACKWARE Linux is to be launched, Type the following instructions under the GRUB prompt symbol, so you will enter the SLACKWARE Linux system:
GRUB> root (HD0, 1)
Grub> kernel / boot / vmlinuz root = / dev / hda2 ro
GRUB> Boot
The root instruction will mount the hard disk segmentation area of the back parameter. When the Mount is completed, the KERNEL directive will load its parameters, the core of Linux is usually a file named Vmlinuz in the / boot directory. The last two parameters are the core to be transmitted, and root = / dev / hda2 is to tell the core root directory in / dev / hda2, and require mounting to read (RO). Finally, the boot instruction is executed to start the SLACKWARE system. Similarly, the MANDRAKE Linux on HDB1 can also be launched in a similar way:
GRUB> root (HD1, 0)
Grub> kernel / boot / vmlinuz root = / dev / hdb1 ro
GRUB> Boot
Now the ROOT instruction changes the split area of Mount (HD1, 0), which is the root location of Mandrake Linux. Then the Kernel instruction is loaded into the core file of Mandrake, telling the core of the corerake system in / dev / hdb1, and is required to be mounted to read. Finally, the system starts with the boot directive.
The Linux system can be launched smoothly, but whether the Windows system is for Windows systems, to start Windows 98 on HDA1, then you have to do this, please type the following instructions in the GRUB command column. You can enter Windows98:
Grub> rootnoveriff (HD0, 0)
GRUB> ChainLoader 1
GRUB> makeactive
GRUB> Boot
With the rootnoverity instruction, let GRUB do not want Mount (HD0, 0) split area, as long as you want to start the job system on this split area. What CHAINLOADER 1 means to specify the first magnetic area on this division to do start. The MakeActive command is to set the Active flag on this split area, as long as the WINDOWS job system is done. Finally, boot in the BOOR directive.
Start up using the grub on the hard disk:
GRUB's boot magnetic sheet is convenient, but the purpose of making GRUB boot magnetic sheets is only for system rescue, it is necessary to make GRUB's powerful features, it is best to boot on the grub on the hard disk, just like LILO is mounted on the MBR of the hard drive.
First, you must establish a GRUB-specific boot directory / boot / grub, such as the startup file that makes GRUB is required, so please set the Stage1 file in the I386-PC directory in the GRUB installation directory. COPY to the bottom of the / boot / grub directory:
MKDIR / BOOT / GRUB
Cp / usr / local / share / grub / i386-pc / stage * / boot / grub
After completing, type the command GRUB instruction to enter the grub command, type the following instructions in the GRUB command:
GRUB> root (HD0, 2)
GRUB> Setup (HD0)
GRUB> quit
So, the grub can be completed in / boot / grub, first use the root instruction mount directory / boot / grub location, where (HD0, 2) is the Slackware system that assumes above, that is, / boot / The GRUB directory is established in the SLACKWARE system. If you want to change to the STAGE file of the GRUB by Windows 98, you must create / boot / grub's directory on the Windows98 system, and store the Stage1 gear and the Stage2 file in the / boot / grub directory on Windows 98, and The parameters of the root directive are also changed to the split area where Windows98 is located, that is, the above assumptions (HD0, 0). The second instruction setup refers to which position is to be turned on which location is to be turned on. If it is to be installed on the MBR of the hard disk, only the position of the hard disk is like (HD0), if it is to be installed to the hard disk first The first magnetic area on the divided area is to add the position of the divided area such as (HD0, 0). Unless there is a special case, it is preferably a safer to the split area of the hard disk. Finally, use the QUIT instruction to leave the grub command column environment.
Use option list:
Now, although you can use GRUB to do multiple boot management, it is not convenient to enter complicated instructions each time. Therefore, GRUB also provides a list of options, so that you only need to press Up and next button to boot every time you start. Press the ENTER button to boot without having to enter any instructions. GRUB will first look for the Menu.lst file under the / boot / grub directory. If you find the grub, you will display an option list according to the content of the menu.lst file, so that the user selects the job system to be turned on.
First, build a new file in the / boot / grub directory to menu.lst, under the setting example of the menu.lst file:
# / boot / grub / menu.lst
TIMEOUT 30
Default 0 #default Slackware Linux
Fallback 1 # windows98
Fallback 2 #Mandrake Linux
Color Light-Green / Brown BLINK-Red / Blue
# For booting slackware linux
Title Slackware
Root (HD0, 1)
Kernel / boot / vmlinuz root = / dev / hda2 ro
#For booting windows
Title windows98
Rootnoverify (HD0, 0)
ChainLoader 1
Makeactive
#For booting mandrake Linux
Title Mandrake
Root (HD1, 1)
Kernel / boot / vmlinuz root = / dev / hdb1 ro
The example of the menu.lst file is set for the operating system configured on the hard disk segmentation area that is previously assumed. Menu.lst is the beginning of an annotated as an # symbol, and GRUB ignores all annotated rows started with a # symbol. The Timeout command refers to the wait time after GRUB startup, in seconds, so the example above is awaiting for 30 seconds. The DEFAULT instruction is the time after the GRUB starts exceeds the time set by the command Timeout, the system specified by the DEFAULT, parameter 0 represents the first set job system in the MENU.lst file, above For example, it means Slackware Linux because it is the first to be set, if the parameter is changed to 1, it is to start Windows98, and so on. The Fallback instruction refers to the failure of the job system specified by the GRUB startup command Default, and will start the job system specified by the command Fallback. For the above example, when the SLACKWARE starts failure, GRUB will start Fallback specified by the Fallback. Windows98. The command color can set the prospect / background color of the GRUB option list, and the color of the GRUB can specify can view the GRUB INFO file. The next instruction is to set the job system. The command title can set the title of the job system, and the commands below it are the same, the instructions originally typed in the GRUB command column, the difference is not added On the boot directive. After setting the menu.lst file, you can display this setting file below / boot / grub directory, and then you will see the GRUB beautiful option list, which can try to start different job systems.
The above is the basic instructions of GRUB. When there are many job systems on the hard disk, use grub is a matter of course, and it is the correct choice, and only one or two job systems on the hard disk can also use GRUB. Of course, the function of GRUB is very powerful. It is sufficient to replace traditional LILO, and you can read the description of the GRUB INFO file.