GCC Cross Compiler Installation for Nachos on Linux


These instructions are intended for use with Linux boxes. I have tested them on a departmental Linux box using gcc-3.3.

  1. Download binutils and gcc from ftp://ftp.gnu.org and unpack them in the build directory you are using in your system, e.g. /src/nachos_gcc:
binutils: ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
gcc:      ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.2.tar.gz
Now the build directory should contain the following sub-directories:
binutils-2.11.2/	gcc-2.95.2/
  1. Create two new directories within the build directory:
cross/	gcc-obj/
  1. Set up environment, assuming csh is used:
% setenv target decstation-ultrix
% setenv host i686-pc-linux-gnu
% setenv prefix /apps/nachos_gcc/cross
% setenv srcdir /apps/nachos_gcc/gcc-2.95.2
% setenv objdir /apps/nachos_gcc/gcc-obj
  1. Configure binutils:
% configure --host=$host --target=$target --prefix=$prefix -v
  1. Install binutils:
% make all install

A successful install will generate the following files in $prefix/decstation-ultrix/bin/:
ar	as	gcc	ld	nm	ranlib	strip
  1. Nachos does not depend on any library, we will fake out the sys-include directory to make the Makefile happy:
% mkdir $prefix/decstation-ultrix/sys-include
  1. Configure the gcc cross compiler
% cd $objdir
% $srcdir/configure --host=$host \
    --target=$target \
    --prefix=$prefix \
    --program-prefix=cross \
    --with-gnu-as \
    --with-gnu-ld \
    --with-as=$prefix/decstation-ultrix/bin/as \
    --with-ld=$prefix/decstation-ultrix/bin/ld \
    --enable-languages=c \
    --disable-multilib \
    --disable-libgcj
  1. Install the gcc cross compiler
% make
This will generate a libgcc2.a error. Since Nachos does not depend on any library, we will just ignore this error and continue with:
% make -k install

This will complete the install.

The installed cross compiler will be under /apps/nachos_gcc/cross/decstation-ultrix/bin. Modify the path to the cross compiler in the Makefile of the directory where your Nachos program recide,
and everything is ready to run. Good luck.

2003-09-5 dsn