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