1 |
On Thu, 26 Sep 2019 at 15:47, Peter Humphrey <peter@××××××××××××.uk> wrote: |
2 |
> |
3 |
> On Thursday, 26 September 2019 10:16:54 BST Adam Carter wrote: |
4 |
> > > > The Gentoo Handbook says to create a small unformatted partition at the |
5 |
> > > > beginning of the (primary?) disk, then to create a FAT-32 partition for |
6 |
> > > > /boot, then whatever other partitions are required. |
7 |
|
8 |
Strictly speaking the FAT32 partition is the ESP, which is typically |
9 |
mounted under /boot and it should be marked with the corresponding ESP |
10 |
GUID. As I mentioned before, the initial disk space (rather than |
11 |
partition) starting at LBA0 contains either a legacy MBR with its time |
12 |
honoured 4 partition table, or a Protective MBR containing a fake |
13 |
single whole-disk partition in its table. Either the legacy MBR or |
14 |
Protective MBR blocks are not processed by the UEFI firmware, which |
15 |
goes to LBA1 and reads the GPT tables to find the ESP. Therefore, it |
16 |
is not clear to me why a small empty partition might be necessary at |
17 |
the start of the disk, unless earlier versions of partitioning tools |
18 |
were not as clever and started at LBA0, or some some weird UEFI |
19 |
firmware implementations were devised by some OEMs. |
20 |
|
21 |
|
22 |
> > > Another question answered: yes, it has to be the primary disk. I installed |
23 |
> > > a small test system on another disk. It has its own FAT-32 /boot |
24 |
> > > partition, in which I set up a similar directory structure to the main |
25 |
> > > system's. Efibootmgr still insisted on adding the UEFI entry to the main |
26 |
> > > set, in spite of my telling it to use the secondary disk. And the BIOS |
27 |
> > > couldn't see the image on the secondary disk. |
28 |
|
29 |
I believe you'll need a bootloader to jump to different disks. I |
30 |
don't think the UEFI firmware in its current version can handle more |
31 |
than one ESP in any number of drives. Some OS auto-scripted |
32 |
installation media will fail if the same disk has two FAT32 partitions |
33 |
marked as ESP (e.g. Windows 7). |
34 |
|
35 |
|
36 |
> > I found my BIOS didn't recognise the UEFI setup until it was |
37 |
> > specified/setup by efibootmgr, so that checks out. What was the efibootmgr |
38 |
> > command you were using for the second disk? |
39 |
> |
40 |
> efibootmgr -c -p 3 -d /dev/sda -L "TestSys" -l '\EFI\BOOT\bootX64.efi' |
41 |
|
42 |
Did you try specifying the disk device before the partition? |
43 |
|
44 |
efibootmgr -c -d /dev/sdXX -p 3 ..... |
45 |
|
46 |
to see if it is recognised then? |
47 |
|
48 |
|
49 |
> > > The conclusion is that, at least on this motherboard, there is precisely |
50 |
> > > one set of UEFI boot images, and it lives on the primary disk of the |
51 |
> > > system. Well, I haven't yet worked out how much of it is on the disk and |
52 |
> > > how much in BIOS storage. The point remains, however, that I can't spread |
53 |
> > > boot images over several disks. |
54 |
> > |
55 |
> > That's pretty poor. |
56 |
> |
57 |
> It isn't what I expected either. |
58 |
|
59 |
The UEFI firmware implementation (should) follow its specification, |
60 |
which has evolved over time. The specification mentions OS boot |
61 |
loaders, or kernels, or EFI applications, should be stored within EFI/ |
62 |
subdirectories, one per vendor. The EFI/ directory itself must be at |
63 |
the root of the ESP filesystem. Each OS subdirectory must contain |
64 |
only one bootable image, or the boot behaviour for the system won't be |
65 |
deterministic. [1] |
66 |
|
67 |
There may be an EFI/BOOT/ subdirectory in which a recovery bootable |
68 |
image can be stored. This will be used if other OS' images fail to |
69 |
boot. |
70 |
|
71 |
With removable media the directory structure is slightly different. |
72 |
All bootable images (one per supported arch) should be stored under |
73 |
EFI/BOOT/. This will ensure the removable device will boot |
74 |
automatically. Additional UEFI executables must be in directories |
75 |
other than BOOT/. |
76 |
|
77 |
The moment you start deviating from the above you need to manually |
78 |
edit the boot menu with e.g. efibootmgr. It used to be the case only |
79 |
the primary disk was used/usable by the UEFI firmware and only one |
80 |
ESP. Later versions of the specification say they may cater for more |
81 |
flexible ESP arrangements in the future. The older the OEM UEFI |
82 |
implementation the less flexible it would be. |
83 |
|
84 |
> > What does efibootmgr show? |
85 |
> |
86 |
> # efibootmgr |
87 |
> BootCurrent: 0000 |
88 |
> Timeout: 1 seconds |
89 |
> BootOrder: 0000,0004,0005,0001,0002,0003,0006,0007,0008,0009,000A,000B |
90 |
> Boot0000* Gentoo Linux |
91 |
> Boot0001* UEFI:CD/DVD Drive |
92 |
> Boot0002* UEFI:Removable Device |
93 |
> Boot0003* UEFI:Network Device |
94 |
> Boot0004* CD/DVD Drive |
95 |
> Boot0005 Hard Drive |
96 |
> Boot0006* UEFI:CD/DVD Drive |
97 |
> Boot0007* UEFI:Removable Device |
98 |
> Boot0008* UEFI:Network Device |
99 |
> Boot0009* UEFI:CD/DVD Drive |
100 |
> Boot000A* UEFI:Removable Device |
101 |
> Boot000B* UEFI:Network Device |
102 |
> |
103 |
> I'll delete all those duplicates. I don't know what's creating them. It's |
104 |
> happened a few times since this mess started, but I never saw it once before |
105 |
> then. |
106 |
|
107 |
The UEFI firmware can also use the Simple File System Protocol, if the |
108 |
disk supports it. In this case, it will scan the GPT, jump to the |
109 |
root of a partition and read bootable files on it. Then it will |
110 |
populate its boot menu with them. Presently this will only work with |
111 |
FAT(12/16/32) fs formats. Some of the duplicates may have been |
112 |
created in this fashion. |
113 |
|
114 |
|
115 |
> > I got the impression that I would be able to UEFI boot from multiple |
116 |
> > different devices, eg a USB drive with UEFI as well as the hard disk. |
117 |
|
118 |
I may be wrong, but I don't think this is possible (yet?). You could |
119 |
use a secondary bootloader, e.g. GRUB, other than the UEFI firmware to |
120 |
load OS kernels wherever they might be positioned on the system. |
121 |
|
122 |
> Oh yes, removable devices can be booted, but not secondary, internal hard |
123 |
> drives. Apparently. On this system. Today. |
124 |
> |
125 |
> -- |
126 |
> Regards, |
127 |
> Peter. |
128 |
|
129 |
|
130 |
[1] https://uefi.org/specifications |
131 |
|
132 |
-- |
133 |
Regards, |
134 |
Mick |