📄 642.html
字号:
touch /mnt/lfs/proc/mounts <br>
rm /mnt/lfs/etc/mtab <br>
ln -s /proc/mounts /mnt/lfs/etc/mtab <br>
### <br>
echo dev <br>
mkdir /mnt/lfs/lib/dev <br>
cp –a /mnt/lfs/dev /mnt/lfs/lib <br>
### <br>
echo var <br>
mv /mnt/lfs/var/lib /mnt/lfs/lib/var-lib <br>
mv /mnt/lfs/var /mnt/lfs/lib <br>
mkdir /mnt/lfs/var <br>
ln -s /lib/var-lib /mnt/lfs/lib/var/lib <br>
for i in `find /mnt/lfs/lib/var/log -type f`; do cat /dev/null > $i; done <br>
rm `find /mnt/lfs/lib/var/lock -type f` <br>
rm `find /mnt/lfs/lib/var/run -type f` <br>
______________________________________________ <br>
<br>
。 确认test install环境的正确 <br>
重新引导,选择test install <br>
这时这个install应该象一个cdrom似的。 <br>
如果有什么工作不正常,或者重新引导,选择main install后进行修复; <br>
或者在test install中执行如下命令后可以进行修复: <br>
mount -o remount,rw / <br>
<br>
<br>
(二) 创建boot image <br>
。重新引导,选择main install <br>
<br>
。产生一个可以启动的软盘 <br>
# mkbootdisk --mkinitrdargs --with=ide-cd `uname -r` <br>
<br>
。按照如下步骤抽取boot.img中的文件 <br>
# dd if=/dev/fd0 of=/tmp/cdrom.img bs=1440k count=1 <br>
# mkdir /mnt/bootfd <br>
# mount -o loop -t msdos /tmp/cdrom.img /mnt/bootfd <br>
# zcat /mnt/bootfd/initrd.img > /tmp/initrd-cdrom <br>
# mkdir /mnt/initrd <br>
# mount -o loop /tmp/initrd-cdrom /mnt/initrd <br>
。拷贝test install的内核到boot.img文件中 <br>
cp /mnt/lfs/boot/zImage /mnt/bootfd <br>
注意:根据实际情况,有可能需要修改zImage的名字 <br>
。拷贝cdrom驱动模块到cdrom.img中 <br>
#cd /mnt/initrd/lib <br>
#cp /lib/modules/2.4.18-3/kernel/drivers/cdrom/cdrom.o . <br>
#cp /lib/modules/2.4.18-3/kernel/drivers/ide/ide-cd.o . <br>
#cp /lib/modules/2.4.18-3/kernel/fs/nls/nls_iso8859-1.o . <br>
。 编辑linuxrc文件 <br>
# vi /mnt/initrd/linuxrc <br>
---------------------------------- <br>
#!/bin/nash <br>
<br>
echo "Loading cdrom module" <br>
insmod /lib/cdrom.o <br>
echo "Loading ide-cd module" <br>
insmod /lib/ide-cd.o <br>
echo "Loading nls_iso8859-1 module" <br>
insmod /lib/nls_iso8859-1.o <br>
echo Mounting /proc filesystem <br>
mount -t proc /proc /proc <br>
echo Creating root device <br>
mkrootdev /dev/root <br>
echo 0x0100 > /proc/sys/kernel/real-root-dev <br>
echo Mounting root filesystem <br>
mount --ro -t iso9660 /dev/root /sysroot <br>
umount /proc <br>
pivot_root /sysroot /sysroot/initrd <br>
--------------------------------------------- <br>
。编辑boot.img文件中的syslinux.cfg <br>
# cd /mnt/bootfd <br>
# vi syslinux.cfg <br>
_____________________________________ <br>
default linux <br>
label linux <br>
kernel zImage <br>
append initrd=initrd.img root=/dev/hdc rmdisk=32768 <br>
<br>
——————————————————————— <br>
注意:root= 后面是光驱设备名称 <br>
<br>
。压缩initrd,并拷贝到boot.img <br>
# umount /mnt/initrd <br>
# gzip -9 < /tmp/initrd-cdrom > /mnt/bootfd/initrd.img <br>
<br>
。拷贝boot image文件 <br>
# umount /mnt/bootfd <br>
# mv /tmp/cdrom.img /mnt/lfs/boot.img <br>
<br>
(三) 创建并校验iso image <br>
。继续在main install中工作 <br>
。创建iso image <br>
<br>
# cd /root/lfs & 确保其空间足够存储iso image <br>
#mkisofs -R -b boot.img -c boot.catalog -o boot.iso /mnt/lfs <br>
<br>
。校验iso image的正确性 <br>
<br>
a) 通过loop 设备 mount 光盘映象文件 <br>
# mkdir /mnt/iso <br>
# mount boot.iso /mnt/iso -o loop -t iso9660 <br>
b) 校验boot.iso 内容正确 <br>
c) umount boot.iso <br>
umount /mnt/iso <br>
(四) 刻录光盘 <br>
1) 使用linux来刻录 <br>
刻录设备的安装请参考CD-Writing HOWTO。 <br>
命令行: <br>
cdrecord -v speed=<desired writing speed> dev=<path to your writers generic scsi device> boot.iso <br>
<br>
2)如果使用windows来刻录 <br>
可以把iso image ftp到windos平台上,然后使用相应的程序进行刻录 <br>
<br>
<br>
<br>
其他问题 <br>
1: dev文件系统 <br>
我是通过建立ramdisk的办法来完成的。这需要配置内核支持足够大的ramdik。 <br>
另外的一种做法是使用DEVFS文件系统来完成对dev目录的出来,我没有尝试。。 <br>
2:其他文件系统 <br>
系统在启动的时候会提示“mount other filesystem fail“这个问题可以通过注释/etc/rc.d/init.d/netfs文件: <br>
Action $”Mounting other filesystem:” mount –a –t nonfs,smbfs,ncpfs来解决。 <br>
但是如果注释掉的话会telnet连接不了 <br>
<br>
3: 继续‘瘦身’ <br>
我目前只是没有安装x window,应该还可以继续减少其他软件包。 <br>
4: 换碟 <br>
使用目前的引导办法,cdrom启动之后,就不能更换。在那篇日文的资料里,介绍了使用tmpfs系统的办法,把整个root系统放到内存了。这是通过在boot的时候,使用init选项把这个文件展开。 <br>
5:通用性问题 <br>
不同硬盘、光驱、主板、网卡 <br>
<br>
<br>
<br>
参考资料: <br>
http://www.linuxaid.com.cn/articles/7/1/710687494.shtml <br>
介绍制作自己的linux发行版,里面关于boot.img文件的分析比较好 <br>
http://tldp.org/HOWTO/Diskless-root-NFS-HOWTO.html <br>
有一章是关于制作live in cdrom的。特别是讲解了原理 <br>
http://tldp.org/HOWTO/Bootdisk-HOWTO/index.html <br>
关于lilo,boot 过程的权威 <br>
http://www15.big.or.jp/~yamamori/sun/cdlinux/ <br>
关于用cdrom直接运行游戏的介绍,日文的。Initrd.Img的配置比较详细
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -