Steps for building native microMIPS GCC and Binutils

From Dmz-portal

Jump to: navigation, search

Contents

Get the prebuilt

Native little-endian soft-float microMIPS GCC and Binutils are as follows.

File:Micromips-el-sf-toolchain.tar.bz2

Prepare

The following steps require codesourcery 2011.03-110 source tar ball (mips-2011.03-110-mips-linux-gnu.src.tar.bz2). Assume that you have mips-2011.03-110-mips-linux-gnu.src.tar.bz2 under /tmp/ .

1. Unzip source files as follows.

cd /tmp/
tar vxfj mips-2011.03-110-mips-linux-gnu.src.tar.bz2
tar vxfj mips-2011.03-110-mips-linux-gnu/binutils-2011.03-110.tar.bz2
tar vxfj mips-2011.03-110-mips-linux-gnu/gcc-2011.03-110.tar.bz2
tar vxfj mips-2011.03-110-mips-linux-gnu/gmp-2011.03-110.tar.bz2
tar vxfj mips-2011.03-110-mips-linux-gnu/mpfr-2011.03-110.tar.bz2
tar vxfj mips-2011.03-110-mips-linux-gnu/mpc-2011.03-110.tar.bz2

2. Apply two patches to GCC source to fix microMIPS pc-relative branches and be able to set microMIPS as the default mode.

 File:Gcc.diff.gz
 File:Micromips.diff.gz

3. Copy micromips little-endian soft-float libc sysroot to install directories.

cd /tmp
mkdir install_x86
cd install_x86
cp -r /mips/arch/overflow/codesourcery/mips-linux-gnu/lite/release/2011.03-110/Linux/mips-linux-gnu/libc/micromips/soft-float/el libc
cd /tmp
mkdir install_mm
cd install_mm
cp -r /mips/arch/overflow/codesourcery/mips-linux-gnu/lite/release/2011.03-110/Linux/mips-linux-gnu/libc/micromips/soft-float/el libc

Step 1. Build binutils (build=x86 host=x86 target=mipsel-linux-gnu)

cd /tmp
mkdir build-binutils
cd build-binutils
../binutils-2011.03/configure --target=mipsel-linux-gnu --prefix=/tmp/install_x86 --with-sysroot=/tmp/install_x86/libc
make -j4
make install -j4

Step 2. Build GCC (build=x86 host=x86 target=mipsel-linux-gnu)

GCC needs gmp, mpfr and mpc static libraries. We need to build them first.

cd /tmp/
mkdir build-gmp
cd build-gmp
../gmp-2011.03/configure --disable-shared --prefix=/tmp/install_x86
make -j4
make install -j4
cd /tmp/
mkdir build-mpfr
cd build-mpfr
../mpfr--2011.03/configure --disable-shared --prefix=/tmp/install_x86 --with-gmp=/tmp/install_x86
make -j4
make install -j4
cd /tmp/
mkdir build-mpc
cd build-mpc
../mpc-0.81/configure --disable-shared --prefix=/tmp/install_x86 --with-gmp=/tmp/install_x86 --with-mpfr=/tmp/install_x86
make -j4
make install -j4
set path=(/tmp/install_x86/bin $path)
cd /tmp/
mkdir build-gcc
cd build-gcc
../gcc-4.5-2011.03/configure --target=mipsel-linux-gnu --with-arch=mips32r2 --enable-languages=c,c++ --with-llsc --disable-bootstrap --prefix=/tmp/install_x86 --disable-libssp --disable-libgomp --disable-libmudflap --with-sysroot=/tmp/install_x86/libc --with-gmp=/tmp/install_x86 --with-mpfr=/tmp/install_x86 --with-mpc=/tmp/install_x86 --disable-multilib --with-float=soft --with-micromips
(Note: --mipsel-linux-gnu sets the default to little-endian.)
(Note: --with-float=soft sets the default to use soft-float.)
(Note: --with-micromips sets the default to generate microMIPS instructions.)
make -j4
make install -j4

Step 3. Build binutils (build=x86 host=mipsel-linux-gnu target=mipsel-linux-gnu)

set path=(/tmp/install_x86/bin $path)
cd /tmp
mkdir build-binutils-mm
cd build-binutils-mm
../binutils-2011.03/configure --host=mipsel-linux-gnu --target=mipsel-linux-gnu --prefix=/tmp/install_mm --with-sysroot=/tmp/install_mm/libc
make -j4
make install -j4

Step 4. Build GCC (build=x86 host=mipsel-linux-gnu target=mipsel-linux-gnu)

GCC needs microMIPS gmp, mpfr and mpc static libraries. We need to build them first.

set path=(/tmp/install_x86/bin $path)
cd /tmp/
mkdir build-gmp-mm
cd build-gmp-mm
../gmp-2011.03/configure --host=mipsel-linux-gnu --target=mipsel-linux-gnu --disable-shared --prefix=/tmp/install_mm
make -j4
make install -j4
cd /tmp/
mkdir build-mpfr-mm
cd build-mpfr-mm
../mpfr--2011.03/configure --host=mipsel-linux-gnu --target=mipsel-linux-gnu --disable-shared --prefix=/tmp/install_mm --with-gmp=/tmp/install_mm
make -j4
make install -j4
cd /tmp/
mkdir build-mpc-mm
cd build-mpc-mm
../mpc-0.81/configure --host=mipsel-linux-gnu --target=mipsel-linux-gnu --disable-shared --prefix=/tmp/install_mm --with-gmp=/tmp/install_mm --with-mpfr=/tmp/install_mm
make -j4
make install -j4
set path=(/tmp/install_mm/bin $path)
cd /tmp/
mkdir build-gcc-mm
cd build-gcc-mm
../gcc-4.5-2011.03/configure --host=mipsel-linux-gnu --target=mipsel-linux-gnu --with-arch=mips32r2 --enable-languages=c,c++ --with-llsc --disable-bootstrap --prefix=/tmp/install_mm --disable-libssp --disable-libgomp --disable-libmudflap --with-sysroot=/tmp/install_mm/libc --with-gmp=/tmp/install_mm --with-mpfr=/tmp/install_mm --with-mpc=/tmp/install_mm --disable-multilib --with-float=soft --with-micromips
(Note: --mipsel-linux-gnu sets the default to little-endian.)
(Note: --with-float=soft sets the default to use soft-float.)
(Note: --with-micromips sets the default to generate microMIPS instructions.)
make all-gcc all-target-libgcc -j4
make install-gcc install-target-libgcc -j4

(Note: There is a flag issue (-nostdinc++) in Makefile when building libstdc++-v3. So, we just need to install libraries from the build-gcc directory.)

cd /tmp/build-gcc
make install-target-libstdc++-v3 prefix=/tmp/install_mm
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox