How to modify GRUB parameters under Linux

First determine how the system is started

Check in the BIOS Options interface when starting up

The difference between legacy and UEFI

UEFI: New mode, its startup sequence: boot → UEFI initialization → boot the operating system → enter the operating system to start. The speed is faster than the lagacy mode.
UEFI only supports 64-bit operating systems. The system in UEFI mode will have two small partitions, one is called ESP (EFI system partition) and the other is MSR (Microsoft reserved partition, usually 128MB). MSR is required by the window The partition .ESP is very important to the UEFI boot mode. The UEFI boot program is stored in the ESP partition with the suffix .efi, and the ESP partition uses the fat32 file system. In addition, there may also be a small partition called WinRe Tools, which is the recovery partition in Win8. The volume is also very small.
UEFI boot mode: (GPT partition table format + UEFI boot mode + x64 system)

Legacy: The boot sequence of the traditional BIOS transfer mode: boot → BIOS initialization → BIOS self-check → boot the operating system → enter the system.
The traditional hard disk boot record is in MBR format, and MBR cannot support hard disks larger than 2T. But it has the best compatibility.
Legacy boot mode: (MBR master boot record partition format + Legacy boot mode)

Summary: UEFI is a new-style BIOS, and Legacy is a traditional BIOS. The system installed in UEFI mode can only be booted in UEFI mode; similarly, if the system is installed in Legacy mode, it can only enter the system in Legacy mode. UEFI only supports 64-bit systems and the disk partition must be in GPT mode. Traditional BIOS uses INT13 interrupt to read the disk, which can only read 64KB each time, which is very inefficient, while UEFI can read 1MB each time and load faster. In addition, Win8 further optimizes UEFI support, which claims to be able to achieve instant boot.

The difference between MBR and GPT under Legacy and UEFI:
MBR: Master Boot Record (Master Boot Record, abbreviation: MBR), also known as the master boot sector, is the first fan that must be read when the computer is turned on to access the hard disk Area.

GPT: GUID partition table, disk drive capacity can be much larger, so large that the operating system and file system can't support it. It also supports almost unlimited number of partitions, the limitation is only in the operating system, Windows supports up to 128 GPT partitions.

Modification method

First, modify the parameters in /etc/default/grub according to your needs. After modification, the corresponding configuration file needs to be generated.
1. When the startup mode is legacv

grub2-mkconfig -o /boot/grub2/grub.cfg

2. When the boot mode is UEFI

grub2-mkconfig -o /boot/efi/EFI/你的操作系统/grub.cfg

After restarting reboot, you can see that your configuration has been updated

(/etc/default/grub) Boot file description

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#属性名:默认启动项(就是我要的开机默认启动系统)
#值说明:
#数字:从0开始(按照开机选择界面的顺序对应)两级目录直接使用“1>3”,
#字符串:直接写选项的全名。二级目录下直接使用 > 大于号连接例如:“Advanced options for Ubuntu> Ubuntu, with Linux 4.9.90xenomai-3.0.7#saved:默认上次的启动项

#GRUB_HIDDEN_TIMEOUT=0
#属性名:是否隐藏菜单(grub2不再使用)
#值说明:0:不隐藏,1:隐藏

GRUB_HIDDEN_TIMEOUT_QUIET=true
#属性名:是否显示等待倒计时
#值说明:true:不显示,false:显示

GRUB_TIMEOUT=10
#属性名:进入默认启动项的等候时间
#值说明:单位:秒,默认10秒,-1表示一直等待

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
#属性名:内核启动参数的默认值
#值说明:quiet splash为不显示启动信息,安静的启动,如值为空则显示启动信息

GRUB_CMDLINE_LINUX=""
#属性名:手动添加内核启动参数
#值说明:默认为空,可以添加你需要的参数,以 “name=value” 的格式添加,多个参数用空格隔开
#例如:GRUB_CMDLINE_LINUX="name1=value1 name2=value2"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
#属性名:是否使用图形介面
#值说明:默认使用图像界面,去掉前面的“#”则使用控制台终端

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

#GRUB_GFXMODE=640x480
#属性名:图形界面分辨率
#值说明:分辨率啦(还要怎么说明),修改时记得去掉前面的“#”

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
#属性名:grub命令是否使用UUID
#值说明:不知道是干什么的,不常用(如果你知道,欢迎留言,谢谢)

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
#属性名:是否创建修复模式菜单项
#值说明:true:禁用,false:使用,默认false

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
#属性名:启动时发出哔哔声
#值说明:默认不发声,去掉“#”则发声,值是什么意思不明白(应该是发出声音方式吧)

Guess you like

Origin blog.csdn.net/daijingxin/article/details/112688094