[PATCH v3 1/1] efi_loader: expose the device-tree file name

Tom Rini trini at konsulko.com
Mon Oct 23 18:57:41 CEST 2023


On Sun, Oct 22, 2023 at 11:31:52PM +0200, Heinrich Schuchardt wrote:
> On 10/22/23 19:08, Tom Rini wrote:
> > On Sun, Oct 22, 2023 at 06:34:08PM +0200, Heinrich Schuchardt wrote:
> > > On 10/22/23 17:55, Tom Rini wrote:
> > > > On Sun, Oct 22, 2023 at 10:47:33AM +0200, Heinrich Schuchardt wrote:
> > > > 
> > > > > Forward and backward compatibility of Linux kernel device-trees is
> > > > > sometimes missing. One solution approach is to load a kernel specific
> > > > > device-tree. This can either be done via a U-Boot scripts (like the one
> > > > > generated by Debian package flash-kernel or by a boot loader like GRUB.
> > > > > The boot loader approach currently requires to know the device-tree name
> > > > > before first boot which makes it unusable for generic images.
> > > > > 
> > > > > Expose the device-tree file name as EFI variable FdtFile.
> > > > > This will allow bootloaders to load a kernel specific device-tree.
> > > > > 
> > > > > The variable will not be exposed on ACPI based systems or if the
> > > > > environment variable fdtfile is not defined.
> > > > > 
> > > > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> > > > > ---
> > > > > v3:
> > > > > 	Add documentation
> > > > > v2:
> > > > > 	Use a unique GUID to enable future U-Boot independent
> > > > > 	standardization.
> > > > > 	Do not try to add the variable on ACPI based systems.
> > > > > ---
> > > > >    doc/develop/uefi/uefi.rst  | 17 +++++++++++++++++
> > > > >    include/efi_loader.h       |  5 +++++
> > > > >    lib/efi_loader/efi_setup.c | 30 ++++++++++++++++++++++++++++++
> > > > >    3 files changed, 52 insertions(+)
> > > > > 
> > > > > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> > > > > index fb16ac743a..a81d09ae81 100644
> > > > > --- a/doc/develop/uefi/uefi.rst
> > > > > +++ b/doc/develop/uefi/uefi.rst
> > > > > @@ -916,6 +916,23 @@ So our final format of the FilePathList[] is::
> > > > >        Loaded image - end node (0xff) - VenMedia - initrd_1 - [end node (0x01) - initrd_n ...] - end node (0xff)
> > > > > +EFI variable FdtFile
> > > > > +~~~~~~~~~~~~~~~~~~~~
> > > > > +
> > > > > +Ideally U-Boot would always expose a device-tree that can be used for booting
> > > > > +any operating systems. Unfortunately operating systems like Linux sometimes
> > > > > +break forward and backward compatibility. In this case there is a need to load
> > > > > +an operating system version specific device-tree.
> > > > > +
> > > > > +U-Boot has an environment variable fdtfile identifying the device-tree file to
> > > > > +load. The content of this variable is exposed as EFI variable Fdtfile, vendor
> > > > > +GUID d45dde69-3bd6-40e0-90d5-6b606aa57730. It contains the device-tree path
> > > > > +name as a NUL terminated ASCII string.
> > > > > +
> > > > > +On 32bit ARM this is currently only a file name, e.g. 'imx6dl-wandboard.dtb'.
> > > > > +On other architectures the file name is preceded by the vendor directory, e.g.
> > > > > +'rockchip/rk3326-odroid-go2.dtb'.
> > > > 
> > > > The Linux Kernel has split 32bit ARM up by directory now, too.
> > > 
> > > Since Linux v6.5. That is why I wrote "currently". Once we migrate the
> > > values of $fdtfile in U-Boot we may want to change
> > > distro_efi_try_bootflow_files() to search both with and without vendor
> > > directory.
> > > 
> > > Are there already plans for that migration?
> > 
> > Right, v6.5 is out and has this change and v6.6 will be out soon enough,
> > so the documentation we're adding here and now should be worded such
> > that doesn't get stuck on these specifics.
> 
> Should I add a sentence:
> 
> Linux v6.5 has added vendor directories on 32bit ARM and U-Boot is expected
> to follow suit.

No, please re-word the section to be more generic.  Some architectures
use vendor directories, some don't.  I really don't know what we're
going to do in U-Boot.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231023/290f5f5d/attachment.sig>


More information about the U-Boot mailing list