aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-04-23 19:43:59 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-04-23 19:43:59 +0200
commit37da4fbe1562583589eeddb4be8e11bece80fd35 (patch)
tree4d8a454b27e62f9b8d7b0fe641a9f6aa6de2402c /gnu/build/vm.scm
parent73326e742d82b6706333885eca770f7518636b1f (diff)
parente01bd1a67447c1f2a2b5b03e8ea8fbbccd2cd5bd (diff)
downloadpatches-37da4fbe1562583589eeddb4be8e11bece80fd35.tar
patches-37da4fbe1562583589eeddb4be8e11bece80fd35.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index e15ca4d5fb..f2953621ec 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -37,6 +37,7 @@
#:use-module (ice-9 popen)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:export (qemu-command
load-in-linux-vm
@@ -458,6 +459,25 @@ GRUB configuration and OS-DRV as the stuff in it."
closures)
(register-bootcfg-root "/tmp/root" config-file))
+ ;; 'grub-mkrescue' calls out to mtools programs to create 'efi.img', a FAT
+ ;; file system image, and mtools honors SOURCE_DATE_EPOCH for the mtime of
+ ;; those files. The epoch for FAT is Jan. 1st 1980, not 1970, so choose
+ ;; that.
+ (setenv "SOURCE_DATE_EPOCH"
+ (number->string
+ (time-second
+ (date->time-utc (make-date 0 0 0 0 1 1 1980 0)))))
+
+ ;; Our patched 'grub-mkrescue' honors this environment variable and passes
+ ;; it to 'mformat', which makes it the serial number of 'efi.img'. This
+ ;; allows for deterministic builds.
+ (setenv "GRUB_FAT_SERIAL_NUMBER"
+ (number->string (if volume-uuid
+ (string-hash (iso9660-uuid->string volume-uuid)
+ (expt 2 32))
+ #x77777777)
+ 16))
+
(let ((pipe
(apply open-pipe* OPEN_WRITE
grub-mkrescue "-o" target
@@ -471,6 +491,10 @@ GRUB configuration and OS-DRV as the stuff in it."
"mnt=/tmp/root/mnt"
"-path-list" "-"
"--"
+
+ ;; Set all timestamps to 1.
+ "-volume_date" "all_file_dates" "=1"
+
"-volid" (string-upcase volume-id)
(if volume-uuid
`("-volume_date" "uuid"