Linux 概念:grub2
GRUB 2是許多發(fā)行版的缺省efi模式引導(dǎo)加載程序。
grub2 與 grub 的區(qū)別
官方手冊:https://www.gnu.org/software/grub/manual/grub/html_node/Changes-from-GRUB-Legacy.html
幾個主要的區(qū)別:
1.配置文件的名稱改變了。在grub中,配置文件為grub.conf或menu.lst(grub.conf的一個軟鏈接),在grub2中改名為grub.cfg。
2.grub2增添了許多語法,更接近于腳本語言了,例如支持變量、條件判斷、循環(huán)。
3.grub2使用img文件,不再使用grub中的stage1、stage1.5和stage2。
grub2 引導(dǎo)操作系統(tǒng)的方式
官方手冊:https://www.gnu.org/software/grub/manual/grub/html_node/General-boot-methods.html
直接引導(dǎo):(direct-load)直接通過默認(rèn)的grub2 boot loader來引導(dǎo)寫在默認(rèn)配置文件中的操作系統(tǒng)
鏈?zhǔn)揭龑?dǎo):(chain-load)使用默認(rèn)grub2 boot loader鏈?zhǔn)揭龑?dǎo)另一個boot loader,該boot loader將引導(dǎo)對應(yīng)的操作系統(tǒng)
rpm -qa | grep grub2
grub2-tools-2.02-73.oe1.aarch64
grub2-efi-aa64-2.02-73.oe1.aarch64
grub2-common-2.02-73.oe1.noarch
rpm -qc grub2-tools-2.02-73.oe1.aarch64
/etc/default/grub
/etc/grub.d/00_header
/etc/grub.d/01_menu_auto_hide
/etc/grub.d/01_users
/etc/grub.d/10_linux
/etc/grub.d/20_linux_xen
/etc/grub.d/20_ppc_terminfo
/etc/grub.d/30_os-prober
/etc/grub.d/30_uefi-firmware
/etc/grub.d/40_custom
/etc/grub.d/41_custom
rpm -ql grub2-efi-aa64-2.02-73.oe1.aarch64
/boot/efi/EFI/openEuler/fonts
/boot/efi/EFI/openEuler/grub.cfg
/boot/efi/EFI/openEuler/grubaa64.efi
/boot/efi/EFI/openEuler/grubenv
/boot/grub2/grubenv
/boot/loader/entries
/etc/grub2-efi.cfg
grubaa64.efi 這個是操作系統(tǒng)的引導(dǎo)文件
tree /boot/efi/EFI/
/boot/efi/EFI/
├── BOOT
│ ├── BOOTAA64.EFI
│ ├── fbaa64.efi
│ └── mmaa64.efi
└── openEuler
├── BOOTAA64.CSV
├── fbaa64.efi
├── fonts
├── grub.cfg
├── grubaa64.efi
├── grubenv
├── mmaa64.efi
├── shimaa64.efi
└── shimaa64.hash
EFI system partition(ESP)
EFI系統(tǒng)分區(qū)(也稱為ESP)是一個操作系統(tǒng)獨立分區(qū),作為EFI引導(dǎo)加載程序、應(yīng)用程序和驅(qū)動程序的存儲空間,由UEFI固件啟動。UEFI引導(dǎo)時必須配置。
fdisk -l /dev/sdb
Disk /dev/sdb: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk model: SAMSUNG MZ7LH480
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 4FA243ED-88DE-4AFA-A008-E327FAB227D5
Device Start End Sectors Size Type
/dev/sdb1 2048 411647 409600 200M EFI System
/dev/sdb2 411648 2508799 2097152 1G Linux filesystem
/dev/sdb3 2508800 937701375 935192576 446G Linux LVM
The disk's partition table: it indicates Disklabel type: gpt if the partition table is GPT or Disklabel type: dos if it is MBR.
The list of partitions on the disk: Look for the EFI system partition in the list, it is usually at least 100 MiB in size and has the type EFI System or EFI (FAT-12/16/32). To confirm this is the ESP, mount it and check whether it contains a directory named EFI, if it does this is definitely the ESP.
efibootmgr 管理 UEFI 啟動項
BootCurrent: 0003
Timeout: 10 seconds
BootOrder: 0003,0002,0004,0006,0008,000A,000C,000E,0010,0001,0000
Boot0000* BootManagerMenuApp
Boot0001* ByoUiApp
Boot0002* UEFI PXEv4 (MAC:5CE88331C870)
Boot0003* openEuler
Boot0004* UEFI PXEv4 (MAC:5CE88331C871)
Boot0006* UEFI PXEv4 (MAC:5CE88331C872)
Boot0008* UEFI PXEv4 (MAC:5CE88331C873)
Boot000A* UEFI PXEv4 (MAC:5CE88331C874)
Boot000C* UEFI PXEv4 (MAC:5CE88331C875)
Boot000E* UEFI PXEv4 (MAC:5CE88331C876)
Boot0010* UEFI PXEv4 (MAC:5CE88331C877)
總結(jié)
以上是生活随笔為你收集整理的Linux 概念:grub2的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TP5报错
- 下一篇: .net core项目搭建swagger