Skip to content

Instantly share code, notes, and snippets.

@andres7293
Last active December 2, 2020 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andres7293/e1410ba8dc94dc8f2a23421e1457645e to your computer and use it in GitHub Desktop.
Save andres7293/e1410ba8dc94dc8f2a23421e1457645e to your computer and use it in GitHub Desktop.
instrucciones compilación para compilador cruzado para raspberry pi con soporte para hardfloat
#!/bin/bash
INSTALL_DIR=/home/andres/pi
mkdir $INSTALL_DIR
mkdir -p $INSTALL_DIR/src $INSTALL_DIR/build
cd $INSTALL_DIR/src
#descargar paquetes
wget -nc https://ftp.gnu.org/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.xz
wget -nc https://ftp.gnu.org/gnu/glibc/glibc-2.31.tar.xz
wget -nc https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz
wget -nc https://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.xz
wget -nc https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
wget -nc https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz
##extraer paquetes
xz -d gcc-10.1.0.tar.xz
tar xf gcc-10.1.0.tar
xz -d glibc-2.31.tar.xz
tar xf glibc-2.31.tar
xz -d binutils-2.34.tar.xz
tar xf binutils-2.34.tar
xz -d gmp-6.2.0.tar.xz
tar xf gmp-6.2.0.tar
xz -d mpfr-4.0.2.tar.xz
tar xf mpfr-4.0.2.tar
tar xf mpc-1.1.0.tar.gz
#compilar binutils
mkdir $INSTALL_DIR/build/binutils-2.34
cd $INSTALL_DIR/build/binutils-2.34
../../src/binutils-2.34/configure --with-sysroot=$INSTALL_DIR/sysroot --prefix=$INSTALL_DIR --disable-nls --target=arm-linux-gnueabihf --disable-multilib
make
make install
export PATH=$PATH:$INSTALL_DIR/bin
cd $INSTALL_DIR/src/gcc-10.1.0/
ln -s ../gmp-6.2.0 gmp
ln -s ../mpc-1.1.0 mpc
ln -s ../mpfr-4.0.2 mpfr
mkdir $INSTALL_DIR/build/gcc-10.1-fase1/
cd $INSTALL_DIR/build/gcc-10.1-fase1/
../../src/gcc-10.1.0/configure --prefix=$INSTALL_DIR --target=arm-linux-gnueabihf --enable-languages=c --without-headers --disable-nls --disable-multilib --disable-threads --disable-shared --with-float=hard --with-fpu=vfp --with-arch=armv6
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
#kernel headers
cd $INSTALL_DIR/src
mkdir -p $INSTALL_DIR/sysroot/usr
git clone https://github.com/raspberrypi/linux --depth=1
cd linux
make headers_install ARCH=arm INSTALL_HDR_PATH=$INSTALL_DIR/sysroot/usr
#compilar glibc
mkdir $INSTALL_DIR/build/glibc-2.31
cd $INSTALL_DIR/build/glibc-2.31
../../src/glibc-2.31/configure --prefix=/usr --host=arm-linux-gnueabihf --with-headers=$INSTALL_DIR/sysroot/usr/include --disable-multilib --disable-werror
make
make install DESTDIR=$INSTALL_DIR/sysroot
#compilar gcc fase 2
mkdir $INSTALL_DIR/build/gcc-10.1-fase2
cd $INSTALL_DIR/build/gcc-10.1-fase2
../../src/gcc-10.1.0/configure --prefix=$INSTALL_DIR --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --disable-nls --disable-multilib --with-sysroot=$INSTALL_DIR/sysroot --with-float=hard --with-fpu=vfp --with-arch=armv6
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment