[Buildroot] [PATCH] systemd: set time epoch for reproducible builds

John Keeping john at metanate.com
Thu Nov 16 17:03:16 UTC 2017


Systemd embeds a timestamp which is used to impose a minimum bound on
the system time during boot.  Normally this comes from stat'ing the NEWS
file included with the systemd source, but this makes the build
non-reproducible.  Pass in $SOURCE_DATE_EPOCH to use a deterministic
timestamp when reproducible builds are enabled.

Signed-off-by: John Keeping <john at metanate.com>
---
 package/systemd/systemd.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 9f286fd54b..d87c9d33dd 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -40,6 +40,11 @@ SYSTEMD_CONF_OPTS += \
 	--with-default-dnssec=no \
 	--without-python
 
+ifeq ($(BR2_REPRODUCIBLE),y)
+SYSTEMD_CONF_OPTS += \
+	--with-time-epoch=$(SOURCE_DATE_EPOCH)
+endif
+
 SYSTEMD_CFLAGS = $(TARGET_CFLAGS) -fno-lto
 
 # Override paths to a few utilities needed at runtime, to
-- 
2.15.0



More information about the buildroot mailing list