diff mbox series

[2/8,v2] efi_loader: Remove unconditional installation of file2 protocol for initrd

Message ID 20201230150722.154663-3-ilias.apalodimas@linaro.org
State Accepted
Commit 47d2b3b9c98e1adf231f8143bc01b0046ebd5c9c
Headers show
Series Change logic of EFI LoadFile2 protocol for initrd loading | expand

Commit Message

Ilias Apalodimas Dec. 30, 2020, 3:07 p.m. UTC
Up to now we install the 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 start the installation.

A following patch introduces a different logic where we search for an
initrd path defined in an EFI variable named 'Initrd####'.
If the bootmgr is used to launch the EFI payload, we'll will try to match
the BootCurrent value and find the corresponding initrd
(i.e Boot0000 -> Initrd0000 etc). If the file is found, we'll install
the required protocol which the kernel's efi-stub can use and load our
initrd.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 lib/efi_loader/efi_setup.c | 5 -----
 1 file changed, 5 deletions(-)

-- 
2.30.0

Comments

Heinrich Schuchardt Dec. 30, 2020, 6:15 p.m. UTC | #1
On 12/30/20 4:07 PM, Ilias Apalodimas wrote:
> Up to now we install the 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 start the installation.

>

> A following patch introduces a different logic where we search for an

> initrd path defined in an EFI variable named 'Initrd####'.

> If the bootmgr is used to launch the EFI payload, we'll will try to match

> the BootCurrent value and find the corresponding initrd

> (i.e Boot0000 -> Initrd0000 etc). If the file is found, we'll install

> the required protocol which the kernel's efi-stub can use and load our

> initrd.

>

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index e206b60bb82c..d7f880921268 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -209,11 +209,6 @@  efi_status_t efi_init_obj_list(void)
 	if (ret != EFI_SUCCESS)
 		goto out;
 #endif
-#ifdef CONFIG_EFI_LOAD_FILE2_INITRD
-	ret = efi_initrd_register();
-	if (ret != EFI_SUCCESS)
-		goto out;
-#endif
 #ifdef CONFIG_NET
 	ret = efi_net_register();
 	if (ret != EFI_SUCCESS)