0142-grub-install-common-Add-sbat-option.patch 2.8 KB

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