|
|
用livecd安装LFS的一大好处就是成功率比较高,这点对于新手尤其重要。
硬盘安装的好处有很多,这里就不多说了。
论坛精华区有一篇帖子介绍了“把livecd安装在硬盘上”的方法[http://www.linuxsir.cn/bbs/showthread.php?t=274629],可惜我多番尝试都不成功,更改init.c再重新编译重新打包对我来说太难了。
不过我由此得到了提示,再参考livecd的/root目录里的那篇lfscd-remastering-howto.txt,
摸索出了一个比较容易操作的方法。现在不使用光驱,不重启电脑,就可以利用LiveCD的环境来编译安装LFS了。
我下载了lfslivecd-x86-6.2-5.iso,然后
mkdir /mnt/isolfs
mount -o loop lfslivecd-x86-6.2-5.iso /mnt/isolfs
mkdir /mnt/lfslivecd
export WORK=/mnt/lfslivecd
cp /mnt/isolfs/root.ext2 $WORK/root.ext2
这时请查看 $WORK/root.ext2 是不是1.5G,如果不是,请参考lfscd-remastering-howto.txt[http://wiki.linuxfromscratch.org ... -howto.txt?rev=1744]里的办法,得到这个1.5G的文件,然后继续。
mkdir $WORK/root
mount -o loop $WORK/root.ext2 $WORK/root
mount -t proc proc $WORK/root/proc
mount -t sysfs sysfs $WORK/root/sys
mount -t devpts devpts $WORK/root/dev/pts
mount -t tmpfs tmpfs $WORK/root/dev/shm
mount --bind /dev $WORK/root/dev #这句是安装gentoo时学到的。
一切准备就绪,可以chroot了。
chroot /mnt/lfslivecd/root
现在测试一下这个工作环境是否理想,运行以下命令:- cat > version-check.sh << "EOF"
- #!/bin/bash
- # Simple script to list version numbers of critical development tools
- bash --version | head -n1 | cut -d" " -f2-4
- echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-4
- bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
- echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
- diff --version | head -n1
- find --version | head -n1
- gawk --version | head -n1
- gcc --version | head -n1
- /lib/libc.so.6 | head -n1 | cut -d" " -f1-7
- grep --version | head -n1
- gzip --version | head -n1
- cat /proc/version | head -n1 | cut -d" " -f1-3,5-7
- make --version | head -n1
- patch --version | head -n1
- sed --version | head -n1
- tar --version | head -n1
- EOF
- bash version-check.sh
复制代码
如果你也使用livecd-x86-6.2-5.iso,将会得到以下结果:- bash, version 3.1.17(1)-release
- Binutils: version 2.16.1
- bzip2, Version 1.0.3, 15-Feb-2005.
- Coreutils: 5.96
- diff (GNU diffutils) 2.8.1
- GNU find version 4.2.27
- GNU Awk 3.1.5
- gcc (GCC) 4.0.3
- GNU C Library stable release version 2.3.6,
- grep (GNU grep) 2.5.1
- gzip 1.3.5
- Linux version 2.6.18-3-686 2.6.18-7) (waldi@debian.org) (gcc
- GNU Make 3.80
- patch 2.5.4
- GNU sed version 4.1.5
- tar (GNU tar) 1.15.1
复制代码
可见,得到了一个很适合安装LFS的宿主环境。Have fun!
*********************
补充一点,我在这个环境里根据/root/README的说明来设置,可以用startx进xfce里上网。但我还没有正式在里面安装LFS,所以虽然现在一切看起来很好,但并不完全确定安装过程中会有什么情况发生。
另外,我有一个疑问,
mount -t sysfs sysfs $WORK/root/sys
mount -t devpts devpts $WORK/root/dev/pts
mount -t tmpfs tmpfs $WORK/root/dev/shm
这几句我是按照lfscd-remastering-howto.txt来写的,不知道具体有什么用处。高手可以讲解一下吗?谢谢! |
|