Linux From Scratch 构建临时编译环境(一)
最新版本:lfslivecd-x86-6.3-r2160.iso
虚拟机版本:VMware Workstation 6.0.3 build-80004
export LFS=/mnt/lfs
mkdir -pv $LFS
mount /dev/sda2 $LFS
mkdir -v $LFS/sources
chmod -v a+wt $LFS/sources
mkdir -v $LFS/tools
ln -sv $LFS/tools /
passwd lfs
chown -v lfs $LFS/tools
chown -v lfs $LFS/sources
su - lfs" -" 参数指示 su 开启一个登陆Shell(login shell)而不是非登陆Shell(non-login shell)
cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='/u:/w/$ ' /bin/bash
EOF
cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL PATH
EOF
source ~/.bash_profile
cd $LFS/sources
tar xvf /lfs-sources/binutils-2.17.tar.bz2
cd binutils-2.17
Binutils 是一组开发工具,包括连接器、汇编器和其他用于目标文件和档案的工具。mkdir -v ../binutils-build
cd ../binutils-build
CC="gcc -B/usr/bin/" ../binutils-2.17/configure --prefix=/tools --disable-nls --disable-werror
make
make install
make -C ld clean
make -C ld LIB_PATH=/tools/lib
cp -v ld/ld-new /tools/bin
cd ..
rm -rf binutils-build
rm -rf binutils-2.17
GCC-4.0.3 - 第一遍
tar xvf /lfs-sources/gcc-4.1.2.tar.bz2
mkdir -v gcc-build
cd gcc-build
CC="gcc -B/usr/bin/" ../gcc-4.1.2/configure --prefix=/tools /