Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Feb 2001 14:04:59 +0100
From:      Gerhard Sittig <Gerhard.Sittig@gmx.net>
To:        freebsd-questions@freebsd.org
Subject:   how to compile ntpd(8) with additional refclocks?
Message-ID:  <20010203140459.L253@speedy.gsinet>

next in thread | raw e-mail | index | archive | help
I'm stuck.  So I would appreciate any pointers where to learn
more on the topic or even reading success stories and how to do
it / repeat it.  TIA!

Although my problem is with compiling usr.sbin/ntp/ntpd source I
do speak about the other steps, too.  This could result in a
record for later reference just in case there's something simple
I've missed (which is really easy:).

Trying to use a "Conrad parallel port radio clock" (refclock type
#35 as I have read in /usr/share/doc/ntp/{refclock,driver35}.htm)
I added the following options to my kernel config file:

  --- sys/i386/conf/STEIN 2001/01/26 16:09:36     1.2
  +++ sys/i386/conf/STEIN 2001/02/02 17:50:04
  @@ -61,0 +62,12 @@
  +#
  ---------------------------------------------------------------
  +options                PPC_PROBE_CHIPSET
  +options                PCFCLOCK_VERBOSE
  +# options              PCFCLOCK_MAX_RETRIES=5
  +device         ppc0    at isa? irq 7
  +device         ppbus
  +device         lpt
  +device         ppi
  +device         pps
  +device         lpbb
  +device         pcfclock
  +#
  ---------------------------------------------------------------

After building and installing the kernel dmesg(8) output proves
the hardware gets detected and is working.  I don't care much
that I added too many options or at least more than I had to. :>

  ...
  ppc0: parallel port found at 0x378
  ppc0: using extended I/O port range
  PC873xx probe at 0x2e got unknown ID 0xeb
  ppc0: ECP SPP SPP
  ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
  ppc0: Generic chipset (ECP/PS2/NIBBLE) in COMPATIBLE mode
  ppc0: FIFO with 16/16/8 bytes threshold
  lpt0: <Printer> on ppbus0
  lpt0: Interrupt-driven port
  pcfclock0: <PCF-1.0> on ppbus0
  ppi0: <Parallel I/O> on ppbus0
  pps0: <Pulse per second Timing Interface> on ppbus0
  ...

Doing another

  cd /dev && sh MAKEDEV pcfclock0

I can even 'cat /dev/pcfclock0' (no matter how funny the output
looks).  And I noticed /var/log/messages to grow:

  ...
  pcfclock0: 02.02.2001 23:45:55, battery status: ok
  pcfclock0: 02.02.2001 23:45:55, battery status: ok
  pcfclock0: 02.02.2001 23:45:56, battery status: ok
  pcfclock0: 02.02.2001 23:45:56, battery status: ok
  pcfclock0: 02.02.2001 23:45:56, battery status: ok
  pcfclock0: 02.02.2001 23:45:56, battery status: ok
  pcfclock0: 02.02.2001 23:45:57, battery status: ok
  ...

`uname -sr` tells me "FreeBSD 4.2-STABLE", last cvsup + cvs up
was done on January 24th.  Although this shouldn't matter since
there's no problem in this stage yet.


Next step was to setup ntpd(8) to use this source.  So I tried
something as simple as the following /etc/ntp.conf:

  # ----- /etc/ntp.conf ---------------------------------

  server 127.127.35.0
  driftfile /etc/ntp.drift
  logfile   /var/log/ntp
  logconfig =all
  statsdir /tmp/
  filegen loopstats  file loopstats  type day enable
  filegen clockstats file clockstats type day enable

  # ----- E O F -----------------------------------------

So let's start the daemon without rebooting:

  # grep -C ntpd /etc/rc.*
  # grep ntpd /etc/defaults/rc.conf /etc/rc.conf
  # ntpd -p /var/run/ntpd.pid

This is where I find myself welcomed with a message stating

  ...
  refclock_newpeer: clock type 35 invalid
  configuration of 127.127.35.0 failed
  ...

Looking at the "strings `which ntpd`" output I notice there's no
"pcfclock" word in the executable.  There's no "pcf" at all in
there.  After some digging around I applied the following
modification:

  # cvs diff usr.sbin/ntp
  Index: usr.sbin/ntp/config.h
  ===================================================================
  RCS file: /CVSREPO/fbsd/src/usr.sbin/ntp/config.h,v
  retrieving revision 1.4
  diff -u -r1.4 config.h
  --- usr.sbin/ntp/config.h       2000/03/12 13:25:14     1.4
  +++ usr.sbin/ntp/config.h       2001/02/03 13:39:34
  @@ -173,7 +173,7 @@
   #define CLOCK_PARSE 1

   /* Conrad parallel port radio clock */
  -/* #undef CLOCK_PCF */
  +#define CLOCK_PCF 1

   /* PCL 720 clock support */
   /* #undef CLOCK_PPS720 */

This results in compilation errors. :(  Not only did I do "make
clean; make depend; make obj; make all" in the usr.sbin/ntp
directory, I even went back to a "make buildworld" and after some
nine hours got the same error as in the above short "make all"
steps (line breaks are mine):

  cc -O -pipe -I/usr/src/usr.sbin/ntp/ntpd/../../../contrib/ntp/include \
    -I/usr/src/usr.sbin/ntp/ntpd/../ -DSYS_FREEBSD -DPARSE -DHAVE_CONFIG_H \
    -I/usr/obj/usr/src/i386/usr/include -c version.c

  cc -O -pipe -I/usr/src/usr.sbin/ntp/ntpd/../../../contrib/ntp/include \
    -I/usr/src/usr.sbin/ntp/ntpd/../ -DSYS_FREEBSD -DPARSE -DHAVE_CONFIG_H \
    -I/usr/obj/usr/src/i386/usr/include  -o ntpd \
    map_vme.o ntp_config.o ntp_control.o ntp_filegen.o ntp_intres.o \
    ntp_io.o ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \
    ntp_refclock.o ntp_request.o ntp_restrict.o ntp_timer.o ntp_util.o \
    ntpd.o refclock_acts.o refclock_arbiter.o refclock_arc.o \
    refclock_as2201.o refclock_atom.o refclock_bancomm.o \
    refclock_chronolog.o refclock_chu.o refclock_conf.o \
    refclock_datum.o refclock_dumbclock.o refclock_gpsvme.o \
    refclock_heath.o refclock_hpgps.o refclock_irig.o refclock_jupiter.o \
    refclock_leitch.o refclock_local.o refclock_msfees.o refclock_mx4200.o \
    refclock_nmea.o refclock_oncore.o refclock_palisade.o refclock_parse.o \
    refclock_pst.o refclock_ptbacts.o refclock_shm.o refclock_tpro.o \
    refclock_trak.o refclock_true.o refclock_usno.o refclock_wwvb.o \
    version.o /usr/obj/usr/src/usr.sbin/ntp/ntpd/../libparse/libparse.a \
    /usr/obj/usr/src/usr.sbin/ntp/ntpd/../libntp/libntp.a -lm

  refclock_conf.o(.data+0xa8): undefined reference to `refclock_pcf'
  *** Error code 1

  Stop in /usr/src/usr.sbin/ntp/ntpd.
  *** Error code 1

  Stop in /usr/src/usr.sbin/ntp.
  *** Error code 1

  Stop in /usr/src/usr.sbin.
  *** Error code 1

  Stop in /usr/src.
  *** Error code 1

  Stop in /usr/src.
  *** Error code 1

  Stop in /usr/src.

  real    519m13.991s
  user    366m37.000s
  sys     64m27.024s


Since I understand that the contrib/ntp dir is a source container
only while usr.sbin/ntp is the actual working area, fail to see
any other reference to "PCF" in the tree, and haven't seen any
knobs in the Makefile - my only possible conclusion is that
modifying the config.h file really is the thing to do when adding
new sources.  What did I miss?  The "#define REFCLOCK 1" setting
already is in config.h.  Do I have to run ./configure anew?  If
so, where do I do it?  In the contrib dir?  And do I need tools
FreeBSD doesn't have by default?  And why do I fail to see the
configure options FreeBSD's usr.sbin/ntp/config.h file was
generated with?  I'm really puzzled ...

So where do I have to enable additional sources / refclocks for
compiling them into ntpd?


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010203140459.L253>