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
This commit is contained in:
Roland Clobus 2021-02-16 18:23:04 +01:00
parent d7b2d55c8f
commit 2c7c90487a
No known key found for this signature in database
GPG Key ID: 62C57C6AA61495BD
2 changed files with 4 additions and 2 deletions

View File

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

View File

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