环境:
PC系统: ubuntu16.04LTS
目标开发板: itop4412
-
源代码收集
1.1 下载binutils
网址:https://mirrors.tuna.tsinghua.edu.cn/gnu/binutils/binutils-2.26.1.tar.bz21.2 下载glibc
两种源代码:
网址:http://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz
http://ftp.gnu.org/gnu/glibc/glibc-ports-2.16.0.tar.xz1.3 下载gcc源码
下载速度较快
https://github.com/gcc-mirror/gcc/releases/tag/gcc-4_9_4-release
下载速度较慢
ftp://ftp.mpi-sb.mpg.de/pub/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-4.9.0/gcc-4.9.0.tar.bz21.4 下载MPFR
https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.gz1.5 下载GMP
https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz -
联编源代码
2.1 联编binutils
step1: 进入binutils源文件目录,并执行
./configure --disable-werror --build=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --prefix=/usr/local/arm/arm-gcc-2016/bin --with-sysroot=/usr/local/arm/arm-gcc-2016/sysroot
step2: 执行make
step3: 执行make install,结束
2.2 内核头文件安装
step1: 进入内核源代码根目录
step2: 执行make mrproper, 清理环境,是的内核源代码恢复到刚解压时的状态
step3: 执行 make ARCH=arm integrator_defconfig
step4: 执行 make ARCH=arm headers_check,此处出现了错误:原因不知,暂时忽略。
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/if_pppox.h:24: included file ‘linux/if_pppolac.h’ is not exported
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/if_pppox.h:25: included file ‘linux/if_pppopns.h’ is not exported
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/kernel.h:65: userspace cannot reference function or variable defined in the kernel
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/kernel.h:97: userspace cannot reference function or variable defined in the kernel
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/quota.h:175: userspace cannot reference function or variable defined in the kernel
/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/soundcard.h:1054: userspace cannot reference function or variable defined in the kernel
/home/liqiang/work/linux/iTop4412_Kernel_3.0/scripts/Makefile.headersinst:91: recipe for target ‘/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/.check’ failed
make[2]: *** [/home/liqiang/work/linux/iTop4412_Kernel_3.0/usr/include/linux/.check] Error 123
/home/liqiang/work/linux/iTop4412_Kernel_3.0/scripts/Makefile.headersinst:99: recipe for target ‘linux’ failed
make[1]: *** [linux] Error 2
Makefile:1079: recipe for target ‘headers_check’ failed
make: *** [headers_check] Error 2
step5: 执行 make ARCH=arm INSTALL_HDR_PATH=/usr/local/arm/arm-gcc-2016/sysroot/usr headers_install,进行头文件安装,结束。
2.3自举GCC(第一阶段)
step1:
./configure
–build=i686-pc-linux-gnu
–host=i686-pc-linux-gnu
–target=arm-none-linux-gnueabi
–prefix=/usr/local/arm/arm-gcc-2016/bin
–without-headers
–enable-boostrap
–enable-languages"c"
–disable-threads
–enable-_cxa_atexit
–disable-libmudflap
–with-gnu-ld --with-gnu-as
–disable-libssp --disable-libgomp
–disable-nls --disable-shared
至此:发现有现成的交叉编译器下载,地址如下
https://releases.linaro.org/components/toolchain/binaries/
故而终止联编交叉编译工具链,时间白白浪费了1天。
接下来进入《交叉编译opencv3.4之下载交叉编译工具链并编译(三)》,待续
本文参考资料:《Linux嵌入式系统高级程序设计 》