1290001Sglebius------------- 2290001SglebiusINTRODUCTION: 3290001Sglebius------------- 4290001SglebiusLast revision: 06-Jul-1994 5290001Sglebius 6290001SglebiusIncluded in this distribution of XNTP V3 is a configuration file suitable 7290001Sglebiusfor use under Apple's A/UX Version 3.x.x There is also one for A/UX 2.0.1 8290001Sglebiusbut it has not been fully tested. To make the executables follow the steps 9290001Sglebiusoutlined below. 10290001Sglebius 11290001Sglebius*** NOTE: You must have gcc installed to successfully compile the current 12290001Sglebiusdistribution; the native cc supplied with A/UX will NOT correctly compile 13290001Sglebiusthis source. See the FAQ in comp.unix.aux for places to obtain gcc from 14290001Sglebiusand how to install it. 15290001Sglebius 16290001Sglebius---------------------- 17290001SglebiusMAKING XNTPD FOR A/UX: 18290001Sglebius---------------------- 19290001Sglebius 20290001SglebiusFirst, you need to create the makefiles (after you've downloaded the 21290001Sglebiussource, of course): 22290001Sglebius 23290001Sglebius % make clean 24290001Sglebius % make refconf 25290001Sglebius 26290001SglebiusAfter that, you should edit Config.local to make sure that BINDIR is 27290001Sglebiuscorrect for where you wish the programs to be "installed". The default 28290001Sglebius(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and 29290001SglebiusCLOCKDEFS are commented out! Presently, only the LOCAL_CLOCK/REFCLOCK 30290001Sglebiusclock is used and supported. 31290001Sglebius 32290001Sglebius 33290001SglebiusAfter this is done (you should be told that your system is A/UX 3), make 34290001Sglebius'xntpd' (the options to 'gcc' are held in compilers/aux3.gcc): 35290001Sglebius 36290001Sglebius % make 37290001Sglebius 38290001SglebiusI do not normally use the `make install' option and so have not verified its 39290001Sglebiuscompatibility with A/UX. Rather, I pull out each of the executables and 40290001Sglebiusplace them in the locally appropriate locations. 41290001Sglebius 42290001Sglebius--------------- 43290001SglebiusSTARTING XNTPD: 44290001Sglebius--------------- 45290001Sglebius 46290001SglebiusAt this point you need to set things up so that 'xntpd' is started upon 47290001Sglebiusboot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab 48290001Sglebiusor, more ideally, create and use an /etc/rc.local file. Since rc.local is 49290001Sglebiuswhat I recommend, here's how you do it: 50290001Sglebius 51290001SglebiusBy default, A/UX doesn't have rc.local, so you'll need to add the following to 52290001Sglebius/etc/inittab: 53290001Sglebius 54290001Sglebius net6:2:wait:/etc/syslogd # set to "wait" to run a syslog daemon 55290001Sglebius+ jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1 # Local stuff 56290001Sglebius dbg2::wait:/etc/telinit v # turn off init's verbose mode 57290001Sglebius 58290001SglebiusNow, the look of a sample /etc/rc.local is as follows: 59290001Sglebius 60290001Sglebius #!/bin/sh 61290001Sglebius : 62290001Sglebius : rc.local 63290001Sglebius : 64290001Sglebius # @(#)Copyright Apple Computer 1987 Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12) 65290001Sglebius 66290001Sglebius 67290001Sglebius # Push line discipline/set the device so it will print 68290001Sglebius /etc/line_sane 1 69290001Sglebius echo " " 70290001Sglebius echo "Entering rc.local..." 71290001Sglebius 72290001Sglebius set `/bin/who -r` 73290001Sglebius if [ "$7" = 2 ] 74290001Sglebius then 75290001Sglebius /bin/echo " now setting the time..." 76290001Sglebius /usr/local/etc/ntpdate -s -b <host.domain> 77290001Sglebius sleep 5 78290001Sglebius # 79290001Sglebius # start up 'xntpd' if we want 80290001Sglebius # 81290001Sglebius if [ -f /etc/ntp.conf ] 82290001Sglebius then 83290001Sglebius /bin/echo " setting tick and tickadj..." 84290001Sglebius /usr/local/etc/tickadj -t 16672 -a 54 85290001Sglebius sleep 5 86290001Sglebius /bin/echo " starting xntpd..." 87290001Sglebius /usr/local/etc/xntpd <&- > /dev/null 2>&1 88290001Sglebius sleep 5 89290001Sglebius fi 90290001Sglebius # 91290001Sglebius fi 92290001Sglebius 93290001Sglebius echo "Leaving rc.local..." 94290001Sglebius 95290001SglebiusThere are a few things to notice about the above: 96290001Sglebius 97290001Sglebius o When run, 'ntpdate' forces your clock to the time returned by the 98290001Sglebius host(s) specified by <host.domain> (you'll need to replace this 99290001Sglebius be the IP address(es) of your timehosts. This is good since it gets 100290001Sglebius things close to start off with. You can use more than one time 101290001Sglebius server. 102290001Sglebius 103290001Sglebius o 'tickadj' is also called. This does two things: changes the 104290001Sglebius default value of 'tick' (which the the amount of time, in ms, that 105290001Sglebius is added to the clock every 1/60 seconds) and changes the value 106290001Sglebius of 'tickadj' which the the amount that is added or subtracted 107290001Sglebius from 'tickadj' when adjtime() is called. 108290001Sglebius 109290001Sglebius Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of 110290001Sglebius having A/UX add the default of 16666ms every 1/60th of a second, you 111290001Sglebius may want it to add more (or less) so that it keeps better time. The 112290001Sglebius above value works for me but your "best" value may be different and 113290001Sglebius will likely require some fooling around to find the best value. As a 114290001Sglebius general rule of thumb, if you see 'xntpd' make a lot of negative clock 115290001Sglebius adjustments, then your clock is fast and you'll need to _decrease_ 116290001Sglebius the value of 'tick'. If your adjustments are positive, then you need 117290001Sglebius to increase 'tick'. To make a guess on how fast/slow your clock is, 118290001Sglebius use 'ntpdate' to sync your clock. Now watch 'xntpd' and see how it 119290001Sglebius operates. If, for example, it resets your clock by 1 second every 30 120290001Sglebius minutes, then your clock is (1/(30*60)) is about 0.056% off and you'll 121290001Sglebius need to adjust 'tick' by 16666*0.00056 or about 9 (i.e. 'tick' should 122290001Sglebius be ~16675 if slow or ~16657 if fast) 123290001Sglebius 124290001Sglebius A/UX's default value of 'tickadj' is 1666 which is too big for 125290001Sglebius 'xntpd'... so it also needs to be adjusted. I like using larger 126290001Sglebius values then the recommended value of 9 for 'tickadj' (although not 127290001Sglebius anything near as big as 1666) since this allows for quick slews 128290001Sglebius when adjusting the clock. Even with semi-large values of 'tickadj' 129290001Sglebius (~200), getting 5ms (1/200 s) accuracy is easy. 130290001Sglebius 131290001Sglebius 132290001SglebiusFinally, before A/UX and 'xntpd' will work happily together, you need to 133290001Sglebiuspatch the kernel. This is due to the fact that A/UX attempts to keep the 134290001SglebiusUNIX-software clock and the Mac-hardware clock in sync. Neither the h/w or 135290001Sglebiusthe s/w clock are too accurate. Also, 'xntpd' will be attempting to adjust 136290001Sglebiusthe software clock as well, so having A/UX muck around with it is asking 137290001Sglebiusfor headaches. What you therefore need to do is tell the kernel _not_ to 138290001Sglebiussync the s/w clock with the h/w one. This is done using 'adb'. The 139290001Sglebiusfollowing is a shell script that will do the patch for you: 140290001Sglebius 141290001Sglebius #! /bin/sh 142290001Sglebius adb -w /unix <<! 143290001Sglebius init_time_fix_timeout?4i 144290001Sglebius init_time_fix_timeout?w 0x4e75 145290001Sglebius init_time_fix_timeout?4i 146290001Sglebius $q 147290001Sglebius ! 148290001Sglebius 149290001SglebiusThis must be done _every_ time you create a new kernel (via newconfig or 150290001Sglebiusnewunix) or else 'xntpd' will go crazy. 151290001Sglebius 152290001Sglebius-------- 153290001SglebiusHISTORY: 154290001Sglebius-------- 155290001Sglebius 156290001SglebiusJohn Dundas was the original porter of 'xntpd' and a lot of the additions 157290001Sglebiusand A/UX-ports are from him. I got involved when I wanted to run 'xntpd' 158290001Sglebiuson jagubox. It was also around this time that the base-patchlevel of 159290001Sglebius'xntpd' changed relatively (the so-called "jones" version). Since then, 160290001SglebiusI've been maintaining 'xntpd' for A/UX for the xntp development team 161290001Sglebius 162290001SglebiusThe original kernel patch (which patched 'time_fix_timeout') was from 163290001SglebiusRichard Todd. I suggest patching 'init_time_fix_timeout' which prevents 164290001Sglebius'time_fix_timeout' from even being called. 165290001Sglebius 166290001Sglebius---------------- 167290001SglebiusTECHNICAL NOTES: 168290001Sglebius---------------- 169290001Sglebius 170290001Sglebius o As configured (see machines/aux3), 'xntpd' will log messages via syslogd 171290001Sglebius using the LOC_LOCAL1 facility. I would suggest the following in 172290001Sglebius /etc/syslog.conf: 173290001Sglebius 174290001Sglebius local1.notice /usr/adm/ntpd-syslog 175290001Sglebius 176290001Sglebius o As mentioned above, the clocks on A/UX and Macs are kinda bad. Not 177290001Sglebius only that, but logging in and out of the MacOS mode as well as 178290001Sglebius extensive floppy use causes A/UX to drop and lose clock interupts 179290001Sglebius (these are sent every 1/60th of a second). So, if you do these 180290001Sglebius activities a lot, you find out that you lose about 300ms of time 181290001Sglebius (i.e., you become 300ms slow). 'xntpd' default way of handling this 182290001Sglebius is to called 'settimeofday()' and step the clock to the correct 183290001Sglebius time. I prefer having 'xntpd' slew the clock back into line by 184290001Sglebius making gradual adjustments to the clock over a coupla minutes 185290001Sglebius or so. It's for this reason that SLEWALWAYS is defined in 186290001Sglebius include/ntp_machine.h for SYS_AUX3. It's also for this reason than 187290001Sglebius I like larger values of 'tickadj'. 188290001Sglebius 189290001SglebiusGood luck! If you have problems under A/UX feel free to contact me (e-mail 190290001Sglebiusis preferred). 191290001Sglebius-- 192290001Sglebius Jim Jagielski | "That is no ordinary rabbit... 'tis the 193290001Sglebius jim@jagubox.gsfc.nasa.gov | most foul, cruel and bad-tempered 194290001Sglebius NASA/GSFC, Code 734.4 | rodent you ever set eyes on" 195290001Sglebius Greenbelt, MD 20771 | Tim the Enchanter 196