meta-google: Enable systemd-time-wait-sync
Set the timeout to be 20 minutes to make sure we don't wait for it
forever.
The workflow is the following.
- If time synced,
- Start time-sync.target
- If timesout after 20 minutes,
- Start time-sync.target
- After time-sync.target, start services that depends on it.
Tested:
The service with
```
[Unit]
After=gbmc-time-sync.target
Wants=gbmc-time-sync.target
```
always start after timesynced now.
Tested with modified timeout and normal timesync which both worked.
Change-Id: Idbbcdd0f65a5c49f66f74c8e1b9c94d047cd5d7f
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/meta-google/recipes-google/systemd/files/10-gbmc.conf b/meta-google/recipes-google/systemd/files/10-gbmc.conf
new file mode 100644
index 0000000..8ad42c7
--- /dev/null
+++ b/meta-google/recipes-google/systemd/files/10-gbmc.conf
@@ -0,0 +1,2 @@
+[Service]
+TimeoutStartSec=20min
diff --git a/meta-google/recipes-google/systemd/gbmc-systemd-config.bb b/meta-google/recipes-google/systemd/gbmc-systemd-config.bb
index 1e6ce2e..8809a6e 100644
--- a/meta-google/recipes-google/systemd/gbmc-systemd-config.bb
+++ b/meta-google/recipes-google/systemd/gbmc-systemd-config.bb
@@ -14,6 +14,7 @@
file://40-gbmc-forward.conf \
file://40-gbmc-sysctl.conf \
file://40-gbmc-time.conf \
+ file://10-gbmc.conf \
"
FILES:${PN}:append = " \
@@ -22,6 +23,8 @@
${systemd_unitdir}/timesyncd.conf.d/40-gbmc-time.conf \
${libdir}/sysctl.d/40-gbmc-sysctl.conf \
${libdir}/sysctl.d/40-gbmc-forward.conf \
+ ${systemd_system_unitdir}/sysinit.target.wants/systemd-time-wait-sync.service \
+ ${systemd_system_unitdir}/systemd-time-wait-sync.d/10-gbmc.conf \
"
FILES:${PN}:append:dev = " \
@@ -59,6 +62,11 @@
install -d -m 0755 ${D}${systemd_unitdir}/timesyncd.conf.d/
install -D -m0644 ${WORKDIR}/40-gbmc-time.conf ${D}${systemd_unitdir}/timesyncd.conf.d/
+
+ mkdir -p ${D}${systemd_system_unitdir}/sysinit.target.wants/
+ ln -sv ${systemd_system_unitdir}/systemd-time-wait-sync.service ${D}${systemd_system_unitdir}/sysinit.target.wants/
+ mkdir -p ${D}${systemd_system_unitdir}/systemd-time-wait-sync.d/
+ install -D -m0644 ${WORKDIR}/10-gbmc.conf ${D}${systemd_system_unitdir}/systemd-time-wait-sync.d/
}
do_install:append:dev() {