一、首先从此处 http://buildroot.uclibc.org/downloads/snapshots/ 下载最新的buildroot
buildroot-snapshot.tar.bz2
tar jxvf buildroot-snapshot.tar.bz2
cd buildroot
二、配置
对于buildroot的配置可以直接将本目录下的buildroot.config文件直接拷到buildroot目录下并将其改名为.config,也可以直接按照如下所示对其进行配置
make menuconfig
Target Architecture (arm)---à
Target Architecture variant (arm926t) --à
Target ABI (OABI) ---à
Build option --à 此项中只作如下修改 (arm-linux-gnu) GNU build hostname suffix 其余都是默认的选项
Toolchain type (buildroot toolchain) --à
Toolchain Options ---à
---Kernel Header Options
Kernel Headers (Linux 2.6.22.x kernel headers) -à
----uClibc Options
uClibc C library version (daily snapshot) -à
(toolchain/uClibc/uClibc-.config) uClibc configuration files to
[ ] Enable locale/gettext/i8n support?
Thread library implementation (linux threads (stable/old))--à
[ ] Thread library debugging
-----Binutils options
Binutils version (binutils 2.18) --à
() Additional binutils options
-----Gcc options
GCC compiler version (gcc 4.2.1 ) -à
[ ] Enable setjmp /longjmp exceptions?
() Additional gcc options
[ ]Build/install c++ compiler and libstdc++?
[ ]Build/install Objective –C compiler and runtime?
[ ]Build/install Fortran compiler and runtime?
[*]Build/install a shared libgcc?
-------Ccache Options
[ ]Enable ccache support?
--------Gdb Options
[ ]Build gdb debugger for the Target
[ ]Build gdb server for the Target
[ ]Build gdb for the Host
---------elf2flt 未配置该选项
---------Common Toolchain Options 未配置该选项
(-Os –pipe) Target Optimizations
[*] Include target utils in cross toolchain
<注>因为我们使用单孤的linux内核和busybox版本,所以要将Package Selection for the target、Target Options与Board Support Options三项中的内容全部清空(即去除所有选项)。
$ make all
编译结束后即可在staging_dir目录下看到如下文件:arm-linux arm-linux-uclibc bin include info lib libexec man usr 其中bin中即为相应的交叉编译工具,arm-linux目录下的lib中即为相应的库。
为了验证该交叉编译工具是否可以正常工作,修改 .bash_profile文件中的内容,注释掉 export PATH=$PATH:/usr/local/arm/bin 添加上:
export PATH=$PATH:/home/yyl/project1/buildroot/build_arm/staging_dir/bin
重起系统,通过arm-linux-gcc –version命令可检测到当前arm-linux-gcc版本。