📄 635.html
字号:
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=98
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=79
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=103
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=26
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR>
<TR>
<TD colSpan=3><A title=linux知识宝库
href="index.html" tppabs="http://www.linuxhero.com/docs/index.html"><IMG height=83
src="images/header_r1_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c1.gif" width=472 border=0
name=header_r1_c1></A></TD>
<TD colSpan=3>
<form action="http://www.linuxhero.com/docs/search.html" method=get>
<table
style="BORDER-RIGHT: #c4c4c4 1px solid; BORDER-TOP: #c4c4c4 1px solid; BORDER-LEFT: #c4c4c4 1px solid; BORDER-BOTTOM: #c4c4c4 1px solid"
cellspacing=0 cellpadding=3 width="95%" border=0 align="center">
<tbody>
<tr>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif">
<div align=center><font class=normalfont>搜索文章:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>Linux启动盘boot/root盘的制作</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>boot/root盘由两部分组成,即核心和根文件系统。要把这两部分都放到一个1.44MB的软盘上去,通常要对内核和根文件系统进行压缩,压缩核心的最好方法是进行重新编译内核,将一些不必要的支持去掉,如对网络和其它周边设备的支持,重要的一点是记住内核必须支持RAMDISK及ext2,否则系统不能正常引导。关于内核的编译本文不再阐述,下面重点介绍如何生成根文件系统的压缩包。对于根文件系统的压缩包括两方面的问题,第一是只保留必要的根文件系统组件,第二是将根文件系统做成一个压缩包,类似于内核工作的原理。<br>
<br>
(1)根文件系统概述<br>
<br>
一个根文件系统必须包括支持完整Linux系统的全部东西,它至少应包括以下几项:<br>
<br>
基本文件系统结构<br>
至少含有以下目录:/dev、 /proc、 /bin、 /etc、 /lib、 /usr、 /tmp<br>
最基本的应用程序,如sh、 ls、 cp、 mv等<br>
最低限度的配置文件,如rc、 inittab、 fstab等<br>
设备:/dev/hd*、 /dev/tty*、 /dev/fd0<br>
基本程序运行所需的库函数<br>
<br>
以上所需文件一般情况下会超过1.44M,因此我们通常的做法是先准备好内容后再压缩到软盘中,当用软盘启动时,再把文件解压到内存中,形成一个虚拟盘(RAMDISK),通过RAMDISK控制系统启动。<br>
<br>
为了能创建以上的根文件系统,你必须有一个空闲的能够放下大约4MB文件的RAMDISK。系统缺省情况下已替我们建好了一个大小为4096KB的RAMDISK,其设备名一般为/dev/ram0,我们就使用它来保存我们预先准备好的根文件系统。<br>
<br>
(2) 创建根文件系统<br>
<br>
Linux内核识别两种可以直接拷贝到RAMDISK的文件系统,它们是minix 和ext2,ext2性能更好。mke2fs缺省情况下在1.44M的软盘上产生360个信息节点,使用压缩格式的根文件系统需要更多的信息节点,所以使用如下命令创建文件系统可以创建2000个信息节点,而且一般不会用完。<br>
<br>
mke2fs -m 0 -i 2000 /dev/ram0<br>
<br>
mke2fs将会自动判断设备容量的大小并相应地配置自身,-m 0参数防止它给root保留空间,这样会腾出更多的有用空间。接着把虚拟盘挂在节点/mnt上:<br>
<br>
mount -t ext2 /dev/ram0 /mnt/floppy<br>
<br>
<br>
接着是创建目录。根文件系统最少应该有如下8个目录:<br>
<br>
/dev — 设备<br>
/proc — proc 文件系统所需目录<br>
/etc — 系统配置文件<br>
/sbin — 重要的系统程序<br>
/bin — 基本应用程序<br>
/lib — 共享函数库<br>
/mnt — 装载其他磁盘节点<br>
/usr — 附加应用程序<br>
执行如下命令创建这些目录:<br>
#cd /mnt/floppy<br>
#mkdir dev proc etc sbin bin lib mnt usr<br>
<br>
接下来的工作就是确定各个目录下的内容了:<br>
<br>
/dev:/dev中含有系统不可缺少的设备文件。可以把现有系统中/dev的文件拷贝过来,然后删除不必要的文件。命令cp -dpR /dev /mnt会拷贝/dev整个目录但不拷贝文件内容,dp开关保证链接文件仍然不变,不会拷贝链接所指原文件,而且属性不变。如果你没有SCSI设备,删除所有的以sd开头的文件。如果你不想使用串口设备,删除所有以cua开头的文件。不过记住一定要保留console、kmem、mem、null、 ram、tty1等文件。<br>
<br>
/etc:这个目录中含有一些必不可少的系统配置文件。这下面的文件比较多,那么到底哪些文件是必需的,哪些可有可无呢?由于这下面的文件一般是一些文本文件,都不是很大,干脆全部保留算了。<br>
<br>
我的启动盘中含有不到15个配置文件,大致可分为3部分:<br>
<br>
rc.d/* — 系统启动脚本<br>
fstab — 列出要登录的文件系统<br>
inittab — 包含启动过程参数<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -