LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1886|回复: 10

LFS在我的硬盘上安家落户了,LFS安装记实!!!

[复制链接]
发表于 2004-2-12 05:44:04 | 显示全部楼层 |阅读模式
离开学还有一段时间,所以决定装LFS。以前装过一次旧版的,没有成功,最终搁下了。可是上次没有成功却对这次产生了好的影响,虽然还是有很多的不明白,但是装好的感觉就是不一样,收获自在其中……
我的装法很傻瓜式,基本没有“越轨”的行为^_^,可总算装成了。更庆幸的是我把我的每一步都记录下来了,很哆嗦,可是它的确是记实的!
现在贴出来作个纪念吧!


于2004年2月9日晚8时左右到2月12日5点,计算机一气呵成(不是我),直到装完我才关机。

一、准备工作
1.下面是我的硬盘分区情况:
[root@localhost root]# fdisk -l /dev/hda

Disk /dev/hda: 61.4 GB, 61492838400 bytes
255 heads, 63 sectors/track, 7476 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1          1086      7476  51335707+   f  Win95 Ext'd (LBA)
/dev/hda2   *         1       663   5325516   83  Linux
/dev/hda3           664      1008   2771212+  83  Linux
/dev/hda4          1009      1085    618502+  82  Linux swap
/dev/hda5          1086      2360  10241406   83  Linux
/dev/hda6          2361      4910  20482843+  83  Linux
/dev/hda7          4911      7476  20611363+  83  Linux

Partition table entries are not in disk order

/dev/hda2是我的主系统──Fedora1.0
/dev/hda4是我的交换分区
我准备在/dev/hda3上安装LFS,系统文件格式为ext3,并自动挂载到/mnt/lfs上。

2.在这个分区上建几个目录:

[root@localhost root]#export LFS=/mnt/lfs
[root@localhost root]#mkdir $LFS/lfs
[root@localhost root]#mkdir $LFS/sources
[root@localhost root]#mkdir $LFS/tools
[root@localhost root]#ln -s $LFS/tools /

把文档放在lfs里,源码拷到sources里,tools是存放临时系统文件的目录。

3.建一个lfs用户,用于安装LFS:

[root@localhost root]#useradd -s /bin/bash -m lfs
[root@localhost root]#passwd lfs
[root@localhost root]#chown -R lfs $LFS
[root@localhost root]#su - lfs

4.以lfs用户的身份,用以下命令来设置一个工作环境:

-bash-2.05b$cat > ~/.bash_profile << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
PATH=/tools/binPATH
export LFS LC_ALL PATH
unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
EOF

-bash-2.05b$source ~/.bash_profile
 楼主| 发表于 2004-2-12 05:46:02 | 显示全部楼层
二、创建临时系统
1.安装Binutils-2.14──第一遍
-bash-2.05b$cd $LFS/sources
-bash-2.05b$mkdir binutils-build
-bash-2.05b$tar jxvf binutils-2.14.tar.bz2
-bash-2.05b$cd binutils-build
-bash-2.05b$../binutils-2.14/configure --prefix=/tools --disable-nls
-bash-2.05b$make configure-host
-bash-2.05b$make LDFLAGS="-all-static"
-bash-2.05b$make install
-bash-2.05b$make -C ld clean
-bash-2.05b$make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib

2.安装GCC-3.3.1──第一遍
-bash-2.05b$cd $LFS/sources
-bash-2.05b$mkdir gcc-build
-bash-2.05b$tar jxvf gcc-core-3.3.1.tar.bz2
-bash-2.05b$cd gcc-build
-bash-2.05b$../gcc-3.3.1/configure --prefix=/tools --with-local-prefix=/tools \
--disable-nls --enable-shared --enable-languages=c
-bash-2.05b$make BOOT_LDFLAGS="-static" bootstrap
-bash-2.05b$make install
-bash-2.05b$ln -sf gcc /tools/bin/cc

