File 2007-load-efi-addons-just-one-time.patch of Package systemd

From 4b4d58c6b17e7ced04c35e4055f4644cb5b82192 Mon Sep 17 00:00:00 2001
From: Valentin Lefebvre <valentin.lefebvre@suse.com>
Date: Tue, 16 Apr 2024 11:00:46 +0200
Subject: [PATCH 2007/2007] load efi addons just one time

- During the loading addons process, efi addons is load twice.
  As efi addons are kind of global addons, this change load efi
  ones with them.

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
---
 src/boot/stub.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/boot/stub.c b/src/boot/stub.c
index 41349a32b2..6fa9e35bc1 100644
--- a/src/boot/stub.c
+++ b/src/boot/stub.c
@@ -622,6 +622,7 @@ static void items_free(char16_t **items, size_t n_items) {
 static EFI_STATUS load_addons(
                 EFI_HANDLE stub_image,
                 EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
+                bool load_from_efi,
                 const char16_t *prefix,
                 const char *uname,
                 char16_t **cmdline,                         /* Both input+output, extended with new addons we find */
@@ -659,9 +660,11 @@ static EFI_STATUS load_addons(
         if (err != EFI_SUCCESS)
                 return err;
 
-        err = load_addons_from_efi(loaded_image, &addons, &n_items, &n_allocated);
-        if (err != EFI_SUCCESS)
-                return err;
+        if (load_from_efi) {
+                err = load_addons_from_efi(loaded_image, &addons, &n_items, &n_allocated);
+                if (err != EFI_SUCCESS)
+                        return err;
+        }
 
         if (n_items == 0)
                 return EFI_SUCCESS; /* Empty directory */
@@ -1108,6 +1111,7 @@ static void load_all_addons(
         err = load_addons(
                         image,
                         loaded_image,
+                        true,
                         u"\\loader\\addons",
                         uname,
                         cmdline_addons,
@@ -1128,6 +1132,7 @@ static void load_all_addons(
         err = load_addons(
                         image,
                         loaded_image,
+                        false,
                         dropin_dir,
                         uname,
                         cmdline_addons,
-- 
2.49.0

openSUSE Build Service is sponsored by