IT民工一枚,为学弟学妹造福是我一直写博文的动力!为媳妇提供技术支持是我学习新技术的动力!为自己脱离贫困线,买到心仪的摩托车,有饭吃,有床睡,有妹把,笔耕不辍~~
2013年(54)
分类: LINUX
2013-04-14 14:44:01
unset CFLAGS unset CXXFLAGS unset LDFLAGS export CLFS=/opt/arm-linux-4.2.1 #改成你希望按照的目录 export CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" export CLFS_TARGET="arm-linux" sudo mkdir $CLFS sudo chown -v:<group> $CLFS #修改文件所属, 以便可以读写
install -dv ${CLFS}/usr/include cp -av include/{asm-generic,linux,mtd,scsi,sound} ${CLFS}/usr/include
patch -Np1 -i <path-to>/binutils-2.17-posix-1.patch mkdir -v ../binutils-build cd ../binutils-build AR=ar AS=as ../binutils-2.18/configure --prefix=${CLFS}/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} --with-sysroot=${CLFS} --disable-nls --enable-shared --disable-multilib make configure-host make make install cp -v ../binutils-2.18/include/libiberty.h ${CLFS}/usr/include
cp configure{,.orig} sed -e 's/3.4/3.[0-9]/g' configure.orig > configure tar -jxvf ../glibc-ports-2.6.1.tar.bz2 mv -v glibc-ports-2.6.1 ports mkdir -v ../glibc-build cd ../glibc-build echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache echo "libc_cv_arm_tls=yes" >> config.cache echo "install_root=${CLFS}" > configparms CC=gcc ../glibc-2.6.1/configure --prefix=/usr --host=${CLFS_TARGET} --build=${CLFS_HOST} --with-headers=${CLFS}/usr/include --cache-file=config.cache make install-headers cp -v bits/stdio_lim.h ${CLFS}/usr/include/bits touch ${CLFS}/usr/include/gnu/stubs.h cp -v ../glibc-2.6.1/ports/sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h ${CLFS}/usr/include/bits
patch -Np1 -i ../gcc-4.2.1-posix-1.patch patch -Np1 -i ../gcc-4.2.1-cross_search_paths-1.patch mkdir -v ../gcc-build cd ../gcc-build ./gcc-4.2.1/configure --prefix=${CLFS}/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib --with-sysroot=${CLFS} --disable-nls --disable-shared --enable-languages=c make all-gcc
tar -jxvf ../glibc-ports-2.6.1.tar.bz2 mv -v glibc-ports-2.6.1 ports patch -Np1 -i ../glibc-2.6.1-libgcc_eh-1.patch patch -Np1 -i ../glibc-2.6.1-localedef_segfault-1.patch patch -Np1 -i ../glibc-2.6.1-cross_hacks-1.patch patch -Np1 -i ../glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch mkdir -v ../glibc-build cd ../glibc-build echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache echo "install_root=${CLFS}" > configparms BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc" AR="${CLFS_TARGET}-ar "RANLIB="${CLFS_TARGET}-ranlib" ../glibc-2.6.1/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.cache make make install cp -v locale/localedef-native $CLFS/cross-tools/bin
patch -Np1 -i ../gcc-4.2.1-posix-1.patch patch -Np1 -i ../gcc-4.2.1-cross_search_paths-1.patch mkdir -v ../gcc-build cd ../gcc-build ../gcc-4.2.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=posix make make install
unset CFLAGS unset CXXFLAGS unset LDFLAGS unset LD_LIBRARY_PATH unset PKG_CONFIG_PATH CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld LC_ALL=POSIX if ! echo $PATH | grep "\/opt\/arm\-linux\-4.2.1\/cross-tools\/bin" > /dev/null then PATH="/opt/arm-linux-4.2.1/cross-tools/bin:$PATH" fi PS1="\\[\\e[1;31m\\]ARM-CROSS|\\t \\[\\e[1;32m\\]\\u\\n[ \\[\\e[0m\\]\\w\\[\\e[1;32m\\] ]# \\[\\e[0m\\]" export CC CXX LD LC_ALL PATH PS1
source /opt/arm-linux-4.2.1/bashrc