3.安装Linux-2.4.22头文件
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf linux-2.4.22.tar.bz2
-bash-2.05b$cd linux-2.4.22
-bash-2.05b$make mrproper
-bash-2.05b$make include/linux/version.h
-bash-2.05b$make symlinks
-bash-2.05b$mkdir /tools/include/asm
-bash-2.05b$cp include/asm/* /tools/include/asm
-bash-2.05b$cp -R include/asm-generic /tools/include
-bash-2.05b$cp -R include/linux /tools/include
-bash-2.05b$touch /tools/include/linux/autoconf.h

4.安装Glibc-2.3.2
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf glibc-2.3.2.tar.bz2
-bash-2.05b$cp glibc-linuxthreads-2.3.2.tar.bz2 glibc-2.3.2
-bash-2.05b$cd glibc-2.3.2
-bash-2.05b$tar jxvf glibc-linuxthreads-2.3.2.tar.bz2
-bash-2.05b$mkdir /tools/etc
-bash-2.05b$touch /tools/etc/ld.so.conf
-bash-2.05b$patch -Np1 -i ../glibc-2.3.2-sscanf-1.patch
-bash-2.05b$mkdir ../glibc-build
-bash-2.05b$cd ../glibc-build
-bash-2.05b$../glibc-2.3.2/configure --prefix=/tools \
--disable-profile --enable-add-ons \
--with-headers=/tools/include \
--with-binutils=/tools/bin \
--without-gd
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install
-bash-2.05b$make localedata/install-locales

make check时产生的错误(好像没有影响):
make[2]: *** [/mnt/lfs/sources/glibc-build/resolv/tst-leaks.out] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/glibc-2.3.2/resolv'
make[1]: *** [resolv/tests] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.3.2'
make: *** [check] Error 2

5."锁定(Locking in)"Glibc
-bash-2.05b$cd ../binutils-build
-bash-2.05b$make -C ld install
-bash-2.05b$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
注:这里直接复制粘贴的上面的命令。

-bash-2.05b$rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}

用于测试的“dummy.c”程序:
-bash-2.05b$echo 'main(){}' > dummy.c
-bash-2.05b$gcc dummy.c
-bash-2.05b$readelf -l a.out | grep ': /tools'
注意上面“:”后有空格,测试后只有下面这一句:
[Requesting program interpreter: /tools/lib/ld-linux.so.2]。

-bash-2.05b$rm dummy.c a.out

6.安装Tcl-8.4.4
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf tcl8.4.4-src.tar.bz2
-bash-2.05b$cd tcl8.4.4/unix
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$TZ=UTC make test
上面的命令用于测试,测试中没有错误发生。
-bash-2.05b$make install
-bash-2.05b$ln -s tclsh8.4 /tools/bin/tclsh

7.安装Expect-5.39.0
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf expect-5.39.0.tar.bz2
-bash-2.05b$cd expect-5.39.0
-bash-2.05b$patch -Np1 -i ../expect-5.39.0-spawn.patch
-bash-2.05b$./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no
-bash-2.05b$make
-bash-2.05b$make test
-bash-2.05b$make SCRIPTS="" install

8.安装DejaGnu-1.4.3
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf dejagnu-1.4.3.tar.bz2
-bash-2.05b$cd dejagnu-1.4.3
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make install

9.安装GCC-3.3.1──第二遍
-bash-2.05b$cd $LFS/sources
这里要先删除原来的gcc-3.3.1目录。
-bash-2.05b$expect -c "spawn ls"
结果如下:spawn ls
-bash-2.05b$tar jxvf gcc-core*
-bash-2.05b$tar jxvf gcc-g++*
-bash-2.05b$tar jxvf gcc-testsuite*
-bash-2.05b$cd gcc-3.3.1
-bash-2.05b$patch -Np1 -i ../gcc-3.3.1-no_fixincludes-2.patch
-bash-2.05b$patch -Np1 -i ../gcc-3.3.1-specs-2.patch
-bash-2.05b$mkdir ../gcc-build2
-bash-2.05b$cd ../gcc-build2
-bash-2.05b$../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++
-bash-2.05b$make
运行测试套件:
-bash-2.05b$make -k check
-bash-2.05b$../gcc-3.3.1/contrib/test_summary | more
-bash-2.05b$make install

10.安装Binutils-2.14──第二遍
-bash-2.05b$cd $LFS/sources
这里要删除原先的binutils-2.14目录。
-bash-2.05b$tar jxvf binutils-2.14.tar.bz2
-bash-2.05b$mkdir binutils-build2
-bash-2.05b$cd binutils-build
-bash-2.05b$../binutils-2.14/configure --prefix=/tools \
--enable-shared --with-lib-path=/tools/lib
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install
-bash-2.05b$make -C ld clean
-bash-2.05b$make -C ld LIB_PATH=/usr/lib:/lib

11.安装Gawk-3.1.3
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf gawk-3.1.3.tar.bz2
-bash-2.05b$cd gawk-3.1.3
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

12.安装Coreutils-5.0
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf coreutils-5.0.tar.bz2
-bash-2.05b$cd coreutils-5.0
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make RUN_EXPENSIVE_TESTS=yes check
-bash-2.05b$make install

13.安装Bzip2-1.0.2
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf bzip2-1.0.2.tar.bz2
-bash-2.05b$cd bzip2-1.0.2
-bash-2.05b$make PREFIX=/tools install

14.安装Gzip-1.3.5
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf gzip-1.3.5.tar.bz2
-bash-2.05b$cd gzip-1.3.5
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make install

15.安装Diffutils-2.8.1
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf diffutils-2.8.1.tar.bz2
-bash-2.05b$cd diffutils-2.8.1
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make install

16.安装Findutils-4.1.20
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf findutils-4.1.20.tar.bz2
-bash-2.05b$cd findutils-4.1.20
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

17.安装Make-3.80
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf make-3.80.tar.bz2
-bash-2.05b$cd make-3.80
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

18.安装Grep-2.5.1
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf grep-2.5.1.tar.bz2
-bash-2.05b$cd grep-2.5.1
-bash-2.05b$./configure --prefix=/tools \
--disable-perl-regexp --with-included-regex
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

19.安装Sed-4.0.7
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf sed-4.0.7.tar.bz2
-bash-2.05b$cd sed-4.0.7
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

20.安装Gettext-0.12.1
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf gettext-0.12.1.tar.bz2
-bash-2.05b$cd gettext-0.12.1
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

21.安装Ncurses-5.3
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf ncurses-5.3.tar.bz2
-bash-2.05b$cd ncurses-5.3
-bash-2.05b$patch -Np1 -i ../ncurses-5.3-etip-2.patch
-bash-2.05b$patch -Np1 -i ../ncurses-5.3-vsscanf.patch
-bash-2.05b$./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
-bash-2.05b$make
-bash-2.05b$make install

22.安装Patch-2.5.4
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf patch-2.5.4.tar.bz2
-bash-2.05b$cd patch-2.5.4
-bash-2.05b$CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make install

23.安装Tar-1.13.25
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf tar-1.13.25.tar.bz2
-bash-2.05b$cd tar-1.13.25
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

24.安装Texinfo-4.6
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf texinfo-4.6.tar.bz2
-bash-2.05b$cd texinfo-4.6
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make check
-bash-2.05b$make install

25.安装Bash-2.05b
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf bash-2.05b.tar.bz2
-bash-2.05b$cd bash-2.05b
-bash-2.05b$patch -Np1 -i ../bash-2.05b-2.patch
-bash-2.05b$./configure --prefix=/tools
-bash-2.05b$make
-bash-2.05b$make tests
-bash-2.05b$make install
-bash-2.05b$ln -s bash /tools/bin/sh

26.安装Util-linux-2.12
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf util-linux-2.12.tar.bz2
-bash-2.05b$cd util-linux-2.12
-bash-2.05b$cp configure configure.backup
-bash-2.05b$sed "s@/usr/include@/tools/include@g" configure.backup > configure
-bash-2.05b$./configure
-bash-2.05b$make -C lib
-bash-2.05b$make -C mount mount umount
-bash-2.05b$make -C text-utils  more
-bash-2.05b$cp mount/{,u}mount text-utils/more /tools/bin

27.安装Perl-5.8.0
-bash-2.05b$cd $LFS/sources
-bash-2.05b$tar jxvf perl-5.8.0.tar.bz2
-bash-2.05b$cd perl-5.8.0
-bash-2.05b$patch -Np1 -i ../perl-5.8.0-libc-3.patch
-bash-2.05b$chmod u+w hints/linux.sh
-bash-2.05b$echo 'static_ext="IO re Fcntl"' >> hints/linux.sh
-bash-2.05b$./configure.gnu --prefix=/tools
-bash-2.05b$make perl utilities
-bash-2.05b$cp perl pod/pod2man /tools/bin
-bash-2.05b$mkdir -p /tools/lib/perl5/5.8.0
-bash-2.05b$cp -R lib/* /tools/lib/perl5/5.8.0

28.Stripping(去掉调试符号)
-bash-2.05b$strip --strip-unneeded /tools/{,s}bin/*
-bash-2.05b$strip --strip-debug /tools/lib/*
-bash-2.05b$rm -rf /tools/{,share/}{doc,info,man}
 楼主| 发表于 2004-2-12 05:47:04 | 显示全部楼层
三、安装基本的系统软件
1.进入chroot(虚拟根)环境
-bash-2.05b$su
[root@localhost root]#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

2.改变所有者
I have no name!:/#chown -R 0:0 /tools

3.创建目录
I have no name!:/#mkdir -p /{bin,boot,dev/{pts,shm},etc/opt,home,lib,mnt,proc}
I have no name!:/#mkdir -p /{root,sbin,tmp,usr/local,var,opt}
I have no name!:/#for dirname in /usr /usr/local
do
mkdir $dirname/{bin,etc,include,lib,sbin,share,src}
ln -s share/{man,doc,info} $dirname
mkdir $dirname/share/{dict,doc,info,locale,man}
mkdir $dirname/share/{nls,misc,terminfo,zoneinfo}
mkdir $dirname/share/man/man{1,2,3,4,5,6,7,8}
done
I have no name!:/#mkdir /var/{lock,log,mail,run,spool}
I have no name!:/#mkdir -p /var/{tmp,opt,cache,lib/misc,local}
I have no name!:/#mkdir /opt/{bin,doc,include,info}
I have no name!:/#mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}}

I have no name!:/#chmod 0750 /root
I have no name!:/#chmod 1777 /tmp /var/tmp

4.加载proc和devpts文件系统
I have no name!:/#mount proc /proc -t proc
I have no name!:/#mount devpts /dev/pts -t devpts

5.创建重要的符号链接
I have no name!:/#ln -s /tools/bin/{bash,cat,pwd,stty} /bin
I have no name!:/#ln -s /tools/bin/perl /usr/bin
I have no name!:/#ln -s /tools/lib/libgcc_s.so.1 /usr/lib
I have no name!:/#ln -s bash /bin/sh

6.创建passwd和group文件
I have no name!:/#cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
EOF
I have no name!:/#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:
dialout:x:10:
audio:x:11:
EOF
I have no name!:/#exec /tools/bin/bash --login +h

7.创建设备Creating devices(Makedev-1.7)
root:/#cd sources
root:/sources#bzcat MAKEDEV-1.7.bz2 > /dev/MAKEDEV
root:/sources#chmod 754 /dev/MAKEDEV
root:/sources#cd /dev
root:/dev#./MAKEDEV -v generic-nopty

8.安装 Linux-2.4.22 headers
root:/#cd sources
root:/sources#tar jxvf linux-2.4.22.tar.bz2
root:/sources#cd linux-2.4.22
root:/sources/linux-2.4.22#make mrproper
root:/sources/linux-2.4.22#make include/linux/version.h
root:/sources/linux-2.4.22#make symlinks
root:/sources/linux-2.4.22#cp -HR include/asm /usr/include
root:/sources/linux-2.4.22#cp -R include/asm-generic /usr/include
root:/sources/linux-2.4.22#cp -R include/linux /usr/include
root:/sources/linux-2.4.22#touch /usr/include/linux/autoconf.h

9.安装Man-pages-1.60
root:/sources/linux-2.4.22#cd ..
root:/sources#tar jxvf man-pages-1.60.tar.bz2
root:/sources#cd man-pages-1.60
root:/sources/man-pages-1.60#make install

10.安装Glibc-2.3.2
root:/sources/man-pages-1.60#cd ..
root:/sources#tar jxvf glibc-2.3.2.tar.bz2
root:/sources#cd glibc-2.3.2
root:/sources/glibc-2.3.2#touch /etc/ld.so.conf
root:/sources/glibc-2.3.2#patch -Np1 -i ../glibc-2.3.2-sscanf-1.patch
root:/sources/glibc-2.3.2#mkdir ../glibc-build
root:/sources/glibc-2.3.2#cd ../glibc-build
root:/sources/glibc-build#../glibc-2.3.2/configure --prefix=/usr \
--disable-profile --enable-add-ons \
--libexecdir=/usr/bin --with-headers=/usr/include
root:/sources/glibc-build#make
root:/sources/glibc-build#make check
root:/sources/glibc-build#make install
root:/sources/glibc-build#make localedata/install-locales
root:/sources/glibc-build#make -C ../glibc-2.3.2/linuxthreads/man
root:/sources/glibc-build#make -C ../glibc-2.3.2/linuxthreads/man install

配置Glibc
root:/sources/glibc-build#cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: db files

# End /etc/nsswitch.conf
EOF

root:/sources/glibc-build#tzselect
root:/sources/glibc-build#cp --remove-destination \
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime

配置动态链接库加载程序
root:/sources/glibc-build#cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf

/usr/local/lib
/opt/lib

# End /etc/ld.so.conf
EOF


11.再次调整工具链
root:/sources/glibc-build#cd ../binutils-build2
root:/sources/binutils-build2#make -C ld INSTALL=/tools/bin/install install

root:/sources/binutils-build2#cd ..
root:/sources#SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' \
    $SPECFILE > newspecfile &&
mv -f newspecfile $SPECFILE
unset SPECFILE

root:/sources#echo 'main(){}' > dummy.c
gcc dummy.c
readelf -l a.out | grep ': /lib'

测试:
[Requesting program interpreter: /lib/ld-linux.so.2]

root:/sources#rm dummy.c a.out

12.安装Binutils-2.14
root:/sources/binutils-build2#cd ..
这里我删除了binutils以前解了压的源码包和编译所建的目录。
root:/sources#tar jxvf binutils-2.14.tar.bz2
root:/sources#expect -c "spawn ls"
显示:spawn ls

root:/sources#mkdir binutils-build
root:/sources#cd binutils-build
root:/sources/binutils-build#../binutils-2.14/configure \
--prefix=/usr --enable-shared
root:/sources/binutils-build#make tooldir=/usr
root:/sources/binutils-build#make check
root:/sources/binutils-build#make tooldir=/usr install
root:/sources/binutils-build#cp ../binutils-2.14/include/libiberty.h /usr/include

13.安装GCC-3.3.1
root:/sources/binutils-build#cd ..
root:/sources#tar jxvf gcc-core*
root:/sources#tar jxvf gcc-g++*
root:/sources#tar jxvf gcc-testsuite*
root:/sources#cd gcc-3.3.1
root:/sources/gcc-3.3.1#patch -Np1 -i ../gcc-3.3.1-no_fixincludes-2.patch
root:/sources/gcc-3.3.1#patch -Np1 -i ../gcc-3.3.1-suppress-libiberty.patch
root:/sources/gcc-3.3.1#mkdir ../gcc-build
root:/sources/gcc-3.3.1#cd ../gcc-build
root:/sources/gcc-build#../gcc-3.3.1/configure --prefix=/usr \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-clocale=gnu \
--enable-languages=c,c++
root:/sources/gcc-build#make
root:/sources/gcc-build#make -k check
root:/sources/gcc-build#make install
root:/sources/gcc-build#cd ..
root:/sourcesld#ln -s ../usr/bin/cpp /lib
root:/sources#ln -s gcc /usr/bin/cc

14.安装Coreutils-5.0
root:/sources#tar jxvf coreutils-5.0.tar.bz2
root:/sources#cd coreutils
root:/sources/coreutils#patch -Np1 -i ../coreutils-5.0-uname.patch
root:/sources/coreutils#patch -Np1 -i ../coreutils-5.0-hostname-2.patch
root:/sources/coreutils#./configure --prefix=/usr
root:/sources/coreutils#make
root:/sources/coreutils#make install-root
root:/sources/coreutils#echo "dummy1:x:1000" >> /etc/group
root:/sources/coreutils#echo "dummy2:x:1001:dummy" >> /etc/group
root:/sources/coreutils#echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd
root:/sources/coreutils#make check-root
root:/sources/coreutils#su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"
root:/sources/coreutils#sed -i.bak '/dummy/d' /etc/passwd /etc/group
root:/sources/coreutils#make install
root:/sources/coreutils#mv /usr/bin/{basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
root:/sources/coreutils#mv /usr/bin/{dir,dircolors,du,date,echo,false,head} /bin
root:/sources/coreutils#mv /usr/bin/{install,ln,ls,mkdir,mkfifo,mknod,mv,pwd} /bin
root:/sources/coreutils#mv /usr/bin/{rm,rmdir,shred,sync,sleep,stty,su,test} /bin
root:/sources/coreutils#mv /usr/bin/{touch,true,uname,vdir} /bin
root:/sources/coreutils#mv /usr/bin/chroot /usr/sbin
root:/sources/coreutils#ln -s test /bin/[
root:/sources/coreutils#ln -s ../../bin/install /usr/bin

15.安装Zlib-1.1.4
root:/sources/coreutils#cd ..
root:/sources#tar jxvf zlib-1.1.4.tar.bz2
root:/sources#cd zlib-1.1.4
root:/sources/zlib-1.1.4#patch -Np1 -i ../zlib-1.1.4-vsnprintf.patch
root:/sources/zlib-1.1.4#./configure --prefix=/usr --shared
root:/sources/zlib-1.1.4#make
root:/sources/zlib-1.1.4#make install
root:/sources/zlib-1.1.4#make clean
root:/sources/zlib-1.1.4#./configure --prefix=/usr
root:/sources/zlib-1.1.4#make
root:/sources/zlib-1.1.4#make test
root:/sources/zlib-1.1.4#make install
root:/sources/zlib-1.1.4#mv /usr/lib/libz.so.* /lib
root:/sources/zlib-1.1.4#ln -sf ../../lib/libz.so.1 /usr/lib/libz.so
root:/sources/zlib-1.1.4#cp zlib.3 /usr/share/man/man3

16.安装Lfs-Utils-0.3
root:/sources/zlib-1.1.4#cd ..
root:/sources#tar jxvf lfs-utils-0.3.tar.bz2
root:/sources#cd lfs-utils-0.3
root:/sources/lfs-utils-0.3#make
root:/sources/lfs-utils-0.3#make install
root:/sources/lfs-utils-0.3#cp etc/{services,protocols} /etc

17.安装Findutils-4.1.20
root:/sources/lfs-utils-0.3#cd ..
root:/sources#tar jxvf findutils-4.1.20.tar.bz2
root:/sources#cd findutils-4.1.20
root:/sources/findutils-4.1.20#./configure --prefix=/usr --libexecdir=/usr/bin
root:/sources/findutils-4.1.20#make
root:/sources/findutils-4.1.20#make check
root:/sources/findutils-4.1.20#make install

18.安装Gawk-3.1.3
root:/sources/findutils-4.1.20#cd ..
root:/sources#tar jxvf gawk-3.1.3.tar.bz2
root:/sources#cd gawk-3.1.3
root:/sources/gawk-3.1.3#patch -Np1 -i ../gawk-3.1.3-libexecdir.patch
root:/sources/gawk-3.1.3#./configure --prefix=/usr --libexecdir=/usr/bin
root:/sources/gawk-3.1.3#make
root:/sources/gawk-3.1.3#make check
root:/sources/gawk-3.1.3#make install

19.安装Ncurses-5.3
root:/sources/gawk-3.1.3#cd ..
root:/sources#tar jxvf ncurses-5.3.tar.bz2
root:/sources#cd ncurses-5.3
root:/sources/ncurses-5.3#patch -Np1 -i ../ncurses-5.3-etip-2.patch
root:/sources/ncurses-5.3#patch -Np1 -i ../ncurses-5.3-vsscanf.patch
root:/sources/ncurses-5.3#./configure --prefix=/usr --with-shared \
--without-debug
root:/sources/ncurses-5.3#make
root:/sources/ncurses-5.3#make install
root:/sources/ncurses-5.3#chmod 755 /usr/lib/*.5.3
root:/sources/ncurses-5.3#chmod 644 /usr/lib/libncurses++.a
root:/sources/ncurses-5.3#mv /usr/lib/libncurses.so.5* /lib
root:/sources/ncurses-5.3#ln -sf ../../lib/libncurses.so.5 /usr/lib/libncurses.so
root:/sources/ncurses-5.3#ln -sf libncurses.so /usr/lib/libcurses.so

20.安装Vim-6.2
root:/sources/ncurses-5.3#cd ..
root:/sources#tar jxvf vim-6.2.tar.bz2
root:/sources#cd vim-6.2
root:/sources/vim-6.2#echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
root:/sources/vim-6.2#echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h
root:/sources/vim-6.2#./configure --prefix=/usr
root:/sources/vim-6.2#make
root:/sources/vim-6.2#make install
root:/sources/vim-6.2#ln -s vim /usr/bin/vi
配置 Vim
root:/sources/vim-6.2#cat > /root/.vimrc << "EOF"
" Begin /root/.vimrc

set nocompatible
set bs=2

" End /root/.vimrc
EOF

21.安装M4-1.4
root:/sources/vim-6.2#cd ..
root:/sources#tar jxvf m4-1.4.tar.bz2
root:/sources#cd m4-1.4
root:/sources/m4-1.4#./configure --prefix=/usr
root:/sources/m4-1.4#make
root:/sources/m4-1.4#make check
root:/sources/m4-1.4#make install

22.安装Bison-1.875
root:/sources/m4-1.4#cd ..
root:/sources#tar jxvf bison-1.875.tar.bz2
root:/sources#cd bison-1.875
root:/sources/bison-1.875#patch -Np1 -i ../bison-1.875-attribute.patch
root:/sources/bison-1.875#./configure --prefix=/usr
root:/sources/bison-1.875#make
root:/sources/bison-1.875#make check
root:/sources/bison-1.875#make install

23.安装Less-381
root:/sources/bison-1.875#cd ..
root:/sources#tar jxvf less-381.tar.bz2
root:/sources#cd less-381
root:/sources/less-381#./configure --prefix=/usr --bindir=/bin --sysconfdir=/etc
root:/sources/less-381#make
root:/sources/less-381#make install

24.安装Groff-1.19
root:/sources/less-381#cd ..
root:/sources#tar jxvf groff-1.19.tar.bz2
root:/sources#cd groff-1.19
root:/sources/groff-1.19#PAGE=letter ./configure --prefix=/usr
root:/sources/groff-1.19#make
root:/sources/groff-1.19#make install
root:/sources/groff-1.19#ln -s soelim /usr/bin/zsoelim
root:/sources/groff-1.19#ln -s eqn /usr/bin/geqn
root:/sources/groff-1.19#ln -s tbl /usr/bin/gtbl

25.安装Sed-4.0.7
root:/sources/groff-1.19#cd ..
root:/sources#tar jxvf sed-4.0.7.tar.bz2
root:/sources#cd sed-4.0.7
root:/sources/sed-4.0.7#./configure --prefix=/usr --bindir=/bin
root:/sources/sed-4.0.7#make
root:/sources/sed-4.0.7#make check
root:/sources/sed-4.0.7#make install

26.安装Flex-2.5.4a
root:/sources/sed-4.0.7#cd ..
root:/sources# tar jxvf flex-2.5.4a.tar.bz2
root:/sources#cd flex-2.5.4a
root:/sources/flex-2.5.4a#make
root:/sources/flex-2.5.4a#make bigcheck
root:/sources/flex-2.5.4a#make install
root:/sources/flex-2.5.4a#ln -s libfl.a /usr/lib/libl.a
root:/sources/flex-2.5.4a#cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
chmod 755 /usr/bin/lex

27.安装Gettext-0.12.1
root:/sources/flex-2.5.4a#cd ..
root:/sources#tar jxvf gettext-0.12.1.tar.bz2
root:/sources#cd gettext-0.12.1
root:/sources/gettext-0.12.1#./configure --prefix=/usr
root:/sources/gettext-0.12.1#make
root:/sources/gettext-0.12.1#make check
root:/sources/gettext-0.12.1#make install

28.安装Net-tools-1.60
root:/sources/gettext-0.12.1#cd ..
root:/sources#tar jxvf net-tools-1.60.tar.bz2
root:/sources#cd net-tools-1.60
root:/sources/net-tools-1.60#patch -Np1 -i ../net-tools-1.60-miitool-gcc33-1.patch
root:/sources/net-tools-1.60#yes "" | make config
root:/sources/net-tools-1.60#make
root:/sources/net-tools-1.60#make update

29.安装Inetutils-1.4.2
root:/sources/net-tools-1.60#cd ..
root:/sources#tar jxvf inetutils-1.4.2.tar.bz2
root:/sources#cd inetutils-1.4.2
root:/sources/inetutils-1.4.2#./configure --prefix=/usr --disable-syslogd \
--libexecdir=/usr/sbin --disable-logger \
--sysconfdir=/etc --localstatedir=/var \
--disable-whois --disable-servers
root:/sources/inetutils-1.4.2#make
root:/sources/inetutils-1.4.2#make install
root:/sources/inetutils-1.4.2#mv /usr/bin/ping /bin

30.安装Perl-5.8.0
root:/sources/inetutils-1.4.2#cd ..
root:/sources#tar perl-5.8.0.tar.bz2
root:/sources#cd perl-5.8.0
root:/sources/perl-5.8.0#./configure.gnu --prefix=/usr
root:/sources/perl-5.8.0#make
root:/sources/perl-5.8.0#echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
root:/sources/perl-5.8.0#make test
root:/sources/perl-5.8.0#make install

31.安装Texinfo-4.6
root:/sources/perl-5.8.0#cd ..
root:/sources#tar jxvf texinfo-4.6.tar.bz2
root:/sources#cd texinfo-4.6
root:/sources/texinfo-4.6#./configure --prefix=/usr
root:/sources/texinfo-4.6#make
root:/sources/texinfo-4.6#make check
root:/sources/texinfo-4.6#make install
root:/sources/texinfo-4.6#make TEXMF=/usr/share/texmf install-tex

32.安装Autoconf-2.57
root:/sources/texinfo-4.6#cd ..
root:/sources#tar jxvf autoconf-2.57.tar.bz2
root:/sources#cd autoconf-2.57
root:/sources/autoconf-2.57#./configure --prefix=/usr
root:/sources/autoconf-2.57#make
root:/sources/autoconf-2.57#make check
root:/sources/autoconf-2.57#make install
 楼主| 发表于 2004-2-12 05:49:44 | 显示全部楼层
33.安装Automake-1.7.6
root:/sources/autoconf-2.57#cd ..
root:/sources#tar jxvf automake-1.7.6.tar.bz2
root:/sources#cd automake-1.7.6
root:/sources/automake-1.7.6#./configure --prefix=/usr
root:/sources/automake-1.7.6#make
root:/sources/automake-1.7.6#make check
root:/sources/automake-1.7.6#make install
root:/sources/automake-1.7.6#ln -s automake-1.7 /usr/share/automake

34.安装Bash-2.05b
root:/sources/automake-1.7.6#cd ..
root:/sources#tar jxvf bash-2.05b.tar.bz2
root:/sources#cd bash-2.05b
root:/sources/bash-2.05b#patch -Np1 -i ../bash-2.05b-2.patch
root:/sources/bash-2.05b#./configure --prefix=/usr --bindir=/bin
root:/sources/bash-2.05b#make
root:/sources/bash-2.05b#make tests
root:/sources/bash-2.05b#make install
root:/sources/bash-2.05b#exec /bin/bash --login +h

35.安装File-4.04
root:/sources/bash-2.05b#cd ..
root:/sources#tar jxvf file-4.04.tar.bz2
root:/sources#cd file-4.04
root:/sources/file-4.04#./configure --prefix=/usr
root:/sources/file-4.04#make
root:/sources/file-4.04#make install

36.安装Libtool-1.5
root:/sources/file-4.04#cd ..
root:/sources#tar jxvf libtool-1.5.tar.bz2
root:/sources#cd libtool-1.5
root:/sources/libtool-1.5#./configure --prefix=/usr
root:/sources/libtool-1.5#make
root:/sources/libtool-1.5#make check
root:/sources/libtool-1.5#make install

37.安装Bzip2-1.0.2
root:/sources/libtool-1.5#cd ..
root:/sources#tar jxvf bzip2-1.0.2.tar.bz2
root:/sources#cd bzip2-1.0.2
root:/sources/bzip2-1.0.2#make -f Makefile-libbz2_so
root:/sources/bzip2-1.0.2#make clean
root:/sources/bzip2-1.0.2#make
root:/sources/bzip2-1.0.2#make install
root:/sources/bzip2-1.0.2#cp bzip2-shared /bin/bzip2
root:/sources/bzip2-1.0.2#cp -a libbz2.so* /lib
root:/sources/bzip2-1.0.2#ln -s ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
root:/sources/bzip2-1.0.2#rm /usr/bin/{bunzip2,bzcat,bzip2}
root:/sources/bzip2-1.0.2#mv /usr/bin/{bzip2recover,bzless,bzmore} /bin
root:/sources/bzip2-1.0.2#ln -s bzip2 /bin/bunzip2
root:/sources/bzip2-1.0.2#ln -s bzip2 /bin/bzcat

38.安装Diffutils-2.8.1
root:/sources/bzip2-1.0.2#cd ..
root:/sources#tar jxvf diffutils-2.8.1.tar.bz2
root:/sources#cd diffutils-2.8.1
root:/sources/diffutils-2.8.1#./configure --prefix=/usrma
root:/sources/diffutils-2.8.1#make
root:/sources/diffutils-2.8.1#make install

39.安装Ed-0.2
root:/sources/diffutils-2.8.1#cd ..
root:/sources#tar jxvf ed-0.2.tar.bz2
root:/sources#cd ed-0.2
root:/sources/ed-0.2#patch -Np1 -i ../ed-0.2-mkstemp.patch
root:/sources/ed-0.2#./configure --prefix=/usr
root:/sources/ed-0.2#make
root:/sources/ed-0.2#make check
root:/sources/ed-0.2#make install
root:/sources/ed-0.2#mv /usr/bin/{ed,red} /bin

40.安装Kbd-1.08
root:/sources/ed-0.2#cd ..
root:/sources#tar jxvf kbd-1.08.tar.bz2
root:/sources#cd kbd-1.08
root:/sources/kbd-1.08#patch -Np1 -i ../kbd-1.08-more-programs.patch
root:/sources/kbd-1.08#./configure
root:/sources/kbd-1.08#make
root:/sources/kbd-1.08#make install

41.安装E2fsprogs-1.34
root:/sources/kbd-1.08#cd ..
root:/sources#tar jxvf e2fsprogs-1.34.tar.bz2
root:/sources#cd e2fsprogs-1.34
root:/sources/e2fsprogs-1.34#mkdir ../e2fsprogs-build
root:/sources/e2fsprogs-1.34#cd ../e2fsprogs-build
root:/sources/e2fsprogs-1.34#../e2fsprogs-1.34/configure --prefix=/usr --with-root-prefix="" \
--enable-elf-shlibs
root:/sources/e2fsprogs-1.34#make
root:/sources/e2fsprogs-1.34#make check
root:/sources/e2fsprogs-1.34#make install
root:/sources/e2fsprogs-1.34#make install-libs

42.安装Grep-2.5.1
root:/sources/e2fsprogs-1.34#cd ..
root:/sources#tar jxvf grep-2.5.1.tar.bz2
root:/sources#cd grep-2.5.1
root:/sources/grep-2.5.1#./configure --prefix=/usr --bindir=/bin \
--with-included-regex
root:/sources/grep-2.5.1#make
root:/sources/grep-2.5.1#make check
root:/sources/grep-2.5.1#make install

43.安装Grub-0.93
root:/sources/grep-2.5.1#cd ..
root:/sources#tar jxvf grub-0.93.tar.bz2
root:/sources#cd grub-0.93
root:/sources/grub-0.93#patch -Np1 -i ../grub-0.93-gcc33-1.patch
root:/sources/grub-0.93#./configure --prefix=/usr
root:/sources/grub-0.93#make
root:/sources/grub-0.93#make install
root:/sources/grub-0.93#mkdir /boot/grub
root:/sources/grub-0.93#cp /usr/share/grub/i386-pc/stage{1,2} /boot/grub

44.安装Gzip-1.3.5
root:/sources/grub-0.93#cd ..
root:/sources#tar jxvf gzip-1.3.5.tar.bz2
root:/sources#cd gzip-1.3.5
root:/sources/gzip-1.3.5#./configure --prefix=/usr
root:/sources/gzip-1.3.5#cp gzexe.in{,.backup}
root:/sources/gzip-1.3.5#sed 's%"BINDIR"%/bin%' gzexe.in.backup > gzexe.in
root:/sources/gzip-1.3.5#make
root:/sources/gzip-1.3.5#make install
root:/sources/gzip-1.3.5#mv /usr/bin/gzip /bin
root:/sources/gzip-1.3.5#rm /usr/bin/{gunzip,zcat}
root:/sources/gzip-1.3.5#ln -s gzip /bin/gunzip
root:/sources/gzip-1.3.5#ln -s gzip /bin/zcat
root:/sources/gzip-1.3.5#ln -s gunzip /bin/uncompress

45.安装Man-1.5m2
root:/sources/gzip-1.3.5#cd ..
root:/sources#tar jxvf man-1.5ma.tar.bz2
root:/sources#cd man-1.5ma
root:/sources/man-1.5ma#patch -Np1 -i ../man-1.5m2-manpath.patch
root:/sources/man-1.5ma#patch -Np1 -i ../man-1.5m2-pager.patch
root:/sources/man-1.5ma#patch -Np1 -i ../man-1.5m2-80cols.patch
root:/sources/man-1.5ma#./configure -default -confdir=/etc
root:/sources/man-1.5ma#make
root:/sources/man-1.5ma#make install

46.安装Make-3.80
root:/sources/man-1.5ma#cd ..
root:/sources#tar jxvf make-3.80.tar.bz2
root:/sources#cd make-3.80
root:/sources/make-3.80#./configure --prefix=/usr
root:/sources/make-3.80#make
root:/sources/make-3.80#make check
root:/sources/make-3.80#make install

47.安装Modutils-2.4.25
root:/sources/make-3.80#cd ..
root:/sources#tar jxvf modutils-2.4.25.tar.bz2
root:/sources#cd modutils-2.4.25
root:/sources/modutils-2.4.25#./configure
root:/sources/modutils-2.4.25#make
root:/sources/modutils-2.4.25#make install

48.安装Patch-2.5.4
root:/sources/modutils-2.4.25#cd ..
root:/sources#tar jvxf patch-2.5.4.tar.bz2
root:/sources#cd patch-2.5.4
root:/sources/patch-2.5.4#CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/usr
root:/sources/patch-2.5.4#make
root:/sources/patch-2.5.4#make install

49.安装Procinfo-18
root:/sources/patch-2.5.4#cd ..
root:/sources#tar jvxf procinfo-18.tar.bz2
root:/sources#cd procinfo-18
root:/sources/procinfo-18#make LDLIBS=-lncurses
root:/sources/procinfo-18#make install

50.安装Procps-3.1.11
root:/sources/procinfo-18#cd ..
root:/sources#tar jvxf procps-3.1.11.tar.bz2
root:/sources#cd procps-3.1.11
root:/sources/procps-3.1.11#patch -Np1 -i ../procps-3.1.11-locale-fix.patch
root:/sources/procps-3.1.11#make
root:/sources/procps-3.1.11#make install
root:/sources/procps-3.1.11#rm /lib/libproc.so

51.安装Psmisc-21.3
root:/sources/procps-3.1.11#cd ..
root:/sources#tar jvxf psmisc-21.3.tar.bz2
root:/sources#cd psmisc-21.3
root:/sources/psmisc-21.3#./configure --prefix=/usr --exec-prefix=/
root:/sources/psmisc-21.3#make
root:/sources/psmisc-21.3#make install
root:/sources/psmisc-21.3#ln -s killall /bin/pidof

52.安装Shadow-4.0.3
root:/sources/psmisc-21.3#cd ..
root:/sources#tar jvxf shadow-4.0.3.tar.bz2
root:/sources#cd shadow-4.0.3
root:/sources/shadow-4.0.3#touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
root:/sources/shadow-4.0.3#chmod 644 /var/run/utmp /var/log/{btmp,lastlog,wtmp}
root:/sources/shadow-4.0.3#touch /usr/bin/passwd
root:/sources/shadow-4.0.3#patch -Np1 -i ../shadow-4.0.3-newgrp-fix.patch
root:/sources/shadow-4.0.3#./configure --prefix=/usr --libdir=/usr/lib --enable-shared
root:/sources/shadow-4.0.3#make
root:/sources/shadow-4.0.3#make install
root:/sources/shadow-4.0.3#cp etc/{limits,login.access} /etc
root:/sources/shadow-4.0.3#sed -e 's%/var/spool/mail%/var/mail%' \
    -e 's%#MD5_CRYPT_ENAB.no%MD5_CRYPT_ENAB yes%' \
    etc/login.defs.linux > /etc/login.defs
root:/sources/shadow-4.0.3#ln -s vipw /usr/sbin/vigr
root:/sources/shadow-4.0.3#rm /bin/vipw
root:/sources/shadow-4.0.3#mv /bin/sg /usr/bin
root:/sources/shadow-4.0.3#mv /usr/lib/lib{shadow,misc}.so.0* /lib
root:/sources/shadow-4.0.3#ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so
root:/sources/shadow-4.0.3#ln -sf ../../lib/libmisc.so.0 /usr/lib/libmisc.so
root:/sources/shadow-4.0.3#rm /bin/groups

配置 Shadow
root:/sources/shadow-4.0.3#/usr/sbin/pwconv
root:/sources/shadow-4.0.3#/usr/sbin/grpconv

53.安装Sysklogd-1.4.1
root:/sources/shadow-4.0.3#cd ..
root:/sources#tar jxvf sysklogd-1.4.1.tar.bz2
root:/sources#cd sysklogd-1.4.1
root:/sources/sysklogd-1.4.1#make
root:/sources/sysklogd-1.4.1#make install
root:/sources/sysklogd-1.4.1#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


54.安装Sysvinit-2.85
root:/sources/sysklogd-1.4.1#cd ..
root:/sources#tar jxvf sysvinit-2.85.tar.bz2
root:/sources#cd sysvinit-2.85
root:/sources/sysvinit-2.85#cp src/init.c{,.backup}
root:/sources/sysvinit-2.85#sed 's/Sending processes/Sending processes started by init/g' \
    src/init.c.backup > src/init.c
root:/sources/sysvinit-2.85#make -C src
root:/sources/sysvinit-2.85#make -C src install

配置 Sysvinit
root:/sources/sysvinit-2.85#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


55.安装Tar-1.13.25
root:/sources/sysvinit-2.85#cd ..
root:/sources#tar jxvf tar-1.13.25.tar.bz2
root:/sources#cd tar-1.13.25
root:/sources/tar-1.13.25#./configure --prefix=/usr --bindir=/bin \
--libexecdir=/usr/bin
root:/sources/tar-1.13.25#make
root:/sources/tar-1.13.25#make check
root:/sources/tar-1.13.25#make install

56.安装Util-linux-2.12
root:/sources/tar-1.13.25#cd ..
root:/sources#tar jxvf util-linux-2.12.tar.bz2
root:/sources#cd util-linux-2.12
root:/sources/util-linux-2.12#cp hwclock/hwclock.c{,.backup}
root:/sources/util-linux-2.12#sed 's%etc/adjtime%var/lib/hwclock/adjtime%' \
    hwclock/hwclock.c.backup > hwclock/hwclock.c
root:/sources/util-linux-2.12#mkdir -p /var/lib/hwclock
root:/sources/util-linux-2.12#./configure
root:/sources/util-linux-2.12#make HAVE_SLN=yes
root:/sources/util-linux-2.12#make HAVE_SLN=yes install

57.安装GCC-2.95.3
root:/sources/util-linux-2.12#cd ..
root:/sources#tar jxvf gcc-2.95.3.tar.bz2
root:/sources#cd gcc-2.95.3
root:/sources/gcc-2.95.3#patch -Np1 -i ../gcc-2.95.3-2.patch
root:/sources/gcc-2.95.3#patch -Np1 -i ../gcc-2.95.3-no-fixinc.patch
root:/sources/gcc-2.95.3#patch -Np1 -i ../gcc-2.95.3-returntype-fix.patch
root:/sources/gcc-2.95.3#echo timestamp > gcc/cstamp-h.in
root:/sources/gcc-2.95.3#mkdir ../gcc-2-build
root:/sources/gcc-2.95.3#cd ../gcc-2-build
root:/sources/gcc-2-build#../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 \
--enable-shared --enable-languages=c \
--enable-threads=posix
root:/sources/gcc-2-build#make bootstrap
root:/sources/gcc-2-build#make install

/*下面第58步只是在退出系统后再进入时才用得到*/
58.修改过的chroot命令
root:/sources#chroot $LFS /usr/bin/env -i \
    HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    /bin/bash --login


