All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
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 12:07:39 +0100	[thread overview]
Message-ID: <c2085c98-8c81-d808-bdc8-d7cbb1d5bf1f@gmx.de> (raw)
In-Reply-To: <CAC_iWj+JmmOQg5JEvnaLBKKKWX1AQt_hoJA4QePtETY1NLYVrw@mail.gmail.com>

On 06.01.21 11:43, Ilias Apalodimas wrote:
> On Tue, 5 Jan 2021 at 10:50, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
>>
>> Akashi san,
>>
>> On Tue, Jan 05, 2021 at 11:42:22AM +0900, AKASHI Takahiro wrote:
>>> On Wed, Dec 30, 2020 at 05:07:18PM +0200, Ilias Apalodimas wrote:
>>>> Up to now we install EFI_LOAD_FILE2_PROTOCOL to load an initrd
>>>> unconditionally. Although we correctly return various EFI exit codes
>>>> depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the
>>>> kernel loader, only falls back to the cmdline interpreted initrd if the
>>>> protocol is not installed.
>>>>
>>>> This creates a problem for EFI installers, since they won't be able to
>>>> load their own initrd and continue the installation. It also makes the
>>>> feature hard to use, since we can either have a single initrd or we have
>>>> to recompile u-boot if the filename changes.
>>>>
>>>> So let's introduce a different logic that will decouple the initrd
>>>> path from the config option we currently have.
>>>> When the EFI application is launched through the bootmgr, we'll try to
>>>> match the BootCurrent value to an Initrd#### EFI variable.
>>>> e.g Boot0000 -> Initrd0000, Boot0010 -> Initrd0010 etc.
>>>
>>> Do you think this semantics be kept U-boot specific?
>>> It seems that it can work for any other EFI firmware (implementation).
>>>
>>
>> The GUID is very linux specific and it's meant to load an initrd, but I guess
>> any OS that uses a 'helper' file to load the final OS can be supported.
>>
>>>> The Initrd#### EFI variable is expected to include the full file path,
>>>> i.e 'mmc 0:1 initrd'.  If the file is found, we'll install the
>>>
>>> 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.

> 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>

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
>
>
> [...]
>

  reply	other threads:[~2021-01-06 11:07 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 [this message]
2021-01-06 12:53           ` Ilias Apalodimas
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=c2085c98-8c81-d808-bdc8-d7cbb1d5bf1f@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.