分类: LINUX
2007-04-23 14:20:53
tar xvf $LFS/file-4.13.tar.bz2 cd file-4.13 ./configure --prefix=/usr make make install cd .. rm -rf file-4.13
tar xvf $LFS/libtool-1.5.14.tar.bz2 cd libtool-1.5.14 ./configure --prefix=/usr make
make check
make install cd .. rm -rf libtool-1.5.14
tar xvf $LFS/bzip2-1.0.3.tar.bz2 cd bzip2-1.0.3 patch -Np1 -i $LFS/bzip2-1.0.3-install_docs-1.patch patch -Np1 -i $LFS/bzip2-1.0.3-bzgrep_security-1.patch make -f Makefile-libbz2_so make clean make make 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 .. rm -rf bzip2-1.0.3
tar xvf $LFS/diffutils-2.8.1.tar.bz2 cd diffutils-2.8.1 ./configure --prefix=/usr make make install cd .. rm -rf diffutils-2.8.1
tar xvf $LFS/kbd-1.12.tar.bz2 cd kbd-1.12 ./configure make make install cd .. rm -rf kbd-1.12
tar xvf $LFS/e2fsprogs-1.37.tar.bz2 cd e2fsprogs-1.37 sed -i -e 's/-DTEST/$(ALL_CFLAGS) &/' lib/e2p/Makefile.in mkdir -v build cd build ../configure --prefix=/usr --with-root-prefix="" \ --enable-elf-shlibs --disable-evms make
make check
make install make install-libs cd ../.. rm -rf e2fsprogs-1.37
tar xvf $LFS/grep-2.5.1a.tar.bz2 cd grep-2.5.1a ./configure --prefix=/usr --bindir=/bin make
make check
make install cd .. rm -rf grep-2.5.1a
tar xvf $LFS/grub-0.96.tar.bz2 cd grub-0.96 ./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 .. rm -rf grub-0.96
tar xvf $LFS/gzip-1.3.5.tar.bz2 cd gzip-1.3.5 patch -Np1 -i $LFS/gzip-1.3.5-security_fixes-1.patch ./configure --prefix=/usr sed -i 's@"BINDIR"@/bin@g' gzexe.in make make install mv -v /usr/bin/gzip /bin rm -v /usr/bin/{gunzip,zcat} ln -sv gzip /bin/gunzip ln -sv gzip /bin/zcat ln -sv gzip /bin/compress ln -sv gunzip /bin/uncompress cd .. rm -rf gzip-1.3.5
tar xvf $LFS/hotplug-2004_09_23.tar.bz2 cd hotplug-2004_09_23 make install cp -v etc/hotplug/pnp.distmap /etc/hotplug rm -rfv /etc/init.d rm -fv /etc/hotplug/net.agent mkdir -v /lib/firmware cd .. rm -rf hotplug-2004_09_23
tar xvf $LFS/man-1.5p.tar.bz2 cd man-1.5p sed -i 's@-is@&R@g' configure sed -i 's@MANPATH./usr/man@#&@g' src/man.conf.in ./configure -confdir=/etc make make install cd .. rm -rf man-1.5p
tar xvf $LFS/make-3.80.tar.bz2 cd make-3.80 ./configure --prefix=/usr make
make check
make install cd .. rm -rf make-3.80
tar xvf $LFS/module-init-tools-3.1.tar.bz2 tar xvf $LFS/module-init-tools-testsuite-3.1.tar.bz2 cd module-init-tools-3.1 touch modprobe.conf.5 ./configure make check make distclean ./configure --prefix="" --enable-zlib make make install cd .. rm -rf module-init-tools-3.1
tar xvf $LFS/patch-2.5.4.tar.bz2 cd patch-2.5.4 CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/usr make make install cd .. rm -rf patch-2.5.4
tar xvf $LFS/procps-3.2.5.tar.bz2 cd procps-3.2.5 make make install cd .. rm -rf procps-3.2.5
tar xvf $LFS/psmisc-21.6.tar.bz2 cd psmisc-21.6 ./configure --prefix=/usr --exec-prefix="" make make install mv -v /bin/pstree* /usr/bin ln -sv killall /bin/pidof cd .. rm -rf psmisc-21.6
tar xvf $LFS/shadow-4.0.9.tar.bz2 cd shadow-4.0.9 ./configure --libdir=/lib --enable-shared sed -i 's/groups$(EXEEXT) //' src/Makefile sed -i '/groups/d' man/Makefile make make install cp -v etc/{limits,login.access} /etc sed -e's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ -e 's@/var/spool/mail@/var/mail@' \ etc/login.defs.linux > /etc/login.defs mv -v /usr/bin/passwd /bin mv -v /lib/libshadow.*a /usr/lib rm -v /lib/libshadow.so ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so mkdir -v /etc/default pwconv grpconv passwd root
cd .. rm -rf shadow-4.0.9
tar xvf $LFS/sysklogd-1.4.1.tar.bz2 cd sysklogd-1.4.1 patch -Np1 -i $LFS/sysklogd-1.4.1-fixes-1.patch make make install
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 * # log the bootscript output: local2.* -/var/log/boot.log # End /etc/syslog.conf EOF
cd .. rm -rf sysklogd-1.4.1
tar xvf $LFS/sysvinit-2.86.tar.bz2 cd sysvinit-2.86 sed -i 's@Sending processes@& started by init@g' src/init.c make -C src make -C src install
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:S016:once:/sbin/sulogin 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600 # End /etc/inittab EOF
cd .. rm -rf sysvinit-2.86
tar xvf $LFS/tar-1.15.1.tar.bz2 cd tar-1.15.1 patch -Np1 -i $LFS/tar-1.15.1-sparse_fix-1.patch ./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin make
make check
make install cd .. rm -rf tar-1.15.1
tar xvf $LFS/udev-056.tar.bz2 cd udev-056 make udevdir=/dev
make test
make DESTDIR=/ udevdir=/dev install cp -v $LFS/udev-config-4.rules /etc/udev/rules.d/25-lfs.rules /sbin/udevstart cd .. rm -rf udev-056
tar xvf $LFS/util-linux-2.12q.tar.bz2 cd util-linux-2.12q sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' \ hwclock/hwclock.c mkdir -p /var/lib/hwclock patch -Np1 -i $LFS/util-linux-2.12q-cramfs-1.patch patch -Np1 -i $LFS/util-linux-2.12q-umount_fix-1.patch ./configure make HAVE_KILL=yes HAVE_SLN=yes make HAVE_KILL=yes HAVE_SLN=yes install mv /usr/bin/logger /bin cd .. rm -rf util-linux-2.12q
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
/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ -exec /tools/bin/strip --strip-debug '{}' ';'
logout
chroot "$LFS" /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login
tar xvf lfs-bootscripts-3.2.1.tar.bz2 cd lfs-bootscripts-3.2.1 make install cd .. rm -rf lfs-bootscripts-3.2.1
cat > /etc/sysconfig/clock << "EOF" # Begin /etc/sysconfig/clock UTC=1 # End /etc/sysconfig/clock EOF
cat > /etc/inputrc << "EOF" set horizontal-scroll-mode Off set meta-flag On set input-meta On set convert-meta Off set output-meta On set bell-style none "\eOd": backward-word "\eOc": forward-word "\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 "\eOH": beginning-of-line "\eOF": end-of-line "\e[H": beginning-of-line "\e[F": end-of-line EOF
cat > /etc/profile << "EOF" # Begin /etc/profile export LANG=zh_CN.GB18030 export INPUTRC=/etc/inputrc # End /etc/profile EOF
echo "HOSTNAME=mylinux" > /etc/sysconfig/network
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
cd /etc/sysconfig/network-devices && mkdir -v ifconfig.eth0 && cat > ifconfig.eth0/ipv4 << "EOF" ONBOOT=yes SERVICE=ipv4-static IP=192.168.1.1 GATEWAY=192.168.1.2 PREFIX=24 BROADCAST=192.168.1.255 EOF
cat > /etc/resolv.conf << "EOF" # Begin /etc/resolv.conf nameserver 你的首个DNS的地址 nameserver 你的第二DNS的地址 # End /etc/resolv.conf EOF
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 shm /dev/shm tmpfs defaults 0 0 # End /etc/fstab EOF
cd /sources tar xvf linux-2.6.11.12.tar.bz2 cd linux-2.6.11.12 make mrproper make menuconfig
make make modules_install cp -v arch/i386/boot/bzImage /boot/lfskernel-2.6.11.12 cp -v System.map /boot/System.map-2.6.11.12 cp -v .config /boot/config-2.6.11.12
grub
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.1.1 root (hd0,1) kernel /boot/lfskernel-2.6.11.12 root=/dev/sda2 EOF
mkdir -v /etc/grub ln -sv /boot/grub/menu.lst /etc/grub
logout
cd $LFS/sources
mv -v /lib/lib{readline,history}.a /usr/lib
SPECFILE=`gcc --print-file specs`
SPECFILE=$(gcc --print-file specs)
export TCLPATH=`pwd`
export TCLPATH=$(pwd)
perl -pi -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' \ `gcc --print-file specs`
perl -pi -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' \ $(gcc --print-file specs)