arm linux 3.4.4内核,关于arm交叉编译工具3.4.4,编译成功的一点经验

环境是fedora 5.0

下面是该文章提供的编译过程:

1.1 设置环境变量[arm@localhost arm]#vi ~/.bashrc

export PREFIX=/usr/local/arm/3.4.4

export TARGET=armlinux

export SYSROOT=${PREFIX}/sysroot

export ARCH=arm

export CROSS_COMPILE=${TARGET}export

PATH=${PREFIX}/bin:$PATH

export SRC=/home/arm/dev_home/btools/tchain3.4.4

1. 2 准备源码包1.2.1 binuils名称:binutils2.16.tar.gz下载地址:名称:gcc3.4.4.

tar.bz2下载地址:名称:glibc2.3.5.tar.gz

glibclinuxthreads2.3.5.tar.gz下载地址名称:linux2.6.14.1.

tar.gz下载地址准备补丁1.3.1 ioperm.c.diff作用:打修正ioperm()函数.下载地址:作用:该补丁用于产生crti.o和crtn.o文件。下载地址:http://gcc.gnu.org/cgibin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=cslarmbranch&r1=1.563.4.2&r2=1.563.4.31.3.3

t-linux.diff作用:修改gcc一处bug下载地址:编译 GNU

binutils重新以arm用户登陆,让新设置的环境变量起作用.

[arm@localhost arm]#su arm

[arm@localhost arm]#cd ${SRC}

[arm@localhost tchain3.4.4]#tar xzvf binutils2.16.tar.gz

[arm@localhost tchain3.4.4]#mkdir BUILD/binutils2.16

[arm@localhost binutils2.16]#cd BUILD/binutils2.16

[arm@localhost binutils2.16]#../../binutils2.16/ configure

prefix=${PREFIX} target=${TARGET} \withsysroot=${SYSROOT}

[arm@localhost binutils2.16]#make

[arm@localhost binutils2.16]#su root

[root@localhost binutils2.16]#make install

[root@localhost binutils2.16]#exit

[arm@localhost binutils2.16]#

1.5 准备内核头文件1.5.1 使用当前平台的gcc 编译内核头文件[arm@localhost tchain3.4.4]#cd ${KERNEL}

[arm@localhost kernel]#tar xvfz linux2.6.14.1.tar.gz

[arm@localhost kernel]#cd linux2.6.14.1

[arm@localhost linux2.6.14.1]#make ARCH=arm menuconfig

[arm@localhost linux2.6.14.1]#make

1.5.2 复制内核头文件[arm@localhost kernel]#su root

[root@localhost kernel]#mkdir ${SYSROOT}/usr/include

[root@localhost kernel]#cp a include/linux

${SYSROOT}/usr/include/linux

[root@localhost kernel]#cp a include/asmi386

${SYSROOT}/usr/include/asm

[root@localhost kernel]#cp a include/asmgeneric

${SYSROOT}/usr/include/asmgeneric

[root@localhost kernel]#exit

[arm@localhost kernel]#

1.6 译编glibc头文件[arm@localhost kernel]#cd ${SRC}

[arm@localhost chain3.4.4]#tar xvfz glibc2.3.5.tar.gz

[arm@localhost chain3.4.4]#patch dglibc2.3.5 p1<

ioperm.c.diff

[arm@localhost glibc2.3.5]#cd glibc2.3.5

[arm@localhost glibc2.3.5]#tar xvfz

../glibclinuxthreads2.3.5.tar.gz

[arm@localhost chain3.4.4]#cd ..

[arm@localhost chain3.4.4]#mkdir BUILD/glibc2.3.5headers

[arm@localhost chain3.4.4]#cd BUILD/glibc2.3.5headers

[arm@localhost glibc2.3.5headers]#../../glibc2.3.5/configure

prefix=/usr host=${TARGET} \enableaddons=linuxthreads

–withheaders=${SYSROOT}/usr/include

[arm@localhost glibc2.3.5headers]#su root

[root@localhost glibc2.3.5headers]#make crosscompiling=

yes install_root=${SYSROOT} installheaders

[root@localhost glibc2.3.5headers]#touch

${SYSROOT}/usr/include/gnu/stubs.h

[root@localhost glibc2.3.5headers]#touch

