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