diff --git a/meta-oe/recipes-support/ntp/files/ntp.conf b/meta-oe/recipes-support/ntp/files/ntp.conf index 5964828708..bf52440ced 100644 --- a/meta-oe/recipes-support/ntp/files/ntp.conf +++ b/meta-oe/recipes-support/ntp/files/ntp.conf @@ -7,6 +7,7 @@ driftfile /etc/ntp.drift # as required, or change this. server pool.ntp.org # Using local hardware clock as fallback +# Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself server 127.127.1.0 fudge 127.127.1.0 stratum 14 # Defining a default security setting diff --git a/meta-oe/recipes-support/ntp/files/ntpd.service b/meta-oe/recipes-support/ntp/files/ntpd.service index 420a0563a8..bd87b1ea24 100644 --- a/meta-oe/recipes-support/ntp/files/ntpd.service +++ b/meta-oe/recipes-support/ntp/files/ntpd.service @@ -5,8 +5,7 @@ After=network.target [Service] Type=forking PIDFile=/run/ntpd.pid -EnvironmentFile=/etc/ntp.conf -ExecStart=/usr/bin/ntpd $NTPD_ARGS -p /run/ntpd.pid +ExecStart=/usr/bin/ntpd -p /run/ntpd.pid [Install] WantedBy=multi-user.target diff --git a/meta-oe/recipes-support/ntp/files/ntpdate.service b/meta-oe/recipes-support/ntp/files/ntpdate.service new file mode 100644 index 0000000000..b2bc632069 --- /dev/null +++ b/meta-oe/recipes-support/ntp/files/ntpdate.service @@ -0,0 +1,11 @@ +[Unit] +Description=Network Time Service (one-shot ntpdate mode) +Before=ntpd.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/ntpd -q -g -x +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta-oe/recipes-support/ntp/ntp.inc b/meta-oe/recipes-support/ntp/ntp.inc index b398b801e4..1d740f00fb 100644 --- a/meta-oe/recipes-support/ntp/ntp.inc +++ b/meta-oe/recipes-support/ntp/ntp.inc @@ -28,7 +28,8 @@ EXTRA_OECONF = "--without-openssl --without-crypto ac_cv_header_readline_history CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils" -# NOTE: you don't need ntpdate, use "ntpdc -q -g -x" +# NOTE: you don't need ntpdate, use "ntpd -q -g -x" +# or the ntpdate systemd service # This should use rc.update FILES_ntpdate = "${bindir}/ntpdate ${sysconfdir}/init.d/ntpdate" diff --git a/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb index e2bb1a8061..063d82a877 100644 --- a/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb +++ b/meta-oe/recipes-support/ntp/ntp_4.2.6p3.bb @@ -1,6 +1,6 @@ require ntp.inc -PR = "r3" +PR = "r4" inherit systemd @@ -13,6 +13,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${P}.tar.gz \ file://ntpd \ file://ntp.conf \ file://ntpdate \ + file://ntpdate.service \ file://ntpd.service \ " @@ -29,6 +30,7 @@ do_install_append() { install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d install -d ${D}${base_libdir}/systemd/system + install -m 0644 ${WORKDIR}/ntpdate.service ${D}${base_libdir}/systemd/system/ install -m 0644 ${WORKDIR}/ntpd.service ${D}${base_libdir}/systemd/system/ }