Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to BIOS-boot from NVMe device?



    Date:        Fri, 9 Sep 2022 11:10:36 +0200
    From:        Rhialto <rhialto%falu.nl@localhost>
    Message-ID:  <YxsDDIMHc1ERLujK%falu.nl@localhost>

  | How does the UEFI system decide what to boot?

There are a whole set of variables in UEFI internal storage
One group of those are named BOOTxxxx where the xxxx is a 4
digit hex value.  Its value is irrelevant, just serves to make
unique names.  Another variable has as its value a list of those
variables (really just a list of the (binary) 16 bit values that
make the trailing 4 hex digits).  That defines which of the
BOOTxxxx variables should be attempted, and in which order.
First to succeed wins.

The BIOS boot menu will allow you to temporarily alter the order
and its Boot config page to make more permanent alterations.
Its abilities tend to be quite limited though.

  | It obviously requires a special partition on a disk.

I don't think that is actually true.  The ESP serves two roles.
First it is a filesystem of a type the firmware is guaranteed to
be able to read.  That allows files to be placed there - but
firmware can also be taught to read other filesystems if anyone
wants to do the work.

And second, since the firmware typically provides no way to manipulate
the BOOTxxxx variables, other than adding them to, or removing them
from, and reordering the boot order variable, which is useless for
getting started from nothing, it will also look in any new ESP it
encounters for one particular file with a magic name, and create
a BOOTxxxx variable to refer to that specific file (It does similar
things for optical media, though no ESP exists there, and for
network interfaces for PXE booting).

  | But what if there are multiple files in
  | there which are potentially bootable?

Each will have a different name, a separate BOOTxxxx can be made for
each, after which each can be selected from the boot menu.
But only one can have the magic name, so only one will be created
by the firmware.

  | I was expecting some built-in UEFI
  | shell in my newest computer, so that I can handle such cases myself, or
  | something like that. However, I found no signs of such a shell (and when
  | I read about it, it generally seems to be assumed that it is indeed
  | built-in).  Also, even if I would find one as a file (I didn't find ut
  | yet) and put it in my EFI partition, I'm not sure how to start it, since
  | the system as shown no signs that it offers boot opptions more detailed
  | than "boot from a disk".

Yes the mythical UEFI shell.  All your expectations could be met, but
are unlikely to be, as building such a shell into the firmware would
more or less preclude future development.

As an external program it would be booted just like an OS, but would
never actually take over, just operate using firmware primitives.
Such a thing could be created, probably should be, but I could not
find one either.

In general the expectation seems to be that all of this is managed
from within your OS.   Unfortunately in NetBSD we are only just
beginning to im0lement the primitives necessary.  FreeBSD are a bit
more advanced.  Linux even more, though their tool is still extremely
crude.  I assume wintrash has something better, but I have no idea,
that is not my playing field.

If all you need is NetBSD just allow it to put the magic file in
the ESP, the firmware will find it, and add it to the boot menu.
You can then use that to boot NetBSD from any GPT partition.
For other OSs just let the make their own ESP, or use any existing
one, to add their boot file and create the mag8c variable.

Eventually we will do better.

kre


Home | Main Index | Thread Index | Old Index