2.GRUB naming convention 5.1.2 Chained-load operating system
2.GRUB naming Convention
The device characters that Grub uses are a bit different from what you've seen in your operating system before, and you need to know about it so you can specify a drive or partition.
Please see the following examples and explanations:
(FD0)
First, grub requires the device name to enclose the left and right brackets (). The "FD" section indicates that this is a floppy disk (floppy disk). The number "0" represents its drive number 0. This expression means that grub will use the entire floppy disk.
(HD0,MSDOS2)
Here, "HD" represents this is a hard disk (hard disk). The first integer "0" represents the drive letter, which means that this is the first hard disk, the string "Msdos" represents the partition structure, and the integer "2" represents the area code (or the PC slice number in BSD terminology). The partition number is counted starting from 1, not counting from 0 (just like the previous grub version). This expression represents the second partition of the first hard disk. In this case, GRUB uses a partition on the disk, not an entire disk.
(HD1,MSDOS1,BSD1)
This represents the BSD "a" partition on the first partition of the second hard disk.
Of course, to enable grub to access disks or partitions, you need to use the device specification syntax rules on the command line, like "set root" or "Parttool (HD0,MSDOS3) hidden-". To help you figure out which number is the partition number you want, the GRUB command line (see Command-Line interface) option has full parameter hints. This means, for example, that you just need to go to the set root= (and then press the TAB key, GRUB will list all the drives, partitions, or file names.) So, even if you don't know much about grammar, it should be easy to find the partition you want.
Note that GRUB does not differentiate between the IDE and scsi-it simply calculates the drive letter starting at 0, regardless of their type. Generally, any IDE driver is less than the SCSI driver, but if you change the boot sequence by swapping the IDE and SCSI drives in your BIOS, that's not true.
The question now is how to specify the file. Consider one more example:
(HD0,MSDOS1)/vmlinuz
This example specifies a file named "Vmlinuz", which was found on the first partition of the first hard disk. Note that the full parameter hint also applies to the filename. 5.1.2 Chain loading and indexing operating system
Operating systems that do not support multiple booting and have special instructions in grub (LINUX,FREEBSD,NETBSD and OpenBSD can use specific support) must be loaded in a chained way, which requires loading another boot loader and jumping to the real operating system.
The chained load command is used to load this operating system. It is often necessary to load some grub modules and set up appropriate root devices. Put these together and we get something like that for the first partition of the first hard disk on the Windows operating system:
Menuentry "Windows" {
Insmod Chain
Insmod NTFS
Set root= (hd0,1)
Chainloader +1
}
On systems with multiple hard disks, additional workarounds may be required.
Chained to load only on PC BIOS and EFI platform support.
The article originated from [1]:https://www.gnu.org/software/grub/manual/grub/grub.html#role-of-a-boot-loader