GNU Grub Start Manager
http://www.linuxgazette.com/ 01-10-13 15:08 609P
Hilinux translation
What is the startover manager? The boot manager is a program stored in the disk start sector, for example, the MBR (Master Boot Record) of the hard disk, after the system is started, if the system starts from the MBR, the Bios (Basic Input / Output System) will Control is transmitted to the MBR. The program stored in the MBR will then run. This program is called a starter manager. Its task is to transmit control to the operating system to complete the startup process. There are many available boot managers, including GNU GRUB (Grand Unified Boot Loader), Bootmanager, Lilo (Linux Loader), NTLDR (Boot Loader for Windows Nt Systems), and so on. Below I will discuss GNU GRUB and how it is used. What is grub? GRUB is a powerful launch manager that loads a variety of operating systems such as Windows, DOS, Linux, GNU Hurd, * BSD, and more. Currently, LILO is the most popular launch manager that is used to manage boot of multiple systems. However, if you use Lilo, you must remember that when you change its configuration or install a new kernel, you must re-run Lilo. Moreover, LILO flexibility is also inferior to GRUB. GRUB is flexible. Its latest version, 0.5.96.1, supported file system includes ext2 (a file system used by Linux), FFS (Fast File System Used By * BSD UNIX), Reiserfs (a new log file system developed for Linux, In the 2.4.1 kernel, Minix (a vintage file system developed for the Minix system, is also used in early Linux). Use GRUB, you don't even guide the operating system, you can "see" to these file systems For example, if you want to see the date and time stored in a text file, don't want to guide the entire operating system, you can use the Grub shell (prompt "GRUB>"), type the following command: grub> cat (partition Number) /Home/god/filename.txt. You can see all information related to the file, including the date and time. Grub's best application is that you can easily boot any kernel on any partition in the list. For example, If you don't add a newly compiled core to the launch list, you need to boot it, you can use it first in the list, then use it. But after using GRUB, you can simply use the Grub shell. Load the required kernel image. Now I will explain three basic steps using GRUB: Compile, Install, and Configure. Step 1: Compile and install GRUB can be from ftp://alpha.gnu.org/pub/gnu/ GRUB downloads the source code of GRUB. You can use the command "TAR-XVZF filename.tar.gz" to unwinder the compressed document. The file I get is grub-0.5.96.1.tar.gz, so I do this: # tar -xvzf Grub -0.5.96.1.tar.gz This command places unstopened files and directories in a directory called GRUB-0.5.96.1.
Now run as follows: [root @ heaven ~ / grub-0.5.96.1] # ./configure If you want to customize GRUB, make it a popular file system and support for the NIC, or remove the NIC you do not need, you can run The following command: [root @ heaven ~ / grub-0.5.96.1] # ./configure --Help This command will output all command options. You can now add or delete support for specific network cards using the -enable and -disable options. (Note: GRUB Support Network Start) In order to start the compilation process, type the following command: [root @ heaven ~ / grub-0.5.96.1] # Make In order to properly install all files, type the command: [root @ heaven ~ / grub -0.5.96.1] # make install to this, you have already prepared for installing GRUB. Saving GRUB's related files is not a good idea in a directory such as / boot / grub. To do this, follow these steps: 1. By default, all files will be installed in the / usr / share / grub / i386-pc or / usr / local / share / grub / i386-pc directory, depending on your shell variable settings. 2. Create a directory called / boot / grub, then copy the following files to this directory: stage1stage2 * _Stage1_5 I will explain these files later. At the same time, GRUB (possibly in / usr / sbin or / usr / local / sbin directory) is also copied to the / boot / grub directory. Before installing GRUB, you need to know how GRUB identifies your hard drive and partition information. First, the count starts from 0 instead of from 1. In Linux, your first hard disk connected to the main controller is called "had". "HD0" in the grub. Similarly, in GRUB, your first floppy drive is "fd0". Thus, the first, second, and three partitions on the first block are "HD0, 0", "HD0, 1", "HD0, 2", respectively. Note: The comma is the necessary part of the GRUB partition nomenclature. In order to integrate the partially spaced portion, it is necessary to use parentheses. For example: (HD0, 0) (HD0, 1) (HD0, 2), etc. (HD0, 0) is the first partition on the hard disk. Similarly, (HD1, 5) is the sixth partition on the second fast hard disk, (HD2, 0) is the first partition on the third hard disk. Fe Step 2: Installing GRUB Installing GRUB can be divided into three separate steps: 1. Install "Stage1" into the MBR. 2. Set the address or location of "stage2". 3. Set a menu or option to determine which operating system is started. Use the following command to start installing GRUB. [root @ heaven / boot / grub] # ./grub This command detects the hardware device according to the setting of the BIOS while generating some output information. This will take a long time. END_REQUEST: I / O Error, DEV 02:00 (FLOPPY), Sector 0 Grub Version 0.5.96.1 (640K Lower / 3072K Upper Memory) Note: Although it is very surprising, Grub does have a simple interface - just support Word edit. Tab lists the list of possible commands. In other cases, TAB will list the device or file name. It will be very amazing.
Similar to the following prompts: GRUB> now, I assume that you install Linux in the first extension partition of the first hard disk or / dev / hda5. Remember the grub's naming rules, change the above name to (HD0, 4). Type the following command: grub> install (hd0, 4) / boot / grub / stage1 (hd0) (HD0, 4) / boot / grub / stage2 p (hd0, 4) /boot/grub/Menu.conf now let us Analyze the details of this command. Install a built-in command, it tells GRUB to install (HD0, 4) / boot / grub / grub / stage1 to the main boot record of the HD0. (HD0, 4) / boot / grub / stage2 tells the GRUB Stage2 map. P with the the backing options: (hd0, 4) /boot/grub/Menu.conf Sets the configuration file for the display of the menu. I will discuss the structure of this configuration file. Below is a summary of this command usage: 1. NSTALL 2. OURCE_OF_STAGE1 3. WHERE_TO_INSTALL 4. Source_of_stage2 5. p Source_of_configuration_file now, you have completed the basic installation work on your hard drive. Install on the floppy disk: In order to install GRUB on the floppy disk, you have to use the "DD" command and understand how it works. To make a GRUB boot disk, you have to put the Stage1 and Stage2 files in the start sector of the floppy disk. Installing a Stage1 to floppy disk: Insert a formatted floppy disk, type command: [root @ heaven / boot / grub] # DD if = stage1 of = / dev / fd0 bs = 512 count = 1 command detailed description is as follows: IF = input filei.e., stage1 of = Output File IE, Floppy Drive (this May Be Different On Your Computer) BS = bytes to read and write here it it is 512 bytes. count = how much Times to Perform this Operation each time Copy the "BS" number of blocks to the target address. Installing a STAGE2 to floppy disk [root @ heaven / boot / grub] # DD if = stage2 of = / dev / fd0 bs = 512 seek = 1 The step here is the same as STAGE1, except for an SEEK option. The Seek option will be tonified. For example, the value of the BS in the command is 512 so that seek = 1 means that the first 512 bytes on the floppy disk will start from 513 bytes. This will make the first step not override the first 512 bytes of Stage1. Now you have completed the basic floppy drive installation. Step 3: Configure GRUB in this section, let's take a look at how to enter a variety of operating systems after startup, how to build a menu.conf file. We start from the startup process supported by GRUB. There are two ways to complete the startup process: · a. By calling the kernel locally · b. Continuous start or turn the control to another boot A mode startup process 1. Set up the device or tell GRUB your root file system. 2. Quantitative Grub's location and transfer the parameters to the kernel.
3. Restart, try it. In order to launch Linux, I put the kernel in the / boot / directory of the file name, and the file system is / dev / hda5, or the GRUB (HD0, 4). My startup process is as follows: 1. ROOT (HD0, 4) [this set the root partition] 2.kernel / boot / bzimage root = / dev / hda5 [this sets the kernel] b mode startup process (this mode assumes Another start manager is installed in the partition, such as LILO or NTLDR: 1. Set the root partition but do not install it 2. Activate this partition 3. Configure the first sector 4 of the partition that needs to be started. Restart, look at the effect. We try to start Widows installed on / dev / hda1 or (hd0, 0). The process of launching Windows is as follows: 1.Rootnoverify (HD0, 0) 2.makeActive 3.chainLoader 1 [ 1 sets the first sector of the current root part] 4.boot [Transfers the control and quits grub] menu.conf file : It is used to establish a menu when starting a multi-operating system. It is not difficult to build menu.conf. It uses simple English, just like you see this section. All menu items start at the beginning without comma-separated "title titlename". You can set the TitleName at will. Setting up the Linux boot menu steps as follows: 1. Set the title 2. Set the root partition 3. Set the corresponding parameter 4 of the kernel. Start a menu example: Title Debian GNU / Linux 2.2 Kernel 2.4.1Root (HD0, 4) kernel /boot/bzimage.2.4.1boot#---- The front of the front is a comment. Establish a menu that starts Windows or DOS: Title Windoze Rootnoverify (HD0, 0) makeactiveChainLoader 1boot # ---- If you have two versions of Windows - one is yourself, another for your family - This way, the second cannot be installed, because there is a prompt that Windows has been installed. There is a simple way to install two versions of Windows, that is, hidden a partition when starting, using the other. You can even set password protection for your partition, so you can prevent others to load your partition. The following describes how to complete two Windows installation, HDA1, and HDA2 or (HD0, 0) and (HD0, 1), and the commands used by Lock, Password, Hide, and UnHide. Establishing a Windows project "My Entry": Title My Entrylockunhide (HD0, 0) Hide (HD0, 1) Rootnoverify (HD0, 0) MakeActiveChainLoader 1boot # --- To better use the lock command, you need to start in the configuration file Use the password command. The syntax of the Password command is as follows: Password Secret ("Secret" is a password). You can enter your password by pressing the P key.