Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] UEFI install noob questions
Date: Sat, 26 Dec 2020 12:53:16
Message-Id: 4078098.ejJDZkT8p0@lenovo.localdomain
In Reply to: [gentoo-user] UEFI install noob questions by Walter Dnes
1 On Saturday, 26 December 2020 06:28:44 GMT Walter Dnes wrote:
2 > This is my first UEFI install, so please pardon the questions.
3 >
4 > 1) Partitioning questions: The standard layout example in
5 > https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#What_is_the_BI
6 > OS_boot_partition.3F says...
7 >
8 > > The BIOS boot partition is needed when a GPT partition layout is used
9 > > with GRUB2 in BIOS/Legacy mode. It is not required when booting in
10 > > EFI/UEFI mode.
11 >
12 > The standard layout example is...
13 >
14 > Number Start End Size File system Name Flags
15 > 1 1.00MiB 3.00MiB 2.00MiB grub bios_grub
16 > 2 3.00MiB 131MiB 128MiB boot boot
17 > 3 131MiB 643MiB 512MiB swap
18 > 4 643MiB 20479MiB 19836MiB rootfs
19 >
20 > Given that my machine is incapable of booting in BIOS/Legacy mode, I
21 > assume that the 2-megabyte partition is unnecessary, grub or no grub.
22
23 Your assumption is correct.
24
25 This BIOS-GRUB partition is used on GPT partitioned drives to hold the GRUB
26 2nd Stage files.
27
28 Since you're not familiar with GRUB it may help to add some background on the
29 GRUB boot manager architecture. It contains two stages, some argue 3 stages
30 if you include /boot/grub/. The Boot Loader code takes up 446 bytes and is
31 stored in the MBR - sector 0 of the disk. This is the 1st Stage. The 2nd
32 Stage contains files and drivers required by GRUB to be able to jump to and
33 read the contents of any filesystems used on the OS /boot partition. On a
34 disk with a conventional DOS partition table, the 2nd stage files would be
35 normally stored in the "MBR gap", the empty space in the sectors following
36 sector 0 and before the OS partitions start.
37
38 This presents a problem on disks partitioned with a GPT, when installed on a
39 legacy BIOS MoBo. This is because sector 1 of the GPT partitioned disk is
40 used by the GPT partitioning structure to store the partition table. So, the
41 solution for a GPT disk is to use a dedicated partition, the GRUB-BIOS
42 partition, in which the 2nd Stage GRUB files can be stored.
43
44 On a UEFI MoBo, the Boot Loader code is in the UEFI firmware itself, stored in
45 the EEPROM. This code contains all requisite drivers to be able to scan the
46 disk, identify the ESP partition and pick up any .efi executables in its VFAT
47 filesystem. No other boot loader MBR code is required.
48
49 3rd party Boot Managers like GRUB will install their grubx64.efi image in the
50 ESP and this in turn will load any necessary drivers and files to load the
51 GRUB boot menu and any selected OS kernel image thereafter.
52
53
54 > Also, given bloat over time, is 128 megabytes still sufficient for the
55 > boot partition today? I plan to keep 2 kernels around at all times,
56 > "Production" and "Experimental".
57
58 I tend to keep 2 - 3 kernels at a time in the ESP. Along with their
59 corresponding System.map and kernel config files also stored there, 2 kernels
60 currently occupies 26MB. This is on a Gentoo system with no other OS present
61 and no 3rd party boot managers. A laptop, which also has MSWindows OS on it,
62 takes up 54MB of the ESP. I use the UEFI firmware to switch between kernels
63 and live media at boot time. I manage the UEFI menu entries and their order
64 using the efibootmgr application on a CLI, whenever I install a new kernel.
65 If you switch between OSs and live media all the time, then GRUB, rEFInd, et
66 al., would arguably be more convenient.
67
68 I use 250-500MB for ESP partitions and for my needs this is way more than
69 adequate. If you install 10s of multiple OSs, initramfs, and other
70 applications, then you might need more space.
71
72 HTH.

Attachments

File name MIME type
signature.asc application/pgp-signature