From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilias Apalodimas Date: Mon, 28 Dec 2020 14:24:32 +0200 Subject: [PATCH 0/6] Change logic of EFI LoadFile2 protocol for initrd loading Message-ID: <20201228122440.316403-1-ilias.apalodimas@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Right now in U-Boot, we unconditionally register the EFI LoadFile2 protocol and the initrd file path is a U-boot .config option. This imposes a number of limitations. Using multiple initrd's implies you'd have to concatenate them into one big file. Alternatively you'd have to recompile U-Boot or overwrite your initrd with a newer one in order to use it. Since linux efi-stub only falls back to the cmdline interpreted initrd if the protocol is not registered, this also creates a problem for EFI installers, since they won't be able to load their own initrd and start the installation if the option is enabled. This patchset is trying to address all of the above, by changing the logic of the protocol registration and initrd discovery. It introduces a new EFI variable 'Initrd####', which we try to match on the BootCurrent value the bootmanager sets up. For example Boot0010 will search for Initrd0010, which should include the full initrd path i.e 'mmc 0:0 initrd'. If the file is present, the protocol will be registered, so the efi-stub can use it. This opens up another path using U-Boot and defines a new boot flow. A user will be able to control the kernel/initrd pairs without explicit cmdline args or GRUB, just by setting the correct 'Initrd####' variable. Ilias Apalodimas (6): efi_loader: remove unconditional initialization of file2 protocol for initrd efi_loader: Introduce helper functions for EFI efi_loader: Replace config option with EFI variable for initrd loading efi_loader: Remove unused headers from efi_load_initrd.c efi_selftest: Modify self-tests for initrd loading efi_loader: bootmgr: use get_var from efi_helper file include/efi_helper.h | 29 +++ lib/efi_loader/Kconfig | 12 +- lib/efi_loader/Makefile | 4 +- lib/efi_loader/efi_bootmgr.c | 39 +--- lib/efi_loader/efi_helper.c | 189 ++++++++++++++++++++ lib/efi_loader/efi_load_initrd.c | 88 +++------ lib/efi_loader/efi_setup.c | 5 - lib/efi_selftest/efi_selftest_load_initrd.c | 90 +++++++++- 8 files changed, 341 insertions(+), 115 deletions(-) create mode 100644 include/efi_helper.h create mode 100644 lib/efi_loader/efi_helper.c -- 2.30.0.rc2