efi_loader: Remove unconditional installation of file2 protocol for initrd
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 30 Dec 2020 15:07:14 +0000 (17:07 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 31 Dec 2020 13:33:22 +0000 (14:33 +0100)
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>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_setup.c

index ce6292f..5800cbf 100644 (file)
@@ -257,11 +257,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)