From af109fb44469a89b2576d167b02f02a811d13c12 Mon Sep 17 00:00:00 2001 From: Gilles Chanteperdrix Date: Wed, 23 Nov 2016 13:58:44 +0100 Subject: linux: override build timestamp for reproducible builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux kernel include a few information about build environment in its binary. This feature is incompatible with BR2_REPRODUCIBLE. This patch overload build information when BR2_REPRODUCIBLE is enabled. Note that usage of KBUILD_BUILD_TIMESTAMP is not mandatory since Buildroot use `fakedate'. However, native solution is prefered when upstream provide one. Signed-off-by: Gilles Chanteperdrix Reviewed-by: "Yann E. MORIN" Signed-off-by: Jérôme Pouiller Signed-off-by: Thomas Petazzoni --- linux/linux.mk | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linux') diff --git a/linux/linux.mk b/linux/linux.mk index 988427ca7..7e826ccdf 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -94,6 +94,14 @@ LINUX_MAKE_ENV = \ $(TARGET_MAKE_ENV) \ BR_BINARIES_DIR=$(BINARIES_DIR) +ifeq ($(BR2_REPRODUCIBLE),y) +LINUX_MAKE_ENV += \ + KBUILD_BUILD_VERSION=1 \ + KBUILD_BUILD_USER=buildroot \ + KBUILD_BUILD_HOST=buildroot \ + KBUILD_BUILD_TIMESTAMP="$(shell date -d @$(SOURCE_DATE_EPOCH))" +endif + # Get the real Linux version, which tells us where kernel modules are # going to be installed in the target filesystem. LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` -- cgit v1.2.3