grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/2] util/grub-install-common: Print usable grub-mkimage comma


From: Glenn Washburn
Subject: [PATCH v2 2/2] util/grub-install-common: Print usable grub-mkimage command
Date: Fri, 22 Sep 2023 14:34:18 -0500

When grub-install is run with the verbose option, it will print a log
message indicating the grub-mkimage command and arguments used.
GRUB no longer calls the grub-mkimage binary internally, however the
command logged is a command that if run should effectively be what
grub-install used. However, as this has changed some of the newer
options have been incorrectly added so that the printed command fails
when run separately. This change makes the displayed command run as
intended.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 util/grub-install-common.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index f9b9201c894e..014741945e15 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -620,6 +620,10 @@ grub_install_make_image_wrap_file (const char *dir, const 
char *prefix,
     slen += sizeof (" --memdisk ''") + grub_strlen (memdisk_path);
   if (config_path)
     slen += sizeof (" --config ''") + grub_strlen (config_path);
+  if (dtb)
+    slen += sizeof (" --dtb ''") + grub_strlen (dtb);
+  if (sbat)
+    slen += sizeof (" --sbat ''") + grub_strlen (sbat);
 
   for (pk = pubkeys; pk < pubkeys + npubkeys; pk++)
     slen += sizeof (" --pubkey ''") + grub_strlen (*pk);
@@ -642,6 +646,20 @@ grub_install_make_image_wrap_file (const char *dir, const 
char *prefix,
       p = grub_stpcpy (p, config_path);
       *p++ = '\'';
     }
+  if (dtb)
+    {
+      *p++ = ' ';
+      p = grub_stpcpy (p, "--dtb '");
+      p = grub_stpcpy (p, dtb);
+      *p++ = '\'';
+    }
+  if (sbat)
+    {
+      *p++ = ' ';
+      p = grub_stpcpy (p, "--sbat '");
+      p = grub_stpcpy (p, dtb);
+      *p++ = '\'';
+    }
   for (pk = pubkeys; pk < pubkeys + npubkeys; pk++)
     {
       *p++ = ' ';
@@ -661,11 +679,8 @@ grub_install_make_image_wrap_file (const char *dir, const 
char *prefix,
   *p = '\0';
 
   grub_util_info ("grub-mkimage --directory '%s' --prefix '%s' --output '%s'"
-                 " --dtb '%s' "
-                 "--sbat '%s' "
-                 "--format '%s' --compression '%s'%s%s%s\n",
+                 " --format '%s' --compression '%s'%s%s%s\n",
                  dir, prefix, outname,
-                 dtb ? : "", sbat ? : "",
                  mkimage_target, compnames[compression],
                  note ? " --note" : "",
                  disable_shim_lock ? " --disable-shim-lock" : "", s);
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]