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
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命令在相应目录下建立一个空文件,一般就可以编译通过了。
上一篇:基于3c2410的linux2.6.22移植(1)
下一篇:基于3c2410的linux2.6.22移植(3)
推荐阅读最新更新时间:2024-03-16 14:52