59.安装LFS-Bootscripts-1.12
root:/sources/gcc-2-build#cd ..
root:/sources#tar jxvf lfs-bootscripts-1.12.tar.bz2
root:/sources#cd lfs-bootscripts-1.12
root:/sources/lfs-bootscripts-1.12#cp -a rc.d sysconfig /etc
root:/sources/lfs-bootscripts-1.12#chown -R root:root /etc/rc.d /etc/sysconfig

60.设置 root 密码
为 root 用户选择一个密码,并用如下命令设置:
root:/sources/lfs-bootscripts-1.12#cd ..
root:/sources#passwd root
 楼主| 发表于 2004-2-12 05:52:55 | 显示全部楼层
四、设置系统启动脚本
1.配置setclock 脚本
root:/sources#cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock

UTC=1

# End /etc/sysconfig/clock
EOF

2.配置 localnet 脚本
root:/sources#echo "HOSTNAME=yourhostname" > /etc/sysconfig/network

3.创建/etc/hosts 文件
root:/sources#cat > /etc/hosts << "EOF"
# Begin /etc/hosts (no network card version)

127.0.0.1 <value of HOSTNAME>.mydomain.com <value of HOSTNAME> localhost

# End /etc/hosts (no network card version)
EOF

4.创建/etc/fstab 文件
root:/sources#cat > /etc/fstab << "EOF"
#Begin /etc/fstab

