Ceci est une ancienne révision du document !
Compilation croisée (cross-compiling) pour architecture arm
Ceci est un article détaillé de compilation_croisée pour architecture arm! L'article cité précédemment donne la plus part des indications nécessaires. Il y a juste une lacune et une erreur. La lacune est qu'il faut installer les sources pour MPFR et le bug est qu'il manque deux accolades dans un fichier source de gcc (4.4.1). Pour vous faciliter la tâche et vous permettre de boire un café de plus aujourd'hui, je vous présente un petit script qui télécharge, compile et installe le tout tout seul.
Le script utilise des sudo pour les make install. Afin de vous demander le mot de passe tout au début pour que vous puissiez aller boire un café tranquillement, un sudo echo est placé en tête.
Scripte
#!/bin/bash
# Ask for the sudo password at the beginning so that you can go drinking coffee
sudo echo "This script needs to be run as root."
### BINUTILS
wget http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.bz2
tar xvf binutils-2.20.tar.bz2
cd binutils-2.20
cd gas/config
cat <<END >tc-arm.patch
--- tc-arm.c 2009-08-30 00:10:59.000000000 +0200
+++ fix_tc-arm.c 2010-02-11 13:46:23.541598748 +0100
@@ -2486,8 +2486,10 @@
frag->tc_frag_data.first_map = symbolP;
}
if (frag->tc_frag_data.last_map != NULL)
+ {
know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP));
frag->tc_frag_data.last_map = symbolP;
+ }
}
/* We must sometimes convert a region marked as code to data during
END
patch -p0 tc-arm.c tc-arm.patch
cd -
./configure --target=arm-linux
make all
sudo make install
cd ..
### MPFR
wget http://ftp.gnu.org/gnu/mpfr/mpfr-2.4.2.tar.bz2
tar xvf mpfr-2.4.2.tar.bz2
cd mpfr-2.4.2
./configure --target=arm-linux
make all
sudo make install
cd ..
### GCC 4.4
wget http://ftp.gnu.org/gnu/gcc/gcc-4.4.3/gcc-4.4.3.tar.bz2
tar xvf gcc-4.4.3.tar.bz2
cd gcc-4.4.3
./configure --enable-languages=c,c++ --disable-threads --disable-shared --disable-checking --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --target=arm-linux
make all-gcc
sudo make install-gcc
cd ..
### Clean
rm -rf binutils-2.20
rm -rf gcc-4.4.3
rm -rf mpfr-2.4.2
rm -f binutils-2.20.tar.bz2
rm -f gcc-4.4.3.tar.bz2
rm -f mpfr-2.4.2.tar.bz2