个人工具
登录
查看“Crosstool-ng制作交叉编译工具链”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“Crosstool-ng制作交叉编译工具链”的源代码
来自Ubuntu中文
←
Crosstool-ng制作交叉编译工具链
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== 安装交叉编译器和测试 == === 安装交叉编译器 === 刚制作好的交叉编译器其实就可以用了,但是还有些许不方便之处,我们可以进入到生成好的交叉编译器的目录 cd /opt/arm-tonghuix-linux-gnueabi/bin 下面执行 ./arm-tonghuix-linux-gnueabi-gcc -v 应该可以看到如下这样的输出信息 Target: arm-tonghuix-linux-gnueabi Configured with: /home/tonghuix/crosstool-ng-1.11.1/.build/src/gcc-4.3.2/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc inux-gnu --target=arm-tonghuix-linux-gnueabi --prefix=/opt/arm-tonghuix-linux-gnueabi --with-sysroot=/opt/arm-tonghuix-linux-gnueabi- arm-tonghuix-linux-gnueabi/sysroot --enable-languages=c,c++,fortran,java --disable-multilib --with-float=soft --with-pkgversion=crosstool- NG-1.11.1 --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/home/tonghuix /crosstool-ng-1.11.1/.build/arm-tonghuix-linux-gnueabi/build/static --with-mpfr=/home/tonghuix/crosstool-ng-1.11.1/.build/arm-tonghuix- linux-gnueabi/build/static --enable-threads=posix --enable-target-optspace --with-local-prefix=/opt/arm-tonghuix-linux-gnueabi- arm-tonghuix-linux-gnueabi/sysroot --disable-nls --enable-symvers=gnu --enable-c99 --enable-long-long Thread model: posix gcc version 4.3.2 (crosstool-NG-1.11.1) 这样就表明我们的交叉编译器,制作成功了。 下面把交叉编译器所在的目录添加到系统PATH变量中,修改~/.bashrc文件,在其中添加: export PATH=$PATH:/opt/arm-tonghuix-linux-gnueabi/bin 为了使得这个PATH生效,我们可以执行一下~/.bashrc文件 source ~/.bashrc 这样我们就可以在命令行下直接使用arm-tonghuix-linux-gnueabi-gcc这样的命令了! === 标准化安装交叉编译器 === 我们在使用交叉编译器的时候一般是采用arm-tonghuix-linux-gnueabi这样的命令的,但是很多标准Makefile需要实用标准的交叉编译器的名称,一般这个名称是arm-linux-gcc这样的。 cd /opt/arm-tonghuix-linux-gnueabi/bin/ 那么我们在生成交叉编译器的目录下写一个link.sh脚本,新建一些软链接。 >link.sh #!/bin/sh PREFIX=arm-tonghuix-linux-gnueabi- AFTFIX=arm-linux- ln -s ${PREFIX}gcc ${AFTFIX}gcc ln -s ${PREFIX}addr2line ${AFTFIX}addr2line ln -s ${PREFIX}gdbtui ${AFTFIX}gdbtui ln -s ${PREFIX}ar ${AFTFIX}ar ln -s ${PREFIX}as ${AFTFIX}as ln -s ${PREFIX}c++ ${AFTFIX}c++ ln -s ${PREFIX}c++filt ${AFTFIX}c++filt ln -s ${PREFIX}cpp ${AFTFIX}cpp ln -s ${PREFIX}g++ ${AFTFIX}g++ ln -s ${PREFIX}gccbug ${AFTFIX}gccbug ln -s ${PREFIX}gcj ${AFTFIX}gcj ln -s ${PREFIX}gcov ${AFTFIX}gcov ln -s ${PREFIX}gdb ${AFTFIX}gdb ln -s ${PREFIX}gfortran ${AFTFIX}gfortran ln -s ${PREFIX}gprof ${AFTFIX}gprof ln -s ${PREFIX}jcf-dump ${AFTFIX}jcf-dump ln -s ${PREFIX}ld ${AFTFIX}ld ln -s ${PREFIX}ldd ${AFTFIX}ldd ln -s ${PREFIX}nm ${AFTFIX}nm ln -s ${PREFIX}objcopy ${AFTFIX}objcopy ln -s ${PREFIX}objdump ${AFTFIX}objdump ln -s ${PREFIX}populate ${AFTFIX}populate ln -s ${PREFIX}ranlib ${AFTFIX}ranlib ln -s ${PREFIX}readelf ${AFTFIX}readelf ln -s ${PREFIX}run ${AFTFIX}run ln -s ${PREFIX}size ${AFTFIX}size ln -s ${PREFIX}strings ${AFTFIX}strings ln -s ${PREFIX}strip ${AFTFIX}strip 写完这个link.sh文件以后,我们可以执行一下 sh link.sh 这样我们就得到了整个使用标准名称的交叉编译工具链,可以在makefile中使用类似arm-linux-gcc这样的名称了。
返回至
Crosstool-ng制作交叉编译工具链
。