编译进程适当的费事。并且犯错适当多。搞的我把东西链砍掉重练了好几次~
编译进程:
环境设置:
sudo groupadd armsudo useradd arm -g armsudo passwd arm #设置暗码su - arm #切换帐户export CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"export CLFS_TARGET="arm-at91-linux"echo export CLFS_HOST=""${CLFS_HOST}"" >> ~/.bashrcecho export CLFS_TARGET=""${CLFS_TARGET}"" >> ~/.bashrc
内核头文件(2.6.35):
make mrpropermake headers_checkmake INSTALL_HDR_PATH=dest headers_installmkdir -p $CLFS/usr/includecp -rv dest/include/* $CLFS/usr/include
Binutils(2.20):
mkdir -v ../binutils-buildcd ../binutils-build../binutils-2.20.1/configure --prefix=${CLFS}/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} --with-sysroot=${CLFS} --disable-nls --enable-shared --disable-multilibln -sv /usr/bin/ar $CLFS/cross-tools/bin/${CLFS_HOST)-armake configure-hostmakemake installcp -v ../binutils-2.17/include/libiberty.h ${CLFS}/usr/include
Glibc-Headers(2.11):
tar -xf ../glibc-ports-2.11.tar.bz2mv glibc-ports-2.11 ports #重要,没它就会说the arm is unsupportmkdir -v ../glibc-buildcd ../glibc-buildecho "libc_cv_forced_unwind=yes" > config.cacheecho "libc_cv_c_cleanup=yes" >> config.cacheecho "libc_cv_arm_tls=yes" >> config.cacheecho "libc_cv_arm32_tls=yes" >> config.cacheecho "libc_cv_arm_machine=yes" > config.cacheecho "libc_cv_mlong_double_128=yes" >> config.cacheecho "libc_cv_mlong_double_128ibm=yes" >> config.cacheecho "install_root=${CLFS}" > configparmsCC=gcc ../glibc-2.11/configure --prefix=/usr --host=${CLFS_TARGET} --build=${CLFS_HOST} --with-headers=${CLFS}/usr/include --cache-file=config.cachemake install-headersinstall -dv ${CLFS}/usr/include/bitscp -v bits/stdio_lim.h ${CLFS}/usr/include/bitstouch ${CLFS}/usr/include/gnu/stubs.h
Gcc-4.5.1 Pass1:
patch -Np1 -i ../gcc-4.5.1-startfiles_fix-1.patchtar -xf ../gmp-5.0.1.tar.bz2tar -xf ../mpc-0.8.2.tar.gztar -xf ../mpfr-3.0.0.tar.bz2mv gmp-5.0.1 gmpmv mpc-0.8.2.tar.gz mpcmv mpfr-3.0.0 mpfrmkdir -v ../gcc-buildcd ../gcc-build../gcc-4.5.1/configure --prefix=${CLFS}/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib --with-sysroot=${CLFS} --disable-nls --disable-shared --enable-languages=c --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs #适当重要!make all-gccmake install-gccln -sv $CLFS/cross-tools/bin/arm-at91-linux-gcc FS/cross-tools/bin/arm-at91-linux-ccrm $CLFS/cross-tools/bin/i486-cross-linux-gnu-arln -vs libgcc.a `$CLFS_TARGET-gcc -print-libgcc-file-name | sed s/libgcc/&_eh/` #适当重要,没有这个符号衔接就别想编译glibc
Glibc 2.11 Pass2
tar -xf ../glibc-ports-2.11.tar.bz2mv glibc-ports-2.11 portsmkdir -v ../glibc-buildcd ../glibc-buildecho "libc_cv_forced_unwind=yes" > config.cacheecho "libc_cv_c_cleanup=yes" >> config.cacheecho "install_root=${CLFS}" > configparmsBUILD_CC="gcc" CC="${CLFS_TARGET}-gcc" AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" ../glibc-2.4/configure --prefix=/usr --libexecdir=/usr/lib/glibc --host=${CLFS_TARGET} --build=${CLFS_HOST} --disable-profile --enable-add-ons --with-tls --enable-kernel=2.6.0 --with-__thread --with-binutils=${CLFS}/cross-tools/bin --with-headers=${CLFS}/usr/include --cache-file=config.cachemakemake installcat > ${CLFS}/etc/nsswitch.conf << "EOF"# Begin /etc/nsswitch.confpasswd: filesgroup: filesshadow: fileshosts: files dnsnetworks: filesprotocols: filesservices: filesethers: filesrpc: files# End /etc/nsswitch.confEOFTZDIR="${CLFS}/usr/share/zoneinfo" ${CLFS}/usr/bin/tzselectcp -v --remove-destination ${CLFS}/usr/share/zoneinfo/[xxx] ${CLFS}/etc/localtimecat > ${CLFS}/etc/ld.so.conf << "EOF"# Begin /etc/ld.so.conf/usr/local/lib/opt/lib# End /etc/ld.so.confEOF
GCC-Pass3
patch -Np1 -i ../gcc-4.5.1-startfiles_fix-1.patchtar -xf ../gmp-5.0.1.tar.bz2tar -xf ../mpc-0.8.2.tar.gztar -xf ../mpfr-3.0.0.tar.bz2mv gmp-5.0.1 gmpmv mpc-0.8.2.tar.gz mpcmv mpfr-3.0.0 mpfrmkdir -v ../gcc-buildcd ../gcc-build../gcc-4.5.1/configure --prefix=${CLFS}/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib --with-sysroot=${CLFS} --disable-nls --enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posixmake all-gccmake install-gcc #重要!makemake installln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed s/libgcc/&_eh/` #适当重要,没有这个符号衔接就别想编译glibc
假如一步一步按着这个作的,那么告知你:东西链完成了!