[PATCH v4 06/11] efi_loader: bootmgr: add booting from removable media

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Mar 31 08:25:59 CEST 2022


Kojima-san,

On Thu, 31 Mar 2022 at 03:51, Masahisa Kojima
<masahisa.kojima at linaro.org> wrote:
>
> Hi Ilias,
>
> On Thu, 31 Mar 2022 at 04:13, Ilias Apalodimas
> <ilias.apalodimas at linaro.org> wrote:
> >
> > Hello Akashi-san,
> >
> > On Thu, Mar 24, 2022 at 10:54:38PM +0900, Masahisa Kojima wrote:
> > > From: AKASHI Takahiro <takahiro.akashi at linaro.org>
> > >
> > > Under the current implementation, booting from removable media using
> > > a architecture-specific default image name, say BOOTAA64.EFI, is
> > > supported only in distro_bootcmd script. See the commit 74522c898b35
> > > ("efi_loader: Add distro boot script for removable media").
> > >
> > > This is, however, half-baked implementation because
> > > 1) UEFI specification requires this feature to be implemented as part
> > >    of Boot Manager's responsibility:
> > >
> > >   3 - Boot Manager
> > >   3.5.1 Boot via the Simple File Protocol
> > >   When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will
> > >   start with a device path that points to the device that implements the
> > >   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next
> > >   part of the FilePath may point to the file name, including
> > >   subdirectories, which contain the bootable image. If the file name is
> > >   a null device path, the file name must be generated from the rules
> > >   defined below.
> > >   ...
> > >   3.5.1.1 Removable Media Boot Behavior
> > >   To generate a file name when none is present in the FilePath, the
> > >   firmware must append a default file name in the form
> > >   \EFI\BOOT\BOOT{machine type short-name}.EFI ...
> > >
> > > 2) So (1) entails the hehavior that the user's preference of boot media
> > >    order should be determined by Boot#### and BootOrder variables.
> > >
> > > With this patch, the semantics mentioned above is fully implemented.
> > > For example, if you want to boot the system from USB and SCSI in this
> > > order,
> > > * define Boot0001 which contains only a device path to the USB device
> > >   (without any file path/name)
> > > * define Boot0002 which contains only a device path to the SCSI device,
> > > and
> > > * set BootOrder to Boot0001:Boot0002
> >
> > Mark had some concerns wrt to this approach and from what I can tell this
> > hasn't changed in this revision [1]. Can we use boot_targets and generate
> > Boot#### with an empty FilePath as Mark suggested?  Or is the user expected to
> > select that somehow from the menu?
> >
> > [1] https://lore.kernel.org/u-boot/d3cac2e5b37f96b5@bloch.sibelius.xs4all.nl/
>
> My patch series tries to resolve the above issue to some extent
> by a different approach.
>
> The patch "[PATCH v4 10/11] bootmenu: add removable media entries" [*1]
> enumerates the all (removable) medias supporting
> EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
>
> Example bootmenu is as below.
>
>     *** U-Boot Boot Menu ***
>
>        UEFI BOOT0000 : mmc0:1
>        UEFI BOOT0001 : mmc0:2
>        UEFI BOOT0002 : debian
>        UEFI BOOT0003 : nvme0:1
>        UEFI BOOT0004 : ubuntu
>        UEFI BOOT0005 : nvme0:2
>        UEFI BOOT0006 : usb0:2
>
> mmcX:X, usbX:X and nvmeX:X are the entries of the removable media
> having device path without FilePath. They are automatically created
> by the bootmenu and BOOT#### and BootOrder variables are updated.
> They are also managed by the bootmenu, if the usb device is removed from
> the system at the next boot, the BOOT#### variable is removed by bootmenu
> and BootOrder is also updated.
>
> [*1] https://lore.kernel.org/u-boot/20220324135443.1571-11-masahisa.kojima@linaro.org/

Great thanks, that sounds reasonable. I'll go through the rest of the
series and let you know
/Ilias
>
> Thanks,
> Masahisa Kojima
>
> >


More information about the U-Boot mailing list