xref: /freebsd/contrib/ntp/html/hints/a-ux (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1-------------
2INTRODUCTION:
3-------------
4Last revision:  06-Jul-1994
5
6Included in this distribution of XNTP V3 is a configuration file suitable
7for use under Apple's A/UX Version 3.x.x  There is also one for A/UX 2.0.1
8but it has not been fully tested. To make the executables follow the steps
9outlined below.
10
11*** NOTE:  You must have gcc installed to successfully compile the current
12distribution; the native cc supplied with A/UX will NOT correctly compile
13this source.  See the FAQ in comp.unix.aux for places to obtain gcc from
14and how to install it.
15
16----------------------
17MAKING XNTPD FOR A/UX:
18----------------------
19
20First, you need to create the makefiles (after you've downloaded the
21source, of course):
22
23    % make clean
24    % make refconf
25
26After that, you should edit Config.local to make sure that BINDIR is
27correct for where you wish the programs to be "installed". The default
28(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and
29CLOCKDEFS are commented out! Presently, only the LOCAL_CLOCK/REFCLOCK
30clock is used and supported.
31
32
33After this is done (you should be told that your system is A/UX 3), make
34'xntpd' (the options to 'gcc' are held in compilers/aux3.gcc):
35
36    % make
37
38I do not normally use the `make install' option and so have not verified its
39compatibility with A/UX.  Rather, I pull out each of the executables and
40place them in the locally appropriate locations.
41
42---------------
43STARTING XNTPD:
44---------------
45
46At this point you need to set things up so that 'xntpd' is started upon
47boot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab
48or, more ideally, create and use an /etc/rc.local file. Since rc.local is
49what I recommend, here's how you do it:
50
51By default, A/UX doesn't have rc.local, so you'll need to add the following to
52/etc/inittab:
53
54    net6:2:wait:/etc/syslogd		# set to "wait" to run a syslog daemon
55+   jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1	# Local stuff
56    dbg2::wait:/etc/telinit v	# turn off init's verbose mode
57
58Now, the look of a sample /etc/rc.local is as follows:
59
60    #!/bin/sh
61    :
62    : rc.local
63    :
64    #	@(#)Copyright Apple Computer 1987	Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12)
65
66
67    #	Push line discipline/set the device so it will print
68    /etc/line_sane 1
69    echo " "
70    echo "Entering rc.local..."
71
72    set `/bin/who -r`
73    if [ "$7" = 2 ]
74    then
75        /bin/echo " now setting the time..."
76        /usr/local/etc/ntpdate -s -b <host.domain>
77        sleep 5
78    #
79    # start up 'xntpd' if we want
80    #
81        if [ -f /etc/ntp.conf ]
82        then
83    	/bin/echo " setting tick and tickadj..."
84    	/usr/local/etc/tickadj -t 16672 -a 54
85    	sleep 5
86    	/bin/echo " starting xntpd..."
87    	/usr/local/etc/xntpd <&- > /dev/null 2>&1
88    	sleep 5
89        fi
90    #
91    fi
92
93    echo "Leaving rc.local..."
94
95There are a few things to notice about the above:
96
97    o When run, 'ntpdate' forces your clock to the time returned by the
98      host(s) specified by <host.domain> (you'll need to replace this
99      be the IP address(es) of your timehosts. This is good since it gets
100      things close to start off with. You can use more than one time
101      server.
102
103    o 'tickadj' is also called. This does two things: changes the
104      default value of 'tick' (which the the amount of time, in ms, that
105      is added to the clock every 1/60 seconds) and changes the value
106      of 'tickadj' which the the amount that is added or subtracted
107      from 'tickadj' when adjtime() is called.
108
109      Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of
110      having A/UX add the default of 16666ms every 1/60th of a second, you
111      may want it to add more (or less) so that it keeps better time. The
112      above value works for me but your "best" value may be different and
113      will likely require some fooling around to find the best value. As a
114      general rule of thumb, if you see 'xntpd' make a lot of negative clock
115      adjustments, then your clock is fast and you'll need to _decrease_
116      the value of 'tick'. If your adjustments are positive, then you need
117      to increase 'tick'. To make a guess on how fast/slow your clock is,
118      use 'ntpdate' to sync your clock. Now watch 'xntpd' and see how it
119      operates. If, for example, it resets your clock by 1 second every 30
120      minutes, then your clock is (1/(30*60)) is about 0.056% off and you'll
121      need to adjust 'tick' by 16666*0.00056 or about 9 (i.e. 'tick' should
122      be ~16675 if slow or ~16657 if fast)
123
124      A/UX's default value of 'tickadj' is 1666 which is too big for
125      'xntpd'... so it also needs to be adjusted. I like using larger
126      values then the recommended value of 9 for 'tickadj' (although not
127      anything near as big as 1666) since this allows for quick slews
128      when adjusting the clock. Even with semi-large values of 'tickadj'
129      (~200), getting 5ms (1/200 s) accuracy is easy.
130
131
132Finally, before A/UX and 'xntpd' will work happily together, you need to
133patch the kernel. This is due to the fact that A/UX attempts to keep the
134UNIX-software clock and the Mac-hardware clock in sync. Neither the h/w or
135the s/w clock are too accurate. Also, 'xntpd' will be attempting to adjust
136the software clock as well, so having A/UX muck around with it is asking
137for headaches. What you therefore need to do is tell the kernel _not_ to
138sync the s/w clock with the h/w one. This is done using 'adb'. The
139following is a shell script that will do the patch for you:
140
141    #! /bin/sh
142    adb -w /unix <<!
143    init_time_fix_timeout?4i
144    init_time_fix_timeout?w 0x4e75
145    init_time_fix_timeout?4i
146    $q
147    !
148
149This must be done _every_ time you create a new kernel (via newconfig or
150newunix) or else 'xntpd' will go crazy.
151
152--------
153HISTORY:
154--------
155
156John Dundas was the original porter of 'xntpd' and a lot of the additions
157and A/UX-ports are from him. I got involved when I wanted to run 'xntpd'
158on jagubox. It was also around this time that the base-patchlevel of
159'xntpd' changed relatively (the so-called "jones" version). Since then,
160I've been maintaining 'xntpd' for A/UX for the xntp development team
161
162The original kernel patch (which patched 'time_fix_timeout') was from
163Richard Todd. I suggest patching 'init_time_fix_timeout' which prevents
164'time_fix_timeout' from even being called.
165
166----------------
167TECHNICAL NOTES:
168----------------
169
170    o As configured (see machines/aux3), 'xntpd' will log messages via syslogd
171      using the LOC_LOCAL1 facility. I would suggest the following in
172      /etc/syslog.conf:
173
174	local1.notice		/usr/adm/ntpd-syslog
175
176    o As mentioned above, the clocks on A/UX and Macs are kinda bad. Not
177      only that, but logging in and out of the MacOS mode as well as
178      extensive floppy use causes A/UX to drop and lose clock interupts
179      (these are sent every 1/60th of a second). So, if you do these
180      activities a lot, you find out that you lose about 300ms of time
181      (i.e., you become 300ms slow). 'xntpd' default way of handling this
182      is to called 'settimeofday()' and step the clock to the correct
183      time. I prefer having 'xntpd' slew the clock back into line by
184      making gradual adjustments to the clock over a coupla minutes
185      or so. It's for this reason that SLEWALWAYS is defined in
186      include/ntp_machine.h for SYS_AUX3. It's also for this reason than
187      I like larger values of 'tickadj'.
188
189Good luck!  If you have problems under A/UX feel free to contact me (e-mail
190is preferred).
191--
192    Jim Jagielski               |  "That is no ordinary rabbit... 'tis the
193    jim@jagubox.gsfc.nasa.gov   |   most foul, cruel and bad-tempered
194    NASA/GSFC, Code 734.4       |   rodent you ever set eyes on"
195    Greenbelt, MD 20771         |                   Tim the Enchanter
196