From 52b5fe5bcf39ec54a7ff4f4230b4bd390b859a32 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 20 Apr 2019 23:52:09 +0200 Subject: gnu: grub: 'grub-mkrescue' honors 'GRUB_FAT_SERIAL_NUMBER'. * gnu/packages/patches/grub-efi-fat-serial-number.patch: New file. * gnu/packages/bootloaders.scm (grub)[source](patches): Add it. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/bootloaders.scm | 3 ++- .../patches/grub-efi-fat-serial-number.patch | 27 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/grub-efi-fat-serial-number.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 04d11cf467..c6f09df54d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -873,6 +873,7 @@ dist_patch_DATA = \ %D%/packages/patches/groovy-add-exceptionutilsgenerator.patch \ %D%/packages/patches/grub-binutils-compat.patch \ %D%/packages/patches/grub-check-error-efibootmgr.patch \ + %D%/packages/patches/grub-efi-fat-serial-number.patch \ %D%/packages/patches/gsl-test-i686.patch \ %D%/packages/patches/gspell-dash-test.patch \ %D%/packages/patches/gst-plugins-good-libvpx-compat.patch \ diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index d6ef7d52b5..b4eabaea48 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -90,7 +90,8 @@ (base32 "03vvdfhdmf16121v7xs8is2krwnv15wpkhkf16a4yf8nsfc3f2w1")) (patches (search-patches "grub-check-error-efibootmgr.patch" - "grub-binutils-compat.patch")))) + "grub-binutils-compat.patch" + "grub-efi-fat-serial-number.patch")))) (build-system gnu-build-system) (arguments `(#:phases (modify-phases %standard-phases diff --git a/gnu/packages/patches/grub-efi-fat-serial-number.patch b/gnu/packages/patches/grub-efi-fat-serial-number.patch new file mode 100644 index 0000000000..ad92f9bc9e --- /dev/null +++ b/gnu/packages/patches/grub-efi-fat-serial-number.patch @@ -0,0 +1,27 @@ +Change 'grub-mkrescue' to honor the 'GRUB_FAT_SERIAL_NUMBER' +environment variable. That way, the caller can specify a fixed +serial number (instead of the randomly chosen one) to create EFI +images (the 'efi.img' file) that are reproducible bit-for-bit. + +Patch by Ludovic Courtès . + +--- grub-2.02/util/grub-mkrescue.c 2019-04-20 19:15:26.180242812 +0200 ++++ grub-2.02/util/grub-mkrescue.c 2019-04-20 21:56:34.672370849 +0200 +@@ -788,8 +788,15 @@ main (int argc, char *argv[]) + + efiimgfat = grub_util_path_concat (2, iso9660_dir, "efi.img"); + int rv; +- rv = grub_util_exec ((const char * []) { "mformat", "-C", "-f", "2880", "-L", "16", "-i", +- efiimgfat, "::", NULL }); ++ ++ const char *fat_serial_number = getenv ("GRUB_FAT_SERIAL_NUMBER"); ++ const char *mformat_args[] = ++ { "mformat", "-C", "-f", "2880", "-L", "16", ++ fat_serial_number != NULL ? "-N" : "-C", ++ fat_serial_number != NULL ? fat_serial_number : "-C", ++ "-i", efiimgfat, "::", NULL }; ++ ++ rv = grub_util_exec (mformat_args); + if (rv != 0) + grub_util_error ("`%s` invocation failed\n", "mformat"); + rv = grub_util_exec ((const char * []) { "mcopy", "-s", "-i", efiimgfat, efidir_efi, "::/", NULL }); -- cgit v1.2.3