CLFS在线文档:
1、环境变量准备:
export CLFS_HOST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/")export CLFS=/home/wutiejun/host/clfs
export CLFS_HOST=i686-cross-linuxexport CLFS_TARGET=arm-wap-linux-uclibceabiexport CLFS_PREFIX=/home/wutiejun/host/clfs/cross-toolsexport CLFS_ARCH="arm"export CLFS_ENDIAN="little"export CLFS_FLOAT="soft"export CLFS_ABI="aapcs-linux"export CLFS_ARM_ARCH="armv6"export CLFS_ARM_MODE="arm"export CLFS_FPU=""/home/wutiejun/host/clfs/cross-tools/usr/include
arm-wap-linux-uclibceabi-
2、准备内核头文件:
make mrpropermake ARCH=${CLFS_ARCH} headers_checkmake ARCH=${CLFS_ARCH} INSTALL_HDR_PATH=${CLFS_PREFIX}/usr/include headers_installcp -rv dest/include/* ${CLFS}/usr/include
3、GMP包编译:CPPFLAGS=-fexceptions ./configure \ --prefix=${CLFS}/cross-toolsmake
make checkmake install3、编译MPFR包:
LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \ ./configure --prefix=${CLFS}/cross-tools --enable-shared \ --with-gmp=${CLFS}/cross-toolsmake
make install3、编译MPC包:
LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \ ./configure --prefix=${CLFS}/cross-tools \ --with-gmp=${CLFS}/cross-tools \ --with-mpfr=${CLFS}/cross-toolsmake
make install 3、编译binutils;config参数:../binutils-2.21/configure --prefix=${CLFS}/cross-tools \
--target=${CLFS_TARGET} --with-sysroot=${CLFS} --disable-nls \ --enable-shared --disable-multilibmake configure-host
makemake install
cp -v ../binutils-2.21/include/libiberty.h ${CLFS}/usr/include
4、编译静态gcc:AR=ar LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \
../gcc-4.6.0/configure --prefix=${CLFS}/cross-tools \ --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ --with-sysroot=${CLFS} --disable-nls --disable-shared \ --with-mpfr=${CLFS}/cross-tools --with-gmp=${CLFS}/cross-tools \ --with-mpc=${CLFS}/cross-tools --without-headers --with-newlib \ --disable-decimal-float --disable-libgomp --disable-libmudflap \ --disable-libssp --disable-threads --enable-languages=c \ --disable-multilib --with-abi=${CLFS_ABI} --with-arch=${CLFS_ARM_ARCH} \ --with-mode=${CLFS_ARM_MODE} --with-float=${CLFS_FLOAT} \ --with-fpu=${CLFS_FPU}make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
5、编译uclibc:declare -xPATH="/home/wutiejun/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt
/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin"
export PATH=$PATH:${CLFS_PREFIX}/bin
patch -Np1 -i ../uClibc-0.9.31-configs-2.patch
修改eabi或者oabi
cp -v clfs/config.${CLFS_ARCH}.${CLFS_ENDIAN} .configif [ "${CLFS_ABI}" == "aapcs" ] || [ "${CLFS_ABI}" == "aapcs-linux" ]; \ then sed -i s/CONFIG_ARM_OABI/CONFIG_ARM_EABI/g .config; fimake oldconfig
make
make PREFIX=${CLFS} install
6、编译gcc第二次:
AR=ar LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \
../gcc-4.6.0/configure --prefix=${CLFS}/cross-tools \ --build=${CLFS_HOST} --target=${CLFS_TARGET} --host=${CLFS_HOST} \ --with-sysroot=${CLFS} --disable-nls --enable-shared \ --enable-languages=c --enable-c99 --enable-long-long \ --with-mpfr=${CLFS}/cross-tools --with-gmp=${CLFS}/cross-tools \ --with-mpc=${CLFS}/cross-tools --disable-multilib \ --with-abi=${CLFS_ABI} --with-arch=${CLFS_ARM_ARCH} \ --with-mode=${CLFS_ARM_MODE} --with-float=${CLFS_FLOAT} \ --with-fpu=${CLFS_FPU}make
make install
cp -v ${CLFS}/cross-tools/${CLFS_TARGET}/lib/libgcc_s.so.1 ${CLFS}/lib