分区要求:
1 biosboot
2 EFi 分区
3 根分区
分区顺序 根分区要求必须是最后一个,不然根分区没法扩展
大致步骤
1 安装vm 从uefi 启动。
2 安装bios 的grub、 grub2-install grub2-mkconfig sed linuxefi/linux grub.cfg
这样 vm 镜像 从 uefi/legacy 就都可以启动了.
问题,这样的镜像有2份 grub
1 ESP/distio/grub.cfg
2 /boot/grub2/grub/cfg
legacy/uefi 各自使用一份grub 不好维护。
使用 BOOT_LOADER_SPECIFICATION 可以做到兼容。使用同一份grub(efi 的)
bios 的
search --no-floppy --set efi --file /efi/distro/grub.cfg
configfile ($efi)/efi/distro/grub.cfg
boot 分区要求必须是 vfat 格式的。
We define two directories below $BOOT
:
$BOOT/loader/
is the directory containing all files needed for Type #1 entries$BOOT/loader/entries/
is the directory containing the drop-in snippets. This directory contains one .conf
file for each boot menu item.Note: In all cases the /loader/
directory should be located directly in the root of the file system.
Specifically, if $BOOT
is the ESP, then /loader/
directory should be located directly in the root directory of the ESP, and not in the /EFI/
subdirectory.
如果是bios 启动的, loader 目录应该放在根目录下面
如果是uefi 启动的。boot 在EFI 分区下, loader 目录应该在EFI 分区的根目录下面,/boot/efi 应该在/boot 下面,而不是 /boot/efi 的子目录下面。
原文:https://www.cnblogs.com/jkklearn/p/12991876.html