制作crosstool-ng交叉编译链

编译安装

注意编译过程安装仅在CentOS 6和Ubuntu 12.04测试成功,其他较高版本因为gcc版本过高导致编译失败,如果想在高版本发行版上使用请直接复制打包制作好的交叉编译链

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.16.0.tar.bz2
tar xjf crosstool-ng-1.16.0.tar.bz2
# 依赖压缩包
wget https://gitee.com/sfantree/oss3/raw/master/arm_tools/crosstool-ng/crosstool-ng-1.16.0-tarballs.tar.bz2
tar xjf crosstool-ng-1.16.0-tarballs.tar.bz2
mv tarballs crosstool-ng-1.16.0
cd crosstool-ng-1.16.0
./configure --prefix=`pwd` && make && make install
# 配置文件
cp -f ./tarballs/config/crosstool-ng-1.16.0-arm920t.config .config
./bin/ct-ng build
cd /opt/xtools/arm920t/bin
# 生成arm-linux-格式文件
for file in `ls arm-*-gnueabi-*` ; do
sym_file=arm-linux-`echo $file | awk -F '-' '{print $NF}'`
ln -s $file $sym_file
done

CentOS 6自动化编译安装

1
2
3
wget https://gitee.com/sfantree/oss3/raw/master/arm_tools/crosstool-ng/crosstool-ng-centos-LingYun-v1.0.0.bin
chmod +x crosstool-ng-centos-LingYun-v1.0.0.bin
./crosstool-ng-centos-LingYun-v1.0.0.bin

复制安装

做好的交叉编译工具我已经上传coding.net,需要的同学可以直接下载

1
2
3
4
5
wget https://coding.net/u/sfantree/p/self_use_OSS/git/raw/master/source/xtools-arm920t.tar.xz
xz -d xtools-arm920t.tar.xz
tar xf xtools-arm920t.tar
sudo mv xtools /opt/
/opt/xtools/arm920t/bin/arm-linux-gcc -v

可能运行时会出现缺少libiconv.so.2,参考oneinstack编译安装libiconv

1
2
3
4
5
6
7
8
9
10
#wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz
wget https://mirrors.ustc.edu.cn/gnu/libiconv/libiconv-1.15.tar.gz
tar zxvf libiconv-1.15.tar.gz
wget https://github.com/lj2007331/oneinstack/raw/master/src/libiconv-glibc-2.16.patch
patch -d libiconv-1.15 -p0 < libiconv-glibc-2.16.patch
cd libiconv-1.15
./configure --prefix=/usr/local
make
sudo make install
sudo ldconfig
分享到: