北肙

当你不能够再拥有,唯一可以做的,就是令自己不要忘记。

Configuring GRUB for Gentoo-based Linux

1. Necessary Packages sys-boot/grub sys-fs/dosfstools sys-block/parted GRUB_PLATFORMS variable for controlling target platform for grub FILE /etc/portage/make.conf Available options: efi-64, efi-32 pc coreboot emu ieee1275 loongson multiboot qemu, qemu-mips uboot xen, xen-32, xen-pvh GRUB_PLATFORMS="efi-64" USE for packages FILE /etc/portage/package.use/grub # Enabling lvm2 support if '/' is mounted as a LVM partition sys-boot/grub device-mapper Installing packages emerge […]

1. Necessary Packages

  • sys-boot/grub
  • sys-fs/dosfstools
  • sys-block/parted

GRUB_PLATFORMS variable for controlling target platform for grub
FILE /etc/portage/make.conf

Available options:

  • efi-64, efi-32
  • pc
  • coreboot
  • emu
  • ieee1275
  • loongson
  • multiboot
  • qemu, qemu-mips
  • uboot
  • xen, xen-32, xen-pvh
GRUB_PLATFORMS="efi-64"

USE for packages
FILE /etc/portage/package.use/grub

# Enabling lvm2 support if '/' is mounted as a LVM partition
sys-boot/grub device-mapper

Installing packages

emerge -avt sys-boot/grub sys-fs/dosfstools sys-block/parted

2. Necessary Disk Partition

  • /boot --> /dev/sda2 --> ext4 --> 200MiB
  • /boot/EFI --> /dev/sda1 --> fat32 --> 128MiB
    Or
  • /boot --> /dev/sda1 --> fat32 --> 200MiB

Preparing partitions with parted, type m for help.

parted /dev/sda

Setting flat for boot partition.
Be sure the number of /boot partition is 1.

set 1 boot on
set 1 esp on

3. Formatting partitions

For those /boot & /boot/EFI is separated

mkfs.ext4 /dev/sda2
mkfs.vfat -F 32 /dev/sda1

For those ONLY has one partition for /boot

mkfs.vfat -F 32 /dev/sda1

4. Installing grub

grub-install --target=x86_64-efi --efi-directory=/boot/EFI/ --removable /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.

5. Installing kernel files

cd /usr/src/linux
make && make modules_install && make install

6. Generating Grub menu list

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

Troubleshooting

Volume group "rootvg" not found

Select builtin kernel modules for SCSI/SAS control
[['Cannot open root device' or 'volume group xxx not found' when booting with a Linux Kernel]]

Leave a Reply

Your email address will not be published. Required fields are marked *