chrony bbappend: install config and patch for enable gpsd support

Example configuration for getting time from gnss signal provided
by gpsd (SHM 0) and NTP.

Chrony confilcts with others NTP daemons.

BugzID: 52095

Signed-off-by: Ramon Moesching <ramon.moesching@netmodule.com>
This commit is contained in:
Ramon Moesching 2020-02-18 15:29:12 +01:00
parent 0bfe64981a
commit 9cb57ba3eb
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# Copyright (C) 2020 Ramon Moesching <ramon.moesching@netmodule.com>
# Released under the MIT license (see COPYING.MIT for the terms)
FILESEXTRAPATHS_prepend:= "${THISDIR}/files:"
# chrony needs continuously running nmea stream and for
# thus gpsd daemon needs to start with -n paramteter.
# Patching at installation time gpsd configuration file
# to apply this parameter
pkg_postinst_${PN}_prepend () {
GPSD_CONF=$D${sysconfdir}/default/gpsd.default
GPSD_OPS=$(awk /GPSD_OPTIONS/ "$GPSD_CONF" )
GPSD_OPSPARAM=$(echo "$GPSD_OPS" | awk /-n/)
if [ -e "$GPSD_CONF" ]; then
if [ -z "$GPSD_OPSPARAM" ]; then
GPSD_OPSPARAM="${GPSD_OPS%\"} -n\""
sed -i "s/$GPSD_OPS/$GPSD_OPSPARAM/g" "$GPSD_CONF"
echo "Patched $GPSD_CONF with -n"
fi
echo "Apply -n to GPSD_OPTIONS to use chrony "
else
echo "GPSD configuration file not at $GPSD_CONF "
fi
}

View File

@ -0,0 +1,26 @@
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
#initstepslew 30 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org
refclock SHM 0 poll 1 refid GPS offset 0.0 delay 2 filter 16
rtcdevice /dev/rtc
rtconutc
logchange 0.5
local stratum 10
logdir /var/log/chrony
keyfile /etc/chrony/chrony.keys
commandkey 10
dumpdir /var/log/chrony
driftfile /var/log/chrony/chrony.drift
makestep 10 -1
maxdistance 3.0
cmdallow 127.0.0.1