Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->内核研究 ->正文

CLFS2.0原理分析

来源:linuxsir 作者:youbest  时间:2007-04-22 点击: [收藏] [投稿]

cd ../gcc-build
../gcc-4.1.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
make install-gcc

glibc-2.4
patch -Np1 -i ../glibc-2.4-libgcc_eh-1.patch
patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch
patch -Np1 -i ../glibc-2.4-crosscompile_timezone_fix-1.patch
patch -Np1 -i ../glibc-2.4-iconv_fix-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.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.cache
make
make install
cat > ${CLFS}/etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF
TZDIR="${CLFS}/usr/share/zoneinfo" ${CLFS}/usr/bin/tzselect
cp -v --remove-destination ${CLFS}/usr/share/zoneinfo/[xxx] \
${CLFS}/etc/localtime
cat > ${CLFS}/etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
# End /etc/ld.so.conf
EOF

gcc-4.1.1第二遍
patch -Np1 -i ../gcc-4.1.1-posix-1.patch
patch -Np1 -i ../gcc-4.1.1-PR20425-1.patch
patch -Np1 -i ../gcc-4.1.1-cross_search_paths-1.patch
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-4.1.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

file-4.17
./configure --prefix=${CLFS}/cross-tools
make
make install

Groff-1.19.2
PAGE=A4 ./configure --prefix=${CLFS}/cross-tools --without-x
make
make install

工具链制作完成
目标系统制作
export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"
echo export CC=\""${CC}\"" >> ~/.bashrc
echo export CXX=\""${CXX}\"" >> ~/.bashrc
echo export AR=\""${AR}\"" >> ~/.bashrc
echo export AS=\""${AS}\"" >> ~/.bashrc
echo export RANLIB=\""${RANLIB}\"" >> ~/.bashrc
echo export LD=\""${LD}\"" >> ~/.bashrc
echo export STRIP=\""${STRIP}\"" >> ~/.bashrc

Linux-2.6.17.6
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}- menuconfig
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}-
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}- \
INSTALL_MOD_PATH=${CLFS} modules_install
cp vmlinux ${CLFS}/boot/clfskernel-2.6.17.6
cp System.map ${CLFS}/boot/System.map-2.6.17.6
cp .config ${CLFS}/boot/config-2.6.17.6


MIPS的工具链制作过程及内核编译
环境设置过程(略)
export CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
export CLFS_TARGET="mips-unknown-linux-gnu"
echo export CLFS_HOST=\""${CLFS_HOST}\"" >> ~/.bashrc
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc

Linux-Kernel-headers
make include/linux/version.h
install -dv ${CLFS}/usr/include/{asm,asm-generic,linux,net,mtd,scsi,sound}
cp -av include/asm-generic/* ${CLFS}/usr/include/asm-generic
cp -av include/linux/* ${CLFS}/usr/include/linux
cp -av include/mtd/* ${CLFS}/usr/include/mtd
cp -av include/net/* ${CLFS}/usr/include/net
cp -av include/scsi/* ${CLFS}/usr/include/scsi
cp -av include/sound/* ${CLFS}/usr/include/sound
cp -av include/asm-mips/* ${CLFS}/usr/include/asm

binutils-2.17
patch -Np1 -i ../binutils-2.17-posix-1.patch
mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.17/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.17/include/libiberty.h ${CLFS}/usr/include


glibc-2.4-headers
cp configure{,.orig}
sed -e 's/3.4/3.[0-9]/g' configure.orig > configure
tar -jxvf ../glibc-ports-2.4.tar.bz2
mv -v glibc-ports-2.4 ports
echo "" > ports/sysdeps/mips/mips32/Makefile
sed -i ‘s/wordsize.h>$/wordsize.h>\n#define __WORDSIZE 32/g’ bits/types.h

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:使用异步 I/O 大大提高应用程序的性能   下一篇:简析Linux与FreeBSD的syscall

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号