${SYSROOT}/usr/include/bits/stdio_lim.h

[root@localhost glibc2.3.5headers]#exit

[arm@localhost glibc2.3.5headers]#注意: prefix=/

usr :是gcc寻找库的搜索路径。1.7 编译gcc第一阶段[arm@localhost glibc2.3.5headers]#cd ${SRC}

[arm@localhost chain3.4.4]#tar xjvf gcc3.4.4.tar.bz2

[arm@localhost chain3.4.4]#patch d gcc3.4.4 p1<

flow.c.diff

[arm@localhost chain3.4.4]#patch d gcc3.4.4 p1<

tlinux.diff

[arm@localhost chain3.4.4]#mkdir pBUILD/gcc3.4.4stage1

[arm@localhost chain3.4.4]#cd BUILD/gcc3.4.4stage1

[arm@localhost gcc3.4.4stage1]#../../gcc3.4.4/configure

prefix=${PREFIX} target=${TARGET} \enablelanguages=c

withsysroot=${SYSROOT}注意:不能加上"disableshared"选项。[arm@localhost gcc3.4.4stage1]#make allgcc

[arm@localhost gcc3.4.4stage1]#su root

[root@localhost gcc3.4.4stage1]#make installgcc

[root@localhost gcc3.4.4stage1]#exit

[arm@localhost gcc3.4.4stage1]#

1.8 编译完整的glibc

[arm@localhost gcc3.4.4stage1]

#cd ${SRC}

[arm@localhost tchain3.4.4]#mkdir BUILD/glibc2.3.5

[arm@localhost tchain3.4.4]#cd BUILD/glibc2.3.5

[arm@localhost glibc2.3.5]#BUILD_CC=gcc CC=${CROSS_COMPILE}gcc

AR=${CROSS_COMPILE}ar \

RANLIB=${CROSS_COMPILE}ranlib AS=${CROSS_COMPILE}as

LD=${CROSS_COMPILE}ld \

../../glibc2.3.5/

configure prefix=/

usr build=

i386redhatlinux

host=

armunknownlinuxgnu

\

target=

armunknownlinuxgnu

without__

thread enableaddons=

linuxthreads \

withheaders=${

SYSROOT}/usr/include说明:prefix:指定安装路径。target:指定目标平台。host:指定当前平台。build:指定编译平台。withsysroot:用于指定编译所需要的头文件,及链接库。enableaddons:加入其它的库,如线程库等。enablelanguages:指定gcc所支持的语言。[arm@localhost glibc2.3.5]#make

[arm@localhost glibc2.3.5]#su root

[root@localhost glibc2.3.5]#make install_root=${SYSROOT}

install

[root@localhost glibc2.3.5]#exit

[arm@localhost glibc2.3.5]#

1.9 编译完整的gcc

[arm@localhost glibc2.3.5]#cd ${SRC}

[arm@localhost tchain3.4.4]#mkdir BUILD/gcc3.4.4

[arm@localhost tchain3.4.4]#cd BUILD/gcc3.4.4

[arm@localhost gcc3.4.4]#../../gcc3.4.4/configure prefix=${PREFIX}

target=${TARGET} \enablelanguages=c withsysroot=${SYSROOT}

[arm@localhost gcc3.4.4]#make

[arm@localhost gcc3.4.4]#su root

[root@localhost gcc3.4.4]#make install

[root@localhost gcc3.4.4]#exit

[arm@localhost gcc3.4.4]#上面的基本是对的,我编译了,好几次都没成功,在编译glib那部时间特别长,错了重来一次时间太长为了保证不发生不必要的问题,因为我对linux还不是很熟悉,所以每次发生错误,我都重第2步开始重做,最后成功了,主要做了以下的细小改动:

1.生成头文件那步时,不需要编译内核 只要make

include/linux/version.h 看下version.h文件在不在,即使失败也没关系,继续做下去2.copy 头文件时选择asm-arm下面的到asm下!!!

3.glib2.3.5 编译时 --build=i686-pc-linux-gnu

,对应的pc cpu不同而不同,我的是p4 2.7G的!!!成功后,我弄了helloworld

编译了下,并下载到板上试验了下,成功执行其他问题还要等待以后,用3.4.4编译2.6内核时,才能知道.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值