aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/hints/aux
blob: aa7ccbb2c420283bb25c3abe3cddb41afe4bd997 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Last revision:  09-Aug-1993

Included in this distribution of XNTP V3 is a configuration file suitable
for use under Apple's A/UX Version 3.0.x  While it may work with
other versions, it has not been tested.  To make the executables follow
the steps outlined below.

*** NOTE:  You must have gcc installed to successfully compile the current
distribution; the native cc supplied with A/UX will NOT correctly compile
this source.  See the FAQ in comp.unix.aux for places to obtain gcc from
and how to install it.

Now, you need to create the makefiles:

    % make refconf

First of all, you need to edit Config.local to make sure that BINDIR is
correct for where you wish the programs to be "installed". The default
(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and
CLOCKDEFS are commented out!


After this is done (you should be told that your system is A/UX 3), make
xntpd (the options to 'gcc' are held in compilers/aux3.gcc):

    % make

I do not normally use the `make install' option and so have not verified its
compatibility with A/UX.  Rather, I pull out each of the executables and
place them in the locally appropriate locations.

At this point you need to set things up so that 'xntpd' is started upon
boot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab
or create and use an /etc/rc.local file.

By default, A/UX doesn't have one, so you'll need to add the following to
/etc/inittab:

    net6:2:wait:/etc/syslogd		# set to "wait" to run a syslog daemon
+   jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1	# Local stuff
    dbg2::wait:/etc/telinit v	# turn off init's verbose mode

Now, the look of /etc/rc.local is as follows:

    #!/bin/sh
    :
    : rc.local
    :
    #	@(#)Copyright Apple Computer 1987	Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12)
    
    
    #	Push line discipline/set the device so it will print
    /etc/line_sane 1
    echo " "
    echo "Entering rc.local..."
    
    set `/bin/who -r`
    if [ "$7" = 2 ]
    then
        /bin/echo " now setting the time..."
        /usr/local/etc/ntpdate -s -b <host.domain>
        sleep 5
    #
    # start up xntpd if we want
    #
        if [ -f /etc/ntp.conf ]
        then
    	/bin/echo " setting tick and tickadj..."
    	/usr/local/etc/tickadj -t 16672 -a 54
    	sleep 5
    	/bin/echo " starting xntpd..."
    	/usr/local/etc/xntpd <&- > /dev/null 2>&1
    	sleep 5
        fi
    #
    fi
    
    echo "Leaving rc.local..."

There are a few things to notice about the above:

    o When run, 'ntpdate' forces your clock to the time returned by the
      host(s) specified by <host.domain> (you'll need to replace this
      be the IP address(es) of your timehosts. This is good since it gets
      things close to start off with.

    o 'tickadj' is also called. This does two things: changes the
      default value of 'tick' (which the the amount of time, in ms, that
      is added to the clock every 1/60 seconds) and changes the value
      of 'tickadj' which the the amount that is added or subtracted
      from 'tickadj' when adjtime() is called.

      Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of
      having A/UX add the default of 16666ms every 1/60th of a second,
      you want it to add more so that it keeps better time. The above
      value works for me but your "best" value may be different and will
      likely require some fooling around to find the best value.

      A/UX's default value of 'tickadj' is 1666 which is too big for
      'xntpd'... so it also needs to be adjusted.


Finally, before A/UX and 'xntpd' will work happily together, you need to
patch the kernel. This is due to the fact that A/UX attempts to keep the
UNIX-software clock and the Mac-hardware clock in sync. Now both of these
are too good. Also, 'xntpd' will be attempting to adjust the software
clock as well, so having A/UX muck around with it is asking for headaches.
What you therefore need to do is tell the kernel _not_ to sync the s/w clock
with the h/w one. This is done using 'adb'. The following is a shell script
that will do the patch for you:

    #! /bin/sh
    adb -w /unix <<!
    init_time_fix_timeout?4i
    init_time_fix_timeout?w 0x4e75
    init_time_fix_timeout?4i
    $q
    !

This must be done _every_ time you create a new kernel (via newconfig or
newunix) or else 'xntpd' will go crazy.

John Dundas was the original porter of xntpd and a lot of the additions
and A/UX-ports are from him. I got involved when I wanted to run 'xntpd'
on jagubox. It was also around this time that the base-patchlevel of
'xntpd' changed relatively significantly so John may not be up on this
version (called the "jones" version).

The original kernel patch (which patched 'time_fix_timeout') was from
Richard Todd. I suggest patching 'init_time_fix_timeout' which prevents
'time_fix_timeout' from even being called.

TECHNICAL NOTES:

    o As configured (see machines/aux3), 'xntpd' will log messages via syslogd
      using the LOC_LOCAL1 facility. I would suggest the following in
      /etc/syslog.conf:

	local1.notice					/usr/adm/ntpd-syslog

    o As mentioned above, the clocks on A/UX and Macs are kinda bad. Not
      only that, but logging in and out of the MacOS mode as well as
      extensive floppy use causes A/UX to drop and lose clock interupts
      (these are sent every 1/60th of a second). So, if you do these
      activities a lot, you find out that you lose about 300ms of time
      (i.e., you become 300ms slow). 'xntpd' default way of handling this
      is to called 'settimeofday()' and step the clock to the correct
      time. I prefer having 'xntpd' slew the clock back into line by
      making gradual adjustments to the clock over a coupla minutes
      or so. It's for this reason that SLEWALWAYS is defined in
      include/ntp_machine.h for SYS_AUX3. 

Good luck!  If you have problems under A/UX feel free to contact me (e-mail
is preferred).
--
    Jim Jagielski               |  "That is no ordinary rabbit... 'tis the
    jim@jagubox.gsfc.nasa.gov   |   most foul, cruel and bad-tempered
    NASA/GSFC, Code 734.4       |   rodent you ever set eyes on"
    Greenbelt, MD 20771         |                   Tim the Enchanter