]> Git Repo - J-u-boot.git/blobdiff - lib/efi_loader/efi_bootmgr.c
efi_loader: Replace config option for initrd loading
[J-u-boot.git] / lib / efi_loader / efi_bootmgr.c
index 25f5cebfdb67510f3b15713a4938cc6fd83db41d..46c8011344b9aae30a8627ffe5032ffeeb4c8906 100644 (file)
@@ -118,11 +118,13 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
                ret = efi_set_variable_int(L"BootCurrent",
                                           &efi_global_variable_guid,
                                           attributes, sizeof(n), &n, false);
-               if (ret != EFI_SUCCESS) {
-                       if (EFI_CALL(efi_unload_image(*handle))
-                           != EFI_SUCCESS)
-                               log_err("Unloading image failed\n");
-                       goto error;
+               if (ret != EFI_SUCCESS)
+                       goto unload;
+               /* try to register load file2 for initrd's */
+               if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) {
+                       ret = efi_initrd_register();
+                       if (ret != EFI_SUCCESS)
+                               goto unload;
                }
 
                log_info("Booting: %ls\n", lo.label);
@@ -146,6 +148,13 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
 error:
        free(load_option);
 
+       return ret;
+
+unload:
+       if (EFI_CALL(efi_unload_image(*handle)) != EFI_SUCCESS)
+               log_err("Unloading image failed\n");
+       free(load_option);
+
        return ret;
 }
 
This page took 0.024175 seconds and 4 git commands to generate.