util/grub-install-common: Print usable grub-mkimage command

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>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn 2023-09-22 14:34:18 -05:00 committed by Daniel Kiper
parent 1c2e162306
commit 28a509dd58

View File

@ -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, sbat);
*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);