1、创建安装文件夹crosstool-ng-1.8.1
su 切换到root用户
mkdir /home/armtool/crosstool-ng-1.8.1
2、拷贝压缩文件到crosstool-ng-1.8.1下,并解压
cd /home/armtool/crosstool-ng-1.8.1
cp /mnt/hgfs/share/crossng/crosstool-ng-1.8.1.tar.bz2 ./
tar jxvf crosstool-ng-1.8.1.tar.bz2 ./
3、安装一些必要的工具
apt-get install gawk autotools-dev automake texinfo libtool cvs patch bison flex libncurses5-dev
4、创建必要的目录
mkdir build install
5、打补丁
mkdir src //该目录放一些需要的源码包
mkdir cross-ng181-tool //该目录发工具生成后安装文件
cp/mnt/hgfs/share/crossng/000-scripts_log_do_not_interpret_log_string_as_printf_format.patch ./src
cp /mnt/hgfs/share/crossng/001-binutils_binutils_remove_faulty_patch.patch ./src
cp /mnt/hgfs/share/crossng/002-kconfig_resync_curses_check_with_Linux_kernel.patch ./src
cd crosstool-ng-1.8.1
patch -p1< ../src/000-scripts_log_do_not_interpret_log_string_as_printf_format.patch
patch -p1< ../src/001-binutils_binutils_remove_faulty_patch.patch
patch -p1< ../src/002-kconfig_resync_curses_check_with_Linux_kernel.patch
6、配置并编译交叉工具
./configure --prefix=/home/armtool/crosstool-ng-1.8.1/install
make
make install
7、配置工具链选项
cd ../build/
cp ../crosstool-ng-1.8.1/samples/arm-unknown-linux-gnueabi/* ./
mv crosstool.config .config
../install/bin/ct-ng menuconfig
Paths and misc options --->
(/home/armtool/crosstool-ng-1.8.1/src) Local tarballs directory //源码包存放路径
(/home/armtool/crosstool-ng-1.8.1/cross-ng181-tool) Prefix directory //工具生成后安装路径
(1) Number of parallel jobs
Target options --->
(armv4t) Architecture level
(arm9tdmi) Emit assembly for CPU
(arm920t) Tune for CPU
C compiler --->
[ ] Java
Operating System --->
[ ] Check installed headers
Toolchain options --->
(mfx) Tuple's vendor string
修改.config 文件,将文件中的2.6.33.2全部改为2.6.35
拷贝文件到/home/armtool/cross-ng-1.8.1/src/ 下:
binutils-2.19.1.tar.bz2
gcc-4.3.2.tar.bz2
glibc-ports-2.9.tar.bz2
linux-2.6.35.tar.bz2
ncurses-5.7.tar.gz
dmalloc-5.5.2.tgz
gdb-6.8.tar.bz2
gmp-4.3.2.tar.bz2
ltrace_0.5.3.orig.tar.gz
strace-4.5.19.tar.bz2
duma_2_5_15.tar.gz
glibc-2.9.tar.bz2
libelf-0.8.13.tar.gz
mpfr-2.4.2.tar.bz2
sstrip.c
8、工具链编译
../install/bin/ct-ng build
9、环境变量添加
在/etc/bash.bashrc中添加下面内容:
Export PATH=$PATH:/home/armtool/crosstool-ng-1.8.1/cross-ng181-tool/bin
执行source bash.bashrc
10、工具链测试
执行 arm-mfx-linux-gnueabi-gcc -v 显示gcc信息