Tag Archives: uefi

NUC7PJYH: Gentoo UEFI Configure

This is no fun exercise. I did this over a year ago with my Asrock system, but of course did not record the exact steps, so I had to learn all over again.

The best start is to use the Gentoo Handbook example. I used a combination of fdisk and parted for the drive layout. As a note, I swapped to an EVO850 500G SSD that I had laying around. The following is how my SSD is layed out with a fdisk first, followed by a parted list:

fdisk -l:
Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B8C5EDC2-AAB2-5142-B4FC-23FA7FCD69E4

Device        Start       End   Sectors   Size Type
/dev/sda1      2048      6143      4096     2M BIOS boot
/dev/sda2      6144    518143    512000   250M EFI System
/dev/sda3    518144  21489663  20971520    10G Linux swap
/dev/sda4  21489664 976773134 955283471 455.5G Linux filesystem

parted -l:
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name    Flags
 1      1049kB  3146kB  2097kB  ext2            grub    bios_grub
 2      3146kB  265MB   262MB   fat32           boot    boot, esp
 3      265MB   11.0GB  10.7GB  linux-swap(v1)  swap    swap
 4      11.0GB  500GB   489GB   xfs             rootfs

The sda2 partition is the normal boot partition for the kernel, followed by swap, and then sda4 as the root partition. So, what about sda1? Well it is there to provide space for grub to the best of my knowledge, but it is not used. Why use xfs for the rootfs? Because I have never used it before … I will probably downsize to a 250G SSD and switch to ext4 later because I have heard the 5.10 kernels have improvements/changes.

Next, install grub following the handbook. Note, you should be using the handbook as a guide, so at this point the drive is mounted, stage3 is installed, etc … I mount sda4 and sda2 using my script from the previous post and chroot into the image. Finally, execute:

grub-install --target=x86_64-efi --efi-directory=/boot

Typical issues with Gentoo are panics on the first start. Sometimes it is the grub configuration. For the above, I have the following in /etc/default/grub:

GRUB_CMDLINE_LINUX="root=/dev/sda4"

Other times, it could be that you are not using an initial ram disk (I do not) which case the filesystem needs to be compiled into the kernel and not as a modules.