livecd ~ # parted /dev/nvme0n1 print
Model: Unknown (unknown)
Disk /dev/nvme0n1: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 106MB 105MB fat32 EFIboot boot, esp
2 106MB 53.8GB 53.7GB linux-swap(v1) SWAP
3 53.8GB 107GB 53.7GB ext3 NVM-SYSTEM
4 107GB 161GB 53.7GB ext3 NVM-SYSBCK
3.3 Mounting the root partition
livecd ~ # mount /dev/nvme0n1p3 /mnt/gentoo/
3.4 Downloading the stage tarball
...... následuje klasická instalace gentoo na 3 53.8GB 107GB 53.7GB ext3 NVM-SYSTEM ....
6 Kernel
6.2 UEFI
https://wiki.gentoo.org/wiki/Efibootmgr potřebuje NLS ISO 8859-1 a vypnutý EFI mixed-mode support
emerge -avq sys-boot/efibootmgr
mount | grep efivars # must be RW otherwise try somthing like
# mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars
efibootmgr -v # just list entries for fun :)
6.3 kernel
emerge --ask --verbose --update --deep --newuse -q --load-average --jobs -N sys-kernel/gentoo-sources sys-apps/pciutils
lspci
ls -al /usr/src/
cd /usr/src/linux
make menuconfig
Nastavení kernelu
Sensor driver: X570 boards (no WMI interface - use nct6775 driver instead)
(root=/dev/nvme0n1p3) Built-in kernel command string - podle skutecne partisny, kde ten linux bude
Processor type and features --->
[*] EFI runtime service support
[*] EFI stub support
[ ] EFI mixed-mode support
[*] Built-in kernel command line
(root=/dev/nvme0n1p3 net.ifnames=0 vga=ask) Built-in kernel command string
Firmware Drivers --->
EFI (Extensible Firmware Interface) Support --->
<*> EFI Variable Support via sysfs
6.5 Mounting the boot partition (pro kernel)
(chroot) livecd / # mount /dev/nvme0n1p1 /boot/ # To je EFI
(chroot) livecd / # df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p1 99M 512 99M 1% /boot
6.6 Compiling kernel
make -j 26
make modules_install
# tady na te EFI udelam adresar, kam zkopiruju kernel, ktery ma nastaveno, kde je system
mkdir -p /boot/EFI/'Gentoo-NVM-SYSTEM' # or any other name under /boot/EFI
cp /usr/src/linux/arch/x86/boot/bzImage /boot/EFI/'Gentoo-NVM-SYSTEM'/bzImage.efi
efibootmgr -c -L "Gentoo-NVM-SYSTEM" -l '\EFI\Gentoo-NVM-SYSTEM\bzImage.efi' -d /dev/nvme0n1p1
7 PROBLEMY !!! bomb
System nebootuje, proste NVMe nejde vybrat.
bzImage.efi jde spustit z GRUB2 na flasce linux (hd2,1)/EFI/Gentoo-NVM-SYSTEM/bzImage.efi - nebo jiny hdx - a bezi to, ale v EFI to vybrat nejde
Řešení - je potřeba říct, z jaké EFI partišny to má bootovat (default je z té připojené) - " -d /dev/nvme0n1p1"
efibootmgr -b 0 -c -L "NVM-Gentoo-NVM-SYSTEM" -l '\EFI\Gentoo-NVM-SYSTEM\bzImage.efi' -d /dev/nvme0n1p1
9.2 Nastavení EFI, když ho něco zboří
################################################################################
# cat ebm
################################################################################
#!/bin/bash -x
efibootmgr -B -b 0
efibootmgr -B -b 1
efibootmgr -B -b 2
mount /dev/nvme0n1p1 /boot/
efibootmgr -b 0 -c -L "NVM-Gentoo-NVM-SYSTEM" -l '\EFI\Gentoo-NVM-SYSTEM\bzImage.efi' -d /dev/nvme0n1p1
efibootmgr -b 1 -c -L "NVM-Gentoo-SDA2" -l '\EFI\Gentoo-SDA2\bzImage.efi' -d /dev/nvme0n1p1
efibootmgr -b 2 -c -L "NVM-Gentoo-NVM-SYSBCK" -l '\EFI\Gentoo-NVM-SYSBCK\bzImage.efi' -d /dev/nvme0n1p1
umount /boot
mount /dev/sda1 /boot/
if ( df /boot | grep -q /dev/sda1 ) ; then
echo SDA
efibootmgr -B -b 3
efibootmgr -B -b 4
efibootmgr -B -b 5
efibootmgr -c -L "SDA-Gentoo-NVM-SYSTEM" -l '\EFI\Gentoo-NVM-SYSTEM\bzImage.efi' -d/dev/sda1
efibootmgr -c -L "SDA-Gentoo-SDA2" -l '\EFI\Gentoo-SDA2\bzImage.efi' -d/dev/sda1
efibootmgr -c -L "SDA-Gentoo-NVM-SYSBCK" -l '\EFI\Gentoo-NVM-SYSBCK\bzImage.efi' -d/dev/sda1
fi
umount /boot
efibootmgr -o 0,1,2
efibootmgr -D