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 <[email protected]>
---
 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


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to