|
正式接触学习linux有两个月了,20天前开始lfs之旅,因为是新手所以选择了用虚拟机+ubuntu来做,开始看到好多网友说在ubuntu下做lfs会出很多错误,现在回头看看没有想象的那么困难,但是错误还是有的不是很多。下面来谈谈感想。首先,我觉得如果你绝对自信或者有两台机器的话最好不要用虚拟机来做,因为这样确实很慢!其次,应该仔细阅读LFS手册,lfs需要足够的耐心,仔细会帮助你避免很多错误;第三,新手的话最好参考youbest大哥的《手把手教你如何建立自己的Linux系统 第二版》和《制作LFS过程中各个阶段恢复工作状态的方法 第二版》(适合LFS6.3),这两篇文章很实用。
下面是我遇到的一些错误和我自己最后的解决办法:
1、 binutils make pass1 出错
make [2] *** [info-recursive] Error1
make [1] *** [all-bfd] Error2
make : ***[all] Error2
解决方法:需要安装texinfo软件包,apt-get install texinfo.
2、 GCC-4.3.2 pass1 过程中不能通过configure
error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+
这时我已经按照手册安装过gmp和mpfr了
解决方法:tar -xvf ../gcc-4.3.2.tar.bz2
cd gcc-4.3.2
tar -xvf ../mpfr-2.3.2.tar.bz2
mv mpfr-2.3.2 mpfr
tar -xvf ../gmp-4.2.4.tar.bz2
mv gmp-4.2.4 gmp
3、 make glibc pass1 出错
mawk: scripts/gen-sorted.awk: line 19: regular expression compile failed (bad class -- [], [^] or [)
/[^
mawk: scripts/gen-sorted.awk: line 19: syntax error at or near ]
mawk: scripts/gen-sorted.awk: line 19: runaway regular expression /, "", subd ...
make[1]: *** No rule to make target `/mnt/lfs/sources/glibc-build/Versions.all', needed by `/mnt/lfs/sources/glibc-build/abi-versions.h'. Stop.
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.8-20080929'
make: *** [all] Error 2
解决方法:
问题处在ubuntu安装的是mawk,而编译glibc需要gawk,在ubuntu下apt-get install gawk,就可以了。如果还不行,将mawk链接到gawk,我就是这么做的。
4、make install Bash-3.2报错
make[1]: Leaving directory `/mnt/lfs/sources/bash-3.2/doc'
( cd ./builtins ; make DESTDIR= install )
make[1]: Entering directory `/mnt/lfs/sources/bash-3.2/builtins'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/mnt/lfs/sources/bash-3.2/builtins'
( cd ./po/ ; make DESTDIR= install )
make[1]: Entering directory `/mnt/lfs/sources/bash-3.2/po'
test -z "en@quot.gmo en@boldquot.gmo ru.gmo" || make en@quot.gmo en@boldquot.gmo ru.gmo
make[2]: Entering directory `/mnt/lfs/sources/bash-3.2/po'
make[2]: `en@quot.gmo' is up to date.
make[2]: `en@boldquot.gmo' is up to date.
rm -f ru.gmo && : -c --statistics -o ru.gmo ru.po
mv: cannot stat `t-ru.gmo': No such file or directory
make[2]: *** [ru.gmo] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/bash-3.2/po'
make[1]: *** [stamp-po] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/bash-3.2/po'
make: [install] Error 2 (ignored)
解决方法:
apt-get install gettext 是gettext的问题,然后重新编译
5、 6.7节安装API Headers出现问题,提示没有权限
解决方法:
tar xvf $LFS/linux-2.6.22.5.tar.bz2
cd linux-2.6.22.5
sed -i '/scsi/d' include/Kbuild
make mrproper
make headers_check
make INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* /usr/include
cd ..
rm -rf linux-2.6.22.5
6、 最后我遇到的一个问题就是grub,需要注意的是grub加载的硬盘文件系统一定不能是LVM的,我就在这出错了,另外因为ubuntu本身有自己的grub,所以可以不用重新建立grub,直接利用原有的grub,这样也不会破坏原来宿主系统,只需要修改grub中的menu.lst,加入LFS6.4的启动内容。例如:
title LFS 6.4
root (hd0,3)
kernel /boot/lfskernel-2.6.27.4 root=/dev/hda4
特别注明:以上的这些错误都是基于ubuntu8.10宿主系统的。
终于完成了lfs,断断续续用了20天的时间,当看到自己的小系统启动时还是很有成就感的,祝大家好运,我也会继续努力的! |
|