154 lines
5.5 KiB
HTML
154 lines
5.5 KiB
HTML
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>vxWorks Port of NTP</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY LINK="#00008B" VLINK="#8B0000">
|
||
|
|
||
|
<H1>VxWorks port of NTP </H1>
|
||
|
|
||
|
<P>Creating a port for vxWorks posed some problems. This port may help
|
||
|
as a starting point for similar ports to real-time OS's and other embeddable
|
||
|
kernels, particularly where main() is not allowed, and where the configure
|
||
|
scripts need to be altered. </P>
|
||
|
|
||
|
<H1><B>Configuration issues</B></H1>
|
||
|
|
||
|
<P>I decided to do as little invasive surgery as possible on the NTP code,
|
||
|
so I brought the vxWorks header tree in line with the standard unix tree.
|
||
|
The following changes were needed, as a side effect these changes will
|
||
|
allow for easy porting of other autoconfigure enabled code. </P>
|
||
|
|
||
|
<P>Where I have 386 you will need to put in your target type. The vxWorks
|
||
|
tree entry point is /usr/wind. If these are the same for your system, you
|
||
|
should be able to cut and paste the changes. </P>
|
||
|
|
||
|
<P><BLINK>WARNING: Check you are not overwriting files, before entering
|
||
|
the following: there should be no conflict, but check first... </BLINK></P>
|
||
|
|
||
|
<P>export CC="cc386 -nostdlib -m486 -DCPU=I80486 -I/usr/wind/target/h"
|
||
|
<BR>
|
||
|
export RANLIB=ranlib386 <BR>
|
||
|
export AR=ar386 <BR>
|
||
|
export VX_KERNEL=/usr/wind/target/config/ims_std_bsp/vxWorks <BR>
|
||
|
cd /usr/wind/target/sys <BR>
|
||
|
ln -s ../signal.h <BR>
|
||
|
ln -s ../time.h <BR>
|
||
|
ln -s socket.h sockio.h <BR>
|
||
|
ln -s ../selectLib.h select.h <BR>
|
||
|
ln -s ../timers.h <BR>
|
||
|
touch file.h param.h resource.h utsname.h var.h ../netdb.h ../a.out.h ../termios.h
|
||
|
<BR>
|
||
|
echo " ******ADD #include \"sys/times.h\" to sys/time.h
|
||
|
" </P>
|
||
|
|
||
|
<P>The configure script must be changed in the following way to get the
|
||
|
linking tests to work, once in the correct directory issue the following
|
||
|
commands: <BR>
|
||
|
sed -e 's%main.*()%vxmain()%' configure > configure.vxnew <BR>
|
||
|
mv configure.vxnew configure <BR>
|
||
|
chmod 755 configure </P>
|
||
|
<P>The new version 4 of NTP requires some maths functions so it links in the
|
||
|
maths library (-lm) in the ntpd <a href="../ntpd/Makefile.am">Makefile.am</a>
|
||
|
change the line "ntpd_LDADD = $(LDADD) -lm" by removing the "-lm".<BR>
|
||
|
You are now ready to compile</P>
|
||
|
|
||
|
|
||
|
<P><BR>
|
||
|
The <A HREF="../configure.in">configure.in </A>file needed to be altered
|
||
|
to allow for a host-target configuration to take place. </P>
|
||
|
|
||
|
<UL>
|
||
|
<LI>The define SYS_VXWORKS was added to the compilation flags. </LI>
|
||
|
|
||
|
<LI>Little endianess is set if the target is of type iX86. </LI>
|
||
|
|
||
|
<LI>The size of char, integer, long values are all set. If Wind River ever
|
||
|
changes these values they will need to be updated. </LI>
|
||
|
|
||
|
<LI>clock_settime() is defined to be used for setting the clock. </LI>
|
||
|
|
||
|
<LI>The Linking flags have -r added to allow for relinking into the vxWorks
|
||
|
kernel </LI>
|
||
|
</UL>
|
||
|
|
||
|
<P>Unfortunately I have had to make use of the <A HREF="../include/ntp_machine.h">ntp_machine.h
|
||
|
</A>file to add in the checks that would have been checked at linking stage
|
||
|
by autoconf, a better method should be devised. </P>
|
||
|
|
||
|
<UL>
|
||
|
<LI>There is now a NO_MAIN_ALLOWED define that simulates command line args,
|
||
|
this allows the use of the normal startup sysntax. </LI>
|
||
|
|
||
|
<LI>POSIX timers have been added. </LI>
|
||
|
|
||
|
<LI>Structures normally found in netdb.h have been added with, the corresponding
|
||
|
code is in <A HREF="../libntp/machines.c">machines.c </A>. Where possible
|
||
|
the defines for these have been kept non-vxWorks specific.</LI>
|
||
|
</UL>
|
||
|
|
||
|
<P>Unfortunately there are still quite a few SYS_VXWORKS type defines in
|
||
|
the source, but I have eliminated as many as possible. You have the choice
|
||
|
of using the usrtime.a library avaliable from the vxworks archives or forgoing
|
||
|
adjtime() and using the clock_[get|set]time().The <A HREF="../include/ntp_machine.h">ntp_machine.h
|
||
|
</A>file clearly marks how to do this. </P>
|
||
|
|
||
|
<H1><B>Compilation issues</B> </H1>
|
||
|
|
||
|
<P>You will need autoconf and automake ... available free from the gnu
|
||
|
archives worldwide. </P>
|
||
|
|
||
|
<P>The variable arch is the target architecture (e.g. i486) </P>
|
||
|
|
||
|
<P>mkdir A.vxworks (or whatever....) <BR>
|
||
|
cd A.vxworks <BR>
|
||
|
../configure --target=arch-wrs-vxworks [any other options] <BR>
|
||
|
make </P>
|
||
|
|
||
|
<P>Options I normally use are the --disable-all-clocks --enable-LOCAL-CLOCK flags.
|
||
|
The program should proceed to compile without problem. The daemon ntpd,
|
||
|
ntpdate, ntptrace, ntpdc, ntpq programs and of course the libraries are
|
||
|
all fully ported. The other utilities are not, but they should be easy
|
||
|
to port. </P>
|
||
|
|
||
|
<H1>Running the software </H1>
|
||
|
|
||
|
<P>Load in the various files, call them in the normal vxWorks function
|
||
|
type manner. Here are some examples. Refer to the man pages for further
|
||
|
information. </P>
|
||
|
|
||
|
<P>ld < ntpdate/ntpdate <BR>
|
||
|
ld < ntpd/ntpd <BR>
|
||
|
ld < ntptrace/ntptrace <BR>
|
||
|
ld < ntpq/ntpq <BR>
|
||
|
ld < ntpdc/ntpdc <BR>
|
||
|
ntpdate ("-b", "192.168.0.245") <BR>
|
||
|
sp(ntpd, "-c", "/export/home/casey/ntp/ntp.conf")
|
||
|
<BR>
|
||
|
ntpdc("-c", "monlist", "192.168.0.244")
|
||
|
<BR>
|
||
|
ntpq("-c", "peers", "192.168.0.244") <BR>
|
||
|
ntptrace("192.168.0.244") <BR>
|
||
|
</P>
|
||
|
|
||
|
<H1>Bugs and such </H1>
|
||
|
|
||
|
<P>Should you happen across any bugs, please let me know, or better yet
|
||
|
fix them and submit a patch. Remember to make you patch general for Vxworks,
|
||
|
not just for your particular architecture.
|
||
|
<A HREF="http://www.ccii.co.za">CCII Systems
|
||
|
(Pty) Ltd</A>, my ex employers, sponsored the time to this port.
|
||
|
Please let me know how it goes, I would be most interested in offsets
|
||
|
and configurations. </P>
|
||
|
|
||
|
<P><BR>
|
||
|
</P>
|
||
|
|
||
|
<P>Casey Crellin</A> <BR>
|
||
|
<A HREF="mailto:casey@csc.co.za">casey@csc.co.za</A> </P>
|
||
|
|
||
|
<P><BR>
|
||
|
</P>
|
||
|
|
||
|
</BODY>
|
||
|
</HTML>
|