1 |
On Monday, 12 October 2020 10:15:16 BST peter@××××××××××××.uk wrote: |
2 |
> On 2020-10-12 12:26 AM, "Jack" <ostroffjh@×××××××××××××××××.net> wrote: |
3 |
> > On 10/11/20 7:37 PM, Jude DaShiell wrote: |
4 |
> > > If you followed the handbook /dev/sda2 would be where the boot record |
5 |
> > > lives.> |
6 |
> > I don't think so, but the terminology is certainly confusing. Peter |
7 |
> > asked where efibootmgr writes something. What is on /dev/sda2 could be |
8 |
> > grub.cfg if it were mounted at /boot, and the grub booting stub (I |
9 |
> > forget the correct name, but grubx64.efi) might be on /dev/sda2 if it |
10 |
> > were mounted at /boot/EFI. However, efibootmgr doesn't mess with either |
11 |
> > of those. It deals with what is stored in the UEFI boot firmware. That |
12 |
> > entry, which is read by the UEFI at boot time, runs the entry in the EFI |
13 |
> > disk partition (usually under /boot/EFI), which then runs the kernel |
14 |
> > (and possibly initramfs) in /boot. Unfortunately, "boot record" is |
15 |
> > probably too general a term. |
16 |
> |
17 |
> Yes, I meant the equivalent of that in an MBR system. Where the bootable |
18 |
> kernel image lives is another matter. |
19 |
|
20 |
The MBR's architecture is a bit different to UEFI. Legacy BIOS in CMOS has a |
21 |
jump command to the MBR 'boot sector', stored @sector 0, which in the first |
22 |
446 bytes contains a bootstrap code and thereafter a partition table. The |
23 |
bootstrap code signature is checked by BIOS and loaded in RAM where it is |
24 |
executed as a boot loader. The bootstrap code (a.k.a. boot.img) contains a |
25 |
pointer to either Stage 1.5 or Stage 2. Stage 1.5 starts on Sector 1 and has |
26 |
any filesystem drivers needed to access and read Stage 2. Some boot loaders |
27 |
jump into a partition and load hardcoded sectors into RAM, which then run in |
28 |
order to load the rest of the OS boot image and execute it. These are Stage 1 |
29 |
boot loaders. Other boot loaders like GRUB, load Stage 1 drivers and use |
30 |
these to access the stage 2 files in /boot, present a boot menu and load an OS |
31 |
kernel image. |
32 |
|
33 |
With UEFI a lot of the above is stored in the much larger compared to CMOS |
34 |
UEFI firmware NVRAM. The UEFI has its own bootstrap code, plus a boot |
35 |
manager, boot menu table and requisite device drivers, to access the ESP, or |
36 |
other bootable devices. |
37 |
|
38 |
UEFI can load and execute any compatible UEFI applications from ESP, including |
39 |
OS boot loaders. |
40 |
|
41 |
|
42 |
> I haven't been using grub, just efibootmgr to declare the image to the UEFI |
43 |
> BIOS, and bootctl from systemd-boot to show a list of boot options. |
44 |
> |
45 |
> I assume there's something like an EEPROM on the motherboard to contain |
46 |
> pointers (what I called boot records) to the the bootable kernel images. |
47 |
> That's what I was asking about. I'm pretty sure that that table doesn't |
48 |
> live on the disk. (Followers of this tale may remember that I had a problem |
49 |
> with the NVMe disk; it turned out to be faulty, and I've replaced it. |
50 |
> Windows could still boot on another disk without any intervention by me.) |
51 |
> |
52 |
> Can someone confirm or refute those ideas? |
53 |
|
54 |
The UEFI firmware contains a number of variables in key/value pairs, stored on |
55 |
NVRAM. One of these is a table containing a Boot Menu within an editable area |
56 |
of the firmware, which can be manipulated with the EFI shell (efibootmgr) to |
57 |
set, rename, delete bootable .efi images. |
58 |
|
59 |
Upon a reboot the UEFI boot manager will scan the ESP and other similar VFAT |
60 |
partitions and bootable devices (CD/USB) for executable UEFI applications, to |
61 |
re-list any .efi bootable images it finds in its GUI boot menu. If the |
62 |
previously configured boot menu order is lost/corrupted, a rescanned ESP may |
63 |
not arrive at the same order of bootable images. |
64 |
|
65 |
As I understand it the concern of the OP here is the EEPROM chip may have |
66 |
corrupted its editable content. Different OEMs have different solutions, with |
67 |
OOB hypervisors managing backup/restore functions, to using a secondary Boot |
68 |
Block found in the main Firmware chip, but at an alternate address location, |
69 |
to using two separate EEPROM chips and so on and using some jumper to restore |
70 |
from the backup. If major firmware malfunction is suspected, then re-flashing |
71 |
the MoBo with the latest version of OEM firmware should hopefully restore |
72 |
sanity. If the MoBo chip is faulty, or on its way out, then the failure mode |
73 |
will soon repeat itself. |