wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-core-4.6.2.tar.bz2
tar xvzf binutils-2.23.tar.gz
bunzip2 gmp-4.3.2.tar.bz2
tar xvf gmp-4.3.2.tar
bunzip2 mpfr-2.4.2.tar.bz2
tar xvf mpfr-2.4.2.tar
tar zxvf mpc-0.8.1.tar.gz
bunzip2 gcc-core-4.6.2.tar.bz2
tar xvf gcc-core-4.6.2.tar
mkdir src
mv gmp-4.3.2 mpc-0.8.1 mpfr-2.4.2 binutils-2.23 gcc-4.6.2 src
mkdir -p opt/cross
export PREFIX="$HOME/opt/cross"
export TARGET=i586-elf
export PATH="$PREFIX/bin:$PATH"
cd $HOME/src
mkdir build-binutils
cd build-binutils
../binutils-2.23/configure --target=$TARGET --prefix="$PREFIX" --disable-nls
make
make install
mv gmp-4.3.2 gcc-4.6.2/gmp
mv mpc-0.8.1 gcc-4.6.2/mpc
mv mpfr-2.4.2 gcc-4.6.2/mpfr
mkdir build-gcc
cd build-gcc
../gcc-4.6.2/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
$HOME/opt/cross/bin/$TARGET-gcc --version
#to add cross compiler location to system path
#export PATH="$HOME/opt/cross/bin:$PATH"
#if you like, you can copy the whole "cross" directory from your $HOME/opt to system /opt directory.
#and you add that path to your system path. You can place the export command in .bashrc in $HOME.
No comments:
Post a Comment