U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@google.com>, Peter Robinson <pbrobinson@gmail.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v2 1/1] efi_loader: expose the device-tree file name
Date: Fri, 20 Oct 2023 09:55:15 -0400	[thread overview]
Message-ID: <20231020135515.GG3119521@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ3KZLTHUWnnQtBsiaeRRXgHjbqdkfw6cW+_+aXZ9zpogA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4556 bytes --]

On Fri, Oct 20, 2023 at 06:21:33AM -0700, Simon Glass wrote:
> +Doug Anderson
> 
> Hi Heinrich,
> 
> On Thu, 19 Oct 2023 at 09:09, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
> >
> > On 19.10.23 15:55, Simon Glass wrote:
> > > Hi Heinrich,
> > >
> > > On Wed, 18 Oct 2023 at 02:15, Heinrich Schuchardt
> > > <heinrich.schuchardt@canonical.com> wrote:
> > >>
> > >> On 10/18/23 05:33, Simon Glass wrote:
> > >>> Hi Heinrich,
> > >>>
> > >>> On Tue, 17 Oct 2023 at 07:50, Heinrich Schuchardt
> > >>> <heinrich.schuchardt@canonical.com> 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@canonical.com>
> > >>>> ---
> > >>>> v2:
> > >>>>           Use a unique GUID to enable future U-Boot independent
> > >>>>           standardization.
> > >>>>           Do not try to add the variable on ACPI based systems.
> > >>>> ---
> > >>>>    include/efi_loader.h       |  5 +++++
> > >>>>    lib/efi_loader/efi_setup.c | 30 ++++++++++++++++++++++++++++++
> > >>>>    2 files changed, 35 insertions(+)
> > >>>
> > >>> I was too slow to reply to v1.
> > >>>
> > >>> Does grub load the DT? I was assuming that U-Boot would pass it on?
> > >>> What is the interface between U-Boot and grub?
> > >>
> > >> The device-tree built into U-Boot is often out of date and not usable to
> > >> boot current Linux. A single device-tree can be loaded by U-Boot from
> > >> file and passed on as EFI configuration table. This device-tree may not
> > >> be compatible with all kernel versions exposed by GRUB.
> > >>
> > >> GRUB provides a devicetree command. It is disabled if you use secure
> > >> boot. At least in Debian and Ubuntu GRUB invokes the
> > >> EFI_DT_FIXUP_PROTOCOL exposed by U-Boot to run U-Boot's device-tree
> > >> fix-ups after loading a device-tree.
> > >>
> > >> Vendor scripts for GRUB like Ubuntu's /etc/grub.d/10_linux add
> > >> devicetree commands to the boot options in grub.cfg.
> > >
> > > Thanks. I wonder if you could document this somewhere? It seems like
> > > there are a lot of options and it is quite complicated.
> > >
> > > Back to the question, I suppose you are expecting grub to load the DT
> > > using this filename? But why doesn't U-Boot load it instead? It seems
> > > very convoluted.
> >
> > A separate file of this name exists for every kernel version installed.
> > The loaded dtb must match the kernel. U-Boot does not know what kernel
> > version will be chosen in GRUB. And for a generic image GRUB does not
> > what board it is on.
> >
> > >
> > > Also, can we test this interface?
> >
> > Neither the sandbox nor QEMU have environment variable fdtfile. And we
> > don't create the EFI variable with ACPI as used on the sandbox.
> 
> I worry that this is creating another interface that some poor sod is
> going to have to deal with in the future. Is this part of the EFI
> standard?
> 
> We should really be using the compatible string to choose the
> devicetree. Why are we using filenames at all? What is the
> relationship between the compatible string and the filename? Is there
> a lookup table, or should we create one?
> 
> The correct way of doing this is implemented in U-Boot with
> CONFIG_FIT_BEST_MATCH. Can we mirror something like that in grub, etc?

I'm adding Peter here as well because we spent a good chunk of time
yesterday digging in to issues that turn out to be, in short the patch
to make Fedora load the device tree that matches the kernel be loaded
wasn't in the actively used path anymore.

So we continue to be in the place where the hope is that in a few years,
platforms will ship with a device tree that the OS can use, but that
reality is generally not there yet.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2023-10-20 13:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 13:49 [PATCH v2 1/1] efi_loader: expose the device-tree file name Heinrich Schuchardt
2023-10-17 14:15 ` Ilias Apalodimas
2023-10-18  3:33 ` Simon Glass
2023-10-18  8:15   ` Heinrich Schuchardt
2023-10-19 13:55     ` Simon Glass
2023-10-19 14:14       ` Mark Kettenis
2023-10-19 16:09       ` Heinrich Schuchardt
2023-10-20 13:21         ` Simon Glass
2023-10-20 13:55           ` Tom Rini [this message]
2023-10-20 15:40           ` Heinrich Schuchardt
2023-10-20 16:24             ` Tom Rini
2023-10-21 15:42               ` Simon Glass
2023-10-22  4:53                 ` Heinrich Schuchardt
2023-10-23  7:08                   ` Simon Glass
2023-10-23  8:10                     ` Heinrich Schuchardt
2023-10-23 15:37                     ` Mark Kettenis
2023-10-23 16:34                       ` Tom Rini
2023-10-23 17:05                         ` Mark Kettenis
2023-11-03 19:17                           ` Simon Glass
2023-11-03 19:42                             ` Ilias Apalodimas
2023-11-03 20:00                             ` Ilias Apalodimas
2023-11-03 20:03                             ` Tom Rini
2023-11-14 19:09                             ` Mark Kettenis
2023-11-14 23:20                               ` Tom Rini
2023-12-31 14:25                       ` Peter Robinson
2023-10-20 21:19           ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231020135515.GG3119521@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=pbrobinson@gmail.com \
    --cc=sjg@google.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox