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]#

  • 相关阅读:
    vs2017 vs2019 打开cs文件提示无法识别的GUID格式
    A股和B股票的区别?
    选股:“均线是水,K线是舟,量是马达!”的选美理念!
    什么是K线?K线的详解!
    5日均线MACD
    炒股的常见技术指标
    选股票几大原则:趋势原则,强势原则,分批原则
    金融蝴蝶效应
    股市里的大户和散户
    期货平仓/强制平仓/爆仓-股市平仓建仓
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11105574.html
Copyright © 2011-2022 走看看