|
|
第一次是按教程安装的,结果发现启动后无法使用网络,于是决定再装一次。
可是安装时间实在太长,于是我写了个脚本来做。这次是第五章的安装。从以lfs用户登录后开始。
用法:复制下面的部分到一个文本文件ai.sh,运行
source ai.sh
则开始。注意:脚本中有一些检测的代码,简单判断是否编译成功。若有错,请多按几次Ctrl-C强制退出(按一次说不定还不行,记得多按几次,谁有更好的办法退出脚本执行?谢谢)
# !/bin/sh
# ----------------------------------------------------------
# Arthur Yang, 2004.09.24
# For charpter 5, LFS ver 5.0 (Chinese version)
# After loginned as lfs at the end of "Add a user: lfs", use
# this script to finish the remainder part of chapter 5.
# Especially for those who build LFS for second time. Just
# save some time, Enjoy it.
# -----------------------------------------------------------
# Shell script functions
home()
{
cd $LFS/sources;
}
btar()
{
bunzip2 -k $1;
tar xvf ${1%.bz2};
}
check()
{
if grep -E "Error|No such file or directory"
$LFS/sources/log.file
then
echo $LFS/sources/log.file
rm $LFS/sources/log.file
stop
else
rm $LFS/sources/log.file
fi
}
stop()
{
echo There\'s ERROR! Stopped.
while test 1
do
echo Press Ctrl-C to exit the shell script!
read
done
}
#export LFS=/mnt/lfs
#
#
#mkdir $LFS/tools
#ln -s $LFS/tools /
#
## Assume user lfs exists.
#chown lfs $LFS/tools
#chown lfs $LFS/sources
#su - lfs
# Begin from here!
export logfile=$LFS/sources/log.file
cat > ~/.bash_profile << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
PATH=/tools/bin PATH
export LFS LC_ALL PATH
unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
EOF
source ~/.bash_profile
home
btar binutils-2.14.tar.bz2
cd binutils-2.14 2> $logfile
check
mkdir ../binutils-build
cd ../binutils-build
../binutils-2.14/configure \
--prefix=/tools --disable-nls
make configure-host
make LDFLAGS="-all-static"
make install
make -C ld clean
make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib
home
btar gcc-core-3.3.1.tar.bz2
cd gcc-3.3.1 2> $logfile
check
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.1/configure --prefix=/tools \
--with-local-prefix=/tools \
--disable-nls --enable-shared \
--enable-languages=c
make BOOT_LDFLAGS="-static" bootstrap 2> $logfile
check
make install
ln -sf gcc /tools/bin/cc
home
rm -rf gcc-3.3.1 gcc-core-3.3.1.tar gcc-build
btar linux-2.4.22.tar.bz2
cd linux-2.4.22 2> $logfile
check
make mrproper
make include/linux/version.h
make symlinks
mkdir /tools/include/asm
cp include/asm/* /tools/include/asm
cp -R include/asm-generic /tools/include
cp -R include/linux /tools/include
touch /tools/include/linux/autoconf.h
home
btar glibc-2.3.2.tar.bz2
cd glibc-2.3.2 2> $logfile
check
btar ../glibc-linuxthreads-2.3.2.tar.bz2
mkdir /tools/etc
touch /tools/etc/ld.so.conf
patch -Np1 -i ../glibc-2.3.2-sscanf-1.patch
mkdir ../glibc-build
cd ../glibc-build 2> $logfile
check
../glibc-2.3.2/configure --prefix=/tools \
--disable-profile --enable-add-ons \
--with-headers=/tools/include \
--with-binutils=/tools/bin \
--without-gd
make 2> $logfile
check
make -k check
make install
make localedata/install-locales
home
rm -rf glibc-2.3.2.tar glibc-2.3.2 glibc-build
cd binutils-build 2> $logfile
check
make -C ld install
SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \
$SPECFILE > tempspecfile
mv tempspecfile $SPECFILE &&
unset SPECFILE
rm -f /tools/lib/gcc-lib/*/*/include/
{pthread.h,bits/sigthread.h}
echo 'main(){}' > dummy.c
gcc dummy.c
#-------------Check--------------
if
readelf -l a.out | grep ': /tools'
then
echo Check OK! Finished the installation of compiler series
rm dummy.c a.out
else
rm dummy.c a.out
echo Compiler check failed!
stop
fi
home
btar tcl8.4.4-src.tar.bz2
cd tcl8.4.4
cd unix 2> $logfile
check
./configure --prefix=/tools
make
TZ=UTC make test
ln -s tclsh8.4 /tools/bin/tclsh
home
rm tcl8.4.4-src.tar
btar expect-5.39.0.tar.bz2
cd expect-5.39 2> $logfile
check
patch -Np1 -i ../expect-5.39.0-spawn.patch
./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no
make
make test
make SCRIPTS="" install
home
rm -rf tcl8.4.4 expect-5.39 expect-5.39.0.tar
btar dejagnu-1.4.3.tar.bz2
cd dejagnu-1.4.3 2> $logfile
check
./configure --prefix=/tools
make install
home
rm -r dejagnu-1.4.3 dejagnu-1.4.3.tar
btar gcc-core-3.3.1.tar.bz2
btar gcc-g++-3.3.1.tar.bz2
btar gcc-testsuite-3.3.1.tar.bz2
cd gcc-3.3.1 2> $logfile
check
patch -Np1 -i ../gcc-3.3.1-no_fixincludes-2.patch
patch -Np1 -i ../gcc-3.3.1-specs-2.patch
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.1/configure --prefix=/tools \
--with-local-prefix=/tools \
--enable-clocale=gnu --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-languages=c,c++
make 2> $logfile
check
make -k check
../gcc-3.3.1/contrib/test_summary >
$LFS/sources/gcc_compile_log
make install
home
rm -rf gcc-3.3.1 gcc-core-3.3.1.tar gcc-build gcc-g++-
3.3.1.tar gcc-testsuite-3.3.1.tar
btar binutils-2.14.tar.bz2
cd binutils-2.14 2> $logfile
check
mkdir ../binutils-build
cd ../binutils-build
../binutils-2.14/configure --prefix=/tools \
--enable-shared --with-lib-path=/tools/lib
make 2> $logfile
check
make check 2> $logfile
check
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
home
btar gawk-3.1.3.tar.bz2
cd gawk-3.1.3 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf gawk-3.1.3 gawk-3.1.3.tar
btar coreutils-5.0.tar.bz2
cd coreutils-5.0 2> $logfile
check
./configure --prefix=/tools
make
make RUN_EXPENSIVE_TESTS=yes check
make install
home
rm -rf coreutils-5.0 coreutils-5.0.tar
btar bzip2-1.0.2.tar.bz2
cd bzip2-1.0.2 2> $logfile
check
make PREFIX=/tools install
home
rm -rf bzip2-1.0.2
btar gzip-1.3.5.tar.bz2
cd gzip-1.3.5 2> $logfile
check
./configure --prefix=/tools
make
make install
home
rm -rf gzip-1.3.5.tar gzip-1.3.5
btar diffutils-2.8.1.tar.bz2
cd diffutils-2.8.1 2> $logfile
check
./configure --prefix=/tools
make
make install
home
rm -rf diffutils-2.8.1 diffutils-2.8.1.tar
btar findutils-4.1.20.tar.bz2
cd findutils-4.1.20 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf findutils-4.1.20 findutils-4.1.20.tar
btar make-3.80.tar.bz2
cd make-3.80 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf make-3.80 make-3.80.tar
btar grep-2.5.1.tar.bz2
cd grep-2.5.1 2> $logfile
check
./configure --prefix=/tools \
--disable-perl-regexp --with-included-regex
make
make check
make install
home
rm -rf grep-2.5.1 grep-2.5.1.tar
btar sed-4.0.7.tar.bz2
cd sed-4.0.7 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf sed-4.0.7 sed-4.0.7.tar
btar gettext-0.12.1.tar.bz2
cd gettext-0.12.1 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf gettext-0.12.1 gettext-0.12.1.tar
btar ncurses-5.3.tar.bz2
cd ncurses-5.3 2> $logfile
check
patch -Np1 -i ../ncurses-5.3-etip-2.patch
patch -Np1 -i ../ncurses-5.3-vsscanf.patch
./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
make
make install
home
rm -rf ncurses-5.3 ncurses-5.3.tar
btar patch-2.5.4.tar.bz2
cd patch-2.5.4 2> $logfile
check
CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools
make
make install
home
rm -rf patch-2.5.4.tar patch-2.5.4
btar tar-1.13.25.tar.bz2
cd tar-1.13.25 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf tar-1.13.25 tar-1.13.25.tar
btar texinfo-4.6.tar.bz2
cd texinfo-4.6 2> $logfile
check
./configure --prefix=/tools
make
make check
make install
home
rm -rf texinfo-4.6 texinfo-4.6.tar
btar bash-2.05b.tar.bz2
cd bash-2.05b 2> $logfile
check
patch -Np1 -i ../bash-2.05b-2.patch
./configure --prefix=/tools
make
make tests
make install
ln -s bash /tools/bin/sh
home
rm -rf bash-2.05b bash-2.05b.tar
btar util-linux-2.12.tar.bz2
cd util-linux-2.12 2> $logfile
check
cp configure configure.backup
sed "s@/usr/include@/tools/include@g" configure.backup >
configure
./configure
make -C lib
make -C mount mount umount
make -C text-utils more
cp mount/{,u}mount text-utils/more /tools/bin
home
rm -rf util-linux-2.12.tar util-linux-2.12
btar perl-5.8.0.tar.bz2
cd perl-5.8.0 2> $logfile
check
patch -Np1 -i ../perl-5.8.0-libc-3.patch
chmod u+w hints/linux.sh
echo 'static_ext="IO re Fcntl"' >> hints/linux.sh
./configure.gnu --prefix=/tools
make perl utilities
cp perl pod/pod2man /tools/bin
mkdir -p /tools/lib/perl5/5.8.0
cp -R lib/* /tools/lib/perl5/5.8.0
home
rm -rf perl-5.8.0 perl-5.8.0.tar
strip --strip-unneeded /tools/{,s}bin/*
strip --strip-debug /tools/lib/*
rm -rf /tools/{,share/}{doc,info,man} |
|