From 5462b0052b175292d659c19553a803317e3e2b96 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 31 Aug 2016 21:35:38 +0000 Subject: [PATCH] Set UEFI boot loader PE/COFF timestamps to known value for reproducible builds Reviewed by: rpokala MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7633 --- sys/boot/efi/boot1/Makefile | 4 ++++ sys/boot/efi/loader/Makefile | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 12144786ed4..5355c3141ec 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -89,11 +89,15 @@ EFI_TARGET= efi-app-ia32 EFI_TARGET= binary .endif +# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 +# for build reproducibility. +SOURCE_DATE_EPOCH?=1451606400 boot1.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ fi + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame \ diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index 07c7af17212..7503cc2667c 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -131,11 +131,15 @@ EFI_TARGET= efi-app-ia32 EFI_TARGET= binary .endif +# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 +# for build reproducibility. +SOURCE_DATE_EPOCH?=1451606400 loader.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ fi + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \