Grub It is our bootloader that greets us first when the system boots up. Grub Thanks to this, our kernel and initramfs image are loaded into memory and the system is started.

Grub let's get to know your screen

Grub It is possible to change the opening options using the screen. There are edit mode and command line mode for this.

Note: Grub Since there is no keyboard support on the screen, you have to write according to the English q keyboard layout.

Grub on the screen if e If you press the button, it will enter the edit mode. In this way, it is possible to change the boot parameters before starting the system.

Grub text editing mode

After we've done our editing f10 or a ctrl-x You can start the boot by pressing the button. To exit edit mode and revert changes e you can use the key.

if c If you press the key, it will switch to command line mode. Here, it is possible to do the opening manually by entering the commands manually.

Grub command line mode

To exit command line mode e you can use the key.

Basic commands

ls command lists available disks. If you add the directory name next to the command, it will list the directory contents.

ls command

clear command clears the command line.

clear command

set The command is used to set a variable. root variable refers to the disk we are on.

set command

threw out The command prints text to the screen. Variables $variable or a ${variable} is expressed as.

echo command

exit command grub exits the screen and starts the next bootloader in the bios sequence.

fwsetup with the command UEFI bIOS You can access the bios on systems with

To create a condition if used. Structurally bash Same as if in but for conditions only [] used. ([[]] not found this way.)

if [ "${root}" ] ; then set root=(hd0,gpt2) else echo $root fi

search command searches disks. if –File If you add a parameter, it will search for files. If –fs-uuid If you add it, it will look for the uuid value. –set=xxx If we add it, it assigns the found disk to the variable.

search --file --set=root /boot/vmlinuz-xxx

source command imports a configuration file.

source ($root)/boot/grub/linux.cfg

insmod The command loads the module. List of available modules lsmod You can access it with the command

insmod all_video lsmod

Starting the system with the command line

GNU/Linux requires the kernel and initramfs image to boot. For this, we need to run the following commands in order.

set root=(hd0,gpt2) linux /boot/vmlinuz-xxx root=/dev/sda2 ro quiet splash initrd /boot/initrd.img-xxx boot

Here, in our first command, we made the disk with the kernel the current disk. In the second command, we provided the location and parameters of the kernel to load the kernel. In the third command, we provided the location of our initramfs image and ensured it was loaded. Finally, we wrote the command required to start the boot.

Grub configuration

grub-mkconfig using the command (or update-grub) you can create automatic configuration. However, it is also possible to write this configuration manually. For this / boot /grub/grub.cfg We can write our file as follows.

insmod all_video insmod ext2 menuentry Pardus { set root=(hd0,gpt2) linux /boot/vmlinux-xxx ro quiet splash initd /boot/initrd.img-xxx }

In the example configuration above menentry The expression serves to add an option to the splash screen. To create a submenu submenu You can use the expression.

However, chain loader It is possible to boot a different (non-linux) system using the command

menuentry "Winzort 10 UEFI" { search --file --set=root /EFI/MICROSOFT/BOOT/bootmgfw.efi chainloader ($root)/EFI/MICROSOFT/BOOT/bootmgfw.efi }

To run the nt kernel in Legacy bios, you can follow a path as follows.

menuentry "Winzort Xp Legacy" { insmod ntfs insmod ntldr search --file --set=root /bootmgr ntldr /bootmgr }

Links that may be useful