Introduction to MIPSel
MIPSel is the little-endian (32-bit) variant of MIPS, used by early
systems, mainly in embedded environments. Video game consoles of
that time often used the PowerPC, MIPS 64, or MIPS 32
architectures. The toolchain that will be built with the following
instructions will aim to target the latter.
The instructions below will build a simple cross compiler for
MIPSel using Binutils and GCC. Both will be installed in this page.
The target is mipsel-linux-gnu, which
is shorter than most other target triplets.
Note
This may take a while to build. Feel free to do something else
while this is building.
Installation of MIPSel-Binutils
Install MIPSel-Binutils by running the following commands:
mkdir build-mipsel-binutils &&
cd build-mipsel-binutils &&
../configure --prefix=/usr \
--target=mipsel-linux-gnu \
--infodir=/usr/share/info/mipsel-linux-gnu \
--disable-nls \
--disable-werror \
--with-gold=no &&
make
Now, as the root user:
make DESTDIR=$PWD/DESTDIR install &&
rm -v DESTDIR/usr/lib/bfd-plugins/libdep.so &&
cp -Rv DESTDIR/usr/* /usr &&
rm -rf DESTDIR
Binutils Command Explanations
--disable-nls: This option
disables NLS support, disabling output diagnostics in languages
other than American English. Omit --disable-nls and invoke --enable-nls to enable NLS support.
--disable-werror: This
option makes it so warnings won't be considered errors.
--with-gold=no: This option
disables building gold, which is now considered deathware by many.
The tarball used for the installation includes gold due to
versioning issues, so this option helps counteract that.
--target=*: This option
builds files for the architecture passed to it.
rm -v
DESTDIR/usr/lib/bfd-plugins/libdep.so: This command
removes a library that conflicts with the original library provided
by the original compilation of
Binutils.
Installation of MIPSel-GCC
Install MIPSel-GCC by running the following commands:
mkdir build-mipsel-gcc &&
cd build-mipsel-gcc &&
../configure --prefix=/usr \
--target=mipsel-linux-gnu \
--disable-shared \
--disable-multilib \
--disable-threads \
--enable-languages=c,c++ &&
make inhibit_libc=true all-gcc
Now, as the root user:
make install-gcc &&
ln -sfv mipsel-linux-gnu-gcc /usr/bin/mipsel-linux-gnu-cc
GCC Command Explanations
--disable-shared: This
option disables building shared libraries.
--disable-multilib: This
option ensures that files are created specifically for MIPSel.
--disable-threads: This
option disables thread support due to build errors in GCC.
Threading support is also unnecessary for this compiler.
--enable-languages=c,c++:
This command builds support for C and C++. Refer to https://linuxfromscratch.org/blfs/view/systemd/general/gcc.html
to find what other languages are supported.
Contents
There are no binaries specific to MIPSel besides the format the
toolchain is targeting, and thus each binary is prefixed with the
architecture triplet, such as mipsel-linux-gnu-gcc. For
in-depth descriptions, read both
https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/binutils.html#contents-binutils
and
https://www.linuxfromscratch.org/lfs/view/systemd/chapter08/gcc.html#contents-gcc.