1258945Sroberto------------- 2258945SrobertoINTRODUCTION: 3258945Sroberto------------- 4258945SrobertoLast revision: 06-Jul-1994 5258945Sroberto 6258945SrobertoIncluded in this distribution of XNTP V3 is a configuration file suitable 7258945Srobertofor use under Apple's A/UX Version 3.x.x There is also one for A/UX 2.0.1 8258945Srobertobut it has not been fully tested. To make the executables follow the steps 9258945Srobertooutlined below. 10258945Sroberto 11258945Sroberto*** NOTE: You must have gcc installed to successfully compile the current 12258945Srobertodistribution; the native cc supplied with A/UX will NOT correctly compile 13258945Srobertothis source. See the FAQ in comp.unix.aux for places to obtain gcc from 14258945Srobertoand how to install it. 15258945Sroberto 16258945Sroberto---------------------- 17258945SrobertoMAKING XNTPD FOR A/UX: 18258945Sroberto---------------------- 19258945Sroberto 20258945SrobertoFirst, you need to create the makefiles (after you've downloaded the 21258945Srobertosource, of course): 22258945Sroberto 23258945Sroberto % make clean 24258945Sroberto % make refconf 25258945Sroberto 26258945SrobertoAfter that, you should edit Config.local to make sure that BINDIR is 27258945Srobertocorrect for where you wish the programs to be "installed". The default 28258945Sroberto(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and 29258945SrobertoCLOCKDEFS are commented out! Presently, only the LOCAL_CLOCK/REFCLOCK 30258945Srobertoclock is used and supported. 31258945Sroberto 32258945Sroberto 33258945SrobertoAfter this is done (you should be told that your system is A/UX 3), make 34258945Sroberto'xntpd' (the options to 'gcc' are held in compilers/aux3.gcc): 35258945Sroberto 36258945Sroberto % make 37258945Sroberto 38258945SrobertoI do not normally use the `make install' option and so have not verified its 39258945Srobertocompatibility with A/UX. Rather, I pull out each of the executables and 40258945Srobertoplace them in the locally appropriate locations. 41258945Sroberto 42258945Sroberto--------------- 43258945SrobertoSTARTING XNTPD: 44258945Sroberto--------------- 45258945Sroberto 46258945SrobertoAt this point you need to set things up so that 'xntpd' is started upon 47258945Srobertoboot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab 48258945Srobertoor, more ideally, create and use an /etc/rc.local file. Since rc.local is 49258945Srobertowhat I recommend, here's how you do it: 50258945Sroberto 51258945SrobertoBy default, A/UX doesn't have rc.local, so you'll need to add the following to 52258945Sroberto/etc/inittab: 53258945Sroberto 54258945Sroberto net6:2:wait:/etc/syslogd # set to "wait" to run a syslog daemon 55258945Sroberto+ jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1 # Local stuff 56258945Sroberto dbg2::wait:/etc/telinit v # turn off init's verbose mode 57258945Sroberto 58258945SrobertoNow, the look of a sample /etc/rc.local is as follows: 59258945Sroberto 60258945Sroberto #!/bin/sh 61258945Sroberto : 62258945Sroberto : rc.local 63258945Sroberto : 64258945Sroberto # @(#)Copyright Apple Computer 1987 Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12) 65258945Sroberto 66258945Sroberto 67258945Sroberto # Push line discipline/set the device so it will print 68258945Sroberto /etc/line_sane 1 69258945Sroberto echo " " 70258945Sroberto echo "Entering rc.local..." 71258945Sroberto 72258945Sroberto set `/bin/who -r` 73258945Sroberto if [ "$7" = 2 ] 74258945Sroberto then 75258945Sroberto /bin/echo " now setting the time..." 76258945Sroberto /usr/local/etc/ntpdate -s -b <host.domain> 77258945Sroberto sleep 5 78258945Sroberto # 79258945Sroberto # start up 'xntpd' if we want 80258945Sroberto # 81258945Sroberto if [ -f /etc/ntp.conf ] 82258945Sroberto then 83258945Sroberto /bin/echo " setting tick and tickadj..." 84258945Sroberto /usr/local/etc/tickadj -t 16672 -a 54 85258945Sroberto sleep 5 86258945Sroberto /bin/echo " starting xntpd..." 87258945Sroberto /usr/local/etc/xntpd <&- > /dev/null 2>&1 88258945Sroberto sleep 5 89258945Sroberto fi 90258945Sroberto # 91258945Sroberto fi 92258945Sroberto 93258945Sroberto echo "Leaving rc.local..." 94258945Sroberto 95258945SrobertoThere are a few things to notice about the above: 96258945Sroberto 97258945Sroberto o When run, 'ntpdate' forces your clock to the time returned by the 98258945Sroberto host(s) specified by <host.domain> (you'll need to replace this 99258945Sroberto be the IP address(es) of your timehosts. This is good since it gets 100258945Sroberto things close to start off with. You can use more than one time 101258945Sroberto server. 102258945Sroberto 103258945Sroberto o 'tickadj' is also called. This does two things: changes the 104258945Sroberto default value of 'tick' (which the the amount of time, in ms, that 105258945Sroberto is added to the clock every 1/60 seconds) and changes the value 106258945Sroberto of 'tickadj' which the the amount that is added or subtracted 107258945Sroberto from 'tickadj' when adjtime() is called. 108258945Sroberto 109258945Sroberto Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of 110258945Sroberto having A/UX add the default of 16666ms every 1/60th of a second, you 111258945Sroberto may want it to add more (or less) so that it keeps better time. The 112258945Sroberto above value works for me but your "best" value may be different and 113258945Sroberto will likely require some fooling around to find the best value. As a 114258945Sroberto general rule of thumb, if you see 'xntpd' make a lot of negative clock 115258945Sroberto adjustments, then your clock is fast and you'll need to _decrease_ 116258945Sroberto the value of 'tick'. If your adjustments are positive, then you need 117258945Sroberto to increase 'tick'. To make a guess on how fast/slow your clock is, 118258945Sroberto use 'ntpdate' to sync your clock. Now watch 'xntpd' and see how it 119258945Sroberto operates. If, for example, it resets your clock by 1 second every 30 120258945Sroberto minutes, then your clock is (1/(30*60)) is about 0.056% off and you'll 121258945Sroberto need to adjust 'tick' by 16666*0.00056 or about 9 (i.e. 'tick' should 122258945Sroberto be ~16675 if slow or ~16657 if fast) 123258945Sroberto 124258945Sroberto A/UX's default value of 'tickadj' is 1666 which is too big for 125258945Sroberto 'xntpd'... so it also needs to be adjusted. I like using larger 126258945Sroberto values then the recommended value of 9 for 'tickadj' (although not 127258945Sroberto anything near as big as 1666) since this allows for quick slews 128258945Sroberto when adjusting the clock. Even with semi-large values of 'tickadj' 129258945Sroberto (~200), getting 5ms (1/200 s) accuracy is easy. 130258945Sroberto 131258945Sroberto 132258945SrobertoFinally, before A/UX and 'xntpd' will work happily together, you need to 133258945Srobertopatch the kernel. This is due to the fact that A/UX attempts to keep the 134258945SrobertoUNIX-software clock and the Mac-hardware clock in sync. Neither the h/w or 135258945Srobertothe s/w clock are too accurate. Also, 'xntpd' will be attempting to adjust 136258945Srobertothe software clock as well, so having A/UX muck around with it is asking 137258945Srobertofor headaches. What you therefore need to do is tell the kernel _not_ to 138258945Srobertosync the s/w clock with the h/w one. This is done using 'adb'. The 139258945Srobertofollowing is a shell script that will do the patch for you: 140258945Sroberto 141258945Sroberto #! /bin/sh 142258945Sroberto adb -w /unix <<! 143258945Sroberto init_time_fix_timeout?4i 144258945Sroberto init_time_fix_timeout?w 0x4e75 145258945Sroberto init_time_fix_timeout?4i 146258945Sroberto $q 147258945Sroberto ! 148258945Sroberto 149258945SrobertoThis must be done _every_ time you create a new kernel (via newconfig or 150258945Srobertonewunix) or else 'xntpd' will go crazy. 151258945Sroberto 152258945Sroberto-------- 153258945SrobertoHISTORY: 154258945Sroberto-------- 155258945Sroberto 156258945SrobertoJohn Dundas was the original porter of 'xntpd' and a lot of the additions 157258945Srobertoand A/UX-ports are from him. I got involved when I wanted to run 'xntpd' 158258945Srobertoon jagubox. It was also around this time that the base-patchlevel of 159258945Sroberto'xntpd' changed relatively (the so-called "jones" version). Since then, 160258945SrobertoI've been maintaining 'xntpd' for A/UX for the xntp development team 161258945Sroberto 162258945SrobertoThe original kernel patch (which patched 'time_fix_timeout') was from 163258945SrobertoRichard Todd. I suggest patching 'init_time_fix_timeout' which prevents 164258945Sroberto'time_fix_timeout' from even being called. 165258945Sroberto 166258945Sroberto---------------- 167258945SrobertoTECHNICAL NOTES: 168258945Sroberto---------------- 169258945Sroberto 170258945Sroberto o As configured (see machines/aux3), 'xntpd' will log messages via syslogd 171258945Sroberto using the LOC_LOCAL1 facility. I would suggest the following in 172258945Sroberto /etc/syslog.conf: 173258945Sroberto 174258945Sroberto local1.notice /usr/adm/ntpd-syslog 175258945Sroberto 176258945Sroberto o As mentioned above, the clocks on A/UX and Macs are kinda bad. Not 177258945Sroberto only that, but logging in and out of the MacOS mode as well as 178258945Sroberto extensive floppy use causes A/UX to drop and lose clock interupts 179258945Sroberto (these are sent every 1/60th of a second). So, if you do these 180258945Sroberto activities a lot, you find out that you lose about 300ms of time 181258945Sroberto (i.e., you become 300ms slow). 'xntpd' default way of handling this 182258945Sroberto is to called 'settimeofday()' and step the clock to the correct 183258945Sroberto time. I prefer having 'xntpd' slew the clock back into line by 184258945Sroberto making gradual adjustments to the clock over a coupla minutes 185258945Sroberto or so. It's for this reason that SLEWALWAYS is defined in 186258945Sroberto include/ntp_machine.h for SYS_AUX3. It's also for this reason than 187258945Sroberto I like larger values of 'tickadj'. 188258945Sroberto 189258945SrobertoGood luck! If you have problems under A/UX feel free to contact me (e-mail 190258945Srobertois preferred). 191258945Sroberto-- 192258945Sroberto Jim Jagielski | "That is no ordinary rabbit... 'tis the 193258945Sroberto jim@jagubox.gsfc.nasa.gov | most foul, cruel and bad-tempered 194258945Sroberto NASA/GSFC, Code 734.4 | rodent you ever set eyes on" 195258945Sroberto Greenbelt, MD 20771 | Tim the Enchanter 196