选用的交叉编译工具链,是Raspberry Pi 基金会官方发布的 交叉编译工具包,也就是官方用来编译Raspbian操作系统所用的交叉编译工具链,是最适合编译用在Raspberry pi 上运行的程序的工具包。
首先下载最新的编译工具包
1
|
git clone git:
//github
.com
/raspberrypi/tools
.git
|
完成后可以在当前目录下看到tools文件夹。
把编译链工具安装到 /opt 文件夹下面 需root权限。
1
2
|
cd
tools
cp
-r arm-bcm2708
/opt
|
配置默认路径,加入编译工具路径。
1
|
export PATH=/opt/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin:$PATH
|
配置编译参数。
1
|
export CFLAGS="-O2 -pipe -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -w"
|
至此 交叉编译环境配置完成
编译的时候,在make后面加上用于指定交叉编译器的参数。
1
|
CROSS_COMPILE=arm-bcm2708hardfp-linux-gnueabi-
|
该参数的意义是指定交叉编译器为支持bcm2708芯片硬件浮点的arm编译器。
如果是编译linux内核,需要同时在make后面加上指定架构的参数。
1
|
ARCH=arm
|
转载自:http://shumeipai.nxez.com/2013/10/08/configure-cross-compiler-platform-raspberry-pi.html