a-ux revision 181834
1181834Sroberto------------- 2181834SrobertoINTRODUCTION: 3181834Sroberto------------- 4181834SrobertoLast revision: 06-Jul-1994 5181834Sroberto 6181834SrobertoIncluded in this distribution of XNTP V3 is a configuration file suitable 7181834Srobertofor use under Apple's A/UX Version 3.x.x There is also one for A/UX 2.0.1 8181834Srobertobut it has not been fully tested. To make the executables follow the steps 9181834Srobertooutlined below. 10181834Sroberto 11181834Sroberto*** NOTE: You must have gcc installed to successfully compile the current 12181834Srobertodistribution; the native cc supplied with A/UX will NOT correctly compile 13181834Srobertothis source. See the FAQ in comp.unix.aux for places to obtain gcc from 14181834Srobertoand how to install it. 15181834Sroberto 16181834Sroberto---------------------- 17181834SrobertoMAKING XNTPD FOR A/UX: 18181834Sroberto---------------------- 19181834Sroberto 20181834SrobertoFirst, you need to create the makefiles (after you've downloaded the 21181834Srobertosource, of course): 22181834Sroberto 23181834Sroberto % make clean 24181834Sroberto % make refconf 25181834Sroberto 26181834SrobertoAfter that, you should edit Config.local to make sure that BINDIR is 27181834Srobertocorrect for where you wish the programs to be "installed". The default 28181834Sroberto(and what I use) is /usr/local/etc. Make sure that DEFS_LOCAL and 29181834SrobertoCLOCKDEFS are commented out! Presently, only the LOCAL_CLOCK/REFCLOCK 30181834Srobertoclock is used and supported. 31181834Sroberto 32181834Sroberto 33181834SrobertoAfter this is done (you should be told that your system is A/UX 3), make 34181834Sroberto'xntpd' (the options to 'gcc' are held in compilers/aux3.gcc): 35181834Sroberto 36181834Sroberto % make 37181834Sroberto 38181834SrobertoI do not normally use the `make install' option and so have not verified its 39181834Srobertocompatibility with A/UX. Rather, I pull out each of the executables and 40181834Srobertoplace them in the locally appropriate locations. 41181834Sroberto 42181834Sroberto--------------- 43181834SrobertoSTARTING XNTPD: 44181834Sroberto--------------- 45181834Sroberto 46181834SrobertoAt this point you need to set things up so that 'xntpd' is started upon 47181834Srobertoboot-up. You can do this in 1 of 2 ways: either add entries in /etc/inittab 48181834Srobertoor, more ideally, create and use an /etc/rc.local file. Since rc.local is 49181834Srobertowhat I recommend, here's how you do it: 50181834Sroberto 51181834SrobertoBy default, A/UX doesn't have rc.local, so you'll need to add the following to 52181834Sroberto/etc/inittab: 53181834Sroberto 54181834Sroberto net6:2:wait:/etc/syslogd # set to "wait" to run a syslog daemon 55181834Sroberto+ jmj0:2:wait:/etc/rc.local 1>/dev/syscon 2>&1 # Local stuff 56181834Sroberto dbg2::wait:/etc/telinit v # turn off init's verbose mode 57181834Sroberto 58181834SrobertoNow, the look of a sample /etc/rc.local is as follows: 59181834Sroberto 60181834Sroberto #!/bin/sh 61181834Sroberto : 62181834Sroberto : rc.local 63181834Sroberto : 64181834Sroberto # @(#)Copyright Apple Computer 1987 Version 1.17 of rc.sh on 91/11/08 15:56:21 (ATT 1.12) 65181834Sroberto 66181834Sroberto 67181834Sroberto # Push line discipline/set the device so it will print 68181834Sroberto /etc/line_sane 1 69181834Sroberto echo " " 70181834Sroberto echo "Entering rc.local..." 71181834Sroberto 72181834Sroberto set `/bin/who -r` 73181834Sroberto if [ "$7" = 2 ] 74181834Sroberto then 75181834Sroberto /bin/echo " now setting the time..." 76181834Sroberto /usr/local/etc/ntpdate -s -b <host.domain> 77181834Sroberto sleep 5 78181834Sroberto # 79181834Sroberto # start up 'xntpd' if we want 80181834Sroberto # 81181834Sroberto if [ -f /etc/ntp.conf ] 82181834Sroberto then 83181834Sroberto /bin/echo " setting tick and tickadj..." 84181834Sroberto /usr/local/etc/tickadj -t 16672 -a 54 85181834Sroberto sleep 5 86181834Sroberto /bin/echo " starting xntpd..." 87181834Sroberto /usr/local/etc/xntpd <&- > /dev/null 2>&1 88181834Sroberto sleep 5 89181834Sroberto fi 90181834Sroberto # 91181834Sroberto fi 92181834Sroberto 93181834Sroberto echo "Leaving rc.local..." 94181834Sroberto 95181834SrobertoThere are a few things to notice about the above: 96181834Sroberto 97181834Sroberto o When run, 'ntpdate' forces your clock to the time returned by the 98181834Sroberto host(s) specified by <host.domain> (you'll need to replace this 99181834Sroberto be the IP address(es) of your timehosts. This is good since it gets 100181834Sroberto things close to start off with. You can use more than one time 101181834Sroberto server. 102181834Sroberto 103181834Sroberto o 'tickadj' is also called. This does two things: changes the 104181834Sroberto default value of 'tick' (which the the amount of time, in ms, that 105181834Sroberto is added to the clock every 1/60 seconds) and changes the value 106181834Sroberto of 'tickadj' which the the amount that is added or subtracted 107181834Sroberto from 'tickadj' when adjtime() is called. 108181834Sroberto 109181834Sroberto Now Mac clocks are pretty bad and tend to be slow. Sooo, instead of 110181834Sroberto having A/UX add the default of 16666ms every 1/60th of a second, you 111181834Sroberto may want it to add more (or less) so that it keeps better time. The 112181834Sroberto above value works for me but your "best" value may be different and 113181834Sroberto will likely require some fooling around to find the best value. As a 114181834Sroberto general rule of thumb, if you see 'xntpd' make a lot of negative clock 115181834Sroberto adjustments, then your clock is fast and you'll need to _decrease_ 116181834Sroberto the value of 'tick'. If your adjustments are positive, then you need 117181834Sroberto to increase 'tick'. To make a guess on how fast/slow your clock is, 118181834Sroberto use 'ntpdate' to sync your clock. Now watch 'xntpd' and see how it 119181834Sroberto operates. If, for example, it resets your clock by 1 second every 30 120181834Sroberto minutes, then your clock is (1/(30*60)) is about 0.056% off and you'll 121181834Sroberto need to adjust 'tick' by 16666*0.00056 or about 9 (i.e. 'tick' should 122181834Sroberto be ~16675 if slow or ~16657 if fast) 123181834Sroberto 124181834Sroberto A/UX's default value of 'tickadj' is 1666 which is too big for 125181834Sroberto 'xntpd'... so it also needs to be adjusted. I like using larger 126181834Sroberto values then the recommended value of 9 for 'tickadj' (although not 127181834Sroberto anything near as big as 1666) since this allows for quick slews 128181834Sroberto when adjusting the clock. Even with semi-large values of 'tickadj' 129181834Sroberto (~200), getting 5ms (1/200 s) accuracy is easy. 130181834Sroberto 131181834Sroberto 132181834SrobertoFinally, before A/UX and 'xntpd' will work happily together, you need to 133181834Srobertopatch the kernel. This is due to the fact that A/UX attempts to keep the 134181834SrobertoUNIX-software clock and the Mac-hardware clock in sync. Neither the h/w or 135181834Srobertothe s/w clock are too accurate. Also, 'xntpd' will be attempting to adjust 136181834Srobertothe software clock as well, so having A/UX muck around with it is asking 137181834Srobertofor headaches. What you therefore need to do is tell the kernel _not_ to 138181834Srobertosync the s/w clock with the h/w one. This is done using 'adb'. The 139181834Srobertofollowing is a shell script that will do the patch for you: 140181834Sroberto 141181834Sroberto #! /bin/sh 142181834Sroberto adb -w /unix <<! 143181834Sroberto init_time_fix_timeout?4i 144181834Sroberto init_time_fix_timeout?w 0x4e75 145181834Sroberto init_time_fix_timeout?4i 146181834Sroberto $q 147181834Sroberto ! 148181834Sroberto 149181834SrobertoThis must be done _every_ time you create a new kernel (via newconfig or 150181834Srobertonewunix) or else 'xntpd' will go crazy. 151181834Sroberto 152181834Sroberto-------- 153181834SrobertoHISTORY: 154181834Sroberto-------- 155181834Sroberto 156181834SrobertoJohn Dundas was the original porter of 'xntpd' and a lot of the additions 157181834Srobertoand A/UX-ports are from him. I got involved when I wanted to run 'xntpd' 158181834Srobertoon jagubox. It was also around this time that the base-patchlevel of 159181834Sroberto'xntpd' changed relatively (the so-called "jones" version). Since then, 160181834SrobertoI've been maintaining 'xntpd' for A/UX for the xntp development team 161181834Sroberto 162181834SrobertoThe original kernel patch (which patched 'time_fix_timeout') was from 163181834SrobertoRichard Todd. I suggest patching 'init_time_fix_timeout' which prevents 164181834Sroberto'time_fix_timeout' from even being called. 165181834Sroberto 166181834Sroberto---------------- 167181834SrobertoTECHNICAL NOTES: 168181834Sroberto---------------- 169181834Sroberto 170181834Sroberto o As configured (see machines/aux3), 'xntpd' will log messages via syslogd 171181834Sroberto using the LOC_LOCAL1 facility. I would suggest the following in 172181834Sroberto /etc/syslog.conf: 173181834Sroberto 174181834Sroberto local1.notice /usr/adm/ntpd-syslog 175181834Sroberto 176181834Sroberto o As mentioned above, the clocks on A/UX and Macs are kinda bad. Not 177181834Sroberto only that, but logging in and out of the MacOS mode as well as 178181834Sroberto extensive floppy use causes A/UX to drop and lose clock interupts 179181834Sroberto (these are sent every 1/60th of a second). So, if you do these 180181834Sroberto activities a lot, you find out that you lose about 300ms of time 181181834Sroberto (i.e., you become 300ms slow). 'xntpd' default way of handling this 182181834Sroberto is to called 'settimeofday()' and step the clock to the correct 183181834Sroberto time. I prefer having 'xntpd' slew the clock back into line by 184181834Sroberto making gradual adjustments to the clock over a coupla minutes 185181834Sroberto or so. It's for this reason that SLEWALWAYS is defined in 186181834Sroberto include/ntp_machine.h for SYS_AUX3. It's also for this reason than 187181834Sroberto I like larger values of 'tickadj'. 188181834Sroberto 189181834SrobertoGood luck! If you have problems under A/UX feel free to contact me (e-mail 190181834Srobertois preferred). 191181834Sroberto-- 192181834Sroberto Jim Jagielski | "That is no ordinary rabbit... 'tis the 193181834Sroberto jim@jagubox.gsfc.nasa.gov | most foul, cruel and bad-tempered 194181834Sroberto NASA/GSFC, Code 734.4 | rodent you ever set eyes on" 195181834Sroberto Greenbelt, MD 20771 | Tim the Enchanter 196