From: Eduardo Ferreira <[email protected]>

When we use the 'meta-updater' layer, we get a conflit on
SOURCE_DATE_EPOCH variable. where sota.conf.inc exports,
globally, SOURCE_DATE_EPOCH=0.

This ends up in systemd's TIME_EPOCH constant, that is used
clock_apply_epoch function to determine the difference to the system's
clock. And since there's a big jump we get the following error message
while booting up:
  systemd[1]: Current system time is further ahead 15y after build time, but 
cannot correct: Invalid argument

So, instead of creating a function to read the environment variable, we
can call get_source_date_epoch_value directly, since this is the way the
variable SOURCE_DATE_EPOCH is populated inside the recipe.

And, this way, SOURCE_DATE_EPOCH can still be used. If the packageconfig
is not used, '-Dtime-epoch=0' will be passed and when time-epoch <= 0,
meson build script will read the value of SOURCE_DATE_EPOCH before
trying to calculate the timestamp via git or by stating the NEWS file.

Signed-off-by: Eduardo Ferreira <[email protected]>
---
 meta/recipes-core/systemd/systemd_252.4.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_252.4.bb 
b/meta/recipes-core/systemd/systemd_252.4.bb
index eb6f5ecc17..e63b2bb681 100644
--- a/meta/recipes-core/systemd/systemd_252.4.bb
+++ b/meta/recipes-core/systemd/systemd_252.4.bb
@@ -191,10 +191,7 @@ PACKAGECONFIG[sysusers] = 
"-Dsysusers=true,-Dsysusers=false"
 PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d 
-Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= 
-Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
 # When enabled use reproducble build timestamp if set as time epoch,
 # or build time if not. When disabled, time epoch is unset.
-def build_epoch(d):
-    epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
-    return '-Dtime-epoch=%d' % int(epoch)
-PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
+PACKAGECONFIG[set-time-epoch] = 
"${@get_source_date_epoch_value(d)},-Dtime-epoch=0"
 PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
 PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
 PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
--
2.34.1


[Toradex Logo] <https://www.toradex.com/>       Embedded Computing
Made Easy
Choose 
Us<https://www.toradex.com/how-to-choose-system-computer-on-module-partner> | 
Products<https://www.toradex.com/products> | Developer 
Center<https://developer.toradex.com/> | 
Community<https://community.toradex.com/> | 
Careers<https://careers.toradex.com/>
Join our webinar:<https://www.toradex.com/webinars>
- Implementing Power-safe Atomic Over the Air Updates | January 20, 2023: 
Register<https://www.toradex.com/webinars/implementing-power-safe-atomic-over-the-air-updates>

Meet our engineers at:<https://www.toradex.com/events>
- Embedded World | Nuremberg, Germany | March 14-16, 2023

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#175139): 
https://lists.openembedded.org/g/openembedded-core/message/175139
Mute This Topic: https://lists.openembedded.org/mt/95953516/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to