]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ntp/html/build/hints/vxworks.html
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ntp / html / build / hints / vxworks.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3 <html>
4
5     <head>
6         <title>vxWorks Port of NTP</title>
7         <link href="scripts/style.css" type="text/css" rel="stylesheet">
8     </head>
9
10     <body link="#00008B" vlink="#8B0000">
11         <h1>VxWorks port of NTP</h1>
12         <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>
13         <h1><b>Configuration issues</b></h1>
14         <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>
15         <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>
16         <p><blink>WARNING: Check you are not overwriting files, before entering the following: there should be no conflict, but check first... </blink></p>
17         <p>export CC=&quot;cc386 -nostdlib -m486 -DCPU=I80486 -I/usr/wind/target/h&quot;<br>
18             export RANLIB=ranlib386<br>
19             export AR=ar386<br>
20             export VX_KERNEL=/usr/wind/target/config/ims_std_bsp/vxWorks<br>
21             cd /usr/wind/target/sys<br>
22             ln -s ../signal.h<br>
23             ln -s ../time.h<br>
24             ln -s socket.h sockio.h<br>
25             ln -s ../selectLib.h select.h<br>
26             ln -s ../timers.h<br>
27             touch file.h param.h resource.h utsname.h var.h ../netdb.h ../a.out.h ../termios.h<br>
28             echo &quot; ******ADD #include \&quot;sys/times.h\&quot; to sys/time.h &quot;</p>
29         <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>
30             sed -e 's%main.*()%vxmain()%' configure &gt; configure.vxnew<br>
31             mv configure.vxnew configure<br>
32             chmod 755 configure</p>
33         <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 &quot;ntpd_LDADD = $(LDADD) -lm&quot; by removing the &quot;-lm&quot;.<br>
34             You are now ready to compile</p>
35         <p><br>
36             The <a href="../../configure.in">configure.in </a>file needed to be altered to allow for a host-target configuration to take place.</p>
37         <ul>
38             <li>The define SYS_VXWORKS was added to the compilation flags.
39             <li>Little endianess is set if the target is of type iX86.
40             <li>The size of char, integer, long values are all set. If Wind River ever changes these values they will need to be updated.
41             <li>clock_settime() is defined to be used for setting the clock.
42             <li>The Linking flags have -r added to allow for relinking into the vxWorks kernel
43         </ul>
44         <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>
45         <ul>
46             <li>There is now a NO_MAIN_ALLOWED define that simulates command line args, this allows the use of the normal startup sysntax.
47             <li>POSIX timers have been added.
48             <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.
49         </ul>
50         <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>
51         <h1><b>Compilation issues</b></h1>
52         <p>You will need autoconf and automake ... available free from the gnu archives worldwide.</p>
53         <p>The variable arch is the target architecture (e.g. i486)</p>
54         <p>mkdir A.vxworks (or whatever....)<br>
55             cd A.vxworks<br>
56             ../configure --target=arch-wrs-vxworks [any other options]<br>
57             make</p>
58         <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>
59         <h1>Running the software</h1>
60         <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>
61         <p>ld &lt; ntpdate/ntpdate<br>
62             ld &lt; ntpd/ntpd<br>
63             ld &lt; ntptrace/ntptrace<br>
64             ld &lt; ntpq/ntpq<br>
65             ld &lt; ntpdc/ntpdc<br>
66             ntpdate (&quot;-b&quot;, &quot;192.168.0.245&quot;)<br>
67             sp(ntpd, &quot;-c&quot;, &quot;/export/home/casey/ntp/ntp.conf&quot;)<br>
68             ntpdc(&quot;-c&quot;, &quot;monlist&quot;, &quot;192.168.0.244&quot;)<br>
69             ntpq(&quot;-c&quot;, &quot;peers&quot;, &quot;192.168.0.244&quot;)<br>
70             ntptrace(&quot;192.168.0.244&quot;)<br>
71         </p>
72         <h1>Bugs and such</h1>
73         <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>
74         <p><br>
75         </p>
76         <p>Casey Crellin<br>
77             <a href="mailto:casey@csc.co.za">casey@csc.co.za</a></p>
78         <p><br>
79         </p>
80     </body>
81
82 </html>