From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 6/8 v2] efi_loader: Replace config option with EFI variable for initrd loading
Date: Wed, 6 Jan 2021 14:53:35 +0200 [thread overview]
Message-ID: <X/Wyz0RND1L6jIUw@enceladus> (raw)
In-Reply-To: <c2085c98-8c81-d808-bdc8-d7cbb1d5bf1f@gmx.de>
> >>>
[...]
> >>> If so, the content of "Initrd####" should contain a generic EFI
> >>> representation of file path.
> >>> Please note that "Boot####" internally contains a flattened string of
> >>> "EFI device path" to the image while efidebug command accepts a style of
> >>> "mmc 0:1 image" as arguments to "efidebug boot add" sub-command.
> >>
> >> Thanks for the pointers. I've already changed the patchset and using exactly
> >> what you described. This has another advantage, all the helper files for the
> >> string parsing previous patches introduce, went away as well.
> >>
> >
> > While I was trying to code this I came across a few things that we
> > need to resolve before posting my v3.
> > This feature is supposed to be very specific in linux so each OS
> > loader can decide on how to expose and
> > load the corresponding initrd.
> >
> > Moving the contents to a device path adds more problems that it solves
> > at the moment.
> > First of all we'll be forced to use efi_load_image_from_file(), which
>
> You are not obliged to call efi_load_image_from_file(). You could
> implement your own function.
>
> Or you could add a check *buffer!=NULL to detect a pre-allocated buffer
> and neither allocate nor free the buffer in this case.
Right obliged was a poor choice of words. I was just trying to point out
issues with using the current U-Boot functions.
>
> > uses EFI_SIMPLE_FILESYSTEM_PROTOCOL
> > and EFI_FILE_PROTOCOL to eventually load the file. This has 2
> > problems. We'll have to place the initrd on the same
> > filesystem the image we load resides (as opposed to my patch where the
> > initrd can be anywhere).
>
> Given Boot#### contains
>
> dp1<sep>dp2<sep>dp3<end>
Let's clarify this a bit first so other people can join the discussion.
What I proposed yesterday to Heinrich, since we can use a device path
directly, is store it in the EFI_LOAD_OPTION we construct when we add the
Boot#### variables.
According to the EFI spec FilePathList is an array of device paths.
The first element of the array is a device path that describes the
device and location of the Image for this load option, but the rest are OS
specific, so we might as well use them instead of using a custom EFI variable.
Ok I'll send a v3 implementing this idea + a new function that can consume the
device path and load a file without using EFI_SIMPLE_FILESYSTEM_PROTOCOL.
That would probablty solve all our problems.
Cheers
/Ilias
>
> when calling efi_load_image_from_file() three times, once for dp1, dp2,
> dp3, each of these device paths can point to a different block device.
>
> Best regards
>
> Heinrich
>
> > Apart from that calling efi_load_image_from_file() will try to free
> > the memory on errors, but that memory is allocated
> > and managed by the efi-stub.
> >
> > I'd prefer keeping the implementation as is, unless someone has a better idea.
> >
> > Thoughts?
> >
> > Cheers
> > /Ilias
> >
> >
> > [...]
> >
>
next prev parent reply other threads:[~2021-01-06 12:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-30 15:07 [PATCH 0/8 v2] Change logic of EFI LoadFile2 protocol for initrd loading Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 1/8 v2] efi_loader: Remove unused headers from efi_load_initrd.c Ilias Apalodimas
2020-12-30 18:21 ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 2/8 v2] efi_loader: Remove unconditional installation of file2 protocol for initrd Ilias Apalodimas
2020-12-30 18:15 ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 3/8 v2] efi_loader: Add size checks to efi_create_indexed_name() Ilias Apalodimas
2020-12-30 18:34 ` Heinrich Schuchardt
2020-12-30 21:23 ` Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 4/8 v2] efi_loader: Introduce helper functions for EFI Ilias Apalodimas
2020-12-30 19:29 ` Heinrich Schuchardt
2020-12-30 21:21 ` Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 5/8 v2] efi_loader: bootmgr: Use get_var from efi_helper file Ilias Apalodimas
2020-12-30 19:32 ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 6/8 v2] efi_loader: Replace config option with EFI variable for initrd loading Ilias Apalodimas
2020-12-30 19:38 ` Heinrich Schuchardt
2021-01-05 2:42 ` AKASHI Takahiro
2021-01-05 8:50 ` Ilias Apalodimas
2021-01-06 10:43 ` Ilias Apalodimas
2021-01-06 11:07 ` Heinrich Schuchardt
2021-01-06 12:53 ` Ilias Apalodimas [this message]
2020-12-30 15:07 ` [PATCH 7/8 v2] efi_selftest: Modify self-tests for initrd loading via Loadfile2 Ilias Apalodimas
2020-12-30 20:29 ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 8/8 v2] doc: uefi: Add instruction for initrd loading Ilias Apalodimas
2020-12-30 20:17 ` Heinrich Schuchardt
2020-12-30 20:44 ` [PATCH 0/8 v2] Change logic of EFI LoadFile2 protocol " Heinrich Schuchardt
2020-12-30 21:17 ` Ilias Apalodimas
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=X/Wyz0RND1L6jIUw@enceladus \
--to=ilias.apalodimas@linaro.org \
--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