1From bb51ee2b49fbda0f66c1fa580a33442ff578f110 Mon Sep 17 00:00:00 2001 2From: Dimitri John Ledkov <xnox@ubuntu.com> 3Date: Mon, 22 Feb 2021 17:05:25 +0000 4Subject: [PATCH] grub-install-common: Add --sbat option 5 6Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com> 7Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> 8Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> 9--- 10 include/grub/util/install.h | 5 ++++- 11 util/grub-install-common.c | 12 ++++++++++-- 12 2 files changed, 14 insertions(+), 3 deletions(-) 13 14diff --git a/include/grub/util/install.h b/include/grub/util/install.h 15index c03befd..8cb5056 100644 16--- a/include/grub/util/install.h 17+++ b/include/grub/util/install.h 18@@ -63,6 +63,8 @@ 19 /* TRANSLATORS: "embed" is a verb (command description). "*/ \ 20 { "pubkey", 'k', N_("FILE"), 0, \ 21 N_("embed FILE as public key for signature checking"), 0}, \ 22+ { "sbat", GRUB_INSTALL_OPTIONS_SBAT, N_("FILE"), 0, \ 23+ N_("SBAT metadata"), 0 }, \ 24 { "verbose", 'v', 0, 0, \ 25 N_("print verbose messages."), 1 } 26 27@@ -122,7 +124,8 @@ enum grub_install_options { 28 GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, 29 GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, 30 GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, 31- GRUB_INSTALL_OPTIONS_DTB 32+ GRUB_INSTALL_OPTIONS_DTB, 33+ GRUB_INSTALL_OPTIONS_SBAT 34 }; 35 36 extern char *grub_install_source_directory; 37diff --git a/util/grub-install-common.c b/util/grub-install-common.c 38index 5d43ed1..1fcccd2 100644 39--- a/util/grub-install-common.c 40+++ b/util/grub-install-common.c 41@@ -307,6 +307,7 @@ handle_install_list (struct install_list *il, const char *val, 42 43 static char **pubkeys; 44 static size_t npubkeys; 45+static char *sbat; 46 static grub_compression_t compression; 47 48 int 49@@ -337,6 +338,12 @@ grub_install_parse (int key, char *arg) 50 * (npubkeys + 1)); 51 pubkeys[npubkeys++] = xstrdup (arg); 52 return 1; 53+ case GRUB_INSTALL_OPTIONS_SBAT: 54+ if (sbat) 55+ free (sbat); 56+ 57+ sbat = xstrdup (arg); 58+ return 1; 59 60 case GRUB_INSTALL_OPTIONS_VERBOSITY: 61 verbosity++; 62@@ -498,9 +505,10 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, 63 grub_util_info ("grub-mkimage --directory '%s' --prefix '%s'" 64 " --output '%s' " 65 " --dtb '%s' " 66+ "--sbat '%s' " 67 "--format '%s' --compression '%s' %s %s\n", 68 dir, prefix, 69- outname, dtb ? : "", mkimage_target, 70+ outname, dtb ? : "", sbat ? : "", mkimage_target, 71 compnames[compression], note ? "--note" : "", s); 72 free (s); 73 74@@ -511,7 +519,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, 75 grub_install_generate_image (dir, prefix, fp, outname, 76 modules.entries, memdisk_path, 77 pubkeys, npubkeys, config_path, tgt, 78- note, compression, dtb, NULL); 79+ note, compression, dtb, sbat); 80 while (dc--) 81 grub_install_pop_module (); 82 } 83-- 842.14.2 85 86