diff options
author | John Klug <john.klug@multitech.com> | 2017-05-30 18:29:08 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-05-30 18:29:27 -0500 |
commit | c1c2f0d8be1db3300a26a8083cdc0983076d6b63 (patch) | |
tree | 1162ac05f99f07778b42f34c25bdb4fae3ce0ee3 /recipes-support | |
parent | ffc8eb97709544e1ee5cc8652e7c3a160de55c06 (diff) | |
download | meta-mlinux-c1c2f0d8be1db3300a26a8083cdc0983076d6b63.tar.gz meta-mlinux-c1c2f0d8be1db3300a26a8083cdc0983076d6b63.tar.bz2 meta-mlinux-c1c2f0d8be1db3300a26a8083cdc0983076d6b63.zip |
Add mLinux ntp configuration and NTP time test program
Diffstat (limited to 'recipes-support')
-rw-r--r-- | recipes-support/ntp/files/logtime.patch | 58 | ||||
-rw-r--r-- | recipes-support/ntp/files/ntp.conf.patch | 8 | ||||
-rw-r--r-- | recipes-support/ntp/files/ntpd-init.patch | 63 | ||||
-rw-r--r-- | recipes-support/ntp/ntp_%.bbappend | 3 |
4 files changed, 58 insertions, 74 deletions
diff --git a/recipes-support/ntp/files/logtime.patch b/recipes-support/ntp/files/logtime.patch index 6b104ce..bb253f4 100644 --- a/recipes-support/ntp/files/logtime.patch +++ b/recipes-support/ntp/files/logtime.patch @@ -1,13 +1,9 @@ - Create a test to log time since boot MONOTONIC_RAW or uptime - and the REALTIME clock (UTC) - Not real sure how the build should work. To build logtime - do bitbake -c devshell ntp - Then cd clockstuff, and to: - make logtime -============================================================== -diff -Naur old/clockstuff/logtime.c new/clockstuff/logtime.c ---- old/clockstuff/logtime.c 1969-12-31 18:00:00.000000000 -0600 -+++ new/clockstuff/logtime.c 2017-01-27 16:55:46.420307603 -0600 +# The logtime test is used to compare the kernel realtime +# clock and the kernel monotonic clock, so that leap +# second may be observed. +diff -Naru old/tests/ntpd/logtime.c new/tests/ntpd/logtime.c +--- old/tests/ntpd/logtime.c 1969-12-31 18:00:00.000000000 -0600 ++++ new/tests/ntpd/logtime.c 2017-05-30 13:22:11.827179154 -0500 @@ -0,0 +1,44 @@ +#include <time.h> +#include <stdio.h> @@ -53,27 +49,25 @@ diff -Naur old/clockstuff/logtime.c new/clockstuff/logtime.c + } + +} -diff -Naur old/clockstuff/Makefile.am new/clockstuff/Makefile.am ---- old/clockstuff/Makefile.am 2017-01-27 16:50:58.929973639 -0600 -+++ new/clockstuff/Makefile.am 2017-01-27 16:53:22.625139584 -0600 -@@ -1,7 +1,7 @@ - #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies - AUTOMAKE_OPTIONS = --noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ --EXTRA_PROGRAMS = propdelay chutest clktest -+noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ @LOGTIME@ -+EXTRA_PROGRAMS = propdelay chutest clktest logtime +diff -Naru old/tests/ntpd/Makefile.am new/tests/ntpd/Makefile.am +--- old/tests/ntpd/Makefile.am 2017-05-30 13:31:45.124160267 -0500 ++++ new/tests/ntpd/Makefile.am 2017-05-30 16:53:59.784755988 -0500 +@@ -29,6 +29,7 @@ + test-ntp_restrict \ + test-ntp_scanner \ + test-ntp_signd \ ++ logtime \ + $(NULL) - INCLUDES = -I$(top_srcdir)/include - # We need -lm (and perhaps $(COMPAT) for propdelay, -lntp for {chu,clk}test -diff -Naur old/configure.ac new/configure.ac ---- old/configure.ac 2017-01-27 17:59:46.940532782 -0600 -+++ new/configure.ac 2017-01-27 17:55:26.626841232 -0600 -@@ -4115,6 +4115,7 @@ - AC_SUBST([PROPDELAY]) dnl Set to "propdelay" - AC_SUBST([CHUTEST]) dnl Set to "chutest" - AC_SUBST([CLKTEST]) dnl Set to "clktest" -+AC_SUBST([LOGTIME]) dnl Set to "logtime" - AC_SUBST([MAKE_ADJTIMED]) - AC_MSG_CHECKING([if we want HP-UX adjtimed support]) +@@ -191,8 +192,8 @@ + ## check-libntp.mf - automake fragment + ## slightly adapted for deeper directory + +-BUILT_SOURCES += check-libntpd check-libntp check-libunity +-CLEANFILES += check-libntpd check-libntp check-libunity ++BUILT_SOURCES += check-libntpd check-libntp check-libunity logtime ++CLEANFILES += check-libntpd check-libntp check-libunity logtime + + check-libntpd: ../../ntpd/libntpd.a + @echo stamp > $@ diff --git a/recipes-support/ntp/files/ntp.conf.patch b/recipes-support/ntp/files/ntp.conf.patch index bb1dcfe..1a40d24 100644 --- a/recipes-support/ntp/files/ntp.conf.patch +++ b/recipes-support/ntp/files/ntp.conf.patch @@ -1,11 +1,11 @@ -diff -Naur old/ntp.conf new/ntp.conf ---- old/ntp.conf 2017-02-02 19:09:54.524791189 -0600 -+++ new/ntp.conf 2017-02-02 19:06:41.744669788 -0600 +diff -Naru orig.new/ntp.conf up/ntp.conf +--- orig.new/ntp.conf 2017-05-30 10:44:16.311034239 -0500 ++++ up/ntp.conf 2017-05-30 10:37:42.837793409 -0500 @@ -1,16 +1,47 @@ -# This is the most basic ntp configuration file # The driftfile must remain in a place specific to this # machine - it records the machine specific clock error --driftfile /etc/ntp.drift +-driftfile /var/lib/ntp/drift +# Driftfile must be in a directory owned by ntp +driftfile /var/lib/ntp/ntp.drift + diff --git a/recipes-support/ntp/files/ntpd-init.patch b/recipes-support/ntp/files/ntpd-init.patch index 2ef7e0b..1890e07 100644 --- a/recipes-support/ntp/files/ntpd-init.patch +++ b/recipes-support/ntp/files/ntpd-init.patch @@ -1,17 +1,23 @@ -diff -Naur old/ntpd new/ntpd ---- old/ntpd 2017-02-06 09:21:52.607908299 -0600 -+++ new/ntpd 2017-02-06 09:22:52.417169090 -0600 -@@ -1,6 +1,8 @@ +diff -Naru old/ntpd up/ntpd +--- old/ntpd 2017-05-30 11:08:30.368920821 -0500 ++++ up/ntpd 2017-05-30 11:52:42.965527343 -0500 +@@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash - # + + ### BEGIN INIT INFO + # Provides: ntp +@@ -9,7 +9,9 @@ + # Short-Description: Start NTP daemon + ### END INIT INFO + +. /etc/default/ntpd PATH=/sbin:/bin:/usr/bin:/usr/sbin +GNSSRST=/sys/devices/platform/mts-io/gnss-reset - # ntpd init.d script for ntpdc from ntp.isc.org - test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 -@@ -18,13 +20,29 @@ + DAEMON=/usr/sbin/ntpd + PIDFILE=/var/run/ntpd.pid +@@ -34,13 +36,35 @@ } } startdaemon(){ @@ -20,7 +26,7 @@ diff -Naur old/ntpd new/ntpd - # this. If ntpd seems to disappear after a while assume TICKADJ - # above is set to a totally incorrect value. - echo -n "Starting ntpd: " -- start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" +- start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@" - echo "done" + /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd --test -- -u ntp:ntp -p /var/run/ntp.pid "$@" \ + || return 1 @@ -32,7 +38,7 @@ diff -Naur old/ntpd new/ntpd + # use the ntpd one shot option to get to less than + # 250mS error so that we don't waste time adjusting the clock. + /usr/sbin/ntpd -gq -+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" ++ start-stop-daemon -N -20 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@" + else + # Need a GPS fix before startint ntp. Try again later. + /usr/sbin/start-stop-daemon -b -n z1e9d3qb -N -20 --start -x /bin/bash -- -c "sleep $GPSD_WAIT_TIME;/etc/init.d/ntpd start" @@ -43,17 +49,21 @@ diff -Naur old/ntpd new/ntpd + ntpd -gq + shift + fi -+ /usr/sbin/start-stop-daemon -N -20 --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" ++ # The -g option allows ntpd to step the time to correct it just ++ # once. The daemon will exit if the clock drifts too much after ++ # this. If ntpd seems to disappear after a while assume TICKADJ ++ # above is set to a totally incorrect value. ++ echo -n "Starting ntpd: " ++ start-stop-daemon -N -20 --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -u ntp:ntp -p $PIDFILE "$@" ++ echo "done" + fi } stopdaemon(){ echo -n "Stopping ntpd: " -@@ -34,24 +52,38 @@ +@@ -50,6 +74,20 @@ case "$1" in start) -- settick -- startdaemon -g + if ! [[ $ENABLED =~ ^[yY][eE][sS]$ ]] ; then + exit 0 + fi @@ -68,29 +78,6 @@ diff -Naur old/ntpd new/ntpd + chown ntp:ntp ${STATSDIR} >/dev/null 2>&1 + fi + fi -+ settick -+ startdaemon -g $CONFIGOPT - ;; - stop) -- stopdaemon -+ stopdaemon - ;; - force-reload) -- stopdaemon -- settick -+ stopdaemon -+ settick + settick startdaemon -g ;; - restart) -- # Don't reset the tick here -+ # Don't reset the tick here - stopdaemon - startdaemon -g - ;; - reload) -- # Must do this by hand, but don't do -g -+ # Must do this by hand, but don't do -g - stopdaemon - startdaemon - ;; diff --git a/recipes-support/ntp/ntp_%.bbappend b/recipes-support/ntp/ntp_%.bbappend index c8e094d..6c75feb 100644 --- a/recipes-support/ntp/ntp_%.bbappend +++ b/recipes-support/ntp/ntp_%.bbappend @@ -1,6 +1,9 @@ PR .= ".mlinux2" SRC_URI += " file://ntpd-default \ + file://ntp.conf.patch;patchdir=.. \ + file://ntpd-init.patch;patchdir=.. \ + file://logtime.patch \ " FILESEXTRAPATHS_prepend := "${THISDIR}/files:" |