(5)
a.
b.
c.
d.
e.
f.
1、 生成内核头文件
$root@host:/home/arm/kernel# tar xvjf linux-2.6.22.tar.bz2
$root@host:/home/arm/kernel# cd linux-2.6.22
$root@host:/home/arm/kernel/linux-2.6.22#
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
其间menuconfig指定了装备界面,可用的还有config(全字符界面) xconfig(xwindow下的图形界面)。Ubuntu需求装置tk8.4以支撑xconfig。别的需求将mawk卸载,装置gawk。(mawk有bug)
linux2.6的内核供给了对s3c2410的支撑。在system中选上s3c2410系列就能够了。装备结束退出保存。
$root@host:/home/arm/kernel/linux-2.6.22# cd include
$root@host:/home/arm/kernel/linux-2.6.22/include# cd linux
$root@host:/home/arm/kernel/linux-2.6.22/include/linux# ls version.h autoconf.h
version.h autoconf.h
这2个文件在后面的编译中会用到。假如没有,退到内目录下make version.h就能够了。
下面树立链接:
$root@host:/home/arm/kernel/linux-2.6.22/include# ln –s asm-arm asm
$root@host:/home/arm/kernel/linux-2.6.22/include# ln -s asm/arch-s3c2410 asm/arch
将内核头文件拷贝到终究装置目录下:
$root@host:/home/arm/kernel/linux-2.6.22/include# mkdir –p ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include#
cp –r asm- ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include# cp –r linux ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include# cp –d asm ${TARGET_PREFIX}/include
至此内核头文件树立结束。
2、 树立Binary utilities:
binutils是一些二进制东西的调集,其间常用的是as ,ar和ld。
$root@host:/home/arm/kernel/include# cd ${PRJROOT}/build-tools
$root@host:/home/arm/build-tools# tar xvjf binutils-2.18.tar.bz2
$root@host:/home/arm/build-tools# cd build-binutils
$root@host:/home/arm/build-tools/build-binutils#
patch –Np1 –i /home/arm/build-tools/patch/binutils-2.18*
$root@host:/home/arm/build-tools/build-binutils#
../binutils-2.18/configure –target=${TARGET} –prefix=${PREFIX}
$root@host:/home/arm/build-tools/build-binutils# make
$root@host:/home/arm/build-tools/build-binutils# make install
${PREFIX}/bin下应该生成一些以arm-linux最初的文件
$root@host:/home/arm/build-tools/build-binutils# ls ${PREFIX}/bin
3、 生成glibc头文件:
$root@host:/home/arm/build-tools/build-binutils# cd ..
$root@host:/home/arm/build-tools/# tar xvjf glibc-2.6.1.tar.bz2
$root@host:/home/arm/build-tools/#
tar xvzf glibc-ports-2.6.1.tar.gz –directory ./glibc-2.6.1/
$root@host:/home/arm/build-tools/# cd glibc-2.6.1
$root@host:/home/arm/build-tools/glibc-2.6.1# mv glibc-ports-2.6.1 ports –v
打上补丁:
$root@host:/home/arm/build-tools/glibc-2.6.1#
patch –Np1 –i /home/arm/build-tools/patch/glibc-2.6.1-*patch
$root@host:/home/arm/build-tools/glibc-2.6.1# cd ..
$root@host:/home/arm/build-tools/# cd build-glibc-headers
这儿需求增加对NPTL线程库的支撑:
$root@host:/home/arm/build-tools/build-glibc-headers#
echo “libc_cv_forced_unwind=yes”>>config.cache
echo “libc_cv_c_cleanup=yes”>>config.cache
echo “libc_cv_arm_tls=yes”>>config.cache
注:假如编译中呈现”cannot compute long double size”,增加:
echo “ac_cv_sizeof_long_double=12”>>config.cache
$root@host:/home/arm/build-tools/build-glibc-headers#
../glibc-2.6.1/configure –host=${TARGET} –prefix=”/usr” –enable-add-ons
–with-headers=${TARGET_PREFIX}/include –cache-file=config.cache
$root@host:/home/arm/build-tools/build-glibc-headers#
make cross-compiling=yes install_root=${TARGET_PREFIX} prefix=””
install-headers
$root@host:/home/arm/build-tools/build-glibc-headers#
mkdir –p ${TARGET_PREFIX}/include/gnu
$root@host:/home/arm/build-tools/build-glibc-headers#
touch ${TARGET_PREFIX}/include/gnu/stubs.h
注:假如编译进程中呈现找不到头文件的过错,能够依据过错提示的文件名用touch指令在相应目录下树立一个空文件,一般就能够编译通过了。