Building a cross compiler for Buenos
To compile Buenos (and generally to build binaries for the YAMS simulator), a C cross compiler and cross assembler are needed. These are provided by the GNU binutils and GCC packages. Binutils is needed mainly for the GNU assembler and linker, but the others can be quite useful too.
Starting from version 1.1.0, Buenos userland programs are in ELF format, and starting from version 1.3.0, YAMS supports the booting of ELF executables. If you need the instructions for the old COFF format cross compiler, they can be found here.
These instructions are tested on binutils 2.16 and 2.16.1, gcc 3.4.3 and 4.0.2; they should work for newer versions also. The use of GNU make (gmake) is recommended, the build may fail if using other make. Since we only need a C compiler for Buenos, the gcc-core package is used here. The full package can also be used with these instructions, but enabling other languages may or may not work.
Download the packages to a suitable empty directory and do the following steps to install them.
First extract the packages:
gunzip -c binutils-2.16.1.tar.gz | tar xf -
gunzip -c gcc-core-4.0.2.tar.gz | tar xf -
Then make a separate directory for building the binutils and build and install them:
mkdir build-binutils
cd build-binutils
../binutils-2.16.1/configure --target=mips-elf --prefix=$PREFIX -v
gmake all
gmake install
You might want to run make -k install
instead if
e.g. making the info documentation fails. The $PREFIX
is
of course the directory where you want to install the binutils,
e.g. $HOME/cross-gcc
.
Building GCC may require some of the tools in binutils, so make sure
that $PREFIX/bin
is in your PATH before starting. Then
make a separate directory for building GCC and build and install it:
mkdir build-gcc
cd build-gcc
../gcc-4.0.2/configure --with-gnu-ld --with-gnu-as --without-nls --enable-languages=c --disable-multilib --target=mips-elf --prefix=$PREFIX -v
gmake all
gmake install
Again, you might want to use make -k install
instead. The
install prefix should be the same as for binutils (if you want to use
a different prefix you must also give configure
the
option --with-as=$BINUTILSPREFIX/bin/mips-elf-as
).
Now that binutils and GCC have been installed, all you need is to add
$PREFIX/bin
to your PATH, and you're ready to compile
Buenos.