From 8673ab6237fdfe248aca26241177187d20288900 Mon Sep 17 00:00:00 2001 From: Paul J R Date: Sun, 25 Aug 2013 15:18:14 +1000 Subject: [PATCH] added ntp stuff to startup and base ntp config file --- .../filesystem/etc/init.d/S01custom_pre_startup | 31 ++++++++++++++------ .../custom/filesystem/etc/init.d/S99final_sequence | 5 +++ .../custom/filesystem/opt/ntp/ntp.conf | 27 +++++++++++++++++ 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 src/buildroot-2013.05/custom/filesystem/opt/ntp/ntp.conf diff --git a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup index 106d07a..4b3546a 100755 --- a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup +++ b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup @@ -1,7 +1,7 @@ #!/bin/sh # deal with our mounts -echo "Mounting normal file systems" +echo "Mounting info file systems" echo ".... proc" mkdir /proc > /dev/null 2>&1 mount -t proc proc /proc @@ -15,14 +15,6 @@ echo ".... tmpfs" mount /tmp > /dev/null 2>&1 -# create out gps0 -echo "Creating serial devices" -echo ".... gps0" -ln -s /dev/ttyS0 /dev/gps0 -echo ".... gpspps0" -mknod -m 0664 /dev/pps0 c 252 0 -ln -s /dev/pps0 /dev/gpspps0 - # mount the config file system mkdir /fs > /dev/null 2>&1 echo "Mounting /fs" @@ -105,3 +97,24 @@ EOF fi fi + +# create out gps0 +echo "Creating serial devices" +echo ".... gps0" +ln -s /dev/ttyS0 /dev/gps0 + + +# addatch the pps device +ldattach pps /dev/ttyS0 +# find the minor/major numbers of the device and create +if [ -f /sys/class/pps/pps*/dev ] +then + PPSMAJOR=`cat /sys/class/pps/pps*/dev|cut -f1 -d:` + PPSMINOR=`cat /sys/class/pps/pps*/dev|cut -f2 -d:` + echo ".... pps0" + mknod -m 0664 /dev/pps0 c $PPSMAJOR $PPSMINOR + echo ".... gpspps0" + ln -s /dev/pps0 /dev/gpspps0 +else + echo "Cant find pps device?" +fi diff --git a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence index a4b3781..81f7c4d 100755 --- a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence +++ b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence @@ -14,3 +14,8 @@ then tar cf /fs/config/dropbear.tar /etc/dropbear cd $RD fi + +if [ -f /fs/config/ntp.conf ] +then + ntpd -c /fs/config/ntp.conf -x -g +fi diff --git a/src/buildroot-2013.05/custom/filesystem/opt/ntp/ntp.conf b/src/buildroot-2013.05/custom/filesystem/opt/ntp/ntp.conf new file mode 100644 index 0000000..9c8ac15 --- /dev/null +++ b/src/buildroot-2013.05/custom/filesystem/opt/ntp/ntp.conf @@ -0,0 +1,27 @@ +driftfile /tmp/ntp/drift + +statsdir /tmp/ntp/stats + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + +server time.iinet.net.au noselect +server 0.au.pool.ntp.org noselect +server 1.au.pool.ntp.org noselect +server 2.au.pool.ntp.org noselect +server 3.au.pool.ntp.org noselect + +#correct ones for pps ntp +server 127.127.20.0 mode 24 minpoll 2 maxpoll 2 prefer +fudge 127.127.20.0 flag1 1 flag2 0 flag3 1 refid PPS + +# By default, exchange time with everybody, but don't allow configuration. +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery + +# Local users may interrogate the ntp server more closely. +restrict 127.0.0.1 +restrict 127.0.1.1 +restrict ::1 -- 1.7.0.4