Using the current platform gcc compiler kernel headers

[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

 

Copy the kernel headers

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

 

Translation compiled glibc header files

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

Note: prefix = / usr: gcc is looking for the library search path.

 

Compile gcc first stage

[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}

Note: You can not add "disableshared" option. [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] #

 

Complete compilation 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

 

Description:

prefix: specify the installation path.

target: Specifies the target platform.

host: Specifies the current platform.

build: Specifies the compiler platform.

withsysroot: compiler is used to specify the required header files and libraries.

enableaddons: add other libraries, such as threading libraries.

enablelanguages: Specifies the language supported by 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]#

 

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

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11105574.html