RaspberryPi Cross Compiling

1:get cross compiler
   cd /opt/RasPi
   git clone https://github.com/raspberrypi/tools.git 

2:copy RaspberryPi-microSD-directory(/usr, /opt) to Linux
   cd /opt/RasPi/PI_ROOT
     cp -r RasPi-SD/usr  .
    (cp -r RasPi-SD/opt  .)

3:install 32bits Labrary(if 64bits)
  Fedora(Redhat)
    sudo yum install glibc.i686
  Ubuntu(Debian)
    sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

-----  raspi_cross.sh -----
#	raspi_cross.sh
#		RasspberryPi2 cross compiling
#		2015.05.08
#		By H.Nakano
#
#   usage)		
# 	  . raspi_cross.sh
#	  $CC -o out_xx ${CFLAGS} source_xx.c ${LDFLAGS} -lwiringPi
#
# --------------------------------------------------
## Cross env :: copy RasPi-directory
## /usr/lib, /usr/include, (/opt ) 

Bdir="/opt/RasPi"
Rdir="$Bdir/PI_ROOT"

## Cross compiler directory
CCdir="$Bdir/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin"

export ARCH=''
export CC="${CCdir}/arm-bcm2708hardfp-linux-gnueabi-gcc"
export PATH=${CCdir}:.:/bin:/sbin:/bin/sbin:/usr/bin:/usr/sbin

INCLUDE="-I. -I${Rdir}/usr/include -I${Rdir}/usr/local/include -I${Rdir}/opt/vc/include"
export CFLAGS="-O2 -D_GNU_SOURCE -Wformat=2 -Wall -Winline $INCLUDE -pipe -fPIC"
export LDFLAGS="-L${Rdir}/usr/lib -L${Rdir}/usr/local/lib -I${Rdir}/opt/vc/lib"

export LD_LIBRARY_PATH=${Rdir}/lib:${Rdir}/usr/local/lib:${Rdir}/usr/lib:${Rdir}/opt/vc/lib
export GTK_CONFIG_PATH=${Rdir}/usr/lib/pkgconfig:${Rdir}/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH=${Rdir}/usr/lib/arm-linux-gnueabihf/pkgconfig:${Rdir}/usr/share/pkgconfig:${Rdir}/usr/lib/pkgconfig
----------------------------

to Top
to IndexPage

Last modified:2015-05-08; First Release:2015-05-08