VxWorks under Linux
In July of 1999, I finally got serious about getting a VxWorks development
environment set up to run on a fast Linux PC. For many years prior to this,
I had been running VxWorks 5.1 on motorola targets (mvme147 and mvme167
boards), and doing development on Sun sparc hosts. I actually tackled a
number of transitions in parallel at this time: A transition from 5.1 to
5.3.1 and tornado; A transition from m68k to pc486 targets; and a transition
from sun hosts to linux hosts.
Tools for x86 targets
For several reasons, I decided to tackle the pc486 targets first. Most
of all, I was eager to start trying the new pc486 board support package.
I began by looking at the Sparta
VxWorks home page, which I found invaluable, but not infallible. My
notes here are my adaptation and augmentation of the methods they describe.
In the instructions below, I mention a number of files that must be
added or changed in the standard Gnu distribution. These are all available
here
as a compressed tar file, or you can try to browse what I have here.
The first thing is to get the wind distribution onto my linux machine.
I put it into /u1/wind, but you can put it where you like. In my case I
just copied verbatim what we had installed on our sun host, which included
both the m68k and pc486 packages and all the sun host executables and tornado
stuff which will almost certainly be of no use on a linux system. I then
made an empty directory /u1/wind/host/linux to hold the new linux host
tools I am going to build.
The next thing is to get the Gnu tools. In my case this was binutils-2.9.1
and gcc-2.8.1 (at the time of this writing, these are the latest versions
that are official releases). I placed the source trees for both of these
in /u1/vxtools/src,
No gdb at this time, maybe someday, but I have lived my VxWorks life
just fine without gdb support thus far and may continue to do so. I am
also ignoring C++ for now and the forseeable future.
Binutils
Building binutils comes first, (this must be done before trying to build
gcc). Two files must be modified as follows:
-
bfd/config.bfd
-
ld/configure.tgt
The files I used are available in one package (see below). Once these are
in place, I did the build in a separate directory as follows:
-
mkdir /u1/vxtools/src/binutils-2.9.1/vx86
-
cd /u1/vxtools/src/binutils-2.9.1/vx86
-
../configure --target=i386-wrs-vxworks --prefix=/u1/wind/host/linux --exec-prefix=/u1/wind/host/linux
-
make ; make install
A couple of points about all of this. First I am doing the build in the
directory ./vx86 since I anticipate later creating a parallel directory
./vx68k to build the motorola cross tools from the same tree. Second, I
just let configure determine the build and host system, which it does just
fine. Third, I place the tools I build right where I want them. Lastly,
in my case, I use the -j 5 switch to make since I have a dual cpu system
and want to hurry things along. I actually put the configure and make commands
in a script I call ./vx86/BUILD since I hate having to type that long configure
line more than once.
Gcc
Building gcc is pretty much the same game as for binutils. Three files
need to be changed or added:
-
./configure
-
config/i386/t-vxworks
-
config/i386/vx386.h
The files I used are available in one package (see below). Once the files
are in place, I again create a separate directory ./vx86 to build in, place
my BUILD script in it and go to it.
Back in April when I first tried all of this, the build fell on its
face in the midst of objc (trying to build objective C). Since I don't
want objective C (or C++ for that matter), the solution is just to avoid
it, which is neatly done by telling make that you just want to build C
as follows:
-
make LANGUAGES=c ; make LANGUAGES=c install
Tools for m68k targets
This is pretty simple after doing the x86. binutils and gcc support the
target m68k-wrs-vxworks right out of the box, and that is good enough for
me. To build binutils, I did:
-
cd /u1/vxtools/src/binutils-2.9.1
-
mkdir vx68k
-
cd vx68k
-
../configure --target=m68k-wrs-vxworks --prefix=/u1/wind/host/linux --exec-prefix=/u1/wind/host/linux
-
make ; make install
And indeed, lots of new things appear in /u1/wind/host/linux/bin.
To build gcc, It is pretty much the same:
-
cd /u1/vxtools/src/gcc-2.8.1
-
mkdir vx68k
-
cd vx68k
-
../configure --target=m68k-wrs-vxworks --prefix=/u1/wind/host/linux --exec-prefix=/u1/wind/host/linux
-
make LANGUAGES=c; make LANGUAGES=c install
Setup
Now you are almost there. What I do next is to go into /u1/wind/host/linux/bin
and make a bunch of links like:
-
ln -s i386-wrs-vxworks-gcc cc386
I have a script called "LINKS" that does all of this you should want to
do. Then you are ready to try things out. What I did was try to rebuild
a vxWorks kernel for the pc486 target. Some of the host utilities are missing
to to do this. Some like vxsize are just shell scripts that can be copied
from whatever host distribution you have. Others like munch and xsym I
was able to hack together and provide in my package of files.
I use a script called "vxmake" which is in my path to invoke make with
the appropriate environment, and I provide a copy in my collection of files.
This script sets up an environment so that to build a kernel for instance,
I just do this:
-
cd /u1/wind/target/config/pc486
-
vxmake
Have any comments? Questions? Drop
me a line!
Adventures in Computing / ttrebisky@as.arizona.edu