#filesystem     mount-point     fs-type         options         dump  fsck-order

/dev/hda3       /               ext3            defaults        1 1
/dev/hda4       swap            swap            pri=1           0 0
proc            /proc           proc            defaults        0 0
devpts          /dev/pts        devpts          gid=4,mode=620  0 0
shm             /dev/shm        tmpfs           defaults        0 0

#End /etc/fstab


5.最后是内核的编译,我是在/mnt/lfs/usr/src里面编译的,步骤和手册上的一样。
注意:如果使用是ext3系统文件格式,要在编译内核时加上。

6.我是用原来装系统时装的GRUB引导的,内容如下:
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
title Fedora Core 1.0 (2.4.22-1.2115.nptl)
        root (hd0,1)
        kernel /boot/vmlinuz-2.4.22-1.2115.nptl ro root=LABEL=/1 hdd=ide-scsi rhgb
        initrd /boot/initrd-2.4.22-1.2115.nptl.img
title renbagshoes'LFS 5.0(2.4.22)
        root (hd0,2)
        kernel /boot/lfskernel ro

还没有清除调试符号,带内核源码共521.9M

一点体会和建议:第一次安装最好按步就班,如此见立信心,兴趣由此而生!

The Linux From Scratch Counter

Thanks for registering renbagshoes, your LFS ID is: 12189
发表于 2004-2-12 07:55:07 | 显示全部楼层
Congratulations!
发表于 2004-2-12 09:00:13 | 显示全部楼层
辛苦了,恭喜一下先
发表于 2004-2-12 11:49:29 | 显示全部楼层
真是细心。
发表于 2004-2-13 06:26:47 | 显示全部楼层
虽然现在不装,还是打印下来再带回去看.祝贺!
 楼主| 发表于 2004-2-13 13:42:51 | 显示全部楼层
谢谢大家的祝贺!
装LFS关键是一个兴趣,然后手册+耐心,我想一定会成功。
我现在正在弄BLFS,如果成了,我会考虑用它作主系统(我现在用Fedora1.0)。
如果有时间的话,我会再来一次第六章,必竟第一次只是照搬来的,而且每一次都应会有新的收获。

我用的手册和源码都是从LFS中文主站下载的:
http://lfs.linuxsir.cn/cgi-bin/wiki/moin.cgi/_cf_c2_d4_d8
==》2 稳定版本文档
==》LFS5.0
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表