Detailed description of GRUB boot Bootstrap program configuration and command line interface
I. Version
Grub: Grand uniied Bootloader
Grub 0.x: grub legacy
Grub 1.x: grub2
Ii. grub legacy
Three Processes
Stage1: Installed in mbr
Stage00005: slice after mbr
Stage2: stored in the disk partition (/boot/grub)
Configuration File
/Boot/grub. conf,/etc/grub. conf
Functions
Stage2 and kernel are usually placed in a basic disk partition.
1. Provides menus and interactive interfaces • e: editing mode for editing menus
C: Command mode and interactive interface
2. Load the selected kernel or operating system • allow passing parameters to the kernel
This menu can be hidden.
3. Provides menu Protection
Authenticate the editing menu
Recognize Devices
GRUB does not distinguish between IDE hard disks and SCSI hard disks, which are identified by hdx. X specifies the BISO hard disk number, which starts from scratch, and usually the computer's IDE Hard Disk number is in front of the SCSI hard disk. Grub uses hd (X, Y) numbers to identify a partition of a hard disk in a computer.
The parentheses must be half-width English characters, and there are no spaces after the hd comma;
* Hd (X, Y) X indicates the X hard disk in the computer. The hard disk number starts from 0. In the BIOS, set the first hard disk to 0, other hard disks are arranged in the order of IDE, which are 1, 2, 3 ,...
In hd (X, Y), Y refers to the partitions in the hard disk. The number also starts from 0. Other partitions are 1, 2, 3. Note that:, 2, and 3 are the primary partitions in the hard disk. If it is an extended partition, the number starts from 4 to the last extended partition.
Grub command line interface
Help: get the help list
Help KEYWORD: Detailed help Information
Find (hd #, #)/PATH/TO/SOMEFILE: find
Kernel/PATH/TO/KERNEL_FILE: Set the kernel file used for this startup. You can also add many kernel-supported cmdline parameters.
Initrd/PATH/TO/INITRAMFS_FILE: Set ramdisk TO provide additional files for the selected Kernel
Boot: boot the selected Kernel
Manually start the system on the grub command line interface
Grub> root (hd #, #) root of grub
Grub> kernel/vmlinuz-VERSION-RELEASE ro root =/dev/DEVICE set the kernel file used for this startup
Grub> initrd/initrafs-VERSION-RELEASE.img
Grub> boot
3. view the configuration file/boot/grub. conf.
Default = 0 set the default start menu item
Timeout = 5 the waiting time for menu items is 5 s
Splashimage = (hd0, 0)/grub/splash.xpm.gz specifies the path of the menu background image
Hiddenmenu hide menu
Title CentOS (2.6.32-358.6.1.el6.x86 _ 64) defines menu items
Root (hd0, 0) grub searches for the device partition where the stage2 and kernel files are located, and grub root
Kernel/vmlinuz-2.6.32-358.6.1.el6.x86_64 ro root =/dev/vg_have/lv_root rd_NO_LUKS LANG = en_US.UTF-8 SYSFONT = latarcyrheb-sun16 crashkernel = auto rhgb quiet boot kernel
Ramfs file for initrd/initramfs-2.6.32-358.6.1.el6.x86_64.img kernel matching
Https://www.bkjia.com/Linux/2018-02/150958.htm