Blame VxWorks/README

Packit 423ecb
             libxml2 on VxWorks 6.4+
Packit 423ecb
Packit 423ecb
Here are my instructions for building on VxWorks.... I am very ashamed of
Packit 423ecb
how I did this because it is a complete hack, but it works great, so I
Packit 423ecb
can't complain too much.
Packit 423ecb
Packit 423ecb
General Information
Packit 423ecb
Packit 423ecb
1. The only way to build for VxWorks is to cross compile from a windows or
Packit 423ecb
linux system.  We use a RedHat 5.1 workstation system as our build
Packit 423ecb
environment.
Packit 423ecb
Packit 423ecb
2. VxWorks 6.X has two main types of executable, DKMs (dynamic kernel
Packit 423ecb
modules), and RTPs (real-time processes).  Kernel modules are the bread
Packit 423ecb
and butter of VxWorks, but they look nothing like processes/threads in
Packit 423ecb
normal UNIX/Windows systems.  RTPs are more like processes that have
Packit 423ecb
memory protection, threads, etc.  VxWorks 6.X also introduces some level
Packit 423ecb
of POSIX conformance to their environment.  The POSIX conformance was the
Packit 423ecb
key for us to be able to port libxml2.  We support accessing libxml2 from
Packit 423ecb
both DKMs and RTPs.
Packit 423ecb
Packit 423ecb
3. There are 2 compilers for VxWorks, the WindRiver compiler, and a port
Packit 423ecb
of the GNU toolchain, we have only tested and built with the GNU
Packit 423ecb
toolchain.
Packit 423ecb
Packit 423ecb
How To Build
Packit 423ecb
Packit 423ecb
1. Run the configure on your native linux system (this is the cheesy
Packit 423ecb
hack).  Since the VxWorks GNU toolchain is very close in version to the
Packit 423ecb
one in red hat, it generates a good config.h file.  We configured libxml2
Packit 423ecb
with the following to keep the size down, (but we have done basic testing
Packit 423ecb
with everything compiled in).
Packit 423ecb
Packit 423ecb
./configure --with-minimum --with-reader --with-writer --with-regexps
Packit 423ecb
--with-threads --with-thread-alloc
Packit 423ecb
Packit 423ecb
2. Rename the libxml2 folder to "src".  This step is required for our
Packit 423ecb
replacement makefile to work.
Packit 423ecb
Packit 423ecb
3. Run the replacement makefile.  I wrote a new makefile that sets all the
Packit 423ecb
proper vxworks defines and uses the correct compilers.  The two defines on
Packit 423ecb
the make command line are to tell it which VxWorks Target (SH3.2 little
Packit 423ecb
endian), and the executable type.  We have tested this code on PENTIUM2gnu
Packit 423ecb
and SH32gnule.
Packit 423ecb
Packit 423ecb
This makefile creates a shared library that runs on VxWorks: (libxml2.so)
Packit 423ecb
make -f Makefile.vxworks clean all VXCPU=SH32gnule VXTYPE=RTP
Packit 423ecb
Packit 423ecb
This makefile creates a kernel module that runs on VxWorks: (xml2.out)
Packit 423ecb
make -f Makefile.vxworks clean all VXCPU=SH32gnule VXTYPE=DKM
Packit 423ecb
Packit 423ecb
Important Notes
Packit 423ecb
Packit 423ecb
1. There are several ways that this process could be improved, but at the
Packit 423ecb
end of the day, we make products, not port libraries, so we did a meets
Packit 423ecb
minimum for our needs.
Packit 423ecb
Packit 423ecb
2. VxWorks is the devil, give me embedded linux every day.
Packit 423ecb
Packit 423ecb
3. No matter what I tried, I couldn't get the configure to pick up the
Packit 423ecb
VxWorks toolchain, and in my investigation, it has something to do with
Packit 423ecb
automake/autoconf, not any individual package.  VxWorks doesn't play by
Packit 423ecb
the normal rules for building toolchains.
Packit 423ecb
Packit 423ecb
4. The PIC flag in VxWorks (especially for SH processors) is very
Packit 423ecb
important, and very troublesome.  On linux, you can liberally use the PIC
Packit 423ecb
flag when compiling and the compiler/linker will ignore it as needed, on
Packit 423ecb
VxWorks if must always be on for shared libraries, and always be off for
Packit 423ecb
static libraries and executables.
Packit 423ecb
Packit 423ecb
5. If anyone wants to work on a better way to do the build of libxml2 for
Packit 423ecb
VxWorks, I'm happy to help as much as I can, but I'm not looking to
Packit 423ecb
support it myself.
Packit 423ecb
Packit 423ecb
Attached Files
Packit 423ecb
Packit 423ecb
1. To use my Makefile for vxworks, you should enter the vxworks
Packit 423ecb
environment (/opt/windriver/wrenv.linux -p vxworks-6.4 for me).
Packit 423ecb
2. Run: build.sh libxml2-2.6.32 SH32gnule RTP (where you have
Packit 423ecb
libxml2-2.6.32.tar.gz and the Makefile in the same directory as the script
Packit 423ecb
file).
Packit 423ecb
Packit 423ecb
Thanks,
Packit 423ecb
Packit 423ecb
Jim Wert Jr.
Packit 423ecb
JWert@ILSTechnology.com