交叉编译器建立过程
准备工作
下载一下源码包:
可以到
ftp://ftp.gnu.org 下载源码包binutils-2.17.tar.gz gcc-3.4.6.tar.gz glibc-2.3.6.tar.gz glibc-linuxthreads-2.3.6.tar.gz 或者到
ftp://sourceware.org/pub/下载。
将源码包放入/home/zht/cross-compiler/build-tools/目录下。
可以到
http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/下载相关源码包的补丁文件。将补丁文件放入/home/zht/cross-compiler/build-tools/patch目录中。
准备内核源代码包:linux-2.4.27.tar.gz patch-2.4.27-vrs1 2.4.27vrs1-at91-17032005.patch
在目录/home/zht/cross-compiler/kernel目录下准备好目标板内核源码,并配置编译。
1 准备内核头文件
# cd /home/zht/cross-compiler/
# mkdir -p /usr/loca/arm/arm-linux/include
# cp -r kernel/linux-2.4.27/include/linux/ /usr/local/arm/arm-linux/include/
# cp -r kernel/linux-2.4.27/include/asm-arm/ /usr/local/arm/arm-linux/include/asm
# cp -r kernel/linux-2.4.27/include/asm-generic/ /usr/local/arm/arm-linux/include
2 binutils的设置
# cd build-tools/
# mkdir build-binutils
# tar zxvf binutils-2.17.tar.gz
# cd build-binutils/
# ../binutils-2.17/configure --target=arm-linux --prefix=/usr/local/arm
# make
# make install
查看一下:# ls /usr/local/arm/bin/
设置环境变量
<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
#export PATH=$PATH:/usr/local/arm/bin
2 引导编译器的设置
① 为引导编译器准备glibc头文件(参见2 p130)
# cd cd /home/zht/cross-compiler/ build-tools/
# tar zxvf glibc-2.3.6.tar.gz
# tar zxvf glibc-linuxthreads-2.3.6.tar.gz --directory=glibc-2.3.6
# mkdir build-glibc-headers
# cd build-glibc-headers
# ../glibc-2.3.6/configure --host=arm-linux --prefix="/usr" --enable-add-ons=linuxthreads --with-headers=/usr/local/arm/arm-linux/include/
# make cross-compiling=yes install_root=/usr/local/arm/arm-linux/ prefix="" install-headers
# touch /usr/local/arm/arm-linux/include/gnu/stubs.h
# touch /usr/local/arm/arm-linux/inc