zoukankan      html  css  js  c++  java
  • 使用当前平台的 gcc 编译内核头文件

    [arm@localhost tchain3.4.4]#cd ${KERNEL} [arm@localhost kernel]#tar xvfz linux­2.6.14.1.tar.gz [arm@localhost kernel]#cd linux­2.6.14.1

    [arm@localhost linux­2.6.14.1]#make ARCH=arm menuconfig [arm@localhost linux­2.6.14.1]#make

    复制内核头文件

    [arm@localhost kernel]#su root

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

    [root@localhost kernel]#cp ­a include/linux ${SYSROOT}/usr/include/linux [root@localhost kernel]#cp ­a include/asm­i386 ${SYSROOT}/usr/include/asm [root@localhost kernel]#cp ­a include/asm­generic ${SYSROOT}/usr/include/asm­generic [root@localhost kernel]#exit

    [arm@localhost kernel]#

    译编 glibc 头文件

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

    [arm@localhost chain3.4.4]#tar xvfz glibc­2.3.5.tar.gz [arm@localhost chain3.4.4]#patch ­d glibc­2.3.5 ­p1 < ioperm.c.diff [arm@localhost glibc­2.3.5]#cd glibc­2.3.5

    [arm@localhost glibc­2.3.5]#tar xvfz ../glibc­linuxthreads­2.3.5.tar.gz [arm@localhost chain3.4.4]#cd ..

    [arm@localhost chain3.4.4]#mkdir BUILD/glibc­2.3.5­headers [arm@localhost chain3.4.4]#cd BUILD/glibc­2.3.5­headers

    [arm@localhost glibc­2.3.5­headers]#../../glibc­2.3.5/configure ­­prefix=/usr ­­host=${TARGET}

    ­­enable­add­ons=linuxthreads –with­headers=${SYSROOT}/usr/include [arm@localhost glibc­2.3.5­headers]#su root

    [root@localhost glibc­2.3.5­headers]#make cross­compiling=yes install_root=${SYSROOT} install­headers [root@localhost glibc­2.3.5­headers]#touch ${SYSROOT}/usr/include/gnu/stubs.h

    [root@localhost glibc­2.3.5­headers]#touch ${SYSROOT}/usr/include/bits/stdio_lim.h [root@localhost glibc­2.3.5­headers]#exit

    [arm@localhost glibc­2.3.5­headers]#

    注意: ­­prefix=/usr :是 gcc 寻找库的搜索路径。

    编译 gcc 第一阶段

    [arm@localhost glibc­2.3.5­headers]#cd ${SRC} [arm@localhost chain3.4.4]#tar xjvf gcc­3.4.4.tar.bz2 [arm@localhost chain3.4.4]#patch ­d gcc­3.4.4 ­p1 < flow.c.diff [arm@localhost chain3.4.4]#patch ­d gcc­3.4.4 ­p1 < t­linux.diff [arm@localhost chain3.4.4]#mkdir ­p BUILD/gcc­3.4.4­stage1 [arm@localhost chain3.4.4]#cd BUILD/gcc­3.4.4­stage1

    [arm@localhost gcc­3.4.4­stage1]#../../gcc­3.4.4/configure ­­prefix=${PREFIX} ­­target=${TARGET}

    ­­enable­languages=c ­­with­sysroot=${SYSROOT}

    注意:不能加上"­­disable­shared"选项。 [arm@localhost gcc­3.4.4­stage1]#make all­gcc [arm@localhost gcc­3.4.4­stage1]#su root [root@localhost gcc­3.4.4­stage1]#make install­gcc [root@localhost gcc­3.4.4­stage1]#exit [arm@localhost gcc­3.4.4­stage1]#

    编译完整的 glibc

    [arm@localhost gcc­3.4.4­stage1] #cd ${SRC} [arm@localhost tchain3.4.4]#mkdir BUILD/glibc­2.3.5 [arm@localhost tchain3.4.4]#cd BUILD/glibc­2.3.5

    [arm@localhost glibc­2.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

    ../../glibc­2.3.5/configure ­­prefix=/usr ­­build=i386­redhat­linux ­­host=arm­unknown­linux­gnu

    ­­target=arm­unknown­linux­gnu ­­without­    thread ­­enable­add­ons=linuxthreads

    ­­with­headers=${SYSROOT}/usr/include

    说明:

    ­­prefix:                            指定安装路径。

    ­­target:           指定目标平台。

    ­­host:                               指定当前平台。

    ­­build:                              指定编译平台。

    ­­with­sysroot:                 用于指定编译所需要的头文件,及链接库。

    ­­enable­add­ons:           加入其它的库,如线程库等。

    ­­enable­languages:       指定 gcc 所支持的语言。

    [arm@localhost glibc­2.3.5]#make [arm@localhost glibc­2.3.5]#su root

    [root@localhost glibc­2.3.5]#make install_root=${SYSROOT} install [root@localhost glibc­2.3.5]#exit

    [arm@localhost glibc­2.3.5]#

    编译完整的 gcc

    [arm@localhost glibc­2.3.5]#cd ${SRC} [arm@localhost tchain3.4.4]#mkdir BUILD/gcc­3.4.4 [arm@localhost tchain3.4.4]#cd BUILD/gcc­3.4.4

    [arm@localhost gcc­3.4.4]#../../gcc­3.4.4/configure ­­prefix=${PREFIX} ­­target=${TARGET}

    ­­enable­languages=c ­­with­sysroot=${SYSROOT} [arm@localhost gcc­3.4.4]#make

    [arm@localhost gcc­3.4.4]#su root [root@localhost gcc­3.4.4]#make install [root@localhost gcc­3.4.4]#exit [arm@localhost gcc­3.4.4]#

  • 相关阅读:
    [转载] python 计算字符串长度
    收藏好文章
    centos7安装部署kafka_2.13-2.4.1集群
    (转)zookeeper-3.5.5安装报错:找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain
    (转)Marathon私有镜像仓库用户名和密码方式
    centos7安装最新版git
    最新版Harbor搭建(harbor-offline-installer-v1.10.1.tgz)(转)
    安装不可描述服务端socket.error: [Errno 99] Cannot assign requested address错误:
    Integer值判断是否相等问题
    LVS实现Kubernetes集群高可用
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11105574.html
Copyright © 2011-2022 走看看