[LinuxPPS] LinuxPPS with 'nano' support cookbook recipe

Hal V. Engel hvengel at astound.net
Sat Jul 26 21:48:13 CEST 2008


On Saturday 26 July 2008 02:13:36 am Udo van den Heuvel wrote:
> Remco den Besten wrote:
> > 1. Apply everything necessary to implement microsupport (LinuxPPS), see
> > this list ;-)
>
> See the wiki:
> http://wiki.enneenne.com/index.php/LinuxPPS_support#The_userland_tools
> (still is true for the links etc; `ppstest and ppsctl` paragraph needs
> ppsldisc mention)
>
> > 2. Apply the patch from James to /usr/include/sys/timex.h

This is sort of standard but is also distro dependant.  This file on my system 
conditionally (depending on arch) includes the actual timex.h which in my case 
is /usr/include/gentoo-multilib/amd64/sys/timex.h.  I applied these changes to 
/usr/include/gentoo-multilib/amd64/sys/timex.h since that is the actual file 
that is being used but having these modifications in /usr/include/sys/timex.h 
would have also worked but the patch would not have worked.    

> > 3. Create the symlink: ln -s /usr/include/sys/timex.h
> > /usr/include/timex.h 4. re-../configure ntp (' ../configure <insert
> > options> ') and make the ntp sources ('make')
>
> Correct.

Again this is distro dependant.  I don't need to do this symlink for the ntpd 
build to pickup /usr/include/sys/timex.h on my system.  Before creating the 
symlink users should do a 

make | grep timex.h 

to see if the ntp build is picking up  /usr/include/sys/timex.h.  If it is 
then they do not need the symlink.

>
> > 5. in ntp-source tree go to ntpd directory and strip ntpd (' strip ntpd '
> > ) 6. stop currently running ntpd and start new ntpd (' sudo ./ntpd ')
>
> start ppsldisc /dev/ttySx before starting ntpd...
>
> > (optional: do a make install within the ntp source tree)
>
> rpmbuild -bb SPECS/ntp.spec on my fedora box does the same.
> rpm -Uvh RPMS/bla/ntp-etc...rpm for insatlling.

Users may want to modify the /etc/init.d/ntpd script (or whatever script they 
use to start and stop ntpd) so that it runs ppsldisc as part of the ntpd 
startup and kills ppsldisc as part of stopping ntpd.  This will ensure the 
correct behaviour of ppsldisc when starting and stopping ntpd when these 
scritps are used.  This allows this to be integrated into the systems normal 
startup and shutdown processes. 

In my script I now have:

start() {
        checkconfig || return $?

        ebegin "Starting ntpd"
        /bin/ppsldisc /dev/ttyS1 & start-stop-daemon --start --exec 
/usr/sbin/ntpd \
            --pidfile /var/run/ntpd.pid \
            -- -p /var/run/ntpd.pid ${NTPD_OPTS}
        eend $? "Failed to start ntpd"
}

stop() {
        ebegin "Stopping ntpd"
        killall ppsldisc
        start-stop-daemon --stop \
                --pidfile /var/run/ntpd.pid \
                --exec /usr/sbin/ntpd
        eend $? "Failed to stop ntpd"
}

______________

Of course this is using a hardcoded serial device in the start statement which 
is not real elegant.   But I suspect that most users will want to do something 
like this so that ntpd can be started and stopped by the system in the normal 
way.  Of course this script probably looks different for other distros.  So 
users will need to use some judgement when making this modification.

>
> > To monitor the behaviour of the new ntpd, use the tools and commands from
> > the freshly
> > compiled ntp-source (see subdirs ntpq, ntpdc, etc. and utils) otherwise
> > erroneous values
> > will and/or may be reported.
>
> ntptime will show nano support if all is well:
>
> # ntptime
> ntp_gettime() returns code 0 (OK)
>   time cc35689a.c1f383a8  Sat, Jul 26 2008 11:10:50.757, (.757622621),
>   maximum error 3338 us, estimated error 1 us
> ntp_adjtime() returns code 0 (OK)
>   modes 0x0 (),
>   offset 352.967 us, frequency -70.965 ppm, interval 1 s,
>   maximum error 3338 us, estimated error 1 us,
>   status 0x2001 (PLL,NANO),
>   time constant 4, precision 0.001 us, tolerance 500 ppm,
>
>
> Udo

By the way kernel 2.6.26 and the latest patches are working OK for me.

Hal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ml.enneenne.com/pipermail/linuxpps/attachments/20080726/8421e322/attachment.htm 


More information about the LinuxPPS mailing list