📄 0510osloader.htm
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>
<html lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
<meta name="Author" content="VBird, 鸟哥" >
<meta name="Description" content="整个 Linux 系统下的开关机流程介绍,以及开机管理软体的介绍" >
<title>鸟哥的 Linux 私房菜 -- 开机关机流程与 Loader</title>
<style type="text/css">
body {
background-color: #D3D3D3;
color: #000000;
background-attachment:fixed ;
}
body,th,td,input,select,textarea,select,checkbox {
font-family: '新细明体', 'Times New Roman', serif;
font-size: 11pt ;
}
a:link {text-decoration: none; color: blue}
a:visited {text-decoration: none; color: blue}
a:active {text-decoration: none; color: blue}
a:hover {text-decoration: underline; color: #ff0000}
table.head1 {width:100%; background-color: #FFCCCC;
border-style:groove;border-width:5px;border-color: #FFCCCC; margin:0;
padding: 5px 5px}
td.head1 {font: 10pt "新细明体", serif; color: #000099; }
td.info1 {font: 11pt "新细明体", serif; color: #000066; text-align:center; width:14%}
td.info2 {font: 11pt "新细明体", serif; color: #000066; text-align:center; width:12%}
*.info21 {font: 11pt "新细明体", serif; color: #000066; }
*.info22 {font: 11pt "新细明体", serif; color: blue ; }
*.info23 {font: 11pt "新细明体", serif; color: green ; }
td.info3 {font: 11pt "新细明体", serif; color: #000066; text-align:justify}
*.text_head0 {font-size:18pt; font-family:'标楷体','Times New Roman','Times', serif; }
*.text_head_en {font-size:18pt; font-family:'Times New Roman','Times', serif; }
*.text_h1 {font: 15pt "新细明体", serif; color: #0000BB; font-weight: bold }
*.text_h2 {font: 13pt "新细明体", serif; color: #0000BB; font-weight: bold }
*.text_import1 {font: 11pt "新细明体", serif; color: #000088; font-weight: bold }
*.text_import2 {font: 11pt "新细明体", serif; color: #000088; font-weight: normal}
*.text_vbird {font: 11pt "新细明体", serif; color: #000088; font-weight: normal;
font-style: italic;}
*.text_history {font: 10pt "新细明体", serif; color: #000066; }
*.text_date {font: 10pt "新细明体", serif; color: #3333FF; }
*.block1 {padding: 10px 20px 10px 25px; text-align:left }
*.block2 {padding: 10px 0px 10px 25px; text-align:left }
table.term2 {width: 350px; background-color: #000000;
border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
table.term {width: 580px; background-color: #000000;
border-style:groove;border-width:3px;border-color: #FFCCCC; margin:10px 0px;}
td.term {font: 10pt "细明体", Fixedsys, serif; color: #FFFFFF; }
*.term_hd {font: 10pt "细明体", Fixedsys, serif; color: #BBBBBB; }
*.term_note {font: 10pt "细明体", Fixedsys, serif; color: #777777; font-weight: normal }
*.term_note_b {font: 10pt "细明体", Fixedsys, serif; color: #FF77FF; font-weight: bolder }
*.term_command {font: 10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: bolder }
*.term_write {font: 10pt "细明体", Fixedsys, serif; color: yellow ; font-weight: normal }
*.term_say {font: 10pt "细明体", Fixedsys, serif; color: #FF6666; font-weight: normal }
</style>
</head>
<body style="margin:0; padding:0">
<center>
<!-- 这里是关于页首按钮处的按钮程式 -->
<div style="text-align:center">
<span style="font-weight:bolder; color:#3333FF"><span class="text_head0">鸟哥的<span class="text_head_en">
Linux </span>私房菜</span></span><br />
<span style="color:#000080">为取得较佳浏览结果,请爱用 <a href="http://moztw.org" target="_blank">firefox</a>
浏览本网页</span><br />
<a href="http://linux.vbird.org/" target="_blank"
onmouseover="document.head_icon1.src='../images/icon_VBird_on.jpg'"
onfocus="document.head_icon1.src='../images/icon_VBird_on.jpg'"
onmouseout="document.head_icon1.src='../images/icon_VBird_off.jpg'">
<img alt="前往鸟哥的 Linux 私房菜馆首页" title="前往鸟哥的 Linux 私房菜馆首页" name="head_icon1"
src="../images/icon_VBird_off.jpg" border="0" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_basic"
onmouseover="document.head_icon2.src='../images/icon_basic_on.jpg'"
onfocus="document.head_icon2.src='../images/icon_basic_on.jpg'"
onmouseout="document.head_icon2.src='../images/icon_basic_off.jpg'">
<img src="../images/icon_basic_off.jpg" border="0"
alt="前往 Linux 基础文件,新手请从头学起"
title="前往 Linux 基础文件,新手请从头学起" name="head_icon2" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_server"
onmouseover="document.head_icon3.src='../images/icon_server_on.jpg'"
onfocus="document.head_icon3.src='../images/icon_server_on.jpg'"
onmouseout="document.head_icon3.src='../images/icon_server_off.jpg'">
<img src="../images/icon_server_off.jpg" border="0"
alt="前往 Linux 架站文件,网路基础那章节请务必参考!"
title="前往 Linux 架站文件,网路基础那章节请务必参考!" name="head_icon3" /></a>
<a target="_blank" href="http://linux.vbird.org/linux_security"
onmouseover="document.head_icon4.src='../images/icon_security_on.jpg'"
onfocus="document.head_icon4.src='../images/icon_security_on.jpg'"
onmouseout="document.head_icon4.src='../images/icon_security_off.jpg'">
<img src="../images/icon_security_off.jpg" border="0"
alt="前往『网路安全』相关文件网页" title="前往『网路安全』相关文件网页" name="head_icon4" /></a>
<a href="http://phorum.vbird.org" target="_blank"
onmouseover="document.head_icon5.src='../images/icon_forum_on.jpg'"
onfocus="document.head_icon5.src='../images/icon_forum_on.jpg'"
onmouseout="document.head_icon5.src='../images/icon_forum_off.jpg'">
<img src="../images/icon_forum_off.jpg" border="0"
alt="前往 Linux 新手讨论区,发问前务必查阅发文规则"
title="前往 Linux 新手讨论区,发问前务必查阅发文规则" name="head_icon5" /></a>
<a target="_blank" href="http://linux.vbird.org/adsl"
onmouseover="document.head_icon6.src='../images/icon_adsl_on.jpg'"
onfocus="document.head_icon6.src='../images/icon_adsl_on.jpg'"
onmouseout="document.head_icon6.src='../images/icon_adsl_off.jpg'">
<img src="../images/icon_adsl_off.jpg" border="0"
alt="前往『ADSL连线分享』相关文件网页" title="前往『ADSL连线分享』相关文件网页" name="head_icon6" /></a>
<a href="http://www.study-area.org" target="_blank"
onmouseover="document.head_icon7.src='../images/icon_study-area.jpg'"
onfocus="document.head_icon7.src='../images/icon_study-area.jpg'"
onmouseout="document.head_icon7.src='../images/icon_study-area.jpg'">
<img src="../images/icon_study-area.jpg" border="0"
alt="前往 Study Area 网站" title="前往 Study Area 网站" name="head_icon7" /></a>
<br />
</div>
<table summary="本文内容的排版" style="width:750px;
background-image:url('../images/VBirdLinux.jpg');
background-attachment:fixed;" border="0" cellspacing="0" cellpadding="0">
<tr><td style="width:16px; height:16px; background-image:url('../images/border-top-left.jpg');
font-size:6px"> </td>
<td style="width:718px; height:16px; font-size:6px;
background-image:url('../images/border-top-center.jpg')"> </td>
<td style="width:16px; height:16px; background-image:url('../images/border-top-right.jpg');
font-size:6px"> </td></tr>
<tr><td style="width:16px; font-size:6px;
background-image:url('../images/border-middle-left.jpg')"> </td>
<td width="718">
<!-- 本文的档头部分 -->
<div style="text-align:center">
<a href="0510osloader.php">
<span class="text_head0">开机关机流程与<span class="text_head_en"> Loader</span></span></a><br />
</div>
<div style="text-align:left">
<a href="0510osloader.php?thisscreen=800x600"><!--切换解析度为 800x600--></a>
</div>
<div style="text-align:right">
<span class="text_history">最近更新日期∶2005/11/09</span>
</div>
<!-- 本文的档头部分 -->
<table class="head1" summary="排版∶文章档头的说明"><tr><td class="head1">
在这个章节当中,我们特别要来看一看整个开机的流程设定,
看看能不能在开机的时候就主动的帮我们将所需要的资讯都填进去!此外,还想要知道一下,
我们要如何来设定多重开机呢?设定多重开机的原理是什么?最重要的是那个『什么是开机管理程式 ( boot
loader ) 呢?』这些东西对于家里只有一部电脑,却又要安装多个作业系统的朋友来说,
是相当重要而有趣的项目呢!鸟哥底下会介绍 Linux 下的两套相当棒的 boot loader 系统,分别是
lilo 及 grub。
</td></tr></table><br>
<!-- 本文的连结区部分 -->
<div class=block1>
<span class="text_h1">
1. <a href="#startup">开机流程分析∶</a><br>
<span class=text_h2>
1.1 <a href="#startup_loader">boot loader 与 kernel 载入</a><br>
1.2 <a href="#startup_init">第一支程式 init 及设定档 /etc/inittab 与 runlevel(图形/纯文字介面的转换)</a><br>
1.3 <a href="#startup_sysinit">init 处理系统初始化流程 (/etc/rc.d/rc.sysinit)</a><br>
1.4 <a href="#startup_runlevel">启动系统服务与相关启动设定档 (/etc/rc.d/rc.n & /etc/sysconfig)</a><br>
1.5 <a href="#startup_local">使用者自订开机启动程序 (/etc/rc.d/rc.local)</a><br>
1.6 <a href="#startup_term">根据 /etc/inittab 之设定,载入终端机或 X-Window 介面</a><br>
1.7 <a href="#startup_other">其他开机相关事项∶/etc/modprobe.conf, /etc/sysconfig/*</a><br>
1.8 <a href="#startup_chrunlevel">Run level 之变换∶ init</a><br>
</span>
2. <a href="#kernel">核心与核心模组</a><br>
<span class=text_h2>
2.1 <a href="#kernel_depmod">核心模组与相依性∶ depmod</a><br>
2.2 <a href="#kernel_look">核心模组的观察∶ lsmod, modinfo</a><br>
2.3 <a href="#kernel_load">核心模组的载入与移除∶insmod, modprobe, rmmod</a><br>
2.4 <a href="#kernel_modprobe">核心模组的额外参数设定∶/etc/modprobe.conf</a><br>
</span>
3. <a href="#grub">Boot loader: Grub</a><br>
<span class=text_h2>
3.1 <a href="#grub_loader">boot loader 的功能与意义∶</a><br>
3.2 <a href="#grub_menulist">grub 的设定档 /boot/grub/menu.lst 与安装型态</a><br>
3.3 <a href="#grub_install">测试与安装 grub</a>∶ <a href="#grub-install">grub-install</a>,
<a href="#grubshell">grub shell</a><br>
3.4 <a href="#grub_other">开机前的额外功能修改</a><br>
3.5 <a href="#grub_vga">关于核心功能当中的 vga 设定∶</a><br>
3.6 <a href="#grub_hd">关于大硬碟的问题</a><br>
</span>
4. <a href="#lilo">Boot loader: LILO</a><br>
<span class=text_h2>
4.1 <a href="#lilo_conf">LILO 的设定档 /etc/lilo.conf</a><br>
4.2 <a href="#lilo_install">测试与安装 LILO 开机管理程式</a><br>
4.3 <a href="#lilo_other">一些问题的解决之道</a><br>
</span>
5. <a href="#solution">开机过程的问题解决∶</a><br>
<span class=text_h2>
5.1 <a href="#solution_root">忘记 root 密码的解决之道;</a><br>
5.2 <a href="#solution_config">因设定错误无法开机(/etc/fstab, filesystem & fsck);</a><br>
5.3 <a href="#solution_chroot">利用 chroot 切换到另一颗硬碟工作</a><br>
</span>
6. <a href="#reference">参考资料</a><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -