|
#2.3. Creating a File System on the Partition
mke2fs -jv /dev/<xxx>
export LFS=/mnt/lfs
mkdir -pv $LFS
mount -v -t ext3 /dev/<xxx> $LFS
mkdir -v $LFS/sources
#此处我是在arch宿主机上做的LFS 已经将源代码包拷贝至sources文件夹内
#cp /mnt/ubuntu/root/lfs_6.4/* /mnt/lfs/sources/
chmod -Rv a+wt $LFS/sources
#4.2. Creating the $LFS tools Directory
mkdir -v $LFS/tools
ln -sv $LFS/tools /
groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs
passwd lfs
chown -v lfs $LFS/tools
chown -Rv lfs $LFS/sources
su - lfs
#4.4. Setting Up the Environment
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
#Chapter 5. Constructing a Temporary System
cd $LFS/sources
#5.4. Binutils-2.18 - Pass 1
tar xvf binutils-2.18.tar.bz2
cd binutils-2.18
patch -Np1 -i ../binutils-2.18-configure-1.patch
mkdir -v ../binutils-build
cd ../binutils-build
CC="gcc -B/usr/bin/" ../binutils-2.18/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 $LFS/sources
rm -rf binutils-2.18
rm -rf binutils-build
#5.5. GCC-4.3.2 - Pass 1
tar xvf gcc-4.3.2.tar.bz2
cd gcc-4.3.2
tar -jxf ../mpfr-2.3.2.tar.bz2
mv mpfr-2.3.2 mpfr
tar -jxf ../gmp-4.2.4.tar.bz2
mv gmp-4.2.4 gmp
mkdir -v ../gcc-build
cd ../gcc-build
CC="gcc -B/usr/bin/" ../gcc-4.3.2/configure \
--prefix=/tools --with-local-prefix=/tools --disable-nls \
--disable-shared --disable-libssp --enable-languages=c
make
make install
ln -vs libgcc.a `gcc -print-libgcc-file-name | \
sed 's/libgcc/&_eh/'`
ln -vs gcc /tools/bin/cc
cd $LFS/sources
rm -rf gcc-build
rm -rf gcc-4.3.2
#5.6. Linux-2.6.27.4 API Headers
tar xvf linux-2.6.27.4.tar.bz2
cd linux-2.6.27.4
make mrproper
make headers_check
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /tools/include
cd $LFS/sources
rm -rf linux-2.6.27.4
#5.7. Glibc-2.8-20080929
tar xvf glibc-2.8-20080929.tar.bz2
cd glibc-2.8-20080929
sed -i 's@/etc/ld.so.preload@/tools/etc/ld.so.preload@' elf/rtld.c
mkdir -v ../glibc-build
cd ../glibc-build
echo "CFLAGS += -march=i486 -mtune=native" > configparms
../glibc-2.8-20080929/configure --prefix=/tools \
--disable-profile --enable-add-ons \
--enable-kernel=2.6.0 --with-binutils=/tools/bin \
--without-gd --with-headers=/tools/include \
--without-selinux
make
mkdir -v /tools/etc
touch /tools/etc/ld.so.conf
make install
cd $LFS/sources
rm -rf glibc-2.8-20080929
rm -rf glibc-build
#5.8. Adjusting the Toolchain
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \
> `dirname $(gcc -print-libgcc-file-name)`/specs
GCC_FIXED=`dirname $(gcc -print-libgcc-file-name)`/include-fixed &&
find ${GCC_FIXED}/* -maxdepth 0 -xtype d -exec rm -rff '{}' \; &&
rm -vf `grep -l "DO NOT EDIT THIS FILE" ${GCC_FIXED}/*` &&
unset GCC_FIXED
# test the result
#
#echo 'main(){}' > dummy.c
#cc dummy.c
#readelf -l a.out | grep ': /tools'
#
# it will display
#
# [Requesting program interpreter:
# /tools/lib/ld-linux.so.2]
#
# clean the temp
#
#rm -v dummy.c a.out
#5.9. Tcl-8.5.5
tar xvf tcl8.5.5-src.tar.gz
cd tcl8.5.5
cd unix
./configure --prefix=/tools
make
# test not mandatory
#TZ=UTC make test
make install
chmod -v u+w /tools/lib/libtcl8.5.so
make install-private-headers
ln -sv tclsh8.5 /tools/bin/tclsh
cd $LFS/sources
rm -rf tcl8.5.5
#5.10. Expect-5.43.0
tar xvf expect-5.43.0.tar.gz
cd expect-5.43
patch -Np1 -i ../expect-5.43.0-spawn-1.patch
patch -Np1 -i ../expect-5.43.0-tcl_8.5.5_fix-1.patch
cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig > configure
./configure --prefix=/tools --with-tcl=/tools/lib \
--with-tclinclude=/tools/include --with-x=no
make
# test not mandatory
#make test
make SCRIPTS="" install
cd $LFS/sources
rm -rf expect-5.43
#5.11. DejaGNU-1.4.4
tar xvf dejagnu-1.4.4.tar.gz
cd dejagnu-1.4.4
./configure --prefix=/tools
make install
cd $LFS/sources
rm -rf dejagnu-1.4.4
#5.12. GCC-4.3.2 - Pass 2
tar xvf gcc-4.3.2.tar.bz2
cd gcc-4.3.2
cp -v gcc/Makefile.in{,.orig}
sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
cp -v gcc/Makefile.in{,.tmp}
sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
> gcc/Makefile.in
for file in $(find gcc/config -name linux64.h -o -name linux.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
echo "
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR 0" >> $file
touch $file.orig
done
tar -jxf ../mpfr-2.3.2.tar.bz2
mv mpfr-2.3.2 mpfr
tar -jxf ../gmp-4.2.4.tar.bz2
mv gmp-4.2.4 gmp
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-4.3.2/configure --prefix=/tools \
--with-local-prefix=/tools --enable-clocale=gnu \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-languages=c,c++ \
--disable-libstdcxx-pch --disable-bootstrap
make
# test not mandatory
#make -k check
make install
# test the result
#
#echo 'main(){}' > dummy.c
#cc dummy.c
#readelf -l a.out | grep ': /tools'
#
# it will display
#
# [Requesting program interpreter:
# /tools/lib/ld-linux.so.2]
#
# clean the temp
#
#rm -v dummy.c a.out
cd $LFS/sources
rm -rf gcc-4.3.2
rm -rf gcc-build
#5.13. Binutils-2.18 - Pass 2
tar xvf binutils-2.18.tar.bz2
cd binutils-2.18
patch -Np1 -i ../binutils-2.18-configure-1.patch
mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.18/configure --prefix=/tools \
--disable-nls --with-lib-path=/tools/lib
make
# test not mandatory
#make check
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin
cd $LFS/sources
rm -rf binutils-2.18
rm -rf binutils-build
#5.14. Ncurses-5.6
tar xvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
make
make install
cd $LFS/sources
rm -rf ncurses-5.6
#5.15. Bash-3.2
tar xvf bash-3.2.tar.gz
cd bash-3.2
patch -Np1 -i ../bash-3.2-fixes-8.patch
./configure --prefix=/tools --without-bash-malloc \
ac_cv_func_working_mktime=yes
make
# test not mandatory
#make tests
make install
ln -vs bash /tools/bin/sh
cd $LFS/sources
rm -rf bash-3.2
#5.16. Bzip2-1.0.5
tar xvf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
make
make PREFIX=/tools install
cd $LFS/sources
rm -rf bzip2-1.0.5
#5.17. Coreutils-6.12
tar xvf coreutils-6.12.tar.gz
cd coreutils-6.12
patch -Np1 -i ../coreutils-6.12-old_build_kernel-1.patch
./configure --prefix=/tools --enable-install-program=hostname
make
# test not mandatory
#make RUN_EXPENSIVE_TESTS=yes check
make install
cp -v src/su /tools/bin/su-tools
cd $LFS/sources
rm -rf coreutils-6.12
#5.18. Diffutils-2.8.1
tar xvf diffutils-2.8.1.tar.gz
cd diffutils-2.8.1
./configure --prefix=/tools
make
make install
cd $LFS/sources
rm -rf diffutils-2.8.1
#5.19. E2fsprogs-1.41.3
tar xvf e2fsprogs-1.41.3.tar.gz
cd e2fsprogs-1.41.3
mkdir -v build
cd build
../configure --prefix=/tools
make
make install-libs
chmod -v u+w \
/tools/lib/{libblkid,libcom_err,libe2p,libext2fs,libss,libuuid}.a
cd $LFS/sources
rm -rf e2fsprogs-1.41.3
#5.20. Findutils-4.4.0
tar xvf findutils-4.4.0.tar.gz
cd findutils-4.4.0
./configure --prefix=/tools
make
# not mandatory
#make check
make install
cd $LFS/sources
rm -rf findutils-4.4.0
#5.21. Gawk-3.1.6
tar xvf gawk-3.1.6.tar.bz2
cd gawk-3.1.6
./configure --prefix=/tools ac_cv_func_working_mktime=yes
make
#make check
make install
cd $LFS/sources
rm -rf gawk-3.1.6
#5.22. Gettext-0.17
tar xvf gettext-0.17.tar.gz
cd gettext-0.17
cd gettext-tools
./configure --prefix=/tools --disable-shared
make -C gnulib-lib
make -C src msgfmt
cp -v src/msgfmt /tools/bin
cd $LFS/sources
rm -rf gettext-0.17
#5.23. Grep-2.5.3
tar xvf grep-2.5.3.tar.bz2
cd grep-2.5.3
./configure --prefix=/tools \
--disable-perl-regexp \
--without-included-regex
make
#make check
make install
cd $LFS/sources
rm -rf grep-2.5.3
#5.24. Gzip-1.3.12
tar xvf gzip-1.3.12.tar.gz
cd gzip-1.3.12
for file in gzip.c lib/utimens.{c,h} ; do \
cp -v $file{,.orig}
sed 's/futimens/gl_&/' $file.orig > $file
done
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf gzip-1.3.12
#5.25. M4-1.4.12
tar xvf m4-1.4.12.tar.bz2
cd m4-1.4.12
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf m4-1.4.12
#5.26. Make-3.81
tar xvf make-3.81.tar.bz2
cd make-3.81
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf make-3.81
#5.27. Patch-2.5.4
tar xvf patch-2.5.4.tar.gz
cd patch-2.5.4
./configure --prefix=/tools
make
make install
cd $LFS/sources
rm -rf patch-2.5.4
#5.28. Perl-5.10.0
tar xvf perl-5.10.0.tar.gz
cd perl-5.10.0
patch -Np1 -i ../perl-5.10.0-consolidated-1.patch
sh Configure -des -Dprefix=/tools \
-Dstatic_ext='Data/Dumper Fcntl IO POSIX'
make perl utilities ext/Errno/pm_to_blib
cp -v perl pod/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/5.10.0
cp -Rv lib/* /tools/lib/perl5/5.10.0
cd $LFS/sources
rm -rf perl-5.10.0
#5.29. Sed-4.1.5
tar xvf sed-4.1.5.tar.gz
cd sed-4.1.5
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf sed-4.1.5
#5.30. Tar-1.20
tar xvf tar-1.20.tar.bz2
cd tar-1.20
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf tar-1.20
#5.31. Texinfo-4.13a
tar xvf texinfo-4.13a.tar.gz
cd texinfo-4.13
./configure --prefix=/tools
make
#make check
make install
cd $LFS/sources
rm -rf texinfo-4.13
#5.32. Util-linux-ng-2.14.1
tar xvf util-linux-ng-2.14.1.tar.bz2
cd util-linux-ng-2.14.1
./configure --prefix=/tools
make BLKID_LIBS="-lblkid -luuid" -C mount mount umount
make -C text-utils more
cp -v mount/{,u}mount text-utils/more /tools/bin
cd $LFS/sources
rm -rf util-linux-ng-2.14.1
#5.33. Stripping
strip --strip-debug /tools/lib/*
strip --strip-unneeded /tools/{,s}bin/*
rm -rf /tools/{info,man}
#6.2. Preparing Virtual Kernel File Systems(do sth begin and the end)
#5.34. Changing Ownership
#exit
#chown -R root:root $LFS/tools
#
#Start----------------------------------------
#
mkdir -pv $LFS/{dev,proc,sys}
#6.2.1. Creating Initial Device Nodes
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
#6.2.2. Mounting and Populating /dev
mount -v --bind /dev $LFS/dev
#6.2.3. Mounting Virtual Kernel File Systems
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
#
#End------------------------------------------
# do something end
#6.4. Entering the Chroot Environment
#chroot "$LFS" /tools/bin/env -i \
# HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
# PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
# /tools/bin/bash --login +h
#6.5. Creating Directories(do sth in the middle of script)
#6.5. Creating Directories
mkdir -pv /{bin,boot,etc/opt,home,lib,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
for dir in /usr /usr/local; do
ln -sv share/{man,doc,info} $dir
done
mkdir -v /var/{lock,log,mail,run,spool}
mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
#6.6. Creating Essential Files and Symlinks
ln -sv /tools/bin/{bash,cat,echo,grep,pwd,stty} /bin
ln -sv /tools/bin/perl /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
ln -sv bash /bin/sh
touch /etc/mtab
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
uucp:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
mail:x:34:
nogroup:x:99:
EOF
# do something
exec /tools/bin/bash --login +h
touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
chgrp -v utmp /var/run/utmp /var/log/lastlog
chmod -v 664 /var/run/utmp /var/log/lastlog
#6.7. Linux-2.6.27.4 API Headers(do sth begain)
#如果你愿意的话,安装paco然后利用paco包管理器安装剩余软件
#这个是安装paco的参考命令,这里的paco安装没有解压cd make rm 等相关命令
#./configure --prefix=/usr --sysconfdir=/etc --disable-gpaco --enable-scripts && make && make install && make logme
#此处往下如果想要用 paco 和pacoball 记录和打包 就需要参考附件中的脚本文件以替换下面的相关脚本。注意,下面的脚本与这里安装的paco没有任何关系。
cd /sources
#6.7. Linux-2.6.27.4 API Headers
tar xvf linux-2.6.27.4.tar.bz2
cd linux-2.6.27.4
make mrproper
make headers_check
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /usr/include
cd /sources
rm -rf linux-2.6.27.4
#6.8. Man-pages-3.11
tar xvf man-pages-3.11.tar.bz2
cd man-pages-3.11
make install
cd /sources
rm -rf man-pages-3.11
#6.9. Glibc-2.8-20080929
tar xvf glibc-2.8-20080929.tar.bz2
cd glibc-2.8-20080929
sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED
patch -Np1 -i ../glibc-2.8-20080929-iconv_tests-1.patch
patch -Np1 -i ../glibc-2.8-20080929-ildoubl_test-1.patch
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
mkdir -v ../glibc-build
cd ../glibc-build
echo "CFLAGS += -march=i486 -mtune=native" > configparms
../glibc-2.8-20080929/configure --prefix=/usr \
--disable-profile --enable-add-ons \
--enable-kernel=2.6.0 --libexecdir=/usr/lib/glibc
make
# ******make test (the test suite for Glibc is considered critical.)
#cp -v ../glibc-2.8-20080929/iconvdata/gconv-modules iconvdata
#make -k check 2>&1 | tee glibc-check-log
#grep Error glibc-check-log
touch /etc/ld.so.conf
make install
mkdir -pv /usr/lib/locale
localedef -i en_HK -f ISO-8859-1 en_HK
localedef -i en_PH -f ISO-8859-1 en_PH
localedef -i en_US -f ISO-8859-1 en_US
localedef -i en_US -f UTF-8 en_US.UTF-8
localedef -i es_MX -f ISO-8859-1 es_MX
localedef -i zh_CN -f GB18030 zh_CN
localedef -i zh_CN -f GBK zh_CN
localedef -i zh_CN -f UTF-8 zh_CN
localedef -i zh_CN -f GB2312 zh_CN
localedef -i zh_HK -f UTF-8 zh_CN
localedef -i zh_HK -f BIG5-HKSCS zh_CN
localedef -i zh_TW -f EUC-TW zh_CN
localedef -i zh_TW -f UTF-8 zh_CN
localedef -i zh_TW -f BIG5 zh_CN
cd /sources
rm -rf glibc-2.8-20080929
rm -rf glibc-build
#6.9.2. Configuring Glibc
cat > /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
cp -v --remove-destination /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
# End /etc/ld.so.conf
EOF
#6.10. Re-adjusting the Toolchain
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
gcc -dumpspecs | sed \
-e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \
-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
`dirname $(gcc --print-libgcc-file-name)`/specs
# test the adjust
#Begin----------------------------------------------
#echo 'main(){}' > dummy.c
#cc dummy.c -v -Wl,--verbose &> dummy.log
#readelf -l a.out | grep ': /lib'
#
# will show
# [Requesting program interpreter: /lib/ld-linux.so.2]
#
#grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
#
# will show
# /usr/lib/crt1.o succeeded
# /usr/lib/crti.o succeeded
# /usr/lib/crtn.o succeeded
#
#grep -B1 '^ /usr/include' dummy.log
#
# will show
# #include <...> search starts here:
# /usr/include
#
#grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
#
# will show
# SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
# SEARCH_DIR("/usr/lib")
# SEARCH_DIR("/lib");
#
#grep "/lib/libc.so.6 " dummy.log
#
# will show
# attempt to open /lib/libc.so.6 succeeded
#
#grep found dummy.log
#
# will show
# found ld-linux.so.2 at /lib/ld-linux.so.2
#
#rm -v dummy.c a.out dummy.log
#End-----------------------------------------------
#6.11. Binutils-2.18
# Verify that the PTYs are working properly inside the chroot environment
#expect -c "spawn ls"
#
#If Show
# The system has no more ptys.
# Ask your system administrator to create more.
#the chroot environment is not set up for proper PTY operation
tar xvf binutils-2.18.tar.bz2
cd binutils-2.18
patch -Np1 -i ../binutils-2.18-configure-1.patch
patch -Np1 -i ../binutils-2.18-GCC43-1.patch
rm -fv etc/standards.info
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.18/configure --prefix=/usr \
--enable-shared
make tooldir=/usr
# *****test (The test suite for Binutils in this section is considered critical.)
#make check
make tooldir=/usr install
cp -v ../binutils-2.18/include/libiberty.h /usr/include
cd /sources
rm -rf binutils-2.18
rm -rf binutils-build
#6.12. GMP-4.2.4
tar xvf gmp-4.2.4.tar.bz2
cd gmp-4.2.4
cd /sources
rm -rf gmp-4.2.4
./configure --prefix=/usr --enable-cxx --enable-mpbsd
make
# test issue
#make check 2>&1 | tee gmp-check-log
#awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log
make install
mkdir -v /usr/share/doc/gmp-4.2.4
cp -v doc/{isa_abi_headache,configuration} doc/*.html \
/usr/share/doc/gmp-4.2.4
cd /sources
rm -rf gmp-4.2.4
#6.13. MPFR-2.3.2
tar xvf mpfr-2.3.2.tar.bz2
cd mpfr-2.3.2
./configure --prefix=/usr --enable-thread-safe
make
#make check
make install
cd /sources
rm -rf mpfr-2.3.2
#6.14. GCC-4.3.2
tar xvf gcc-4.3.2.tar.bz2
cd gcc-4.3.2
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-4.3.2/configure --prefix=/usr \
--libexecdir=/usr/lib --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu --enable-languages=c,c++ \
--disable-bootstrap
make
#*****the test suite for GCC is considered critical.
#make -k check
# check the result
#../gcc-4.3.2/contrib/test_summary
# For only the summaries
#../gcc-4.3.2/contrib/test_summary | grep -A7 Summ
make install
ln -sv ../usr/bin/cpp /lib
ln -sv gcc /usr/bin/cc
# check the compile environment
#Begin------------------------------------------------
#echo 'main(){}' > dummy.c
#cc dummy.c -v -Wl,--verbose &> dummy.log
#readelf -l a.out | grep ': /lib'
#
# will show
# [Requesting program interpreter: /lib/ld-linux.so.2]
#
#grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
#
# will show
# /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../crt1.o succeeded
# /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../crti.o succeeded
# /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../crtn.o succeeded
#
#grep -B4 '^ /usr/include' dummy.log
#
# will show
# #include <...> search starts here:
# /usr/local/include
# /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include
# /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed
# /usr/include
#
#grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
#
# will show
# SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
# SEARCH_DIR("/usr/local/lib")
# SEARCH_DIR("/lib")
# SEARCH_DIR("/usr/lib");
#
#grep "/lib/libc.so.6 " dummy.log
#
# will show
# attempt to open /lib/libc.so.6 succeeded
#
#grep found dummy.log
#
# will show
# found ld-linux.so.2 at /lib/ld-linux.so.2
#
#rm -v dummy.c a.out dummy.log
#End-----------------------------------------------
cd /sources
rm -rf gcc-4.3.2
rm -rf gcc-build
#6.15. Berkeley DB-4.7.25
tar xvf db-4.7.25.tar.gz
cd db-4.7.25
patch -Np1 -i ../db-4.7.25-upstream_fixes-1.patch
cd build_unix
../dist/configure --prefix=/usr --enable-compat185 --enable-cxx
make
make docdir=/usr/share/doc/db-4.7.25 install
chown -Rv root:root /usr/share/doc/db-4.7.25
cd /sources
rm -rf db-4.7.25
#6.16. Sed-4.1.5
tar xvf sed-4.1.5.tar.gz
cd sed-4.1.5
./configure --prefix=/usr --bindir=/bin --enable-html
make
#make check
make install
cd /sources
rm -rf sed-4.1.5
#6.17. E2fsprogs-1.41.3
tar xvf e2fsprogs-1.41.3.tar.gz
cd e2fsprogs-1.41.3
sed -i 's@/bin/rm@/tools&@' lib/blkid/test_probe.in
mkdir -v build
cd build
../configure --prefix=/usr --with-root-prefix="" \
--enable-elf-shlibs
make
#make check
make install
make install-libs
chmod -v u+w /usr/lib/{libblkid,libcom_err,libe2p,libext2fs,libss,libuuid}.a
gunzip -v /usr/share/info/libext2fs.info.gz
install-info --dir-file=/usr/share/info/dir \
/usr/share/info/libext2fs.info
makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
install -v -m644 doc/com_err.info /usr/share/info
install-info --dir-file=/usr/share/info/dir \
/usr/share/info/com_err.info
install -v -m644 -D ../doc/libblkid.txt \
/usr/share/doc/e2fsprogs-1.41.3/libblkid.txt
cd /sources
rm -rf e2fsprogs-1.41.3
#6.18. Coreutils-6.12
tar xvf coreutils-6.12.tar.gz
cd coreutils-6.12
patch -Np1 -i ../coreutils-6.12-uname-1.patch
patch -Np1 -i ../coreutils-6.12-old_build_kernel-1.patch
patch -Np1 -i ../coreutils-6.12-i18n-2.patch
./configure --prefix=/usr --enable-install-program=hostname \
--enable-no-install-program=kill,uptime
make
##Begin test-------------------------------------
#make NON_ROOT_USERNAME=nobody check-root
## run the remainder of the tests as the nobody user
#echo "dummy:x:1000:nobody" >> /etc/group
#chown -Rv nobody config.log {gnulib-tests,lib,src}/.deps
## now run the test
#su-tools nobody -s /bin/bash -c "make RUN_EXPENSIVE_TESTS=yes check"
#sed -i '/dummy/d' /etc/group
##End--------------------------------------------
make install
mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
mv -v /usr/bin/{false,hostname,ln,ls,mkdir,mknod,mv,pwd,readlink,rm} /bin
mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
mv -v /usr/bin/chroot /usr/sbin
mv -v /usr/bin/{head,sleep,nice} /bin
cd /sources
rm -rf coreutils-6.12
#6.19. Iana-Etc-2.30
tar xvf iana-etc-2.30.tar.bz2
cd iana-etc-2.30
make
make install
cd /sources
rm -rf iana-etc-2.30
#6.20. M4-1.4.12
tar xvf m4-1.4.12.tar.bz2
cd m4-1.4.12
./configure --prefix=/usr --enable-threads
make
#make check
make install
cd /sources
rm -rf m4-1.4.12
#6.21. Bison-2.3
tar xvf bison-2.3.tar.bz2
cd bison-2.3
./configure --prefix=/usr
echo '#define YYENABLE_NLS 1' >> config.h
make
#make check
make install
cd /sources
rm -rf bison-2.3
#6.22. Ncurses-5.6
tar xvf ncurses-5.6.tar.gz
cd ncurses-5.6
patch -Np1 -i ../ncurses-5.6-coverity_fixes-1.patch
./configure --prefix=/usr --with-shared --without-debug --enable-widec
make
make install
chmod -v 644 /usr/lib/libncurses++w.a
mv -v /usr/lib/libncursesw.so.5* /lib
ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
for lib in curses ncurses form panel menu ; do \
rm -vf /usr/lib/lib${lib}.so ; \
echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so ; \
ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a ; \
done
ln -sfv libncurses++w.a /usr/lib/libncurses++.a
rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
ln -sfv libncursesw.a /usr/lib/libcursesw.a
ln -sfv libncurses.a /usr/lib/libcurses.a
mkdir -v /usr/share/doc/ncurses-5.6
cp -v -R doc/* /usr/share/doc/ncurses-5.6
cd /sources
rm -rf ncurses-5.6
#6.23. Procps-3.2.7
tar xvf procps-3.2.7.tar.gz
cd procps-3.2.7
patch -Np1 -i ../procps-3.2.7-watch_unicode-1.patch
make
make install
cd /sources
rm -rf procps-3.2.7
#6.24. Libtool-2.2.6a
tar xvf libtool-2.2.6a.tar.gz
cd libtool-2.2.6
./configure --prefix=/usr
make
#make check
make install
cd /sources
rm -rf libtool-2.2.6
#6.25. Zlib-1.2.3
tar xvf zlib-1.2.3.tar.bz2
cd zlib-1.2.3
./configure --prefix=/usr --shared --libdir=/lib
make
#make check
make install
rm -v /lib/libz.so
ln -sfv ../../lib/libz.so.1.2.3 /usr/lib/libz.so
make clean
./configure --prefix=/usr
make
#make check
make install
chmod -v 644 /usr/lib/libz.a
cd /sources
rm -rf zlib-1.2.3
#6.26. Perl-5.10.0
tar xvf perl-5.10.0.tar.gz
cd perl-5.10.0
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
patch -Np1 -i ../perl-5.10.0-consolidated-1.patch
sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" \
-e "s|INCLUDE\s*= ./zlib-src|INCLUDE = /usr/include|" \
-e "s|LIB\s*= ./zlib-src|LIB = /usr/lib|" \
ext/Compress/Raw/Zlib/config.in
sh Configure -des -Dprefix=/usr \
-Dvendorprefix=/usr \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dpager="/usr/bin/less -isR"
make
#make test
make install
cd /sources
rm -rf perl-5.10.0
#6.27. Readline-5.2
tar xvf readline-5.2.tar.gz
cd readline-5.2
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
patch -Np1 -i ../readline-5.2-fixes-5.patch
./configure --prefix=/usr --libdir=/lib
make SHLIB_LIBS=-lncurses
make install
mv -v /lib/lib{readline,history}.a /usr/lib
rm -v /lib/lib{readline,history}.so
ln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.so
ln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so
mkdir -v /usr/share/doc/readline-5.2
install -v -m644 doc/*.{ps,pdf,html,dvi} \
/usr/share/doc/readline-5.2
cd /sources
rm -rf readline-5.2
#6.28. Autoconf-2.63
tar xvf autoconf-2.63.tar.bz2
cd autoconf-2.63
./configure --prefix=/usr
make
#make check
make install
cd /sources
rm -rf autoconf-2.63
#6.29. Automake-1.10.1
tar xvf automake-1.10.1.tar.bz2
cd automake-1.10.1
patch -Np1 -i ../automake-1.10.1-test_fix-1.patch
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.10.1
make
#make check
make install
cd /sources
rm -rf automake-1.10.1
#6.30. Bash-3.2
tar xvf bash-3.2.tar.gz
cd bash-3.2
tar -xvf ../bash-doc-3.2.tar.gz
sed -i "s|htmldir = @htmldir@|htmldir = /usr/share/doc/bash-3.2|" \
Makefile.in
patch -Np1 -i ../bash-3.2-fixes-8.patch
./configure --prefix=/usr --bindir=/bin \
--without-bash-malloc \
--with-installed-readline ac_cv_func_working_mktime=yes
make
#Begain test--------------------------------------------------------
#sed -i 's/LANG/LC_ALL/' tests/intl.tests
#sed -i 's@tests@& </dev/tty@' tests/run-test
#chown -Rv nobody ./
#
#su-tools nobody -s /bin/bash -c "make tests"
#End test----------------------------------------------------------
make install
cd /sources
rm -rf bash-3.2
#6.31. Bzip2-1.0.5(do sth begain and the end)
# do something first for the "6.30. Bash-3.2"
#
#exec /bin/bash --login +h
#
# Start auto build------------------------------
#6.31. Bzip2-1.0.5
tar xvf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
patch -Np1 -i ../bzip2-1.0.5-install_docs-1.patch
make -f Makefile-libbz2_so
make clean
make
make PREFIX=/usr install
cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
rm -v /usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 /bin/bunzip2
ln -sv bzip2 /bin/bzcat
cd /sources
rm -rf bzip2-1.0.5
#6.32. Diffutils-2.8.1
tar xvf diffutils-2.8.1.tar.gz
cd diffutils-2.8.1
patch -Np1 -i ../diffutils-2.8.1-i18n-1.patch
touch man/diff.1
./configure --prefix=/usr
make
make install
cd /sources
rm -rf diffutils-2.8.1
#6.33. File-4.26
tar xvf file-4.26.tar.gz
cd file-4.26
sed -i -e '197,+1d' \
-e '189,+1d' \
-e 's/token$/tokens/' doc/file.man
./configure --prefix=/usr
make
#make check
make install
cd /sources
rm -rf file-4.26
#6.34. Gawk-3.1.6
tar xvf gawk-3.1.6.tar.bz2
cd gawk-3.1.6
./configure --prefix=/usr --libexecdir=/usr/lib \
ac_cv_func_working_mktime=yes
make
#make check
make install
mkdir -v /usr/share/doc/gawk-3.1.6
cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} \
/usr/share/doc/gawk-3.1.6
cd /sources
rm -rf gawk-3.1.6
#6.35. Findutils-4.4.0
tar xvf findutils-4.4.0.tar.gz
cd findutils-4.4.0
./configure --prefix=/usr --libexecdir=/usr/lib/findutils \
--localstatedir=/var/lib/locate
make
#make check
make install
mv -v /usr/bin/find /bin
sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb
cd /sources
rm -rf findutils-4.4.0
#6.36. Flex-2.5.35
tar xvf flex-2.5.35.tar.bz2
cd flex-2.5.35
./configure --prefix=/usr
make
#make check
make install
ln -sv libfl.a /usr/lib/libl.a
cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex
exec /usr/bin/flex -l "$@"
# End /usr/bin/lex
EOF
chmod -v 755 /usr/bin/lex
mkdir -v /usr/share/doc/flex-2.5.35
cp -v doc/flex.pdf \
/usr/share/doc/flex-2.5.35
cd /sources
rm -rf flex-2.5.35
#6.37. GRUB-0.97
tar xvf grub-0.97.tar.gz
cd grub-0.97
patch -Np1 -i ../grub-0.97-disk_geometry-1.patch
patch -Np1 -i ../grub-0.97-256byte_inode-1.patch
./configure --prefix=/usr
make
#make check
make install
mkdir -v /boot/grub
cp -v /usr/lib/grub/i386-pc/stage{1,2} /boot/grub
cd /sources
rm -rf grub-0.97
#6.38. Gettext-0.17
tar xvf gettext-0.17.tar.gz
cd gettext-0.17
./configure --prefix=/usr \
--docdir=/usr/share/doc/gettext-0.17
make
#make check
make install
cd /sources
rm -rf gettext-0.17
#6.39. Grep-2.5.3
tar xvf grep-2.5.3.tar.bz2
cd grep-2.5.3
patch -Np1 -i ../grep-2.5.3-debian_fixes-1.patch
patch -Np1 -i ../grep-2.5.3-upstream_fixes-1.patch
./configure --prefix=/usr \
--bindir=/bin \
--without-included-regex
make
#make check || true
make install
cd /sources
rm -rf grep-2.5.3
#6.40. Groff-1.18.1.4
tar xvf groff-1.18.1.4.tar.gz
cd groff-1.18.1.4
patch -Np1 -i ../groff-1.18.1.4-debian_fixes-1.patch
sed -i -e 's/2010/002D/' -e 's/2212/002D/' \
-e 's/2018/0060/' -e 's/2019/0027/' font/devutf8/R.proto
PAGE=A4 ./configure --prefix=/usr --enable-multibyte
make
make docdir=/usr/share/doc/groff-1.18.1.4 install
ln -sv eqn /usr/bin/geqn
ln -sv tbl /usr/bin/gtbl
cd /sources
rm -rf groff-1.18.1.4
#6.41. Gzip-1.3.12
tar xvf gzip-1.3.12.tar.gz
cd gzip-1.3.12
sed -i 's/futimens/gl_&/' gzip.c lib/utimens.{c,h}
./configure --prefix=/usr --bindir=/bin
make
#make check
make install
mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
cd /sources
rm -rf gzip-1.3.12
#6.42. Inetutils-1.5
tar xvf inetutils-1.5.tar.gz
cd inetutils-1.5
patch -Np1 -i ../inetutils-1.5-no_server_man_pages-2.patch
sed -i 's@<sys/types.h>@<sys/types.h>\n#include <stdlib.h>@' \
libicmp/icmp_timestamp.c
./configure --prefix=/usr --libexecdir=/usr/sbin \
--sysconfdir=/etc --localstatedir=/var \
--disable-ifconfig --disable-logger --disable-syslogd \
--disable-whois --disable-servers
make
make install
mv -v /usr/bin/ping /bin
cd /sources
rm -rf inetutils-1.5
#6.43. IPRoute2-2.6.26
tar xvf iproute2-2.6.26.tar.bz2
cd iproute2-2.6.26
make DESTDIR= SBINDIR=/sbin
make DESTDIR= SBINDIR=/sbin MANDIR=/usr/share/man \
DOCDIR=/usr/share/doc/iproute2-2.6.26 install
mv -v /sbin/arpd /usr/sbin
cd /sources
rm -rf iproute2-2.6.26
#6.44. Kbd-1.14.1
tar xvf kbd-1.14.1.tar.gz
cd kbd-1.14.1
patch -Np1 -i ../kbd-1.14.1-backspace-1.patch
sed -i -e '1i KEYCODES_PROGS = @KEYCODES_PROGS@' \
-e '1i RESIZECONS_PROGS = @RESIZECONS_PROGS@' src/Makefile.in
var=OPTIONAL_PROGS
sed -i "s/ifdef $var/ifeq (\$($var),yes)/" man/Makefile.in
unset var
./configure --prefix=/usr --datadir=/lib/kbd
make
make install
mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
mkdir -v /usr/share/doc/kbd-1.14.1
cp -R -v doc/* \
/usr/share/doc/kbd-1.14.1
cd /sources
rm -rf kbd-1.14.1
#6.45. Less-418
tar xvf less-418.tar.gz
cd less-418
./configure --prefix=/usr --sysconfdir=/etc
make
make install
cd /sources
rm -rf less-418
#6.46. Make-3.81
tar xvf make-3.81.tar.bz2
cd make-3.81
./configure --prefix=/usr
make
#make check
make install
cd /sources
rm -rf make-3.81
#6.47. Man-DB-2.5.2
tar xvf man-db-2.5.2.tar.gz
cd man-db-2.5.2
sed -i -e '\%\t/usr/man%d' -e '\%\t/usr/local/man%d' src/man_db.conf.in
./configure --prefix=/usr --libexecdir=/usr/lib \
--sysconfdir=/etc --disable-setuid \
--enable-mb-groff --with-browser=/usr/bin/lynx \
--with-col=/usr/bin/col --with-vgrind=/usr/bin/vgrind \
--with-grap=/usr/bin/grap
make
make install
cat >> convert-mans << "EOF"
#!/bin/sh -e
FROM="$1"
TO="$2"
shift ; shift
while [ $# -gt 0 ]
do
FILE="$1"
shift
iconv -f "$FROM" -t "$TO" "$FILE" >.tmp.iconv
mv .tmp.iconv "$FILE"
done
EOF
install -v -m755 convert-mans /usr/bin
cd /sources
rm -rf man-db-2.5.2
#6.48. Module-Init-Tools-3.4.1
tar xvf module-init-tools-3.4.1.tar.bz2
cd module-init-tools-3.4.1
patch -Np1 -i ../module-init-tools-3.4.1-manpages-1.patch
# test the package
#./configure
#make check
#make clean
./configure --prefix=/ --enable-zlib --mandir=/usr/share/man
make
make INSTALL=install install
cd /sources
rm -rf module-init-tools-3.4.1
#6.49. Patch-2.5.4
tar xvf patch-2.5.4.tar.gz
cd patch-2.5.4
./configure --prefix=/usr
make
make install
cd /sources
rm -rf patch-2.5.4
#6.50. Psmisc-22.6
tar xvf psmisc-22.6.tar.gz
cd psmisc-22.6
./configure --prefix=/usr --exec-prefix=""
make
make install
mv -v /bin/pstree* /usr/bin
ln -sv killall /bin/pidof
cd /sources
rm -rf psmisc-22.6
#6.51. Shadow-4.1.2.1
tar xvf shadow-4.1.2.1.tar.bz2
cd shadow-4.1.2.1
sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
# Can't display the zh man page normally
sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in
#
# Use the convert-mans script to install other language man page
#
#for i in de es fi fr id it pt_BR; do
# convert-mans UTF-8 ISO-8859-1 man/${i}/*.?
#done
#for i in cs hu pl; do
# convert-mans UTF-8 ISO-8859-2 man/${i}/*.?
#done
#convert-mans UTF-8 EUC-JP man/ja/*.?
#convert-mans UTF-8 KOI8-R man/ru/*.?
#convert-mans UTF-8 ISO-8859-9 man/tr/*.?
# Use the md5 ,in place of the default crypt
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \
-e 's@/var/spool/mail@/var/mail@' etc/login.defs
./configure --sysconfdir=/etc
make
make install
mv -v /usr/bin/passwd /bin
cd /sources
rm -rf shadow-4.1.2.1
# Do something to configure the shadow------------------------
#pwconv
#grpconv
#useradd -D -b /home
#sed -i 's/yes/no/' /etc/default/useradd
#
#passwd root
#6.52. Sysklogd-1.5
#6.52. Sysklogd-1.5
tar xvf sysklogd-1.5.tar.gz
cd sysklogd-1.5
make
make install
#configure the sysklogd
cat > /etc/syslog.conf << "EOF"
# Begin /etc/syslog.conf
auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *
# End /etc/syslog.conf
EOF
cd /sources
rm -rf sysklogd-1.5
#6.53. Sysvinit-2.86
tar xvf sysvinit-2.86.tar.gz
cd sysvinit-2.86
sed -i 's@Sending processes@& configured via /etc/inittab@g' \
src/init.c
sed -i -e 's/utmpdump wall/utmpdump/' \
-e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile
make -C src
make -C src install
# Configure the sysvinit------------------------------
cat > /etc/inittab << "EOF"
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016nce:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab
EOF
cd /sources
rm -rf sysvinit-2.86
#6.54. Tar-1.20
tar xvf tar-1.20.tar.bz2
cd tar-1.20
./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin
make
#make check
make install
cd /sources
rm -rf tar-1.20
#6.55. Texinfo-4.13a
tar xvf texinfo-4.13a.tar.gz
cd texinfo-4.13
./configure --prefix=/usr
make
#make check
make install
make TEXMF=/usr/share/texmf install-tex
cd /usr/share/info
rm dir
for f in *
do install-info $f dir 2>/dev/null
done
cd /sources
rm -rf texinfo-4.13
#6.56. Udev-130
tar xvf udev-130.tar.bz2
cd udev-130
tar -xvf ../udev-config-20081015.tar.bz2
install -dv /lib/{firmware,udev/devices/{pts,shm}}
mknod -m0666 /lib/udev/devices/null c 1 3
mknod -m0600 /lib/udev/devices/kmsg c 1 11
ln -sv /proc/self/fd /lib/udev/devices/fd
ln -sv /proc/self/fd/0 /lib/udev/devices/stdin
ln -sv /proc/self/fd/1 /lib/udev/devices/stdout
ln -sv /proc/self/fd/2 /lib/udev/devices/stderr
ln -sv /proc/kcore /lib/udev/devices/core
./configure --prefix=/usr \
--exec-prefix= \
--sysconfdir=/etc
make
make install
install -m644 -v rules/packages/64-*.rules \
/lib/udev/rules.d/
install -m644 -v rules/packages/40-pilot-links.rules \
/lib/udev/rules.d/
cd udev-config-20081015
make install
make install-doc
make install-extra-doc
cd ..
install -m644 -v -D docs/writing_udev_rules/index.html \
/usr/share/doc/udev-130/index.html
cd /sources
rm -rf udev-130
#6.57. Util-linux-ng-2.14.1
tar xvf util-linux-ng-2.14.1.tar.bz2
cd util-linux-ng-2.14.1
sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
-i $(grep -rl '/etc/adjtime' .)
mkdir -pv /var/lib/hwclock
./configure --enable-arch --enable-partx --enable-write
make
make install
cd /sources
rm -rf util-linux-ng-2.14.1
#6.58. Vim-7.2
tar xvf vim-7.2.tar.bz2
tar xvf vim-7.2-lang.tar.gz
cd vim72
patch -Np1 -i ../vim-7.2-fixes-3.patch
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
./configure --prefix=/usr --enable-multibyte
make
#make test
# Add vi man page link
make install
ln -sv vim /usr/bin/vi
for L in /usr/share/man/{,*/}man1/vim.1; do
ln -sv vim.1 $(dirname $L)/vi.1
done
ln -sv ../vim/vim72/doc /usr/share/doc/vim-7.2
# Configure the vim----------------------------------
cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc
set nocompatible
set backspace=2
syntax on
if (&term == "iterm") || (&term == "putty")
set background=dark
endif
" End /etc/vimrc
EOF
# To get more options use follow command
#vim -c 'ptions'
cd /sources
rm -rf vim72
#6.60. Stripping Again(plz do it manually)
#这一节最好都用手工做
#6.60. Stripping Again
#logout
#chroot $LFS /tools/bin/env -i \
# HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
# PATH=/bin:/usr/bin:/sbin:/usr/sbin \
# /tools/bin/bash --login
# Stripping
#/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
# -exec /tools/bin/strip --strip-debug '{}' ';'
#6.61. Cleaning Up
#logout
#chroot "$LFS" /usr/bin/env -i \
# HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
# PATH=/bin:/usr/bin:/sbin:/usr/sbin \
# /bin/bash --login
#7.2. LFS-Bootscripts-20081031
cd /sources
#7.2. LFS-Bootscripts-20081031
tar xvf lfs-bootscripts-20081031.tar.bz2
cd lfs-bootscripts-20081031
make install
cd /sources
rm -rf lfs-bootscripts-20081031
#7.5. Configuring the setclock Script
cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock
UTC=1
# End /etc/sysconfig/clock
EOF
#7.6. Configuring the Linux Console
#nothing to do for zh
#7.8. Creating the /etc/inputrc File
cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn <roryo@roryo.dynup.net>
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
EOF
#7.9. The Bash Shell Startup Files
cat > /etc/profile << "EOF"
# Begin /etc/profile
export LANG=zh_CN.UTF-8
export INPUTRC=/etc/inputrc
alias ls="ls --color"
export PS1='\u:\w\$ '
# End /etc/profile
EOF
#7.10. Configuring the localnet Script
echo "HOSTNAME=mylinux" > /etc/sysconfig/network
#7.11. Customizing the /etc/hosts File
cat > /etc/hosts << "EOF"
# Begin /etc/hosts (no network card version)
127.0.0.1 mylinux localhost
# End /etc/hosts (no network card version)
EOF
#7.13.2. Creating Network Interface Configuration Files
cd /etc/sysconfig/network-devices
mkdir -v ifconfig.eth0
cat > ifconfig.eth0/ipv4 << "EOF"
ONBOOT=yes
SERVICE=ipv4-static
IP=192.168.1.190
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255
EOF
#7.13.3. Creating the /etc/resolv.conf File
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
#domain <Your Domain Name>
#nameserver <IP address of your primary nameserver>
#nameserver <IP address of your secondary nameserver>
nameserver 202.102.134.68
nameserver 202.102.128.68
# End /etc/resolv.conf
EOF
#8.2. Creating the /etc/fstab File
cat > /etc/fstab << "EOF"
# Begin /etc/fstab
# file system mount-point type options dump fsck
# order
/dev/sda2 / xfs defaults 1 1
/dev/sda1 swap swap pri=1 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
# End /etc/fstab
EOF
#8.3. Linux-2.6.27.4
cd /sources
#8.3. Linux-2.6.27.4
tar xvf linux-2.6.27.4.tar.bz2
cd linux-2.6.27.4
make mrproper
make menuconfig
make
make modules_install
cp -v arch/x86/boot/bzImage /boot/lfskernel-2.6.27.4
cp -v System.map /boot/System.map-2.6.27.4
cp -v .config /boot/config-2.6.27.4
install -d /usr/share/doc/linux-2.6.27.4
cp -r Documentation/* /usr/share/doc/linux-2.6.27.4
cd /sources
rm -rf linux-2.6.27.4
#grub--------------------------
grub
root (hd0,1)
setup (hd0)
quit
cat > /boot/grub/menu.lst << "EOF"
# Begin /boot/grub/menu.lst
# By default boot the first menu entry.
default 0
# Allow 30 seconds before booting the default.
timeout 30
# Use prettier colors.
color green/black light-green/black
# The first entry is for LFS.
title LFS 6.4
root (hd0,3)
kernel /boot/lfskernel-2.6.27.4 root=/dev/hda4
EOF
mkdir -v /etc/grub
ln -sv /boot/grub/menu.lst /etc/grub
#The End----------------------------
echo 6.4 > /etc/lfs-release
logout
umount -v $LFS/dev/pts
umount -v $LFS/dev/shm
umount -v $LFS/dev
umount -v $LFS/proc
umount -v $LFS/sys
umount -v $LFS
umount -v $LFS/usr
umount -v $LFS/home
umount -v $LFS
shutdown -r now
|
|