path: root/meta/recipes-core
diff options
authorRoss Burton <>2019-09-05 22:49:59 (GMT)
committerRichard Purdie <>2019-09-06 13:58:10 (GMT)
commite77c32d1645ad7a77c214f7552a0bf250ea666bd (patch)
tree17ed0fc60955e8cb572baeabb978c878ab842bfd /meta/recipes-core
parentb03278ba4cf32cf40d8986fa68489cf34a6d29ce (diff)
systemd: ensure reproducible builds by clearly exposing the time epoch support
systemd has the ability to check the time on boot and if it's earlier than an epoch determined at build time, set the time to that epoch. This is useful for systems where the system time is January 1st 1970 (because the unix timestamp was 0 at boot) as then at least the time is reset to something approximating the right year at least. By default systemd uses the mtime of the NEWS file, which is static for tarballs and corresponds to the time the release was made, but for git checkouts this is simply the time do_unpack() was executed. Thus, rebuilding systemd will cause this embedded timestamp to change. Remove the PACKAGECONFIG time-epoch which has the logic reversed: enabling time-epoch will set the epoch to the unix timestamp 0). Replace with set-time-epoch with the following semantics: - When disabled, the time epoch is set to 0 (1st January 1970), so there is no time manipulation on boot. - When enabled, if reproducible builds are configured by setting SOURCE_DATE_EPOCH then that timestamp is used for the time epoch. If reproducible builds are not configured then the timestamp of NEWS (thus the build time) is used. The set-time-epoch flag is enabled by default. [ YOCTO #13473 ] (From OE-Core rev: 29afbd4f02354de7103ee3a88f4ce5336b95b88a) Signed-off-by: Ross Burton <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'meta/recipes-core')
1 files changed, 7 insertions, 1 deletions
diff --git a/meta/recipes-core/systemd/ b/meta/recipes-core/systemd/
index 6bbe388..2c101cb 100644
--- a/meta/recipes-core/systemd/
+++ b/meta/recipes-core/systemd/
@@ -83,6 +83,7 @@ PACKAGECONFIG ??= " \
83 quotacheck \ 83 quotacheck \
84 randomseed \ 84 randomseed \
85 resolved \ 85 resolved \
86 set-time-epoch \
86 smack \ 87 smack \
87 sysusers \ 88 sysusers \
88 timedated \ 89 timedated \
@@ -166,7 +167,12 @@ PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
166PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" 167PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
167PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" 168PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
168PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" 169PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
169PACKAGECONFIG[time-epoch] = "-Dtime-epoch=0,," 170# When enabled use reproducble build timestamp if set as time epoch,
171# or build time if not. When disabled, time epoch is unset.
172def build_epoch(d):
173 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
174 return '-Dtime-epoch=%d' % int(epoch)
175PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
170PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" 176PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
171PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" 177PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
172PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" 178PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"