summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Clobus <rclobus@rclobus.nl>2021-02-16 18:23:04 +0100
committerRoland Clobus <rclobus@rclobus.nl>2021-02-16 21:22:12 +0100
commit2c7c90487addb7f741be24418b5ae1caed51f562 (patch)
treee319aae320f42853db2a11b92dd4a69508b4b52e
parentd7b2d55c8f373a3daff48217d7840219e34956c6 (diff)
downloadvyos-live-build-2c7c90487addb7f741be24418b5ae1caed51f562.tar.gz
vyos-live-build-2c7c90487addb7f741be24418b5ae1caed51f562.zip
mkfs.msdos needs at most 32 bits for the -i argument.
Use the hexadecimal version of SOURCE_DATE_EPOCH, limited to the lower 32 bits
-rwxr-xr-xscripts/build/binary_grub-efi3
-rwxr-xr-xscripts/build/efi-image3
2 files changed, 4 insertions, 2 deletions
diff --git a/scripts/build/binary_grub-efi b/scripts/build/binary_grub-efi
index 714a7dd50..bd7d75f02 100755
--- a/scripts/build/binary_grub-efi
+++ b/scripts/build/binary_grub-efi
@@ -258,7 +258,8 @@ size=\$((\$size + 4096 * 4))
blocks=\$(((\$size / 1024 + 55) / 32 * 32 ))
rm -f ${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img
-mkfs.msdos -C "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" \$blocks -i ${SOURCE_DATE_EPOCH} >/dev/null
+# The VOLID must be (truncated to) a 32bit hexadecimal number
+mkfs.msdos -C "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" \$blocks -i $(printf "%08x" $((${SOURCE_DATE_EPOCH}%4294967296))) >/dev/null
mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::EFI
mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::EFI/boot
mcopy -m -o -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ${_CHROOT_DIR}/grub-efi-temp/EFI/boot/*.efi \
diff --git a/scripts/build/efi-image b/scripts/build/efi-image
index 8831bfa81..bc8ed3a93 100755
--- a/scripts/build/efi-image
+++ b/scripts/build/efi-image
@@ -75,9 +75,10 @@ grub-mkimage -O "$platform" \
# Stuff it into a FAT filesystem, making it as small as possible. 24KiB
# headroom seems to be enough; (x+31)/32*32 rounds up to multiple of 32.
+# The VOLID must be (truncated to) a 32bit hexadecimal number
mkfs.msdos -C "$outdir/efi.img" \
$(( ($(stat -c %s "$workdir/boot$efi_name.efi") / 1024 + 55) \
- / 32 * 32 )) -i ${SOURCE_DATE_EPOCH}
+ / 32 * 32 )) -i $(printf "%08x" $((${SOURCE_DATE_EPOCH}%4294967296)))
mmd -i "$outdir/efi.img" ::efi
mmd -i "$outdir/efi.img" ::efi/boot
# Set the timestamp of the .efi file