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.
This commit is contained in:
Ludovic Courtès 2019-04-20 23:52:09 +02:00
parent 6901b9248e
commit 52b5fe5bcf
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 30 additions and 1 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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 <ludo@gnu.org>.
--- 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 });