\documentclass[letterpaper,english]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{The Linux Bootdisk HOWTO}
\author{§@ªÌ: Tom Fawcett ({\ttfamily \onlynameurl{fawcett+BH@croftj.net}})\\ \\ 
{\ttfamily Ä¶ªÌ: \onlynameurl{ ¦¶º~¹A }}}
\date{v4.0, April 2000,
Â½Ä¶¤é´Á: 27 July 2000}
\abstract{¥»¤å´y­z¦p¦ó³]­p»P«Ø³y§A¦Û¤vªº Linux boot/root ºÏ¤ù¡C³o¨ÇºÏ¤ù¯à¥Î¨Ó·í°µ±Ï´©ºÏ¤ù (rescue disks) ¡A©Î¬O¯à¥Î¨Ó´ú¸Õ·s¨t²Î¤¸¥ó (components) ¡C¦b¥ø¹Ï«Ø³y§A¦Û¤vªº bootdisk ¤§«e¡A§AÀ³¸Ó­n¬Û·í¼ô±x¨t²ÎºÞ²z¤u§@¡C¦pªG§A¥u¬O·Q­n¤@±iºò«æ®É¨Ï¥Îªº±Ï´©ºÏ¤ù¡A½Ð°Ñ¦Ò \ref{PreMade} {(Pre-made bootdisks)} ¡C}


\begin{document}
\maketitle
\tableofcontents

\section{«e¨¥ -- Preface}



{\bfseries  ³o¥÷¤å¥ó¥i¯à¤w¸g¹L´Á¤F¡C } ¦pªG¼ÐÃD­¶¤Wªº¤é´Á¶Z¤µ¤w¶W¹L 6 ­Ó¤ë¡A¨º»ò½Ð¬d¾\ \nameurl{http://www.croftj.net/~fawcett/Bootdisk-HOWTO/index.html}{Bootdisk-HOWTO homepage} ¬Ý¬Ý¬O§_¤w¦³¸û·sªºª©¥»¡C

ÁöµM¥»¤å¥H text ®æ¦¡¤]¬O¥i¥H¾\Åª¡A¦ý¬O¦]¬°¦L¨ê²Å¸¹ªºÃö«Y¡A {\itshape  ³Ì¦n \/} ÁÙ¬O¥H Postscript ({\ttfamily .ps}) ¡B PDF ©Î HTML ªº®æ¦¡¨Ó¾\Åª¡C




\subsection{ª©¥»ª`·N¨Æ¶µ -- Version notes}

\nidx{kernel, versions}

Graham Chapman ¬O­ì¥» Bootdisk-HOWTO ªº§@ªÌ¡A¥L¤@ª½´£¨Ñ¤ä´©¨ì version 3.1 ¡C Tom Fawcett ¤j¬ù¬O¦b kernel v2 °Ý¥«®É¦¨¬°¦X§@§@ªÌ¡C¥L¬O¥»¤å¥Ø«eªººûÅ@ªÌ¡C

¤å¤¤¸ê°T¬Oµ¹¦b {\bfseries Intel} ¥­¥x¤W¹B§@ªº Linux ¨Ï¥Î¡C¨ä¤¤³\¦h¸ê°T¤]³\¯àÀ³¥Î¦b¨ä¥¦¥­¥xªº Linux ¡A¦ý¬O§Ú­Ì¨Ã¨S¦³¹Á¸Õ¦b¨ä¥¦¥­¥x»s§@ bootdisk ¡A¤]¨S¦³¬ÛÃöªº¸ê°T¡C¦pªG§A¦³¦b¨ä¥¦¥­¥x¤W»s§@ bootdisk ªº¸gÅç¡A½Ð»P§Ú­ÌÁpµ¸¡C




\subsection{©|¥¼§¹¦¨ªº¨Æ }



¦³¥ô¦ó¦ÛÄ@ªÌ¶Ü ?

\begin{enumerate}
\item  ½Ð´y­z (©Î¬OÃìµ²¨ì¥t¤@¥÷¦³±Ô­zªº¤å¥ó)¦p¦ó»s§@¨ä¥¦¥i¶}¾÷ªºÃþºÏ¤ùª««~¡A½Ñ¦p CDROMs, ZIP disks »P LS110 disks ¡C
            
\item  ½Ð´y­z¦p¦ó³B²z¥¨¤jªº \url{libc.so} ¦@¨É¨ç¦¡®w¡C°ò¥»¤W¥i¿ï¾ÜÀò¨ú¸ûÂÂ¡B¸û¤pªº¨ç¦¡®w¡A©Î¬O§R´î²{¦³ªº¨ç¦¡®w¡C
\item  ­«·s¤ÀªR distribution bootdisks »P§ó·s "How the Pros do it" ³o¤@¸`¡C
           
\item  §R´î±Ô­zÃö©ó¦p¦ó¤É¯Å²{¦³ distribution bootdisks ªº³¹¸`¡C This is usually more trouble than it's worth.
\item  ­«¼g / ¼í¹¢ Troubleshooting ³o¤@¸`¡C
\end{enumerate}





\subsection{¦^À³»P·PÁÂ -- Feedback and credits}



§Ú±µ¨ü¥ô¦óÃö©ó¥»¤å¤º®e¤§¦^À³¡AµL½×¬O¦n¬OÃa¡C§Ú/§Ú­Ì ¤w¤O¨D³o¥÷¤å¥ó¤ºªº«ü¥O»P¸ê°T¬O¥¿½T¦Ó¥i¾aªº¡C¦pªG§Aµo²{¥ô¦ó¿ù»~©Î¿òº|¡A½ÐÅý§Úª¾¹D¡C¦b¼¶¼g®É¡A {\itshape  ½Ð«ü¥X§A©Ò°Ñ¦Òªº¤å¥ó¤§ª©¥»¸¹½X \/} ¡C

§Ú­Ì·PÁÂ³\¦h¨ó§U­×¥¿»Pµ¹¤©«ØÄ³¤§¤H¡C¥L­Ìªº°^Äm¨Ï±o¥»¤å¤ñ§Ú­Ì¦Û¤v¿W¥ß§¹¦¨¥¦®ÉÁÙ¨Ó±o§ó¦n¡C

½Ð¦U¦ì§Q¥Î¤W­zªº email ¦a§}¡Aµ¹¤©§@ªÌ§Aªº§åµû¡B«ü¥¿»PºÃ°Ý¡C§Ú¤£¤¶·N¹Á¸Õ¦^µª¥ô¦ó°ÝÃD¡A¦ý¬O¦pªG§A¦³¯S©w°ÝÃD¬OÃö©ó§Aªº bootdisk ¤£¯à¹B§@¡A¨º»ò½Ð¥ý¾\Åª \ref{Troubleshooting} {(Troubleshooting)} ¡C




\subsection{´²§G¬Fµ¦ -- Distribution policy}

Copyright \copyright{} 1995,1996,1997,1998,1999,2000 by Tom Fawcett and Graham Chapman. ¥»¤å¥i¥H¦b \nameurl{http://linuxdoc.org/copyright.html}{Linux Documentation Project License} ªº±ø¥ó¤U¬y³q¡C¦pªG§A¥¼¯à®³¨ì¦¹ license ¡A½Ð»P§@ªÌÁpµ¸¡C

¥»¤å¬O¤@¥÷§K¶O¤å¥ó¡C§Ú­Ìµo¦æ¥¦¬O§Æ±æ¥¦¯à¦³§U©ó§A¡A¦ý¬O {\bfseries  ¤£¯àµ¹§A¥ô¦ó«OÃÒ } ¡F¥»¤å¤]¨S¦³ {\bfseries  ¨ã¦³°Ó·~¯à¤O } ©Î {\bfseries  ¾A¦X¯S©w¥Î³~ } ªº«OÃÒ¡C






\section{Â²¤¶ -- Introduction}



Linux ¶}¾÷ºÏ¤ù (boot disks) ¦b«Ü¦h±¡ªp¤U¬O«Ü¦³¥Îªº¡A½Ñ¦p
\begin{itemize}
\item  ´ú¸Õ¤@­Ó·sªº®Ö¤ß (kernel)¡C
\item  ±qºÏºÐ¿ù»~¤¤´_­ì (³oÃþ¿ù»~±q¿ò¥¢¶}¾÷ºÏ°Ï¨ìºÏºÐÅª¼gÀY·´·l³£¦³¥i¯à) ¡C
\item ­×´_¤@­ÓÅõºÈ (disabled) ªº¨t²Î
\item ¦w¥þ¦a¤É¯ÅÁ{¬É¦@¥Î (critical) ªº¨t²ÎÀÉ®× (½Ñ¦p \url{libc.so}) ¡C
\end{itemize}


¦³¦n´XºØÀò±o boot disks ªº¤èªk¡G

\begin{itemize}
\item  ¨Ï¥Îµo¦æ®M¥ó (distribution) ¹³¬O Slackware ©Ò´£¨Ñªº¡C¥¦¦Ü¤Ö¯àÅý§A¶}¾÷¡C
          
\item  ¨Ï¥Î±Ï´©®M¥ó (package) «Ø³y¥Î¨Ó°µ¬°±Ï´©ºÏ¤ùªººÏ¤ù¡C
          
\item  ¾Ç²ß¨C¤@ºØ disk ¹B§@¨t²Î®É©Ò»ÝªºªF¦è¡AµM«á¦Û¤v»s§@¡C
\end{itemize}


¦³¨Ç¤H¿ï¾Ü³Ì«á¤@ºØ¤èªk¡A¦p¦¹¥L­Ì¯à¾a¦Û¤v°Ê¤â°µ¡C³o¼Ë¤l¡A¦pªG¬Y³Bµo¥Í°ÝÃD¡A´N¯à§ä
¥X¿ìªk¥h¸Ñ¨M°ÝÃD¡C¦¹¥~¤]¥i¥H¾Ç¨ì«Ü¦h¦³Ãö Linux ¦p¦ó¹B§@ªºª¾ÃÑ¡C

¥»¤å°²³]ÅªªÌ¤w¼ô±x°ò¥»ªº Linux ¨t²ÎºÞ²zÆ[©À¡CÁ|¨Ò¨Ó»¡¡A§AÀ³¸Óª¾¹D¦³Ãö¥Ø¿ý¡B filesystems »P³nºÐ¤ùªºÄ³ÃD¡C§A¤]À³¸Óª¾¹D¦p¦ó¨Ï¥Î {\ttfamily mount} »P {\ttfamily df} ¡C§AÁÙÀ³¸Óª¾¹D \url{/etc/passwd} »P \url{fstab} ³o¨â­ÓÀÉ®×ªº¥Î³~¥H¤Î¥¦­Ì¬Ý°_¨Ó¹³¤°»ò¡C³Ì«á¡A§AÀ³¸Óª¾¹D HOWTO ¤å¥ó¤º¤j³¡¤Àªº«ü¥O¡A³£­n¥H root ªº¨­¥÷¨Ó°õ¦æ¡C

­è¶}©l»s§@§A¦Û¤vªº bootdisk ¬O«Ü½ÆÂøªº¡C¦pªG§A¥¼´¿Åª¹L Linux FAQ »P¬ÛÃö¤å¥ó¡A½Ñ¦p Linux Installation HOWTO »P Linux Installation Guide ¡A¨º»ò§A¤£À³¸Ó¹Á¸Õ«Ø³y¶}¾÷ºÏ¤ù¡C¦pªG§A¥u»Ý­nºò«æ®É¥Îªº bootdisk ¡A¤U¸ü¤@­Ó§O¤H¨Æ¥ý§¹¦¨ªº bootdisk ®³¨Ó¥Î·| {\itshape  §ó \/} ¬°®e©ö¡C½Ð°Ñ¦Ò¤U­±ªº \ref{PreMade} {(Pre-made bootdisks)} ¥H±oª¾¦b­þ¸Ì¥i¥H§ä¨ì³o¨ÇªF¦è¡C




\section{Bootdisks»P¶}¾÷¬yµ{ -- Bootdisks and the boot process}

\nidx{boot process}

bootdisk °ò¥»¤W¬O©ñ¦b³nºÐ¤ù¤ºªº¤@­Ó¤p«¬¦Ó¦Û¨¬ªº Linux ¨t²Î¡C¥¦¥²¶·°õ¦æ³\¦h©M§¹¾ã¤S full-size ªº Linux ¨t²Î¬Û¦Pªº¥\¯à¡C¦b«Ø³y bootdisk ¤§«e¡A§AÀ³¸Ó¤F¸Ñ°ò¥»ªº Linux ¶}¾÷¬yµ{¡C§Ú­Ì¦b¦¹¥u°µ°ò¥»ªº¤¶²Ð¡A¦ý¤w¨¬°÷Åý§A¤F¸Ñ¥»¤å¤§«áªº¤º®e¡C«Ü¦h²Ó¸`»P´À¥N¿ï¶µ¤w³Q¬Ù²¤¡C




\subsection{¶}¾÷¬yµ{ -- The boot process}

\nidx{boot sector}

©Ò¦³ PC ¨t²Î¶}©l¶}¾÷¬yµ{³£¬OÂÇ¥Ñ°õ¦æ ROM (©ú½T¦a»¡¡A´N¬O \idx{BIOS}) ¤¤ªºµ{¦¡¡A±q¶}¾÷ºÏºÐ¾÷ªº²Ä 0 ºÏ°Ï¡B²Ä 0 ºÏ¬W¸ü¤J¥i¨Ñ¶}¾÷ªººÏ°Ï¡C¶}¾÷ºÏºÐ¾÷³q±`¬O²Ä¤@¥x³nºÐ¾÷ (¦p DOS ªº {\ttfamily A¼Ñ } »P Linux ªº \url{/dev/fd0})¡C±µµÛ BIOS ·|¹Á¸Õ°õ¦æ³o­ÓºÏ°Ï¡C¦b¤j³¡¤À¥i¶}¾÷ªº disks ¤W¡A²Ä 0 ºÏ°Ï¡B²Ä 0 ºÏ¬W¥]§t¥H¤U¨âªÌ¤§¤@¡G

\begin{itemize}
\item  ¶}¾÷¸ü¤Jµ{¦¡ (boot loader ¡A¦p LILO)ªºµ{¦¡½X¡A¥¦·|§ä¥X kernel ©Ò¦b¦ì¸m¡A±µµÛ¸ü¤J¨Ã°õ¦æ¥¦¥H±Ò°Ê¶}¾÷µ{§Ç¡C
\item  ¤@­Ó§@·~¨t²Î kernel ªº¶}ÀY (start) ¡A½Ñ¦p Linux ¡C
\end{itemize}


¦pªG¤@­Ó Linux kernel ¤w§Q¥Î raw-copied ªº¤è¦¡¸m¤J¤@±iºÏ¤ù¤º¡A¨º»ò³o±iºÏ¤ùªº²Ä¤@­ÓºÏ°Ï´N¬O Linux kernel ¥»¨­ªº²Ä¤@­ÓºÏ°Ï¡C³o­ÓºÏ°Ï±N±q¶}¾÷³]³Æ¸ü¤J kernel ªº³Ñ¾l³¡¤À¥HÄ~Äò¶}¾÷¬yµ{¡C

¤@¥¹ kernel ¸ü¤J§¹²¦¡A¤@¨Ç°ò¥»³]³Æ¤]§¹¦¨ªì©l¤Æ (initialization) ¡CµM«á¨t²Î±N¹Á¸Õ±q¬Y­Ó³]³Æ¸ü¤J¥H¤Î±¾¤W (mount) {\bfseries \idx{root filesystem}} ¡C©Ò¿×ªº root filesystem ¥u¬O¤@­Ó³Q±¾¤W·í§@ ``\url{/}'' ¥Ø¿ýªº filesystem ¡C kernel ¥²¶·³Q§iª¾¥i±q­þ¸Ì§ä¨ì¦¹ root filesystem ¡F¦pªG kernel ¦b¨º¸Ì§ä¤£¨ì¤@­Ó¥i¸ü¤Jªº¼v¹³ÀÉ (image) ¡A¨t²Î´N·|°±¤î¹B§@ (halt) ¡C

¦b¬Y¨Ç¶}¾÷±¡ªp¤U -- ±`±`¬O±q³nºÐ¤ù¶}¾÷ -- root filesystem ·|³Q¸ü¤J¨ì {\bfseries \idx{ramdisk}} ¤¤¡A¤]´N¬O³Q¨t²Î©Ò¦s¨úªº RAM ¡A¦p¦P¨t²Î¦s¨úºÏºÐ¤@¯ë¡C¬°¦ó¨t²Î·|¸ü¤J¨ì ramdisk ªº²z¥Ñ¦³¤G¡C²Ä¤@¡A RAM ¬O´X­Ó¤ñ³nºÐ¤ù§Öªº¦³§ÇºÏ©ÊÅé¡A©Ò¥H¨t²Î¦b¨ä¤W¹B§@¸û§Ö¡F ²Ä¤G¡A kernel ¥i¥H±q³nºÐ¤ù¸ü¤J¤@­Ó {\bfseries \idx{À£ÁYªºfilesystem}} ¨Ã¥B¦b¸ÑÀ£ÁY«á©ñ¨ì ramdisk ¤W¡A¦p¦¹¥iÅý§ó¦hªºÀÉ®×Àx¦s¦b³nºÐ¤ù¤W¡C

¤@¥¹ root filesystem ³Q¸ü¤J¨Ã±¾¤W¡A§A·|¬Ý¨ì¤@¦æ°T®§¹³¡G
\begin{verbatim}
        VFS: Mounted root (ext2 filesystem) readonly.
\end{verbatim}


\ncdx{init}
\ncdx{inittab}
\ncdx{sysinit}

¦¹®É¨t²Î·|¦b root filesystem ¤W§ä¨ì {\ttfamily init} µ{¦¡ ( ¦b \url{/bin} or \url{/sbin}) ¨Ã°õ¦æ¥¦¡C \url{init} Åª¨ú¥¦ªº²ÕºA³]©wÀÉ (configuration file) \url{/etc/inittab} ¡A§ä¥XÀÉ¤¤¼Ð©ú {\ttfamily sysinit} ªº¤@¦æ¡A¨Ã°õ¦æ³Q«ü¦Wªºscript¡C³o­Ó {\ttfamily sysinit} script ³q±`Ãþ¦ü \url{/etc/rc} ©Î \url{/etc/init.d/boot} ³o¨â­ÓÀÉ¡C³o­Ó script ¬O¤@²Õ«Ø¥ß°ò¥»¨t²ÎªA°Èªº shell «ü¥O¡A½Ñ¦p¡G

\begin{itemize}
\item  ¹ï©Ò¦³ºÏºÐ°õ¦æ {\ttfamily fsck},
\item  ¸ü¤J¥²³Æªº®Ö¤ß¼Ò²Õ (modules),
\item  ±Ò°Ê swapping,
\item  ¶i¦æºô¸ôªì©l¤Æ,
\item  ±N«ü©w¦b {\ttfamily \cdx{fstab}} ¤ºªººÏºÐ±¾¤W¡C
\end{itemize}


³o­Ó script ±`·|±Ò°Ê¨ä¥¦¦UºØ¤£¦Pªº scripts °õ¦æ¼Ò²Õªº (modular) ªì©l¤Æ¡CÁ|¨Ò¨Ó»¡¡A¦b¤@¯ëªº SysVinit ¬[ºc¤U¡A \url{/etc/rc.d/} ³o­Ó¥Ø¿ý¥]§t¤@­Ó½ÆÂøªº¤l¥Ø¿ý¬[ºc¡A¨ä¤¤ªºÀÉ®×«ü¥X¦p¦ó±Ò°Ê»PÃö³¬¤j³¡¤Àªº¨t²ÎªA°È¡CµM¦Ó¡A¦b¤@±i bootdisk ¤W¡A³o¼Ëªº sysinit script ±`±`¬O«D±`Â²³æªº¡C

·í sysinit script µ²§ô«á¡A±±¨îÅv¦^¨ì {\ttfamily init} ¤W¡A±µµÛ¶i¤J {\itshape  ¹w³]ªºrunlevel\/} ¡A¦¹¹w³]ªº runlevel ¥H {\ttfamily initdefault} ³o­ÓÃöÁä¦r³Q«ü©w¦b \url{inittab} ¤º¡C¦¹ runlevel line ³q±`«ü©w¤@­Ó¹³  {\ttfamily \cdx{getty}} ªºµ{¦¡¡A³o­Óµ{¦¡­t³d³B²z console »P ttys ¤§¶¡ªº³q°T¡C¨Æ¹ê¤W¡A´N¬O {\ttfamily getty} µ{¦¡¦b¿Ã¹õ¤W¦L¥X¼ô±xªº ``{\ttfamily login:}'' ´£¥Ü¡C {\ttfamily getty} µ{¦¡¨ÃÂà¦Ó©I¥s {\ttfamily login} µ{¦¡¥H³B²z login ¬O§_¦³®Ä¡A¨Ã©ó¤§«á«Ø¥ß user sessions ¡C




\subsection{ºÏºÐÃþ«¬ -- Disk types}



¦pªG§A¤w¤F¸Ñ°ò¥»ªº¶}¾÷¬yµ{¡A¨º»ò§Ú­Ì²{¦b¥i¥H©w¸q©Ò¯A¤Î¨ì¤§¦UºØ¤£¦PÃþ«¬ªººÏºÐ¡C§Ú­Ì±NºÏºÐ¤ÀÃþ¦¨¥|ºØ¡C¥»¤å»P¦b¦¹°Q½×©ÒºÙ¤§ ``ºÏºÐ (disk)'' °£«D¦³¯S§OÁn©ú¡A§_«h³£¬O«ü³nºÐ¤ù¡AÁöµMµ´¤j³¡¤Àªº°Q½×¤]¦P¼Ë¥iÀ³¥Î¦bµwºÐ¤W¡C

\begin{description}


\item[boot] \mbox{}

¤@±i¥]§t¥i³Q±Ò°Ê¤§ kernel ªººÏ¤ù¡C³o±iºÏ¤ù³Q¥Î¨Ó±Ò°Ê kernel ¡A±µµÛ³o­Ó kernel ·|¸ü¤J¦b¥t¤@±iºÏ¤ù¤Wªº root file system ¡C¦b bootdisk ¤Wªº kernel ³q±`¥²¶·³Q§iª¾¨ì­þ¥h§ä¥¦ªº root filesystem ¡C

bootdisk ±`·|±q¥t¤@±iºÏ¤ù¸ü¤J¤@­Ó root filesystem ¡A¦ý¬O¬Û¤Ï¦a¡A bootdisk ¤]¦³¥i¯à³Q³]©w¦¨¸ü¤JµwºÐªº root filesystem ¡C¤@¯ë¦b´ú¸Õ·s kernel ®É·|³o¼Ë°µ (¨Æ¹ê¤W¡A ``{\ttfamily make zdisk}'' ·|¦Û°Ê¦a±q kernel ªº­ì©l½X»s³y¥X³o¼Ëªº¤@±i bootdisk ¡C



\item[root] \mbox{}

¦b¨ä filesystem ¤W¥]§t¹B§@ Linux ¨t²Î¥²³ÆÀÉ®×ªº¤@±iºÏ¤ù¡C³o±iºÏ¤ù¤£¤@©w¦³ kernel ©Î boot loader ¡C \nidx{root disk}

¤@¥¹ kernel ³Q±Ò°Ê«á¡A root disk ´N¥i¥H¿W¥ß©ó¨ä¥¦ºÏ¤ù¨Ó¹B§@¨t²Î¡C³q±` root disk ªº¤º®e·|³Q¦Û°Ê¦a copy ¨ì RAM ¦Ó¦¨¬° ramdisk ¡C³o¨Ï±o root disk ªº¦s¨úÅÜ±o§ó¬°§Ö³t¡A¦Ó¥B¥iÄÀ©ñ¤@¥x³nºÐ¾÷µ¹¤u¨ãµ{¦¡ºÏ¤ù (utility disk)¡C



\item[boot/root] \mbox{}

¤@±i¦P®É¥]§t kernel »P root filesystem ªººÏ¤ù¡C´«¥y¸Ü»¡¡A³o±iºÏ¤ù¥]§t¤£¥ÎµwºÐ¦Ó¯à±Ò°Ê»P¹B§@ Linux ¨t²Î¤§©Ò¦³¥²³Æ¶µ¥Ø¡C³oºØºÏ¤ùªºÀuÂI¦b©óÂ²³æ»´«K -- ¨C¤@¶µ¥²³ÆªºªF¦è³£©ñ¦b¦P¤@±iºÏ¤ù¤W¡CµM¦Ó¡AÀHµÛÀÉ®× size ªº³vº¥¼W¥[¡AÅý©Ò¦³ªF¦è³£¦s¦b¦P¤@±iºÏ¤ù¤W´N¶VÅã§xÃø¡A¬Æ¦Ü§Q¥ÎÀ£ÁY¤]¤@¼Ë¡C



\item[utility] \mbox{}

¤@±i¥]§t filesystem ªººÏ¤ù¡A¦ý¬O¨Ã¤£¬O­n±¾¤W°µ¬° root file system ¨Ó¨Ï¥Î¡C³o±iºÏ¤ù¥iµø¬°ÃB¥~ªº¸ê®Æ¤ù (data disk) ¡C§A¥i¥H§Q¥Î³oºØºÏ¤ù§â­ì¥»¹L¦h¦Ó¤£¯à©ñ¦b root disk ¤Wªº¤u¨ãµ{¦¡©ñ¦b¨ä¤W¡C
\nidx{utility diskette}

\end{description}


¤@¯ë¦Ó¨¥¡A·í§Ú­Ì´£¤Î ``«Ø³y¤@±i bootdisk'' ®É¡A¬O«ü³y¥X boot ( kernel ) »P root (files) ³o¨â­Ó³¡¤À¡C³o¨â­Ó³¡¤À¤£¬O©ñ¦b¤@°_ (¤@±i³æ±iªºboot/root disk) ¡A´N¬O¨â±i¤À¶}ªººÏ¤ù (boot + root disks) ¡C¹ï±Ï´©ºÏ¤ù¦Ó¨¥³Ì¨ã¼u©Ê¤§°µªk¡A¥i¯à¬O¨Ï¥Î¨â±i¤À¶}ªº boot »P root ºÏ¤ù¡A¦A¥[¤W¤@±i©Î¦h±iªº utility diskettes ¥H³B²z¦h¥X¨ÓªºªF¦è¡C




\section{«Ø¥ß¤@­Óroot filesystem -- Building a root filesystem}

\label{BuildRoot}

³y¥X root filesystem ¯A¤Î¿ï¾Ü¯àÅý¨t²Î¥¿±`¹B§@©Ò¥²³ÆªºÀÉ®×¡C¦b³o¤@¸`¤¤¡A§Ú­Ì±N±Ô­z¦p¦ó«Ø³y¤@­Ó {\itshape \idx{ À£ÁYªº root filesystem}\/} ¡C¦bºÏ¤ù¤W«Ø³y¤@­Óª½±µ±¾¤W°µ¬°®Ú¥Ø¿ý (root) ¤§¥¼¸gÀ£ÁYªº filesystem ¬O¸û¤£´¶¹MªºÆ[©À¡F³o­Ó´À¥N¤è®×±Ô­z¦b \ref{NonRamdiskRoot} {(Non-ramdisk Root Filesystem)} ³o¤@¸`¤¤¡C




\subsection{·§Æ[ -- Overview}



root filesystem ¥²¶·¥]§t¤ä´©§¹¾ã Linux ¨t²Î¹B§@©Ò»Ýªº¨C¤@­Ó¶µ¥Ø¡C¬°¤F¯à°÷¹F¦¨³o­Ó¥Øªº¡A³o±iºÏ¤ù¥²¶·¥]¬A¯àÅý Linux ¨t²Î¹B§@³Ì°_½X (minimum) ªº»Ý¨D¡G

\begin{itemize}
\item  °ò¥»ªºÀÉ®×¨t²Î¬[ºc¡A
\item  ³Ì°_½Xªº¥Ø¿ý¡G {\ttfamily /dev, /proc, /bin, /etc, /lib, /usr, /tmp},
\item  °ò¥»ªº¤u¨ãµ{¦¡¡G {\ttfamily sh, ls, cp, mv}, etc.,
\item  ³Ì°_½Xªº²ÕºA³]©wÀÉ¡G {\ttfamily rc, inittab, fstab}, etc.,
\item  ³]³ÆÀÉ¡G {\ttfamily /dev/hd*, /dev/tty*, /dev/fd0}, etc.,
\item  Runtime ¨ç¦¡®w¥H´£¨Ñ¤u¨ãµ{¦¡©Ò¨Ï¥Î¤§°ò¥»¥\¯à (functions) ¡C
\end{itemize}


·íµM¡A¥ô¦ó¨t²Î¥u¦³¦b§A¯à©ó¨ä¤W°õ¦æ¬Y¨ÇªF¦è®É¤~·|Åã±o¦³¥Î¡A¦Ó¤@±i root ºÏ¤ù³q±`¥u¦³¦b§A¯à°µ¨ì¥H¤U¨Æ±¡®É¤~·|Åã±o¦³¥Î¡G

\begin{itemize}
\item  ÀË¬d¥t¤@¥xºÏºÐ¾÷ªº file system ¡AÁ|¨Ò¨Ó»¡¡AÀË¬d§AµwºÐ¤Wªº root file system ¡A§A¥²¶·¯à°÷±q¥t¤@¥xºÏºÐ¾÷±Ò°Ê Linux ¡A¨Ò¦p§A¥i¥H¥Î¤@±i root ºÏ¤ù¿ì¨ì³o¥ó¨Æ¡CµM«á§A¥i¥H¦b§A­ì¥»ªº root ºÏºÐ¾÷¥¼³Q±¾¤W®É¡A¹ï¨ä°õ¦æ {\ttfamily \cdx{fsck} } ¡C
\item  ¨Ï¥ÎÀÉ®× (archive) »PÀ£ÁY¤u¨ãµ{¦¡¡A½Ñ¦p {\ttfamily cpio, tar, gzip} »P {\ttfamily ftape} ¡A±q³Æ¥÷ (backup) «ì´_Àx¦s©Ò¦³©Î³¡¤À§A­ì¥» root ºÏºÐ¾÷ªº¸ê®Æ¡C
\end{itemize}


§Ú­Ì±N±Ô­z¦p¦ó«Ø³y¤@­Ó {\itshape  À£ÁYªº \/} filesystem ¡A´N¬O¥­®É³QÀ£ÁY¦bºÏ¤ù¤W¡A¥u¦³·í¶}¾÷®É¡A¤~·|¸ÑÀ£ÁY«á¦s¤Jramdisk ¡C
\nidx{compressed root filesystem}
¥ÎÀ£ÁY filesystem ªº¤è¦¡¡A§A¥i¥H¦b¤@±i¼Ð·Çªº 1440K ºÏ¤ù¤W©ñ¤J«Ü¦hÀÉ®× (¤j¬ù 6 megabytes) ¡C¦]¬° filesystem ¤ñºÏ¤ù¤j«Ü¦h¡A§Ú­Ì¤£¯àª½±µ§â¥¦«Ø¦bºÏ¤ù¤W¡C§Ú­Ì¥²¶·¦b¨ä¥¦¦a¤è«Ø¥ß¥¦¡AÀ£ÁY¥¦¡AµM«á¦A§â¥¦ copy ¨ìºÏ¤ù¤W¡C




\subsection{»s§@ filesystem -- Creating the filesystem}

\label{CreatingRootFS}

¬°¤F«Ø³y¦p¦¹ªº¤@­Ó filesystem ¡A§A»Ý­n¤@­Ó¦h¥X¦Ó°÷¤jªº³]³Æ¡A¯à°÷Åý§A¦bÀ£ÁY¤§«e¦s©ñ©Ò¦³ªºÀÉ®×¡C§A±N»Ý­n¤@­Ó¯à°÷¦s©ñ¤j¬ù 4 megabytesÀÉ®×ªº³]³Æ¡C¦³¥H¤U´XºØ¿ï¾Ü¡G

\begin{itemize}
\item  ¨Ï¥Î {\bfseries \idx{ramdisk}} (DEVICE = \url{/dev/ram0})¡C¦b³oºØ±¡ªp¤U¡A°O¾ÐÅé³Q¼ÒÀÀ¦¨¤@¥xºÏºÐ¾÷¡C Ramdisk ¥²¶·¤j¨ì¯à°÷¦s©ñ¤@­Ó¾A·í¤j¤pªº filesystem ¡C¦pªG§A¨Ï¥Î LILO ¡A½ÐÀË¬d§Aªº²ÕºA³]©wÀÉ (\url{/etc/lilo.conf}) ¡A§ä¨ì¤@¦æ¹³
\begin{verbatim}
 RAMDISK = nnn
\end{verbatim}

\nidx{RAMDISK\_SIZE, LILO parameter}
³o¦æ¨M©w¥i¥H¤À°tµ¹ ramdisk ªº RAM ¤§·¥¤j­È¡C¹w³]­È¬O 4096K ¡A³oÀ³¸Ó¬O¨¬°÷¤F¡C§AÀ³¸Ó¤£¥i¯à¹Á¸Õ¦b¤@¥x¤Ö©ó 8MB RAM ªº¹q¸£¤W¨Ï¥Î¦p¦¹ªº ramdisk ¡C

½ÐÀË¬d¥H½T»{§A¦³¤@­Ó³]³ÆÀÉ¹³¬O \url{/dev/ram0, /dev/ram} ©Î¬O \url{/dev/ramdisk} ¡C¦pªG¨S¦³¡A½Ð¦Û¤v¥H {\ttfamily mknod} (major number 1, minor 0)³y¥X \url{/dev/ram0} ¡C
\item  ¦pªG§A¦³¤@­Ó¥¼¨Ï¥Î¥B°÷¤jªºµwºÐ partition (®t¤£¦h´Xmegabytes¤j´N¥i¥H¤F)¡A´N¨Ï¥Î¥¦§a¡C
\item  ¨Ï¥Î¤@­Ó {\bfseries \idx{loopback device}} ¡A³o¥i¥H§â¤@­ÓºÏºÐÀÉ®×·í°µ¬O¤@¥x³]³Æ¨Ó¨Ï¥Î¡C¨Ï¥Î loopback device ®É¡A§A¥i¥H¦bµwºÐ¤W³y¥X¤@­Ó  3 megabyte ªºÀÉ®×¡A¨Ã©ó¨ä¤W«Ø³y filesystem ¡C

Áä¤J {\ttfamily man losetup} §ä´M«ü¥O¥H¨Ï¥Î loopback devices ¡C¦pªG§A¨S¦³ {\ttfamily losetup} ¡A§A¥i¥H±q \nameurl{ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/}{} ¥Ø¿ý¤¤¡A \url{util-linux} ®M¥ó (package) ¤º¬Û®eª©¥»¤§ {\ttfamily mount} »P {\ttfamily unmount} ªºÀHªþª«¤¤§ä¨ì¥¦¡C

¦pªG¦b§Aªº¨t²Î¤W¨S¦³ loop device ÀÉ (\url{/dev/loop0}, \url{/dev/loop1}, etc.)¡A¨º»ò§A¥²¶·¥Î ``{\ttfamily mknod /dev/loop0 b 7 0}'' ¦Û¤v³y¥X¤@­Ó¡C¤@¥¹¦w¸Ë¦n³o¨Ç¯S§Oªº {\ttfamily mount} »P {\ttfamily umount} ¤G¶i¦ìÀÉ¡A´N½Ð¦b¤@¥x®e¶q°÷¤jªºµwºÐ¤W³y¥X¤@­Ó¼È¦sÀÉ (temporary file)(eg, \url{/tmp/fsfile}) ¡C§A¥i¥H¨Ï¥Î¹³³o¼Ë¤lªº«ü¥O¡G
\begin{tscreen}
dd if=/dev/zero of=/tmp/fsfile bs=1k count={\itshape nnn\/}
\end{tscreen}

¥H³y¥X¤@­Ó {\itshape nnn\/}-block ªºÀÉ®×¡C

½Ð¨Ï¥Î¦Û¤vªºÀÉ¦W¨ú¥N¥H¤Uªº DEVICE ¡C·í§A¤U¤F mount «ü¥O¡A§A¦P®É­n¥[¤W ``{\ttfamily -o loop}'' ¿ï¶µ¥H§iª¾ mount ¬O¨Ï¥Î loopback device ¡C \nidx{loopback device}
Á|¨Ò¨Ó»¡¡G
\begin{verbatim}
        mount -o loop -t ext2 /tmp/fsfile /mnt
\end{verbatim}


¥H±¾¤W loopback device ªº¤è¦¡¡A§â \url{/tmp/fsfile} ±¾¤W {\ttfamily /mnt} ³o­Ó mount point ¡C¥Î {\ttfamily df} «ü¥O¥iÅý§A¬Ý¨ì¥H¤Wªºµ²ªG¡C
\end{itemize}


¦b§A¿ï¾Ü¨ä¤¤¤@ºØ¤èªk«á¡A½Ð·Ç³Æ DEVICE ¥H¡G
\begin{verbatim}
        dd if=/dev/zero of=DEVICE bs=1k count=4096
\end{verbatim}


³o¦æ«ü¥O°e¥X¤@°ï 0 §âDEVICE¶ñº¡¡C¥Î 0 ¶ñº¡ device ¬OÃöÁäªº¤@¨B¡A¦]¬° filesystem¤§«á±N·|³QÀ£ÁY¡A©Ò¥H©Ò¦³¥¼¨Ï¥Îªº³¡¤ÀÀ³³Q¥Î 0 ¶ñº¡¥H¹F¨ì³Ì¤jªºÀ£ÁY¤ñ¡CµL½×¦ó®É§A±q§Aªº root filesystem §R°£ÀÉ®×¡A½Ð°O±o³o­Ó¨Æ¹ê¡C¹ê»Ú¤W filesystem ¥u¬OÄÀ¥X (de-allocate) ³o¨Ç blocks ¡A {\itshape ¦ý¬O¨Ã¨S¦³¦A§â¥¦­Ì¶ñ¬° 0 \/}¡C¦pªG§A°õ¦æ¹L«Ü¦h¦¸§R°£»P copy ªº°Ê§@¡A§AªºÀ£ÁY filesystem ³Ì«á·|¤ñ¥²­nªº¤j¥X«Ü¦h¡C

\nidx{inodes, allocation}
¤U¤@¨B´N¬O³y¥X filesystem ¡C Linux kernel ©Ó»{¨âºØ¯àÅý root disks ¦Û°Ê¦a³Q copy ¨ì ramdisk ¤Wªº file system ¡C¥¦­Ì¬O minix »P ext2 ¡A¨ä¤¤ ext2 ¬O¤ñ¸û¨üÅwªïªº¡C¦pªG¨Ï¥Î ext2 ¡A§A·|µo²{¨Ï¥Î {\ttfamily -i} ¿ï¶µ«ü©w¤ñ¹w³]­È§ó¦hªº inodes ¬O¦³§U¯qªº¡F§Ú­Ì«ØÄ³¥Î {\ttfamily -i 2000} ¡A³o¼Ë§A´N¤£·|¥Î§¹ inodes ¡C¦pªG¤£¥Î¤W­z¿ï¶µ¡A§A¥i¥H²¾°£³\¦h¤£¥²­nªº {\ttfamily /dev} ÀÉ®×¥H¸`¬Ù inodes ¡C {\ttfamily mke2fs} ¹w³]·|³y¥X 360 ­Ó inodes¦b¤@±i 1.44Mb ªººÏ¤ù¤W¡C§Úµo²{¦b§Ú¥Ø«eªº±Ï´© root ºÏ¤ù¤W¡A 120 ­Ó inodes ¬O¬Û·í¨¬°÷¤F¡A¦ý¬O¦pªG§A§â©Ò¦³ªº³]³ÆÀÉ³£©ñ¤J {\ttfamily /dev} ¥Ø¿ý¤¤¡A¨º»ò§A«Ü®e©ö·|¶W¹L 360 ­Óinodes ¡C¨Ï¥ÎÀ£ÁYªº root filesystem ¥iÅý§A¾Ö¦³¸û¤jªº filesystem ¡A¦P®É¹w³]·|¦³§ó¦hªº inodes ¡A¦ý¬O§A¤´µM¥²¶·­n¤£´N¬O´î¤ÖÀÉ®×¼Æ¶q¡A­n¤£´N¬O¼W¥[ inodes ¼Æ¥Ø¡C

¦]¦¹¡A§A©Ò¨Ï¥Îªº«ü¥O¬Ý°_¨Ó·|¹³³o¼Ë¡G
\begin{verbatim}
        mke2fs -m 0 -i 2000 DEVICE
\end{verbatim}


(¦pªG§A¨Ï¥Îªº¬O¤@­Ó loopback device ¡A¨º»ò½Ð¥Î§A¥Ø«e©Ò¥ÎªººÏºÐÀÉ®×´À´«±¼¤W­±ªº DEVICE ¡C)
\nidx{loopback device}

{\ttfamily mke2fs} «ü¥O·|¦Û°Ê¦a°»´ú¥iÀò±oªºªÅ¶¡¡AµM«á¨Ì¾Ú°»´ú¹ï¦Û¨­¶i¦æ²ÕºA³]©w¡C ``{\ttfamily -m 0}'' °Ñ¼ÆÁ×§K«O¯dªÅ¶¡µ¹ root ¡A¦]¦¹¥i´£¨Ñ§ó¦h¥i¥ÎªººÏºÐªÅ¶¡¡C

¤U¤@¨B¡A±¾¤W³o­Ó device ¡G

\begin{verbatim}
        mount -t ext2 DEVICE /mnt
\end{verbatim}
 
(¦pªG mount point ¨Ã¤£¦s¦b¡A§A¥²¶·¦Û¦æ³y¥X¤@­Ó mount point {\ttfamily /mnt} ¡C) ¦b³Ñ¤Uªº³¹¸`¤¤¡A©Ò¦³ªº¥Øªº (destination) ¥Ø¿ý³£³Q°²³]¬O¬Û¹ï©ó {\ttfamily /mnt} ¡C




\subsection{²¾´ÓÀÉ®×¨t²Î -- Populating the filesystem}



¥H¤U¬O§Aªº root filesystem ³Ì°_½X¸Ó¦³ªº¥Ø¿ý

¦¹³B©Ò§e²{¤§¥Ø¿ý¬[ºc¶È¨Ñ root diskette ¨Ï¥Î¡C¯u¥¿ªº Linux ¨t²Î¦³¤@®M§ó¬°½ÆÂø¥B³]­p¨}¦nªº¬[ºc¤èªk¡AºÙ¬° \onlynameurl{Filesystem Hierarchy Standard} ¡A¥¦¨M©wÀÉ®×À³¸Ó¦p¦ó©ñ¸m¡C
:

\begin{itemize}
\item \url{/dev} -- ¸Ì­±¦s©ñ³]³ÆÀÉ (Devices) ¡A¬°¹F¦¨ I/O ¤u§@©Ò»Ý
\item \url{/proc} -- Directory stub required by the proc filesystem
\item \url{/etc} -- ¸Ì­±¦s©ñ¨t²Î²ÕºA³]©wÀÉ
\item \url{/sbin} -- ­«­nªº (critical) ¨t²Î¤G¶i¦ì°õ¦æÀÉ (binaries)
\item \url{/bin} -- ³Q»{¬°¬O¨t²Î¤@³¡¤Àªº°ò¥»¤G¶i¦ì°õ¦æÀÉ
\item \url{/lib} -- ´£¨Ñ run-time ¤ä´©ªº¦@¨É¨ç¦¡®w
\item \url{/mnt} -- ºûÅ@¨ä¥¦ºÏºÐ©Ò¥ÎªººÏºÐ±¾¤JÂI (mount point)
\item \url{/usr} -- ÃB¥~ªº¤u¨ãµ{¦¡»PÀ³¥Îµ{¦¡
\end{itemize}


\ncdx{proc}\ncdx{mnt}\ncdx{usr}

¤W­z¥Ø¿ýªº¨ä¤¤¤T­Ó¦b root filesystem ¤W·|¬OªÅªº¡A©Ò¥H¥¦­Ì¥u»Ý­n¥Î {\ttfamily mkdir} ³y¥X¨Ó¡C \url{/proc} ¥Ø¿ý°ò¥»¤W¬O¤@­Ó§â proc filesystem ©ñ¸m©ó¨ä¤Uªº stub ¡C \url{/mnt} »P \url{/usr} ³o¨â­Ó¥Ø¿ý¥u¬O¦b boot/root ¨t²Î¹B§@®É©Ò¨Ï¥Îªº mount points ¡C¦]¦¹¦A­«ÂÐ¤@¦¸¡A³o¨Ç¥Ø¿ý¥u»Ý­n³Q³y¥X¨Ó´N¥i¥H¤F¡C

³Ñ¤Uªº¥|­Ó¥Ø¿ý´y­z©ó¥H¤U¦U¸`¡C




\subsubsection{/dev}



\nidx{device (dev) directory}

\url{/dev} ¥Ø¿ý¥]§t¤@¸s¯S§OªºÀÉ®×¡A³o¨ÇÀÉ®×¬Oµ¹¨t²Î¤W©Ò¦³³]³Æ¨Ï¥Îªº¡A³o¼Ëªº /dev ¥Ø¿ý¨C­Ó Linux ¨t²Î³£¤@©w·|¦³¡C³o­Ó¥Ø¿ý¥»¨­¬O¤@­Ó´¶³q¥Ø¿ý¡A¥i¥H¥H¤@¯ëªº¤èªk¥Î {\ttfamily mkdir} ³y¥X¨Ó¡CµM¦Ó¡A³o¨Ç¯S§OªºÀÉ®×¥²¶·¥H¯S§Oªº¤èªk¥Î {\ttfamily \cdx{mknod}} «ü¥O³y¥X¨Ó¡C

¦ýÁÙ¬O¦³¤@±ø±¶®| -- ª½±µ copy §A²{¦³ \url{/dev} ¥Ø¿ýªº¤º®e¡AµM«á¦A²M°£§A¤£·Q­nªº³]³ÆÀÉ¡C°ß¤@ªº­n¨D¬O copy ³o¨Ç¯S§Oªº³]³ÆÀÉ®É¡A­n¥Î {\ttfamily -R} ¿ï¶µ¡C³o­Ó¿ï¶µ·| copy ¾ã­Ó¥Ø¿ý¤¤ªºÀÉ®×¡A¦ý¬O¤£·| copy ³o¨ÇÀÉ®×ªº¤º®e¡C½Ð½T©w¨Ï¥Î {\itshape ¤j¼g¦r¥À R\/} ¡C³o­Ó«ü¥O¬O¡G
\begin{verbatim}
        cp -dpR /dev /mnt
\end{verbatim}


¦b¦¹§Ú­Ì°²³]ºÏ¤ù¬O³Q±¾¦b \url{/mnt} ©³¤U¡C {\ttfamily dp} ¿ï¶µ (switches) ½T«O symbolic links ¬O¥H links ªº¤è¦¡¨Ó copy ¡A¦Ó¤£¬O copy Ãìµ²ÀÉ©Ò«ü¦Vªº target file ¡A¦P®É­ì¥»ªºÀÉ®×ÄÝ©Ê¤]³Q«O¯d¡A¦]¦¹«O¯d¤FÀÉ®×ªº©Ò¦³Åv¸ê°T¡C

¦pªG§A·Q­n¥Î°ªÃø«×§Þ¥©§¹¦¨³o­Ó¥ô°È¡A´N§Q¥Î {\ttfamily ls -l} ¦C¥X§A·Q­nªº³]³ÆÀÉ¤§ major »P minor device numbers ¡AµM«á¦A¥Î {\ttfamily mknod} ¦bºÏ¤ù¤W³y¥X¥¦­Ì¡C

µL½×¦p¦ó copy ³o¨Ç³]³ÆÀÉ¡AÁÙ¬O­nÀË¬d¥ô¦ó§A©Ò»Ý¤§³]³ÆÀÉ (device special file) ¬O§_¤w©ñ¤J³o±i±Ï´©ºÏ¤ù¤¤¡CÁ|¨Ò¨Ó»¡¡A {\ttfamily \cdx{ftape}} ¨Ï¥ÎºÏ±a³]³Æ¡A¦pªG§A·Q­n±q bootdisk ¦s¨ú³n¦¡ºÏ±a¾÷¡A§A´N»Ý­n copy ©Ò¦³¦³Ãöªº³]³ÆÀÉ¡C

½Ðª`·N¡A¨C¤@­Ó³]³ÆÀÉ»Ý­n¤@­Ó inode ¡A¦ý \idx{inodes} ¤@ª½³£¬Oµ}¤Öªº¸ê·½¡A¯S§O¬O¦bºÏ¤ù filesystems ¤W¡C¦]¦¹¡A±qºÏ¤ù¤Wªº \url{/dev} ¥Ø¿ý²¾°£¥ô¦ó§A©Ò¤£»Ý­nªº³]³ÆÀÉ¬O¦³·N¸qªº¡CÁ|¨Ò¨Ó»¡¡A¦pªG§A¨S¦³ SCSI ºÏºÐ¡A§A¥i¥H©ñ¤ß¦a²¾°£©Ò¦³¥H {\ttfamily sd} ¶}ÀYªº³]³ÆÀÉ¡C¦P¼Ë¦a¡A¦pªG§A¨Ã¤£·Q¨Ï¥Î§Aªº§Ç¦C°ð (serial port) ¡A¨º»ò§A¤]¥i¥H²¾°£©Ò¦³¥H {\ttfamily cua} ¶}ÀYªº³]³ÆÀÉ¡C

{\itshape  ½Ð½T©w±q³o­Ó¥Ø¿ý©ñ¤J¤F¥H¤UÀÉ®×ªº¡G \/}
{\ttfamily console, kmem, mem, null, ram0 and tty1}.




\subsubsection{/etc}

\nidx{etc directory}

³o­Ó¥Ø¿ý¥]§t¤F­«­nªº²ÕºA³]©wÀÉ¡C¦b¤j³¡¤Àªº¨t²Î¤W¡A³o¨ÇÀÉ®×³Q¤À¬°¤T­Ó¸s²Õ¡G

\begin{enumerate}
\item  ¤@ª½³£¬O¥²³Æªº¡A {\itshape e.g.\/} {\ttfamily rc, fstab, passwd} ¡C
\ncdx{rc}\ncdx{fstab}\ncdx{passwd}
\item  ¥i¯à¬O¥²³Æªº¡A¦ý¬O¨S¦³¤H¯à¤Q¤À½T©w¡C
\item  °½¶]¶i¨Óªº©U³ø¡C
\end{enumerate}


³q±`¥i¥H¥Î¥H¤U«ü¥OÃÑ¥X­þ¨Ç¬O«D°ò¥»ªºÀÉ®×¡G

\begin{tscreen}
\begin{verbatim}
        ls -ltru
\end{verbatim}
\end{tscreen}


³o­Ó«ü¥O±NÀÉ®×¨Ì¾Ú¤W¦¸³Q¦s¨úªº¤é´Á¡A¥H¥ý¦­«á±ß (reverse) ªº¶¶§Ç¦C¥X¡A©Ò¥H¦pªG¦³¥ô¦óÀÉ®×¤£·|³Q¦s¨ú¡A¨º»ò¥¦­Ì´N¥i¥H±q root ºÏ¤ù¤¤§R¥h¡C

¦b§Úªº root ºÏ¤ù¤W¡A§Úªº²ÕºAÀÉ¼Æ¥Ø¤w´î¦Ü 15 ­Ó¡C³o¥i´î¤Ö§Ú³B²z¥H¤U¤TºØÀÉ®×ªº¤u§@¡G

\begin{enumerate}
\item  §Ú¥²¶·¬° boot/root ¨t²Î¶i¦æ²ÕºA³]©wªºÀÉ®×¡G

\begin{enumerate}
\item \url{rc.d/*} -- ¨t²Î±Ò°Ê»P§ïÅÜ run level ªº scripts
\item {\ttfamily \cdx{fstab}} -- ­n³Q±¾¤Wªº file systems ²M³æ
\item {\ttfamily \cdx{inittab}} -- µ¹ {\ttfamily init} process ªº°Ñ¼Æ¡A©ó¶}¾÷®É±Ò°Êªº²Ä¤@­Ó process ¡C \ncdx{init}
\end{enumerate}

\item  §Ú­ÌÀ³¸Ó¬° boot/root ¨t²Î¾ã²zªºÀÉ®×¡G
\begin{enumerate}
\item {\ttfamily \cdx{passwd}} -- ­«­nªº¨Ï¥ÎªÌ¡B home ¥Ø¿ýµ¥¨ä¥¦¶µ¥Øªº²M³æ¡C
\item \url{group} -- ¨Ï¥ÎªÌ¸s²Õ¡C \nidx{user groups}
\item \url{shadow} -- ¨Ï¥ÎªÌªº±K½X¡C§A¥i¯à¨S¦³³o­ÓÀÉ¡C \nidx{shadow passwords}
\item \url{termcap} -- the terminal capability database.
\end{enumerate}


¦pªG¨t²Î¦w¥þ (security) ¹ï§A«Ü­«­n¡A¨º»ò \url{passwd} »P \url{shadow} À³¸Ó³Q§R´î¡A¥HÁ×§K±N¨Ï¥ÎªÌ±K½X copy ¥X¨t²Î¡A³o¼Ë·í§A±qºÏ¤ù¶}¾÷®É¡A¤£·Q­nªº logins ·|³Q©Úµ´¡C \nidx{restoring files}

½Ð½T©w {\ttfamily \cdx{passwd}} ¦Ü¤Ö¥]§t¤F {\ttfamily root} ¡C¦pªG§A­nÅý¨ä¥Lªº¨Ï¥ÎªÌ login ¡A½Ð½T©w¥L­Ìªº home ¥Ø¿ý»P shells ³£¦s¦b¡C

\url{termcap} ¡A²×ºÝ¾÷¸ê®Æ®w¡A¤@¯ë¦Ó¨¥¦³´X¦Ê­Ó kilobytes ¡C§A boot/root ºÏ¤ùªºª©¥»À³¸Ó³Q§R´î¨ì¥u¥]§t§A©Ò¨Ï¥Îªº²×ºÝ¾÷¡A³o³q±`´N¬O {\ttfamily linux} ©Î {\ttfamily linux-console} ¶µ¥Ø (entry) ¡C
\item The rest.  They work at the moment, so I leave them alone.
\end{enumerate}


Out of this, §Ú¹ê»Ú¤W¥u¥²¶·³]©w¨â­ÓÀÉ¡A¦Ó¥¦­Ì©ÒÀ³¥]§tªº¶µ¥ØÅå¤H¦a¤Ö¡C
\begin{itemize}
\item \url{rc} À³¸Ó¥]§t¡G
\begin{verbatim}
        #!/bin/sh
        /bin/mount -av
        /bin/hostname Kangaroo
\end{verbatim}


½Ð½T©w¤W­zªº¥Ø¿ý³£¬O¥¿½Tªº¡C§A¨Ã¤£»Ý­n¯u¦a¥h°õ¦æ {\ttfamily \cdx{hostname}} -- ¦pªG§A°õ¦æ¥u¬OÅý¨t²Î¤ñ¸û¦n¬Ý (Ä¶µù¡G¦p¦¹¨t²Î·|¦³­Ó¦W¦r) ¡C
\item {\ttfamily \cdx{fstab}} À³¸Ó¦Ü¤Ö­n¥]§t¡G

\begin{verbatim}
        /dev/ram0       /               ext2    defaults
        /dev/fd0        /               ext2    defaults
        /proc           /proc           proc    defaults
\end{verbatim}


§A¥i¥H±q§A²{¦sªº \url{fstab} copy §A·Q­nªº¶µ¥Ø¡A¦ý¬O§A¨Ã¤£À³¸Ó¦Û°Ê¦a±¾¤W§AµwºÐ¥ô¦óªº partitions ¡F½Ð¹ï³o¨Ç¶µ¥Ø¨Ï¥Î {\ttfamily noauto} ÃöÁä¦r (Ä¶µù¡G¥Î noauto ¥N´À default ) ¡C·í¨Ï¥Î bootdisk ®É¡A§AªºµwºÐ¥i¯à¬O¦­¤w·lÃa©Î±¾¤F¡C
\end{itemize}


§Aªº {\ttfamily \cdx{inittab}} À³¸Ó³Q§ïÅÜ¡A¥H¨Ï¨ä¤¤ {\ttfamily sysinit} ³o¦æ¯à°õ¦æ \url{rc} ©ÎµL½×¤°»ò±N³Q°õ¦æªº°ò¥»¶}¾÷ script ¡C¦P®É¡A¦pªG§A·Q­n½T«O¤£¥i±q§Ç¦C°ð login ¡A½Ð¦b©Ò¦³¦æ§À¥]¬A \url{ttys} ©Î \url{ttyS} ªº \url{getty} ¶µ¥Ø«e¥[¤W¡u\#¡v²Å¸¹ (comment out) ¡C½Ð«O¯d \url{tty} °ð¥HÅý§A¥i¥H¦b console «e login ¡C

¤@­Ó³Ì°_½Xªº {\ttfamily \cdx{inittab}} ÀÉ¬Ý°_¨Ó¼Ë³o¼Ë¡G
\begin{verbatim}
        id:2:initdefault:
        si::sysinit:/etc/rc
        1:2345:respawn:/sbin/getty 9600 tty1
        2:23:respawn:/sbin/getty 9600 tty2
\end{verbatim}
 

{\ttfamily \cdx{inittab}} ÀÉ©w¸q¤F¨t²Î¦b¦UºØ¤£¦Pªº±¡ªp¤¤±N°õ¦æ¤°»ò¶µ¥Ø¡A¥]¬A startup ¡B¤Á´«¦Ü¦h¨Ï¥ÎªÌ¼Ò¦¡µ¥µ¥¡C½Ð¥J²Ó¦aÀË¬d¦b \url{inittab} ¤¤³Q´£¤ÎªºÀÉ®×¦WºÙ (filenames) ¡F¦pªG {\ttfamily init} ¤£¯à§ä¨ì©Ò´£¤Îªºµ{¦¡¡A¨º»ò bootdisk ±N·|°±¤î¹B§@¡A¦Ó§A¬Æ¦Ü¤£·|±o¨ì¿ù»~°T®§¡C

\nidx{hardcoded locations}

½Ðª`·N¡A¬Y¨Çµ{¦¡¤£¯à³Q²¾¨ì¨ä¥¦¦a¤è¡A¦]¬°¨ä¥¦µ{¦¡¤w¦b¼¶¼g®É¡A´N§â¥¦­ÌªºÀÉ®×¦ì¸m¼g¦º¤F (hardcode) ¡CÁ|¨Ò¨Ó»¡¦b§Úªº¨t²Î¤W¡A \url{/etc/shutdown} ¤w§â \url{/etc/reboot} ªº¦ì¸m¼g¦º¦b¨ä¤¤¡C¦pªG§Ú²¾°Ê¤F \url{reboot} ¨ì \url{/bin/reboot}¡AµM«á¤U¹F¤@­Ó {\ttfamily shutdown} «ü¥O¡A±N·|¦]¬°§ä¤£¨ì {\ttfamily reboot} ÀÉ¦Óµo¥Í¿ù»~¡C

\nidx{etc directory}

³Ñ¤U¨Óªº¡A´N¬O copy ¦b§A \url{/etc} ¥Ø¿ý¤¤ªº©Ò¦³¤å¦rÀÉ (text files) ¡A¦A¥[¤W¦b§A \url{/etc} ¥Ø¿ý¤¤¡A§AµLªk½T©w§A»Ý¤£»Ý­nªº©Ò¦³¥i°õ¦æÀÉ¡C»Ý­n«ü¥Ü (guide) ªÌ¡A½Ð°Ñ¦Ò¦b \ref{Listings} {(Sample roodisk directory listings)} ªº¼Ë¥»²M³æ¡C¤]³\¥u­n copy ³o¨ÇÀÉ®×´N¨¬°÷¤F¡A¦ý¬O¨t²Î®t²§·|¦³«Ü¤jªº¼vÅT¡A©Ò¥H§AµLªk½T©w§A¨t²Î¤W¬Û¦PªºÀÉ®×²Õ¦X¡A´N¤@©wµ¥©ó²M³æ¤¤ªºÀÉ®×¡C°ß¤@½T©wªº¤èªk´N¬O±q {\ttfamily inittab} µÛ¤â¡A¨Ã§ä¥X»Ý­n¤°»ò¡C

²{¦b¤j³¡¤Àªº¨t²Î¨Ï¥Î \url{/etc/rc.d/} ¥Ø¿ý¡A¨ä¤¤¥]§tµ¹¤£¦P run levels ªºshell scripts ¡C³Ì°_½X·|¦³¤@­Ó³æ¤@ªº \url{rc} script¡A¦ý¬O¶È±q§A²{¦sªº¨t²Î copy {\ttfamily \cdx{inittab}} »P \url{/etc/rc.d} ³o¨â­Ó¥Ø¿ý¡AµM«á§R´î \url{rc.d} ¥Ø¿ý¤¤ªº shell scripts ¥H²¾°£©MºÏ¤ù¨t²ÎÀô¹ÒµLÃöªº processing ¡A·|¬O¸û¬°Â²³æªº°µªk¡C




\subsubsection{/bin »P /sbin}

\nidx{bin directory}
\nidx{sbin directory}

\url{/bin} ¥Ø¿ý¬O¤@­Ó©ñ¸m¬°¤F°õ¦æ°ò¥»§@·~ (operations) ¦Ó©Ò»Ý¤§ÃB¥~¤u¨ãµ{¦¡ªº¤è«K¦n¦a¤è¡A³o¨Ç¤u¨ãµ{¦¡½Ñ¦p {\ttfamily ls}, {\ttfamily mv}, {\ttfamily cat} »P {\ttfamily dd} ¡C {\ttfamily }bin/ »P \url{/sbin} ³o¨â­Ó¥Ø¿ýªºÀÉ®×²M³æ½d¨Ò½Ð¨£ \ref{Listings} {(Sample rootdisk directory listings)} ¡C¦ý½d¨Ò¤¤¨Ã¨S¦³¥]¬A¥ô¦ó±q³Æ¥÷´_­ì®É©Ò»Ý¤§¤u¨ãµ{¦¡¡A½Ñ¦p {\ttfamily cpio}, {\ttfamily tar} »P {\ttfamily gzip} ¡C³o¬O¦]¬°§Ú§â³o¨ÇªF¦è©ñ¦b¥t¤@±i (separate) ¤u¨ãµ{¦¡ºÏ¤ù¤W¡A¥H¸`¬Ù boot/root ºÏ¤ùªºªÅ¶¡¡C¤@¥¹ boot/root ºÏ¤ù³Q¶}¾÷±Ò°Ê¡A´N·|³Q copy ¨ì ramdisk ¨ÃÄÀ©ñ³nºÐ¾÷¡AÅý³nºÐ¾÷¯à±¾¤W¥t¤@±iºÏ¤ù¡A´N¬O¤u¨ãµ{¦¡¤ù¡C§Ú³q±`§â¥¦±¾¤W·í°µ \url{/usr} ¡C

¤u¨ãµ{¦¡ºÏ¤ù (\idx{utility diskette}) ªº»s§@³Q´y­z¦b¤U­± \ref{UtilityDisk} {(Building a utility disk)} ³o¸`¡C«O¯d¤@¥÷¬Û¦Pª©¥»¤§³Æ¥÷¥Î¤u¨ãµ{¦¡ªºcopy¬O¤ñ¸û¦nªº¡A³o­Ó³Æ¥÷¥Î¤u¨ãµ{¦¡³Q¥Î¨Ó»s§@³Æ¥÷¡A¦p¦¹§A´N¤£¥Î®ö¶O®É¶¡¦b¹Á¸Õ¦w¸Ë¤£¯àÅª¨ú§A³Æ¥÷ºÏ±aªºª©¥»¡C

½Ð½T©w§A¥]¬A¤F¥H¤Uµ{¦¡¡G {\ttfamily init}, {\ttfamily getty} ©Î¬Ûµ¥ªºµ{¦¡, {\ttfamily login}, {\ttfamily mount}, ¬YºØ¥i¥H°õ¦æ§Arc scripts ªº shell, ¥H¤Î¤@­Ó±q {\ttfamily sh} «ü¦V³o­Ó shell ªº link ¡C

\ncdx{init}\ncdx{getty}\ncdx{login}\nidx{shells}




\subsubsection{/lib}

\nidx{library (lib) directory}
\nidx{libraries}

¦b \url{/lib} ¤¤¡A§A­n©ñ¤J¥²­nªº¦@¨É¨ç¦¡®w (libraries) »P¸ü¤Jµ{¦¡ (loaders) ¡C¦pªGµLªk¦b§Aªº \url{/lib} ¥Ø¿ý¤¤§ä¨ì¥²­nªº¨ç¦¡®w¡A¨º»ò¨t²Î±N¤£¯à°÷¶}¾÷¡C¦pªG§A«Ü©¯¹B¡A§A¥i¯à·|¬Ý¨ì§i¶D§A¬°¤°»ò·|µo¥Í¦p¦¹±¡ªpªº¿ù»~°T®§¡C

\ncdx{libc.so}
ªñ¨Ó¨C¤@­Óµ{¦¡¦Ü¤Ö³£­n¨D \url{libc} ¨ç¦¡®w¡A \url{libc.so.}{\itshape N\/} ¡A¨ä¤¤ {\itshape N\/} ¬O¥Ø«eª©¥»ªº½s¸¹¡C½ÐÀË¬d§Aªº \url{/lib} ¥Ø¿ý¡C \url{Libc.so.N} ³q±`¬O¤@­Ó symlink ¡A¥¦«ü¦V¤@­Ó¨ã¦³§¹¾ãª©¥»½s¸¹ªºÀÉ¦W¡G

\begin{tscreen}
\begin{verbatim}
% ls -l /lib/libc*
-rwxr-xr-x   1 root     root      4016683 Apr 16 18:48 libc-2.1.1.so*
lrwxrwxrwx   1 root     root           13 Apr 10 12:25 libc.so.6 -> libc-2.1.1.so*
\end{verbatim}
\end{tscreen}


¦b³o­Ó±¡ªp¤U¡A§A·|·Q­n \url{libc-2.1.1.so} ¡C¬°¤F§ä¨ì¨ä¥¦¨ç¦¡®w¡A§AÀ³¸Ó­n¬Ý¹L©Ò¦³§A¥´ºâ¥]¬Aªº¤G¶i¦ìÀÉ¡A¨Ã¥B¥Î {\ttfamily \cdx{ldd}} «ü¥OÀË¬d¥¦­Ìªº¬Û¨Ì©Ê¡CÁ|¨Ò¨Ó»¡¡G

\begin{verbatim}
        % ldd /sbin/mke2fs
        libext2fs.so.2 => /lib/libext2fs.so.2 (0x40014000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x40026000)
        libuuid.so.1 => /lib/libuuid.so.1 (0x40028000)
        libc.so.6 => /lib/libc.so.6 (0x4002c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
\end{verbatim}

¦b¥k¤âÃäªº¨C¤@­ÓÀÉ®×¬O¤@©w­n¦³ªº¡C¦³¨ÇÀÉ®×¥i¯à¬O¤@­Ó symbolic link ¡C

½Ðª`·N¬Y¨Ç¨ç¦¡®w {\itshape  ¬Û·í¦a¤j \/}¡A¦Ó¥B¨Ã¤£¯à»´©ö¦a°t¦X§Aªº root filesystem ¡CÁ|¨Ò¨Ó»¡¡A¤W­zªº \url{libc.so} ¤j¬ù¦³ 4 megabytes ¡C¦]¦¹¡A¦b§A copy ¥¦­Ì¨ì§A root filesystem ªº¦P®É¡A§A¥i¯à»Ý­n°£¥h¤@¨Ç¨ç¦¡®w¡C½Ð¬Ý \ref{Slimfast} {(Reducing root filesystem size)} ³o¤@¸`¥H¤F¸Ñ instructions ¡C

\nidx{loaders}

¦b \url{/lib} ¤º¡A§A¤]¥²¶·¥]¬A¤@­Ó loader ¨Ñ³o¨Ç¨ç¦¡®w¨Ï¥Î¡C³o­Ó loader ¤£¬O \url{ld.so} (µ¹ A.OUT ¨ç¦¡®w¨Ï¥Î)¡A´N¬O \url{ld-linux.so} (µ¹ ELF ¨ç¦¡®w¨Ï¥Î)¡C¸û·sª©ªº {\ttfamily ldd} ·|¦p¦P¤W­zªº¨Ò¤l¡A¥¿½T¦a§i¶D§A»Ý­n­þ¤@ºØ loader ¡AµM¦ÓÂÂª©ªº´N¤£·|¡C¦pªG§A¨Ã¤£½T©w§A»Ý­n­þ¤@ºØ loader ¡A´N¹ï¨ç¦¡®w°õ¦æ {\ttfamily file} «ü¥O¡CÁ|¨Ò¨Ó»¡¡G
\begin{verbatim}
% file /lib/libc.so.4.7.2 /lib/libc.so.5.4.33 /lib/libc-2.1.1.so
/lib/libc.so.4.7.2: Linux/i386 demand-paged executable (QMAGIC), stripped
/lib/libc.so.5.4.33: ELF 32-bit LSB shared object, Intel 80386, version 1, stripped
/lib/libc-2.1.1.so: ELF 32-bit LSB shared object, Intel 80386, version 1, not stripped
\end{verbatim}

{\ttfamily QMAGIC} «ü¥X {\ttfamily 4.7.2} ª©¬Oµ¹ A.OUT ¨ç¦¡®w¨Ï¥Î¡A¦Ó {\ttfamily ELF} «ü¥X {\ttfamily 5.4.33} ¥H¤Î {\ttfamily 2.1.1} ª©¬Oµ¹ ELF ¨Ï¥Î¡C \nidx{ELF}

½Ð copy §A©Ò»Ý­nªº«ü©w loader(s) ¨ì§A©Ò«Ø¥ßªº root filesystem ¡C°w¹ï©Ò¥]¬Aªº¤G¶i¦ìÀÉ¡A¨ç¦¡®w»P loaders À³¸Ó³Q {\itshape  ¥J²Ó¦aÀË¬d \/} ¡C¦pªG kernel ¤£¯à¸ü¤J©Ò»Ýªº¨ç¦¡®w¡A¨º»ò kernel ´N·|¦b¨S¦³¿ù»~°T®§ªº±¡ªp¤U°±¤î¹B§@¡C




\subsection{¹ï PAM »P NSS ªº´£¨Ñ -- Providing for PAM and NSS}

\label{PAMandNSS}

§Aªº¨t²Î¥i¯à·|»Ý­n°ÊºA¦a¸ü¤J¥¼³Q \url{ldd} ©Ò¨£ªº¨ç¦¡®w¡C¦pªG§A¨S¦³´£¨Ñ¨ç¦¡®wµ¹³o¨Ç¶µ¥Ø¡A¨º»ò§A·|¦bµn¿ý (log in) ©Î¨Ï¥Î§Aªº bootdisk ®É¾D¹J¨ì§xÃø¡C




\subsubsection{PAM (Pluggable Authentication Modules)}



¦pªG§Aªº¨t²Î¨Ï¥Î PAM (Pluggable Authentication Modules) ¡A¨º»ò§A¥²¶·¦b§Aªº bootdisk¤W¬° PAM °µ¤@¨Ç¹w³Æ¡CÂ²¦Ó¨¥¤§¡A PAM ¬O¤@ºØ½ÆÂøºë±Kªº¼Ò²Õ¤Æ¤èªk¡A°w¹ï¨Ï¥ÎªÌ»{ÃÒ¥H¤Î±±¨î¨Ï¥ÎªÌ¹ïªA°Èªº¦s¨ú¡C¤@­Ó¨M©w§Aªº¨t²Î¬O§_¨Ï¥Î PAM ªºÂ²³æ¤èªk¡A¬O¹ï§Aªº \url{login} ¥i°õ¦æÀÉ°õ¦æ \url{ldd} ¡F¦pªG¿é¥X¥]¬A \url{libpam.so} ¡A§A´N»Ý­n PAM ¡C

©¯¹B¦a¡A¦w¥þ©Ê³q±`¨Ã«D bootdisk ©ÒÃö¤ßªºÄ³ÃD¡A¦]¬°¥ô¦ó¹ï¾÷¾¹¦³¹ê»Ú¦s¨úÅvªº¤H¡A³q±`¯à°µ¥ô¦ó¥L­ÌµL½×¦p¦ó·Q°µªº¨Æ¡C¦]¦¹¡A§A¥i¥H¦³®Ä¦aÃö³¬ PAM ¡A¥u­n¦b§Aªº root filesystem ³y¥X¤@­ÓÂ²³æªº \url{/etc/pam.conf} ÀÉ¡A³o­ÓÀÉ¬Ý°_¨Ó¹³³o¼Ë¡G

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
OTHER   auth       optional     /lib/security/pam_permit.so
OTHER   account    optional     /lib/security/pam_permit.so
OTHER   password   optional     /lib/security/pam_permit.so
OTHER   session    optional     /lib/security/pam_permit.so
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


½Ð°O±o¤] copy \url{/lib/security/pam\_permit.so} ³o­ÓÀÉ¨ì§Aªº root filesystem ¡C³o­Ó¨ç¦¡®w¥u¦³¤j¬ù 8K ¡A¦]¦¹¥¦¥u¦û¥Î·¥¤p¶qªº overhead ¡C

½Ð°O±o³o­Ó²ÕºA³]©w¤¹³\¥ô¦ó¤H¹ï³o¥x¾÷¾¹¤WªºÀÉ®×¥H¤ÎªA°È¦³§¹¾ãªº¦s¨úÅv¡C¦pªG§A¦]¬YºØ²z¥Ñ¦Ó¦b¥G§A bootdisk ªº¦w¥þ©Ê¡A¨º»ò§A´N¥²¶· copy ¤@¨Ç©Î¬O¥þ³¡§AµwºÐªº PAM setup ¨ì§Aªº root filesystem ¡C½Ð½T©w´¿¥J²Ó¦aÅª¹L PAM ¤å¥ó¡A¨Ã¥B copy ¥ô¦ó¦b \url{/lib/security} ¤¤©Ò»Ý­nªº¨ç¦¡®w¨ì§Aªº root filesystem ¤W¡C

§A¦P®É¥²¶·¥]§t \url{/lib/libpam.so} ¨ì§Aªº bootdisk ¤W¡C¦ý¬O§A¤wª¾³o¥ó¨Æ¡A¦]¬°§A¤w¹ï \url{/bin/login} °õ¦æ¹L ldd ¡A³o°Ê§@Åã¥Ü¤F¨ä¬Û¨Ì©Ê¡C




\subsubsection{NSS (Name Service Switch)}



¦pªG§A¥¿¨Ï¥Î glibc (aka libc6) ¡A§A´N¥²¶·¬°¦WºÙªA°È (name switch) ¶i¦æ¹w³Æ¡A§_«h§A·|µLªk log in ¡C \url{/etc/nsswitch.conf} ³o­ÓÀÉ®×±±¨î¸ê®Æ®w¹ï¦U¦¡ªA°È¤§·j´M (lookups) ¡C¦pªG§A¨Ã¤£¥´ºâ±qºô¸ô¤W¦s¨úªA°È (¤ñ¦p»¡¡G DNS©Î NIS ·j´M)¡A¨º»ò§A¥u»Ý­n·Ç³Æ¤@­ÓÂ²³æªº \url{nsswitch.conf} ÀÉ¡A³o­ÓÀÉ®×¬Ý°_¨Ó¹³³o¼Ë¡G

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
     passwd:     files
     shadow:     files
     group:      files
     hosts:      files
     services:   files
     networks:   files
     protocols:  files
     rpc:        files
     ethers:     files
     netmasks:   files
     bootparams: files
     automount:  files
     aliases:    files
     netgroup:   files
     publickey:  files
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


³o¼Ë´N«ü©w¨C¤@¶µªA°È¥u³Q local files ´£¨Ñ¡C§A¦P®É»Ý­n¥]¬A \url{/lib/libnss\_files.so.}{\itshape X\/} ¡A¦b¦¹ {\itshape X\/} ¬O 1 ªº¸Ü¬O«ü glibc 2.0 ¡A¦Ó 2 ªº¸Ü¬O«ü glibc 2.1 ¡C³o­Ó¨ç¦¡®w±N³Q¥H°ÊºA¤è¦¡¸ü¤J¥H³B²zÀÉ®×·j´M¡C

¦pªG§A¥´ºâ±q§Aªº bootdisk ¦s¨úºô¸ô¡A¨º»ò§A·|·Q­n»s§@¤@­Ó§óºë¥©½ÆÂøªº \url{nsswitch.conf} ÀÉ¡C²Ó¸`½Ð°Ñ¦Ò \url{nsswitch} man page¡C³Ì«á¡A½Ð°O±o§A¥²¶·¬°§A©Ò«ü©wªº¨C¤@¶µ {\itshape ªA°È (service)\/} ¡A§â \url{/lib/libnss\_}{\itshape service\/}\url{.so.1} ÀÉ©ñ¤J bootdisk ¤¤¡C




\subsection{¼Ò²Õ -- Modules}

\nidx{modules}

¦pªG§A¦³¤@­Ó¼Ò²Õ¤Æªº kernel ¡A§A¥²¶·¦Ò¶q¦b¶}¾÷«á¡A§A·Q­n±q§Aªº bootdisk ¤W¸ü¤J­þ¤@ºØ¼Ò²Õ¡C§A¥i¯à·|·Q­n¥]¬A {\ttfamily ftape} »P {\ttfamily zftape} ¼Ò²Õ (¦pªG§Aªº³Æ¥÷ºÏ±a¬Ofloppy tape)¡A¥H¤Îµ¹ SCSI ³]³Æ¥Îªº¼Ò²Õ (¦pªG§A¦³ SCSI ³]³Æ)¡A¤]¥i¯à¬O PPP ©Î SLIP ¤ä´©ªº¼Ò²Õ (¦pªG§A¦bºò«æ±¡ªp¤U·Q­n¦s¨úºô¸ô)¡C

³o¨Ç¼Ò²Õ¥i¯à·|³Q©ñ¦b \url{/lib/modules} ¡C§A¦P®É¤]À³¸Ó¥]¬A {\ttfamily insmod}, {\ttfamily rmmod} »P {\ttfamily lsmod} ¡C®Ú¾Ú§A¬O§_·Q­n¦Û°Ê¦a¸ü¤J¼Ò²Õ¡A§A¥i¯à¤]­n¥]¬A {\ttfamily modprobe}, {\ttfamily depmod} »P {\ttfamily swapout} ¡C¦pªG§A¨Ï¥Î {\ttfamily kerneld}¡A½Ð»P \url{/etc/conf.modules} ¤@°_¥]¬A¶i¨Ó¡C

µM¦Ó¡A¨Ï¥Î¼Ò²Õªº¥D­nÀuÂI¦b©ó§A¥i¥H§â«DÃöÁä (non-critical)¼Ò²Õ²¾¨ì utility disk ¤W¡A¦b»Ý­n¥Î¨ì®É¤~¸ü¤J¡A³o¼Ë¦b§Aªº root disk ¤W·|¨Ï¥Î¤ñ¸û¤ÖªºªÅ¶¡¡C¦pªG§A­n³B²z³\¦h¤£¦Pªº³]³Æ¡A³o­Ó¤èªk¤ñ«Ø¥ß¤@­Ó¤º«Ø¤ä´©³\¦h³]³Æªº¥¨¤j kernel ¨Ó±o¦n¡C

½Ðª`·N¡A¬°¤F±Ò°Ê (boot) ¤@­ÓÀ£ÁYªº ext2 filesystem ¡A§A¥²¶·¦³ ramdisk »P¤º«Ø ext2 ¤ä´©¡C {\itshape  ¥¦­Ì¤£¯à°÷¥H¼Ò²Õªº¤è¦¡³Q´£¨Ñ¡C \/}




\subsection{¤@¨Ç³Ì«áªº²Ó¸` -- Some final details}



¬Y¨Ç¨t²Îµ{¦¡¡A½Ñ¦p {\ttfamily login} ¡A·í \url{/var/run/utmp} ÀÉ»P \url{/var/log} ¥Ø¿ý¤£¦s¦b®É¡A·|µo¥XÄµ§i¡C©Ò¥H¡G

\begin{verbatim}
        mkdir -p /mnt/var/{log,run{
        touch /mnt/var/run/utmp
\end{verbatim}


³Ì«á¡A¦b§A³]©w (set up) §¹©Ò¦³§A©Ò»Ýªº¨ç¦¡®w«á¡A°õ¦æ {\ttfamily ldconfig} ¥H¦b root filesystem¤W­«·s»s§@ (remake) \url{/etc/ld.so.cache} ¡C³o­Ó cache ·|§i¶D loader ¨ì­þ¸Ì§ä¨ì¨ç¦¡®w¡C­n­«·s»s§@ \url{ld.so.cache}¡A½Ð¤U¹F¥H¤U«ü¥O¡G
\begin{verbatim}
        chdir /mnt; chroot /mnt /sbin/ldconfig
\end{verbatim}


\ncdx{ldconfig}
\ncdx{ld.so.cache}

{\ttfamily chroot} ¬O¥²­nªº¡A¦]¬° {\ttfamily ldconfig} Á`¬O·|¬° root filesystem ­«·s»s§@ cache ¡C




\subsection{Wrapping it up}

\label{WrappingItUp}

¤@¥¹§A§¹¦¨ root filesystem ªº«Øºc¤u§@¡A´N unmount ¥¦¡A±N¤§ copy ¦¨¤@­ÓÀÉ®×¨ÃÀ£ÁY¥¦¡G
\begin{verbatim}
        umount /mnt
        dd if=DEVICE bs=1k | gzip -v9 > rootfs.gz
\end{verbatim}


µ²§ô«á¡A§A·|¦³¤@­Ó¦W¬° \url{rootfs.gz} ªºÀÉ®×¡A³o´N¬O§A³QÀ£ÁY¹Lªº root filesystem¡C§AÀ³¸ÓÀË¬d¥¦ªº size ¥H½T«O¥¦¯à©ñ¦b¤@±i³nºÐ¤ù¤W¡F¦pªG¤£¦æ¡A§A´N¥²¶·¦^·¹¨Ã²¾°£¤@¨ÇÀÉ®×¡C \ref{Slimfast} {(Reducing root filesystem size)} ³o¸`¦³¤@¨Ç´£¥Ü¡A§i¶D§A¦³Ãö´î¤Ö root filesystem ªº size ¡C




\section{¿ï¾Ü¤@­Ó kernel -- Choosing a kernel}

\nidx{kernel, choosing}

²{¦b¡A§A¤w¦³¤@­Ó§¹¾ãªº³QÀ£ÁY¹Lªºroot filesystem¡C¤U¤@¨B¬O­n«Ø¥ß©Î¬O¿ï¾Ü¤@­Ó kernel ¡C¦b¤j³¡¤Àªº±¡ªp¤U¡A copy §A¥Ø«e©Ò¨Ï¥Îªº kernel ¨Ã¥B±q¥¦±Ò°Ê³nºÐ¤ù¬O¥i¯àªº¡CµM¦Ó¡A·|¦³¤@¨Ç±¡ªp¡A§A·|§Æ±æ«Ø¥ß¤@­Ó¿W¥ßªº (separate) kernel ¡C

²z¥Ñ¤§¤@¬O size ªº¦Ò¶q¡C¦pªG§A¥¿«Ø¥ß¤@±i³æ¤@ªº boot/root ºÏ¤ù¡A kernel ±N·|¬OºÏ¤ù¤W³Ì¤jªºÀÉ®×¤§¤@¡A¤]¦]¦¹§A¥²¶·ºÉ¥i¯à¦a´î¤Ö kernel ªº size ¡C¬°¤F´î¤Ö kernel size ¡A½Ð¥Î¯à¤ä´©©Ò·Q­nªº¨t²Î¤§¥²­n³Ì°_½Xªº³]³Æ¨Ó«Ø¥ß kernel ¡C³o¬O«ü¥á¥h§A©Ò¤£·Q­nªº¨C¤@¶µ¡Cºô¸ô¥\¯à¬O¥i¥H¥á¥hªº¦n¿ï¾Ü¡A¥t¥~ÁÙ¦³·í¹B§@§Aªº boot/root filesystem ®É¡A¥ô¦ó§A©Ò¤£»Ý­nªººÏºÐ¾÷»P¨ä¥¦³]³Æªº¤ä´©¡C¦p¦P«e­z¡A§Aªº kernel ¥²¶·¦³ ramdisk »P ext2 ¤ä´©¤º«Ø©ó¨ä¤¤¡C

¦pªG§A¤w§¹¦¨¤@®M³Ì°_½Xªº (minimum) ³]³Æ²Õ¦X¥H«K©ó±N¤§©ñ¤J kernel ¤¤¡A¨º»ò±µ¤U¨Ó§A»Ý­n¶}©l¶i¦æ­n§â¤°»ò¥[¤J¦^¨Ó¡C©Î³\¤@®M boot/root ºÏ¤ù²Õ¤§³Ì±`¨£¥Î³~¡A¬O¬°¤F­n¯àÀË¬d»P¦^´_ (restore) ¤@­Ó¤w·l·´ªº root file system ¡A¦Ó¬°¤F¹F¦¨³o­Ó¥Ø¼Ð¡A§A»Ý­n kernel ªº¤ä´©¡CÁ|¨Ò¨Ó»¡¡A¦pªG§Aªº³Æ¥÷³£©ñ¦bºÏ±a¤W¡A¨Ã¨Ï¥Î Ftape ¦s¨ú§AªººÏ±a¾÷¡A¨º»ò¡A¦pªG§A¥¢¥h¤F§A¥Ø«eªºroot drive»P§t¦³ Ftape ªº drive ¡A§A±N¤£¯à°÷±q§Aªº³Æ¥÷ºÏ±a¶i¦æ¦^´_Àx¦s¡C§A±N¥²¶·­«·s¦w¸Ë Linux ¡A¤U¸ü¨Ã­«¸Ë \cdx{ftape} ¡AµM«á¸ÕµÛÅª¨ú§Aªº³Æ¥÷¡C

¦¹³Bªº­nÂI¬O¡AµL½×§A¤w¥[¤J¤°»ò I/O ¤ä´©¨ì§Aªº kernel ¤º¥H¤ä´©³Æ¥÷¡A§A¦P®É¤]À³¸Ó§â¥¦­Ì¥[¤J¨ì§Aªº boot/root kernel ¤¤¡C

\nidx{kernel, building from source}

¹ê»Ú«Ø³y kernel ªºµ{§Ç¸Ô­z¦bÀHªþ©ó kernel ªº¤å¥ó¤¤¡C§A¥i¥H»´©ö¦a·ÓµÛ«ü¥Ü¶i¦æ¡A©Ò¥H¥i¥H \url{/usr/src/linux} ¬°°_ÂI¡C¦pªG§A¦b«Ø³y kernel ¤W¦³§xÃø¡A§A©Î³\¤£À³¸Ó¥ø¹Ï¤£¾Ü¤â¬q¦a«Ø³y boot/root systems ¡C½Ð°O±o¥Î ``{\ttfamily make zImage}''À£ÁY kernel ¡C




\section{§â¥¦­Ì©ñ¦b¤@°_¡G»s§@ºÏ¤ù(²Õ) -- Putting them together: Making the diskette(s)}



¶i¦æ¨ì³o¸Ì¡A§A¤w¸g¦³¤@­Ó kernel »P¤@­ÓÀ£ÁYªº root filesystem ¡C¦pªG§A¥¿¦b»s§@¤@±i boot/root ºÏ¤ù¡A½ÐÀË¬d¥¦­Ìªº size ¡A¥H½T©w¥¦­Ì³£¯à©ñ¦b¦P¤@±iºÏ¤ù¤W¡C¦pªG§A¥¿¦b»s§@¤@®M¨â±iºÏ¤ùªº boot + root ºÏ¤ù²Õ¡C½ÐÀË¬d root filesystem ¥H½T©w¥¦¯à©ñ¦b¤@±iºÏ¤ù¤W¡C

§AÀ³¸Ó¨M©w¬O§_¨Ï¥Î LILO ¥H±Ò°Ê bootdiskªº kernel ¡C´À¥Nªº¤èªk¬Oª½±µ§â kernel copy ¨ìºÏ¤ù¤W¡AµM«á¤£¨Ï¥Î LILO ¶}¾÷¡C¨Ï¥Î LILO ªº¦n³B¦b©óÅý§A¯à°÷´£¨Ñ¤@¨Ç°Ñ¼Æµ¹ kernel ¡A³o¨Ç°Ñ¼Æ¹ïªì©l¤ÆµwÅé¨Ó»¡¥i¯à¬O¥²­nªº(½ÐÀË¬d§A¨t²Î¤Wªº \url{/etc/lilo.conf} ÀÉ¡C¦pªG³o­ÓÀÉ¦s¦b¡A¦Ó¥B¦³¤@¦æ¹³``{\ttfamily append=...}''¡A§A¥i¯à»Ý­n³o­Ó¯SÂI (feature))¡C¨Ï¥Î LILO ªº¯ÊÂI¦b©ó«Ø³y bootdisk ÅÜ±o§ó¬°½ÆÂø¡A¨Ã¥B¦û¥Îµy¶û¸û¦hªºªÅ¶¡¡C§A±N¥²¶·³]©w¤@­Ó¤p«¬¦Ó¿W¥ßªº filesystem ¡A§Ú­ÌºÙ¤§¬° {\itshape kernel filesystem\/}¡A¦b¨ä¤¤§A¶Ç°e kernel ¥H¤Î¤@¨Ç LILO ©Ò»Ýªº¨ä¥¦ÀÉ®×¡C

\ncdx{lilo filesystem}\nidx{lilo.conf}\nidx{kernel , parameters}

¦pªG§A±N­n¨Ï¥Î LILO ¡A½ÐÄ~ÄòÅª¤U¥h¡F¦pªG§A­nª½±µ¶Ç°e kernel ¡A¥ý¸õ¹L¦¹¡Aª½±µ¨ì \ref{TransferringWithoutLILO} {(Without using LILO)} ³o¤@¸`¡C




\subsection{¥Î LILO ¶Ç°e kernel -- Transferring the kernel with LILO}

\label{TransferringWithLILO}

§A©Ò¥²¶·°µªº²Ä¤@¥ó¨Æ¬O¬° LILO ½s¼g¤@­Ó¤p«¬ªº²ÕºAÀÉ¡C³o­ÓÀÉ¬Ý°_¨Ó¹³³o¼Ë¡G
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
        boot      =/dev/fd0
        install   =/boot/boot.b
        map       =/boot/map
        read-write
        backup    =/dev/null
        compact
        image     =KERNEL
        label     =Bootdisk
        root      =/dev/fd0
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Ãö©ó³o¨Ç°Ñ¼Æªº»¡©ú½Ð¬Ý LILO's user documentation ¡C§A©Î³\¤]·|·Q±q§AµwºÐ¤Wªº \url{/etc/lilo.conf} ÀÉ¡A¥[¤J¤@¦æ {\ttfamily append=...} ¨ì³o­Ó²ÕºAÀÉ¤¤¡C

§â³o­Ó²ÕºAÀÉ¦s¦¨ \url{bdlilo.conf} ¡C

²{¦b§A¥²¶·»s§@¤@­Ó¤p«¬ªºÀÉ®×¨t²Î¡A§Ú­ÌºÙ¤§¬° {\itshape kernel filesystem\/} ¡A¦³§O©ó root filesystem ¡C

­º¥ý¡A«ü¥X³o­Ó filesystem À³¸Ó·|¦³¦h¤j¡C¥Î blocks ­pºâ§A kernel ªº size (³o­Ó size ¥Î ``{\ttfamily ls -l KERNEL}'' Åã¥Ü¥X¨Ó¡A¬O³Q 1024 ©Ò°£¨Ã±j­¢¶i¦ì)¡AµM«á¥[ 50 ¡C³o­Ó 50 blocks ¬O¦ô­pªºªÅ¶¡¡A¬° inodes »P¨ä¥¦ÀÉ®×©Ò»Ý¡C¦pªG§A·Q­n¡A§A¥i¥Hºë½T¦a­pºâ³o­Ó¼Æ¦r¡A©Î¬O´N¥Î 50 ´N¦n¤F¡C¦pªG§A¥¿¦b»s§@¨â±iºÏ¤ùªººÏ¤ù²Õ¡A§A·|°ª¦ô³o­ÓªÅ¶¡¡A¦]¬°µL½×¦p¦ó²Ä¤@±iºÏ¤ù¥uµ¹ kernel ¨Ï¥Î¡C§Ú­ÌºÙ³o­Ó¼Æ¦r·| {\ttfamily KERNEL\_BLOCKS} ¡C

½Ð§â³nºÐ¤ù©ñ¤J³nºÐ¾÷ (¬°¨DÂ²«K¡A§Ú­Ì°²³]¬O \url{/dev/fd0})¡AµM«á¦b¨ä¤W»s§@ ext2 kernel filesystem ¡C
\begin{verbatim}
        mke2fs -i 8192 -m 0 /dev/fd0 KERNEL_BLOCKS
\end{verbatim}


\nidx{inodes, allocation}
``{\ttfamily -i 8192}'' «ü©w§Ú­Ì·Q­n¨C 8192 bytes ¤@­Ó node ¡C±µ¤U¨Ó¡A mount ³o­Ó filesystem ¡A²¾°£ \url{lost+found} ¥Ø¿ý¡AµM«á¬° LILO ³y¥X \url{dev} »P \url{boot} ³o¨â­Ó¥Ø¿ý¡G
\begin{verbatim}
        mount /dev/fd0 /mnt
        rm -rf /mnt/lost+found
        mkdir /mnt/{boot,dev}
\end{verbatim}


¦A¨Ó¡A³y¥X³]³ÆÀÉ \url{/dev/null} »P \url{/dev/fd0} ¡C¤£¥Î´M§ä³]³Æ¸¹½X¡A§A¥u­n±q§AªºµwºÐ¤W¥Î {\ttfamily -R} copy¥¦­Ì¡G
\begin{verbatim}
        cp -R /dev/{null,fd0} /mnt/dev
\end{verbatim}
 
LILO »Ý­n¤@¥÷¥¦ªº boot loader ªº copy ¡A \url{boot.b} ¡A§A¥i¥H±q§AªºµwºÐ±o¨ì¥¦¡C¥¦³q±`¬O©ñ¦b \url{/boot} ¥Ø¿ý¤º¡C
\begin{verbatim}
        cp /boot/boot.b /mnt/boot
\end{verbatim}

³Ì«á¡AÀHªþ§Aªº kernel ¡A copy §A¦b¤W¤@¸`©Ò½s¼gªº LILO ²ÕºAÀÉ¡C¥¦­Ì¨âªÌ¥i¥H³Q©ñ¦b®Ú¥Ø¿ý¤U¡C
\begin{verbatim}
        cp bdlilo.conf KERNEL /mnt
\end{verbatim}

LILO ©Ò»Ýªº¨C¤@¶µ²{¦b³£¦b kernel filesystem¤W¡A©Ò¥H§A¤w·Ç³Æ¦n¥h°õ¦æ¥¦¡C LILO ªº {\ttfamily -r} ºX¸¹(flag)³Q¥Î§@¦w¸Ë boot loader ¦b¬Y­Ó¨ä¥¦ªº root ¤W¡G
\begin{verbatim}
        lilo -v -C bdlilo.conf -r /mnt
\end{verbatim}


LILO À³¸Ó¥i¥H¦bµL¿ùªº±¡ªp¤U°õ¦æ¡A¦b¦¹¤§«á¡A§A¥i¥H¬Ý¬Ý§Aªº kernel filesystem ¡AÀ³¸Óªø±o¹³³o¼Ë¡G
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
total 361
  1 -rw-r--r--   1 root     root          176 Jan 10 07:22 bdlilo.conf
  1 drwxr-xr-x   2 root     root         1024 Jan 10 07:23 boot/
  1 drwxr-xr-x   2 root     root         1024 Jan 10 07:22 dev/
358 -rw-r--r--   1 root     root       362707 Jan 10 07:23 vmlinuz
boot:
total 8
  4 -rw-r--r--   1 root     root         3708 Jan 10 07:22 boot.b
  4 -rw-------   1 root     root         3584 Jan 10 07:23 map
dev:
total 0
  0 brw-r-----   1 root     root       2,   0 Jan 10 07:22 fd0
  0 crw-r--r--   1 root     root       1,   3 Jan 10 07:22 null           
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


\nidx{kernel filesystem}

¦pªGÀÉ®× size ©M§A¦Û¤vªº filesystem ¦³µy·L¤£¦P¡A½Ð¤£¥Î¾á¤ß¡C

²{¦b½Ð§âºÏ¤ù¯d¦b³nºÐ¾÷¤º¡AµM«á«e¶i¨ì \ref{SettingRamdiskWord} {(Setting the ramdisk word)} ³o¤@¸`¡C




\subsection{¤£¨Ï¥Î LILO ¨Ó¶Ç°e kernel -- Transferring the kernel without LILO}

\label{TransferringWithoutLILO}

¦pªG§A {\itshape  ¤£ \/} ¨Ï¥ÎLILO¡A¨º»ò´N¥Î {\ttfamily dd} «ü¥O¨Ó¶Ç°e kernel µ¹ bootdisk ¡G
\begin{verbatim}
        % dd if=KERNEL of=/dev/fd0 bs=1k
        353+1 records in
        353+1 records out
\end{verbatim}


¦b³o­Ó¨Ò¤l¤¤¡A {\ttfamily dd} ¼g¤J¤F 353 ­Ó§¹¾ã°O¿ý(records) + 1­Ópartial record ¡A©Ò¥H kernel ¦û¥Î¤F 354 ­Ó³nºÐ¤ùªº blocks ¡C³o­Ó¼Æ¦rºÙ¬° {\ttfamily KERNEL\_BLOCKS} ¡A½Ð°O±o¥¦¡A³o­Ó¼Æ¦r­nµ¹¤U¤@¸`¨Ï¥Î¡C

³Ì«á¡A½Ð³]©w root device ¬°³nºÐ¤ù¦Û¤v¡AµM«á¦A³]©w root ­n³Q¸ü¤J¦¨ read/write ¡G
\begin{verbatim}
        rdev /dev/fd0 /dev/fd0
        rdev -R /dev/fd0 0
\end{verbatim}


\ncdx{rdev}

¦b²Ä¤G­Ó {\ttfamily rdev} «ü¥O¤¤¡A½Ð¤p¤ß¦a¨Ï¥Î {\ttfamily -R} ¡C




\subsection{³]©wramdisk -- Setting the ramdisk word}

\label{SettingRamdiskWord}

¦b kernel image¤ºªº¬O {\itshape ramdisk word\/} ¡A¥¦¦ñÀH¨ä¥¦¿ï¶µ¡A«ü©w¤F root filesystem À³¸Ó¦b­þ¸Ì³Q§ä¨ì¡C³o­Ó word ·|³Q¥H {\ttfamily rdev} «ü¥O¡A¨Ó¶i¦æ¦s¨ú»P³]©w¡A¦Ó¥¦ªº¤º®e³Q¸ÑÄÀ¦p¤U¡G

\begin{verbatim}
        bits  0-10:     Offset to start of ramdisk, in 1024 byte blocks
        bits 11-13:     unused
        bit     14:     Flag indicating that ramdisk is to be loaded
        bit     15:     Flag indicating to prompt before loading rootfs
\end{verbatim}


¦pªG bit 15 ³Q³]©w¡A¦b¶}¾÷®É (boot-up) ¡A·|´£¥Ü§A§â¤@±i·sªº³nºÐ¤ù©ñ¤J³nºÐ¾÷¤¤¡C³o¹ï¤@®MÂùºÏ¤ùªº¶}¾÷ºÏ¤ù²Õ¨Ó»¡¬O¥²­nªº¡C

¨Ì¾Ú§A¬O«Ø³y¤@±i³æ¤@ªº boot/root ºÏ¤ù¡AÁÙ¬O¨â±i "boot + root" ªººÏ¤ù²Õ¡A³o¸Ì·|²£¥Í¨âºØ±¡ªp¡C

\begin{enumerate}
\item  ¦pªG§A¬O«Ø³y¤@±i³æ¤@ºÏ¤ù¡AÀ£ÁYªº root filesystem ·|³Q©ñ¸m¦b kernel ¤§«á¡A©Ò¥H offset ·|¬O²Ä¤@¶ô free block (³o­Ó­ÈÀ³¸Ó·|»P {\ttfamily KERNEL\_BLOCKS} ¬Ûµ¥) ¡C Bit 14 ·|³Q³]©w¬° 1 ¡A¦Ó bit 15 ·|³Q³]©w¬° 0 ¡C

Á|¨Ò¨Ó»¡¡A°²³]§A¥¿«Ø³y¤@±i³æ¤@ºÏ¤ù¡A¦Ó root filesystem ±N¦Û block 253 (10¶i¦ì)¶}©l¡C¨º»ò¡A ramdisk word ­ÈÀ³¸Ó¬O 253 (10¶i¦ì) ¡A bit 14 ³]¬° 1 ¦Ó bit 15 ³]¬° 0 ¡C­n­pºâ³o­Ó­È¡A§A¥i¥HÂ²³æ¦a¥[¤@¥[³o­Ó 10 ¶i¦ì¼Æ¦r¡C 253 + (2\^{}14) = 253 + 16384 = 16637 ¡C¦pªG§A¨Ã¤£¤Q¤À¤F¸Ñ³o­Ó¼Æ¦r±q¦ó¦Ó¨Ó¡A§â³o¼Æ¦r©ñ¨ì¤uµ{­pºâ¾÷¤W¡AµM«á§â¥¦Âà´«¬° 2 ¶i¦ì¡A
\item  ¦pªG§A«Ø³yªº¬O¤@®MÂùºÏ¤ù²Õ¡A¨º»ò root filesystem ±N¦Û²Ä¤G±iºÏ¤ùªº block 0 ¶}©l¡A©Ò¥H offset ¬° 0 ¡C Bit 14 ³]¬° 1 ¦Ó bit 15 ³]¬° 1 ¡C¦b³o­Ó±¡ªp¤U¡A 10 ¶i¦ì­È¬O 2\^{}14 + 2\^{}15 = 49152 ¡C
\end{enumerate}


\nidx{ramdisk word}\ncdx{rdev}

¦b¥J²Ó¦a¬° ramdisk word ­pºâ«á¡A½Ð¥Î {\ttfamily rdev -r} ³]©w¥¦¡C½Ðª`·N­n¨Ï¥Î {\itshape 10 ¶i¦ì \/} ­È¡C¦pªG§A¨Ï¥Î LILO ¡A¶Çµ¹ {\ttfamily rdev} ªº¤Þ¼Æ¦b¦¹À³¸Ó¬O {\itshape mounted kernel path\/} ¡A¤ñ¦p»¡ \url{/mnt/vmlinuz}¡F¦pªG§A¥Î {\ttfamily dd} ¨Ó copy kernel ¡A´À´«¦¨¨Ï¥Î³nºÐ¾÷¦WºÙ({\itshape  ¤ñ¦p»¡ \/}\url{/dev/fd0})¡C
\begin{verbatim}
        rdev -r KERNEL_OR_FLOPPY_DRIVE  VALUE
\end{verbatim}


¦pªG§A¨Ï¥Î LILO ¡A²{¦b½Ð§âºÏ¤ù unmount ¡C




\subsection{¶Ç°eroot filesystem -- Transferring the root filesystem}



³Ì«á¤@¨B¬O­n¶Ç°e root filesystem ¡C

\begin{itemize}
\item  ¦pªG root filesystem ±N³Q©ñ¸m¦b°µ¬° kernel ¤§ {\itshape  ¬Û¦P \/} ºÏ¤ù¤W¡A½Ð¨Ï¥Î {\ttfamily dd} «ü¥O¤Î¨ä {\ttfamily seek} ¿ï¶µ¶Ç°e¥¦¡A³o·|«ü©w­n¸õ¹L¦h¤Ö­Ó blocks ¡G
\begin{verbatim}
        dd if=rootfs.gz of=/dev/fd0 bs=1k seek=KERNEL_BLOCKS
\end{verbatim}

\item  ¦pªG root filesystem ·|³Q©ñ¸m¦b {\itshape  ²Ä¤G±i \/} ºÏ¤ù¤W¡A½Ð¦ÛºÏºÐ¾÷¤¤®³¨«²Ä¤@±i³nºÐ¤ùµM«á©ñ¤J²Ä¤G±iºÏºÐ¤ù¡A±µµÛ±N root filesystem ¶Ç°e¨ì¨ä¤W¡G
\begin{verbatim}
        dd if=rootfs.gz of=/dev/fd0 bs=1k
\end{verbatim}
\end{itemize}


®¥³ß§A¡A¤w¸g§¹¦¨¤F¡I

¦b§â bootdisk ®¿¬°ºò«æ¨Ï¥Î¤§«e¡A½Ð°O±o¥ý´ú¸Õ¥¦ !¦pªG§Aªº¦¨«~¤£¯à°õ¦æ¡A½ÐÄ~ÄòÅª¤U¥h¡C




\section{°ÝÃD¸Ñ¨M -- Troubleshooting, or The Agony of Defeat}

\label{Troubleshooting}
\nidx{Troubleshooting}

·í«Ø³y bootdisks ®É¡A¶}©lªº´X¦¸¹Á¸Õµ²ªG±`±`¬OµLªk¶}¾÷¡C«Ø³y¤@±i root disk ªº¤@¯ë¤èªk¬O²Õ¦X¨Ó¦Û§A²{¦³¨t²Îªº¤¸¥ó (compnents) ¡A±µµÛ¹Á¸Õ»P±o¨ì³o­Ó¥HºÏ¤ù¬°°òÂ¦ªº¨t²Î (diskette-based system) ¡Aª½¨ì¥¦¦b console ¤WÅã¥Ü°T®§¡C¤@¥¹¥¦¶}©l»P§A¥æ½Í¡A³o³õ¾Ô°«´Nµ²§ô¤@¥b¤F¡A¦]¬°§A¥i¥H¤F¸Ñ¥¦¦b©ê«è¤°»ò¡A¦Ó¥B§A¥i¥H¸Ñ¨M­Ó§Oªº°ÝÃDª½¦Ü¨t²Î¯à¥­¶¶¦a¹B§@¡C¦pªG¨t²Î°±¤î¹B§@¦Ó¨S¦³¥ô¦ó»¡©ú¡A­n§ä¨ì³o­ì¦]·|¬O¤@¥ó§xÃøªº¨Æ¡C¬°¤FÅý¨t²Î¯à±Ò°Ê¨ì¯à»P§A¥æ½Íªº¶¥¬q¡A³o»Ý­n¨Ï¥Î¨ì¦n´XºØ¤¸¥ó¡A¦Ó¥B³o¨Ç¤¸¥ó­n¸g¹L¥¿½T¦a²ÕºA¡C¥H¤U¬O½Õ¬d¨t²ÎµLªk»P§A¥æ½Í¤§°ÝÃDªº«ØÄ³µ{§Ç¡G

\begin{itemize}
\item  §A·|¬Ý¨ì¤@¦æ°T®§¹³³o¼Ë¡G
\begin{verbatim}
kernel panic: VFS: Unable to mount root fs on XX:YY
\end{verbatim}

³o¬O±`¨£ªº°ÝÃD¡A¦Ó¥¦¥u¦³¤@¨Ç­ì¦]¡C­º¥ý¡A½Ð®Ú¾Ú device code ²M³æÀË¬d device {\itshape XX:YY\/} ¡F¥¦¬O¥¿½Tªº root device ¶Ü ?¦pªG¤£¬O¡A¨º§A¥i¯à¨S¦³°µ¹L {\ttfamily rdev -R} ¡A©ÎªÌ¬O§A¬O¹ï¿ù»~ªº image °õ¦ærdev -R¡C¦pªG device code ¬O¥¿½Tªº¡A¨º»ò½Ð¥J²Ó¦aÀË¬d³Q½sÄ¶¨ì§A kernel ¤ºªº device ÅX°Êµ{¦¡¡C½Ð½T©w¥¦¦³¤º«Ø³nºÐ¤ù¡B ext2 filesystem ¤ä´©¡C
\item  ¦pªG§A¬Ý¨ì³\¦h¿ù»~°T®§¹³¬O¡G
\begin{verbatim}
end_request: I/O error, dev 01:00 (ramdisk), sector NNN
\end{verbatim}

³o¬O ramdisk driver ©Ò³ø§iªº I/O ¿ù»~°T®§¡A¥i¯à¬O¦]¬° kernel ¥¿¹Á¸Õ¼g¤J¶W¶V¤F³]³Æªºµ²§À¡C§Aªº ramdisk ¦]¬°¤Ó¤p¦Ó¤£¯à«ù¦³§Aªº root filesystem ¡C½ÐÀË¬d§Aªº bootdisk kernel ªºªì©l¤Æ°T®§¡A§ä¤@¦æ¹³¬O¡G
\begin{verbatim}
        Ramdisk driver initialized : 16 ramdisks of 4096K size
\end{verbatim}

½Ð°w¹ï root filesystem{\itshape  ¥¼¸gÀ£ÁYªº \/}sizeÀË¬d¤W­zªº size ¡C¦pªG ramdisks ¤£°÷¤j¡A¨º´NÅý¥¦§ó¤j§a¡C
\item  ½ÐÀË¬d root disk ¹ê»Ú¤W¦³¥]§t§A©Ò»{¬°À³¸Ó³Q¥]§tªº¥Ø¿ý¡C Copy ¨ì¿ù»~ªº level ¬O®e©ö¥Çªº¿ù»~¡A¥H­P©ó¨ì³Ì«á¦b§Aªº root ºÏºÐ¤ù¤W¡A§A·|¦³¹³¬O \url{/rootdisk/bin} ªº¥Ø¿ý¡A¦Ó«D \url{/bin}¡C
\item  ½ÐÀË¬d¬O§_¦³ \url{/lib/libc.so} ¡A¦Ó¥¦¬O§_¦³»P§AµwºÐ¤º \url{/lib} ¥Ø¿ý¤¤©ÒÅã¥Ü¤§¬Û¦P link ¡C
\item  ½ÐÀË¬d§A¬J¦s¨t²Î \url{/dev} ¥Ø¿ý¤ºªº symbolic links ¬O§_¦P®É¤]¦s¦b©ó§Aªº root ºÏºÐ¤ù filesystem ¤W¡A¦b¦¹¡A¨º¨Ç links ¬O³s©¹§A¤w¥]¬A¦b§A root ºÏºÐ¤ù¤Wªº devices ¡C¤×¨ä¬O¦b«Ü¦h±¡ªp¤U¡A \url{/dev/console} links¬O³Ì°ò¥»ªº¡C
\nidx{device (dev) directory}
\item  ½ÐÀË¬d§A¬O§_¤w¥]¬A¤F \url{/dev/tty1, /dev/null, /dev/zero,
/dev/mem, /dev/ram} »P \url{/dev/kmem} ³o¨ÇÀÉ®×¡C
\item  ½ÐÀË¬d§Aªº kernel ²ÕºA³]©w - ¹ï©óª½¨ìµn¿ýÂI (login point) ©Ò»Ý¤§©Ò¦³¸ê·½ªº¤ä´©¥²¶·³Q¤º«Ø¡A¤£¯à¨Ï¥Î¼Ò²Õ¡C©Ò¥H {\itshape ramdisk »P ext2 ¤ä´©¥²¶·³Q¤º«Ø \/} ¡C
\item  ½ÐÀË¬d§Aªº kernel root device »P ramdisk ³]©w¬O§_¥¿½T¡C
\end{itemize}


¥H¤W¤w¸g²[»\¤@¯ë³¡¤À¡A¥H¤U¬O¤@¨Ç§ó¯S©wªºÀÉ®×»PÀË¬d¶µ¥Ø¡G

\begin{enumerate}
\item  ½Ð½T©w {\ttfamily init} ¬O¥H \url{/sbin/init} ©Î \url{/bin/init} ªº§Î¦¡³Q¥]¬A¶i¨Ó¡C¨Ã¥B½T»{¥¦¬O¥i°õ¦æªº¡C
\item  ½Ð°õ¦æ {\ttfamily ldd init} ¥HÀË¬d init ªº¨ç¦¡®w¡C³q±`³o­Ó´N¬O \url{libc.so} ¡A¦ý¬O½ÐµL½×¦p¦óÁÙ¬OÀË¬d¤@¤U¡C½Ð½T©w§A¤w©ñ¤J¤F¥²³Æªº¨ç¦¡®w»P loaders¡C
\item  ½Ð½T©w§A§â¥¿½Tªº loader µ¹§Aªº¨ç¦¡®w -- \url{ld.so} ¬Oµ¹ a.out ¦Ó \url{ld-linux.so} ¬Oµ¹ ELF ¡C \nidx{loaders}
\item  ½Ð°w¹ï {\ttfamily getty} (©Î¬YºØÃþ¦ü {\ttfamily getty} ªºµ{¦¡¡A½Ñ¦p {\ttfamily agetty}, {\ttfamily mgetty} ©Î {\ttfamily getty\_ps})ªº©I¥s¡AÀË¬d§Abootdisk filesystem¤Wªº \url{/etc/inittab}¡C½Ð°w¹ï§AµwºÐªº \url{inittab} ÀË¬d¨â¦¸¡C¦AÀË¬d§A©Ò¨Ï¥Îªºµ{¦¡ªº man pages ¥H½T©w³o¨Ç¬O¦³·N¸qªº¡C \url{inittab} ¥i¯à¬O³Ì¸Þ²§ªº³¡¤À¡A¦]¬°¥¦ªº»yªk»P¤º®e¡A¨Ì¾Ú©Ò¨Ï¥Îªº init µ{¦¡»P¨t²Î¥»½è¦Ó¦³©Ò¤£¦P¡C¸Ñ¨Mªº°ß¤@¤§¹D´N¬O¥h¾\Åª {\ttfamily init} »P {\ttfamily inittab} ªºman pages¡AµM«á¦A¥¿½T¦a°µ¥X¬J¦s¨t²Î¶}¾÷®É©Ò°µªº¨Æ¡C½ÐÀË¬d¥H½T©w \url{/etc/inittab} ¦³¤@­Ó¨t²Îªì©l¤Æªº°O¿ý (entry) ¡C¥¦À³¸Ó¥]¬A¤@­Ó«ü¥O¥H°õ¦æ¥²©w¦s¦bªº¨t²Îªì©l¤Æ script ¡C
\item  ¦p¦P {\ttfamily init} ¡A¹ï§Aªº {\ttfamily getty} °õ¦æ {\ttfamily ldd} ¥H¤F¸Ñ¥¦»Ý­n¤°»ò¡A¦P®É½T©w¥²³Æªº¨ç¦¡®wÀÉ®×»P loaders ¬O§_³Q©ñ¤J§Aªº root filesystem ¡C
\item  ½Ð½T»{§A¤w©ñ¤J¤@­Ó shell µ{¦¡ (e.g., {\ttfamily bash} or {\ttfamily ash})¡A¥¦¯à°÷°õ¦æ§A©Ò¦³ªº rc scripts ¡C\nidx{shells}
\item  ¦pªG¦b§Aªº±Ï´©ºÏ¤ù¤W¡A¦³¤@­Ó \url{/etc/ld.so.cache} ªºÀÉ®×¡A½Ð­«·s»s§@ (remake) ¥¦¡C
\end{enumerate}


¦pªG {\ttfamily init} ±Ò°Ê¡A¦ý¬O§A«o±o¨ì¤@¦æ°T®§¹³¬O¡G
\begin{verbatim}
        Id xxx respawning too fast: disabled for 5 minutes  
\end{verbatim}

¥¦¬O¨Ó¦Û©ó {\ttfamily init} ¡A³q±`«ü¥X {\ttfamily getty} ©Î {\ttfamily login} ³Q²×µ²¥u­n init ±Ò°Ê¡C½ÐÀË¬d {\ttfamily getty} »P {\ttfamily login} ªº¥i°õ¦æÀÉ»P¬Û¨Ìªº¨ç¦¡®w¡C½Ð½T©w¦b \url{/etc/inittab} ¤ºªº©I¥s (invocations) ¬O¥¿½Tªº¡C¦pªG§A±o¨ì¨Ó¦Û {\ttfamily getty} ªº©_©Ç°T®§¡A¥¦¥i¯à¬O«ü \url{/etc/inittab} ¤ºªº©I¥s®æ¦¡¬O¿ù»~ªº¡C

¦pªG§A±o¨ì¤@­Ó login ´£¥Ü (prompt) ¡AµM«á§A¿é¤J¤@­Ó¦³®Äªº login name ¡A¦ý¬O¨t²Î«o¥ß§Y´£¥Ü§A­n¿é¤J¥t¤@­Ó login name ¡A¨º»ò³o­Ó°ÝÃD¥i¯à¬O¥X¦b PAM ©Î NSS ¡C½Ð¬Ý \ref{PAMandNSS} {(PAM and NSS)} ³o¤@¸`¡C°ÝÃD¤]¥i¯à¬O§A¨Ï¥Î shadow passwords ¦Ó§A«o¨S¦³ copy \url{/etc/shadow} ¨ì§Aªº bootdisk ¤W¡C

¦pªG§A¹Á¸Õ¥h°õ¦æ¬Y­Ó¥i°õ¦æÀÉ¡A½Ñ¦p {\ttfamily df} ¡A¦Ó³o­Ó°õ¦æÀÉ¬O¦b§Aªº±Ï´©ºÏ¤ù¤W¡A°õ¦æ®É«o¥X²{¹³³o¼Ëªº°T®§¡G {\ttfamily df: not found} ¡A³o®É½ÐÀË¬d¨â¥ó¨Æ¡G(1)½Ð½T©w¥]§t¤G¶i¦ìÀÉªº¥Ø¿ý¦³³]©w¦b§Aªº PATH ¡A(2)½Ð½T©w§A¦³µ{¦¡©Ò»Ýªº¨ç¦¡®w (»P loaders)¡C




\section{¨ä¥¦¦UºØ¥DÃD -- Miscellaneous topics}






\subsection{´î¤Ö root filesystem ªº size -- Reducing root filesystem size}

\label{Slimfast}

¦³®É root filesystem ·|¦]¤Ó¤j¦ÓµLªk¶ë¤J¤@±i³nºÐ¤ù¤º¡A¬Æ¦Ü¦bÀ£ÁY¹L«áÁÙ¬O³o¼Ë¡C³o¸Ì¦³¤@¨Ç¤èªk¥i´î¤Ö filesystem ªº size ¡G

\begin{enumerate}
\item {\itshape  ¼W¥[ºÏºÐ¤ù±K«× (density)\/} ¡C
¨Ì·Ó¹w³]¡A³nºÐ¤ù·|¥H 1440 K ¨Ó¶i¦æ®æ¦¡¤Æ¡A¦ý¬O²{¦b¤]¦³§ó°ª±K«×ªº®æ¦¡¡C \url{fdformat}·|¬°¥H¤U sizes ªººÏ¤ù¶i¦æ®æ¦¡¤Æ¡G 1600, 1680, 1722, 1743, 1760, 1840, ¥H¤Î 1920 ¡C¤j³¡¤Àªº 1440 K ³nºÐ¾÷¥i¤ä´© 1722 K ¡A§Ú¤@ª½³£¬O¨Ï¥Î³o­Ó¨Ó»s§@ bootdisks ¡C½Ð°Ñ¦Ò {\ttfamily fdformat} man page»P \url{/usr/src/linux/Documentation/devices.txt} ¡C
\item  {\itshape  ´À´«§Aªº shell\/} ¡C
¤@¨Ç¦b Linux ¤W¼s¨üÅwªïªº shells ¡A½Ñ¦p {\ttfamily bash} »P {\ttfamily tcsh} ¡A¬O¬Û·í¤j¥B»Ý­n³\¦h¨ç¦¡®w¡C Light-weight ªº¿ï¾Ü©ó¬O¦s¦b¡A½Ñ¦p {\ttfamily ash}, {\ttfamily lsh}, {\ttfamily kiss} »P {\ttfamily smash}¡A¥¦­Ì¤p«Ü¦h¦Ó¥B¥u»Ý­n«Ü¤Ö (©Î¬O¤£»Ý­n)¨ç¦¡®w¡C¤j³¡¤À³o¨Ç¥Î¨Ó¥N´Àªº shells ¥i¥H¦b \nameurl{http://metalab.unc.edu/pub/Linux/system/shells/}{} §ä±o¨ì¡C½Ð½T©w§A©Ò¨Ï¥Îªº¥ô¦ó shell ¡A¯à°÷°õ¦æ§A©ñ¦b§A bootdisk ¤ºªº©Ò¦³ \url{rc} ÀÉ®×¤¤ªº«ü¥O¡C
\nidx{shells}
\item {\itshape  §R¥h¨ç¦¡®w»P¤G¶i¦ìÀÉ \/}¡C
«Ü¦h¨ç¦¡®w»P¤G¶i¦ìÀÉ¤@¯ë¦Ó¨¥¬O¥¼³Q§R¥hªº (¥]¬Adebugging symbols)¡C¦pªG¦p¦¹¡A¹ï³o¨ÇÀÉ®×°õ¦æ {\ttfamily file} ·|§i¶D§A ``{\ttfamily not stripped}'' ¡C
\nidx{libraries}
·í copy ¤G¶i¦ìÀÉ¨ì§Aªº root filesystem ®É¡A³o¬O¤@­Ó¦n½m²ß¥h¨Ï¥Î¡G
\begin{verbatim}
      objcopy --strip-all FROM TO
\end{verbatim}


\nidx{libraries, stripping}\ncdx{strip}\ncdx{objcopy}

·í copy ¨ç¦¡®w®É¡A½Ð½T©w¨Ï¥Îªº¬O {\ttfamily strip-debug} ¦Ó¤£¬O {\ttfamily strip-all} ¡C
\item  ¦pªG§A¦b»s§@ root filesystem ®É¡A§R°£©Î²¾°Ê¹L¦hÀÉ®×¡A½Ð¦A­«·s»s§@¤@¦¸¡C½Ð¬Ý¤W­zÃö©ó¤£­n¦b filesystem ¤º¦³ dirty blocks ¤§­«­n©Êªºª`·N¨Æ¶µ¡C
\item  {\itshape  ²¾°Ê«DÃöÁäÀÉ®×¨ì¤u¨ãºÏ¤ù (utility disk) ¤W \/} ¡C
¦pªG§Aªº¤@¨Ç¤G¶i¦ìÀÉ¹ï boot ©Î login ¨Ó»¡¨Ã«D¥ß§Y»Ý­n¡A¨º»ò§A´N¥i¥H§â¥¦­Ì²¾¨ì¤u¨ãºÏ¤ù¤W¡C²Ó¸`½Ð¬Ý \ref{UtilityDisk} {(Building a utility disk)} ³o¤@¸`¡C§A¦P¼Ë¥i¦Ò¼{§â modules ²¾¨ì¤u¨ãºÏ¤ù¤W¡C
\nidx{utility diskette}
\end{enumerate}





\subsection{Non-ramdisk root filesystems}

\label{NonRamdiskRoot}
\nidx{ramdisk}

\ref{BuildRoot} {(Building a root filesystem)} ³o¤@¸`´¿µ¹¤©«ü¥Ü¥H«Ø³y¤@­ÓÀ£ÁYªº root filesystem ¡A¥¦·|¦b¨t²Î¶}¾÷®É³Q¸ü¤J¨ì ramdisk ¡C³o­Ó¤èªk¦³³\¦hÀuÂI¡A©Ò¥H³q±`³£±Ä¥Î¦¹ªk¡CµM¦Ó¡A¤@¨Ç¥u¦³¤@ÂIÂI°O¾ÐÅéªº¨t²ÎµLªk­t¾á¦¹ªk©Ò»Ýªº RAM ¡A¦]¦¹¡A³o¨Ç¨t²Î¥²¶·¨Ï¥Îª½±µ±q³nºÐ¤ù±¾¤Wªº root filesystems ¡C

³o¼Ëªº filesystems ¹ê»Ú¤W¤ñÀ£ÁYªº root filesystems §ó®e©ö«Ø³y¡A¦]¬°¥¦­Ì¥i¥H³Q³y¦b¤@±iºÏ¤ù¤W¡A¦Ó«D¬Y­Ó¨ä¥¦ªº³]³Æ¤W¡A¥t¥~¡A¥¦­Ì¤]¤£¥²³QÀ£ÁY¡C·í²§©ó«e­zªº«ü¥Ü®É¡A§Ú­Ì±N±Ô­z¸Óµ{§Çªº­nÂI¡C¦pªG§A¿ï¾Ü³o¼Ë°µ¡A½Ð°O±o§A¥iÀò±oªº³Ñ¾l {\itshape  ªÅ¶¡·|ÅÜ¤Ö \/} ¡C

\begin{enumerate}
\item  ½Ð­pºâ§A±N¦³¦h¤ÖªÅ¶¡¥i¨Ñ root files ¨Ï¥Î¡C

¦pªG§A«Ø³yªº¬O¤@±i³æ¤@ªº boot/root ºÏ¤ù¡A§A¥²¶·Åý©Ò¦³µ¹ kernel ªº blocks ¥H¤Î©Ò¦³µ¹ root filesystem ªº blocks ³£¯à®e¯Ç©ó¦P¤@±iºÏ¤ù¤W¡C
\item  ¨Ï¥Î {\ttfamily mke2fs} ¡A¦b¾A·í size ªº³nºÐ¤ù¤W³y¥X¤@­Ó root filesystem ¡C
\item  ¦p¦P«e­zªº¤èªk´Þ¤J©ó¦¹ filesystem ¡C
\item  §¹¦¨«á¡A unmount ¦¹ filesystem ¨Ã¥B¶Ç°e¥¦¨Ï¤§¦¨¬°¤@­ÓºÏ¤ùÀÉ®×¡A¦ý¬O {\itshape  ¤£­nÀ£ÁY¥¦ \/} ¡C
\item  ¥H«e­z¤§¤èªk¡A§â kernel ¶Ç°e¨ì¤@±i³nºÐ¤ù¤W¡C·í­pºâ ramdisk word ®É¡A {\itshape  §â bit 14 ³]¦¨ 0\/} ¡A¥H«ü¥Ü¤£­n§â root filesystem ¸ü¤J¨ì ramdisk ¡C½Ð¥H«e­z¤§¤èªk°õ¦æ {\ttfamily rdev} «ü¥O¡C \nidx{ramdisk word}\ncdx{rdev}
\item  ¦p¦P¥H©¹¡A¶Ç°e¦¹ root filesystem ¡C
\end{enumerate}


¦³¦n´XºØ±¶®|§A¥i±Ä¥Î¡C¦pªG§A«Ø³yªº¬O¤@®MÂùºÏ¤ù²Õ¡A§A¥i¥Hª½±µ§â§¹¾ãªº root filesystem«Ø³y¦b²Ä¤G±iºÏ¤ù¤W¡A¦Ó¥B§A¨Ã¤£»Ý­n§â¥¦¶Ç°e¦¨¤@­ÓµwºÐÀÉ®×µM«á¦A¦s¦^ºÏ¤ù¤W¡C¦P¼Ë¦a¡A¦pªG§A«Ø³yªº¬O¤@±i³æ¤@ªº boot/root ºÏ¤ù¦Ó¥B¨Ï¥Î LILO ¡A§A¥i¥H¦b¾ã±iºÏ¤ù¤W«Ø¥ß {\itshape  ³æ¤@ªº \/}filesystem¡A¥]§t kernel ¡B LILO files »P root files ¡AµM«á¥u­n°õ¦æ LILO °µ¬°³Ì«á¤@¨B¡C




\subsection{«Ø³y¤@±i¤u¨ãºÏ¤ù -- Building a utility disk}

\label{UtilityDisk}
\nidx{utility diskette}

«Ø³y¤@±i¤u¨ãºÏ¤ù¬Û¹ï¨Ó»¡Â²³æ¦h¤F -- ¥u­n¦b¤@±i¤w®æ¦¡¤ÆªººÏ¤ù¤W³y¥X¤@­Ó filesystem ¡AµM«á copy ÀÉ®×©ó¨ä¤W§Y¥i¡C¬°¤F¸ò bootdisk ¤@°_¨Ï¥Î¥¦¡A½Ð¦b¨t²Î±Ò°Ê¥H«á¡A¥Î¤â°Êªº¤è¦¡ mount ¥¦¡C

¦b«e­±ªº«ü¥Ü¤¤¡A§Ú­Ì´¿´£¤Î utility disk ¥i¥H³Q mount °µ¬° \url{/usr} ¡C¦b³o­Ó±¡ªp¤U¡A¤G¶i¦ìÀÉ¥i¥H³Q©ñ¦b§A utility disk ¤§ \url{/bin} ¥Ø¿ý¤º¡A¥H«K©ó±N \url{/usr/bin} ³]¤J§Aªº path ¤¤¥i¥H¦s¨ú¥¦­Ì¡C¤G¶i¦ìÀÉ©Ò»Ý¤§¨ä¥¦¨ç¦¡®w³Q©ñ¦b utility disk ¤§ \url{/lib} ¥Ø¿ý¤º¡C

·í³]­p utilitu disk ®É¡A¦³´X­Ó­«ÂI­n°O¦í¡G

\begin{enumerate}
\item  ¤£­n§âÃöÁäªº¨t²Î¤G¶i¦ìÀÉ©Î¨ç¦¡®w©ñ¨ì utility disk ¤W¡A¦]¬°ª½¨ì¨t²Î¶¶§Q±Ò°Ê¤§«e¡A utility disk ¤£·|³Q±¾¤W¡A¨ä¤WªºÀÉ®×¤]µLªk¨Ñ¨t²Î¨Ï¥Î¡C
\item  §A¤£¯à¦P®É¦s¨ú¤@±i³nºÐ¤ù»P¤@¥xºÏ±a¾÷¡C·N«ü¦pªG§A¦³¤@¥xºÏ±a¾÷¡A¨º»ò·í§A¥¿¦b¨Ï¥Î (mount) utility disk ®É¡A§A±N¤£¯à¦s¨ú¨º¥xºÏ±a¾÷¡C
\item  ¦s¨ú utility disk ¤WªºÀÉ®×·|«ÜºC¡C
\end{enumerate}


\ref{utilitylist} {(Sample utility disk directory listing)} ´£¨Ñ¤Futility diskªºÀÉ®×¤§¼Ë¥»¡C¥H¤U¬O¤@¨Ç«ØÄ³Ãö©ó¤@¨Ç§A·|µo²{¦³¥ÎªºÀÉ®×¡GÀË¬d»P¾Þ§@ºÏ¤ù({\ttfamily format, fdisk})¡B filesystems ({\ttfamily mke2fs, fsck, debugfs, isofs.o})ªºµ{¦¡¡A¤p«¬ªº¤å®Ñ½s¿è¾¹ ({\ttfamily elvis, jove})¡AÀ£ÁY»PÀÉ®×¤u¨ã ({\ttfamily gzip, tar, cpio, afio}), ºÏ±a¤u¨ã ({\ttfamily mt, tob, taper})¡A³q°T¤u¨ã ({\ttfamily ppp.o, slip.o, minicom})»Pµ¹³]³Æ¨Ï¥Îªº¤u¨ã ({\ttfamily setserial, mknod})¡C




\section{How the pros do it}

\label{Pros}

±z¥i¯à¤w¸gª`·N¨ì¡A¨º¨Ç³Q½Ñ¦p Slackware¡BRedHat¡BDebian µ¥¥D­n distribution ©Ò¨Ï¥Îªº bootdisks ¡A¦ü¥G¤ñ¥»¤å¤¤©Ò´y­zªºÁÙ­n¨Ó±o½ÆÂø³\¦h¡C±M·~ªº distribution bootdisks ¥H¦b¦¹©Ò´£¥Xªº¬Û¦P­ì«h¬°°òÂ¦¡A¦ý¬O±Ä¥Î¦U¦¡¦U¼Ëªº§Þ¥©¡A¦]¬°¥¦­Ìªº bootdisks ¦³¤@¨ÇÃB¥~ªº»Ý¨D¡C²Ä¤@¡A¥¦­Ì¥²¶·¯à°÷¦b¦UºØ¤£¦PªºµwÅé¤W¹B§@¡A©Ò¥H¥¦­Ì¥²¶·¯à°÷»P¨Ï¥ÎªÌ¤¬°Ê¡A¨Ã¥B¯à¸ü¤J¦U¦¡¦U¼Ëªº³]³ÆÅX°Êµ{¦¡¡C²Ä¤G¡A¥¦­Ì¥²¶··Ç³Æ¥H³\¦h¤£¦Pªº¦w¸Ë¿ï¶µ¡B¤£¦Pªº¦Û°Ê¤Æµ{«×¨Ó¹B§@¡C³Ì«á¡A distribution bootdisks ³q±`µ²¦X¤F¦w¸ËºÏ¤ù»P±Ï´©ºÏ¤ùªº¯à¤O¡C

\nidx{initial ramdisk (initrd)}

¬Y¨Ç bootdisks ¨Ï¥Î¦W¬° {\itshape initrd\/}({\itshape initial ramdisk\/})ªº¯S©Ê¡C³o­Ó¯S©Ê¤j¬ù¦b 2.0.x ª©®É¤Þ¤J¡A¥¦¤¹³\ kernel ¥H¨â¶¥¬q¶}¾÷¡C·í kernel ¶}¾÷®É¡A¥¦±q boot disk ¸ü¤J¤@­Óinitial ramdisk¬M¹³ÀÉ¡C³o­Ó initial ramdisk ¬O¤@­Ó root filesystem ¡A¥]§t¤@­Ó¦b¯u¥¿ªº root fs ³Q¸ü¤J¤§«e©Ò°õ¦æªºµ{¦¡¡C³o­Óµ{¦¡³q±`·|ÀË¬d§@·~Àô¹Ò¡A ¥H¤Î/©Î ­n¨D¨Ï¥ÎªÌ¿ï¾Ü¤£¦Pªº¶}¾÷¿ï¶µ¡A¨Ò¦p¿ï¾Ü±q­þ¤@­Ó³]³Æ¸ü¤J¯u¥¿ªº rootdisk ¡C¤@¯ë¨Ó»¡¡A¥¦·|¸ü¤J¥¼³Q¤º«Ø¦b kernel ¤ºªºÃB¥~¼Ò²Õ¡C·í³o­Óªì©l¤Æ (initial) µ{¦¡µ²§ô (exit) ®É¡A kernel ´N¸ü¤J¯u¥¿ªº root ¬M¹³ÀÉ¡A¶}¾÷°Ê§@±N¨Ì¤@¯ë±¡ªpÄ~Äò°õ¦æ¤U¥h¡C­Y­n¶i¤@¨B±oª¾ {\ttfamily initrd} ªº¸ê°T¡A½Ð¸Ô¾\§A¾÷¾¹¤Wªº \nameurl{file:/usr/src/linux/Documentation/initrd.txt}{/usr/src/linux/Documentation/initrd.txt} ¡A¥H¤Î \nameurl{ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz}{} ¡C

¥H¤U¬O¨C¤@®a distributionªº¦w¸ËºÏ¤ù¦p¦ó¹B§@ªººK­n¡A³o¥÷ºK­n¥HÀË¾\ (inspect) ¥¦­Ìªºfilesystems ¥H¤Î/©Î ¥¦­Ìªº­ì©l½X¬°°òÂ¦¡C§Ú­Ì¤£«OÃÒ³o¥÷¸ê°T§¹¥þ¥¿½TµL»~¡A©Î¬O¦Û±qª©¥»noted¥H¨Ó¡A³o¨Ç¹B§@¤è¦¡¥¼³Q§ïÅÜ¡C

Slackware(v.3.1) ¨Ï¥Î¤@ºØ»P \ref{TransferringWithLILO} {(Transferring the kernel with LILO)} ³o¸`©Ò´y­zÃþ¦üªº«e¦V¦¡ (straightforward) LILO ¶}¾÷ªk¡C Slackware ªº bookdisk §Q¥Î LILO ªº {\ttfamily  °T®§ } °Ñ¼Æ¦L¥X¤@­Ó bootup °T®§ ({``}{\ttfamily Welcome to the Slackware Linux boot kernel disk!}{''}) ¡C°²¦p¥²­nªº¸Ü¡A³o¸Ì·|«ü¥Ü¨Ï¥ÎªÌ¿é¤J¤@­Ó¶}¾÷°Ñ¼Æ¦æ(boot parameter line)¡C¦b¶}¾÷¤§«á¡A¤@­ÓrootÀÉ®×¨t²Î·|±q²Ä¤G±iºÏ¤ù¸ü¤J¡C¦¹®É¨Ï¥ÎªÌ³ê°_(invoke)¤@­Ó {\ttfamily setup} script¡A³o­Óscript±N±Ò°Ê¦w¸Ëµ{§Ç¡CSlackware¨Ã«D¨Ï¥Î¤@­Ó¼Ò²Õ¤Æ kernel ¡A¬Û¤Ï¦a¡A¥¦´£¨Ñ³\¦h¤£¦Pªº kernel ¡A¨Ã¥B¾a¨Ï¥ÎªÌ¦Û¤v¿ï¾Ü¤@­Ó²Å¦X ¥L/¦o µwÅé»Ý¨Dªº kernel ¡C

RedHat(v.4.0) ¤]¨Ï¥Î LILO ¶}¾÷ªk¡C¥¦±q²Ä¤@±iºÏ¤ù¸ü¤J¤@­ÓÀ£ÁYªº ramdisk ¡A³o°Ê§@°õ¦æ¤@­Ó custom {\ttfamily init} µ{¦¡¡C³o­Óµ{¦¡¬d¸ßÅX°Êµ{¦¡¡AµM«á¡A°²¦p¥²­nªº¸Ü¡A±q supplemental ºÏ¤ù¸ü¤JÃB¥~ªºÀÉ®×¡C

Debian(v1.3) ¥i¯à¬O³Ì½ÆÂøªº¦w¸ËºÏ¤ù¶°¡C¥¦¨Ï¥Î SYSLINUX loader ¥h¦w±Æ¦U¦¡¦U¼Ëªº¸ü¤J¿ï¶µ¡AµM«á¨Ï¥Î¤@­Ó {\ttfamily initrd} ¬M¹³ÀÉ«ü¥Ü¨Ï¥ÎªÌ§¹¦¨¦w¸Ëµ{§Ç¡C¥¦ÅãµM¨Ï¥Î¤F¤@­Ó«È»s¤Æªº {\ttfamily init} »P¤@­Ó«È»s¤Æªº shell ¨âªÌ¡C




\section{±`¨£°ÝÃD (FAQ) ¦Cªí -- Frequently Asked Question (FAQ) list}



{\itshape Q. §Ú±q§Úªº boot/root ºÏ¤ù¶}¾÷¡A¦ý¬O¤°»ò³£¶]¤£¥X¨Ó¡C§Ú²{¦b«ç»ò¿ì ?\/}



½Ð¬Ý¤§«eªº \ref{Troubleshooting} {(Troubleshooting)} ³o¸`¡C

{\itshape Q. Slackware/Debian/RedHat ªº bootdisk ¦p¦ó¹B§@ ?\/}



½Ð¬Ý¤§«eªº \ref{Pros} {(What the pros do)} ³o¸`¡C

{\itshape Q. §Ú­n¦p¦ó¥H XYZ ÅX°Êµ{¦¡»s§@¤@±i¶}¾÷ºÏ¤ù ?\/}



³ÌÂ²³æªº¤èªk¬O¥h±qÂ÷§A³Ìªñªº Slackware ¬M®g¯¸®³¨ì¤@­Ó Slackware ªº kernel ¡C Slackware ªº kernel ¬O¤@¯ëªº (generic) kernel ¡A³o¨Ç kernel ¥ø¹Ï±N³\¦h³]³ÆªºÅX°Êµ{¦¡¾¨¥i¯à¦a¥]§t©ó¨ä¤¤¡A¦]¦¹¡A°²¦p§A¦³¤@­Ó SCSI©ÎIDE±±¨î¾¹¡A¸Õ¸Õ¬Ý¡A«Ü¦³¥i¯à¥¦ªºÅX°Êµ{¦¡·|¦b Slackware ªº kernel ·í¤¤¡C

§ä¨ì \url{a1} ¥Ø¿ý¡A¨Ã¥B¨Ì¾Ú§A©Ò¾Ö¦³ªº±±¨î¾¹ºØÃþ¡A¿ï¾Ü IDE ©Î SCSI ¨âªÌ¤§¤@ªº kernel ¡C¹ï©Ò¿ï¾Üªº kernel ÀËµø¨ä xxxxkern.cfg ÀÉ¡A¨Ã¥B¥h¤F¸Ñ³o¥÷ kernel ¤¤©Ò¾Ö¦³ªºÅX°Êµ{¦¡¡C¦pªG§A·Q­n¨Ï¥Îªº³]³Æ¦b³o¥÷¦Cªí¤¤¡A¨º»ò³o­Ó²Å¦Xªº kernel ´NÀ³¸Ó¯à¥Î¨Ó¶}¾÷¡C¤U¸ü xxxxkern.tgz ÀÉ¡A¨Ã¥B¥Î¤§«e¦b¦³Ãö making boot disks ªº³¹¸`¤¤©Ò´y­z¤§¤èªk¡A copy ¥¦¨ì§Aªº¶}¾÷ºÏ¤ù¤¤¡C
\nidx{device drivers}

µM«á§A¥²¶·ÀË¬d¦b kernel ¤¤ªº root ³]³Æ¡A¨Ï¥Î {\ttfamily rdev zImage} ³o­Ó«ü¥O¡C±µµÛ rdev ±NÅã¥Ü¥Ø«e¦b kernel ¤¤ªº root ³]³Æ¡C¦pªG³o©M§A©Ò·Q­nªº root ³]³Æ¤£¦P¡A¨º»ò¨Ï¥Î {\ttfamily rdev} §ïÅÜ¥¦¡CÁ|¨Ò¨Ó»¡¡A§Ú¸Õªº kernel ³]©w¨ì \url{/dev/sda2} ¡A¦ý¬O§Úªº root SCSI partition ¬O \url{/dev/sda8} ¡C¬°¤F¯à¨Ï¥Î root ºÏ¤ù¡A§A±N¥²¶·¨Ï¥Î³o­Ó«ü¥O {\ttfamily rdev zImage }dev/fd0/ ¡C

°²¦p§AÁÙ·Qª¾¹D¦p¦ó set up ¤@±i Slackware ªº root ºÏ¤ù¡A³o´N¤w¸g¶W¥X³o¥÷ HOWTO ªº½d³ò¡A©Ò¥H§Ú«ØÄ³§A¬d¾\ Linux Install Guide ¡A©Î¬O³]ªk¨ú±o Slackware distribution ¡C¸Ô±¡½Ð¬Ý¦b³o¥÷ HOWTO ¤¤¡A¼ÐÃD¬° ``Reference'' ªº³¹¸`¡C

{\itshape Q. §Ú¦p¦ó¥H·sªºÀÉ®×§ó·s§Úªº root ºÏ¤ù ? \/}

\nidx{root filesystems, updating}

³ÌÂ²³æªº¤èªk¬O±q rootdisk copy ÀÉ®×¨t²Î¦^§A©Ò¨Ï¥Îªº¨º­Ó DEVICE (±q¤§«eªº \ref{CreatingRootFS} {(Creating the filesystem)} ³o¸`¦Ó±oªº)¡CµM«á±¾¤W³o­ÓÀÉ®×¨t²Î¨Ã¥B¶i¦æ§ïÅÜ°Ê§@¡C§A¥²¶·°O¦í§Aªº root ÀÉ®×¨t²Î±q­þ¸Ì¶}©l¡A¥H¤Î¥¦¦û¤F¦h¤Ö block¡G
\begin{verbatim}
        dd if=/dev/fd0 bs=1k skip=ROOTBEGIN count=BLOCKS | gunzip > DEVICE
        mount -t ext2 DEVICE /mnt
\end{verbatim}

¦b§¹¦¨§ïÅÜ¤§«á¡A¦p¦P¤§«e¤@¼Ë¶i¦æ¤U¥h (¦b \ref{WrappingItUp} {(Wrapping it up)} ³o¸`¤¤) ¡A¨Ã¥B§â root filesystem ¶Ç°e¦^¨º±iºÏ¤ù¤W¡C¦pªG§A¨Ã¨S¦³§ïÅÜ·sªº root filesystem ªº±Ò©l¦ì¸m¡A§AÀ³¸Ó¤£¥Î¦A­«¶Ç kernel ¡A©Î¬O­«·s­pºâ ramdisk ªº word¡C

{\itshape Q. §Ú­n¦p¦ó²¾°£ LILO ¡A¦nÅý§Ú¯à¦A¥Î DOS ¶}¾÷ ? \/}

\nidx{Master Boot Record (MBR)}
\ncdx{LILO}

³o­Ó°ÝÃD¨Ã«D¯uªº¬O Bootdisk ªº¤@­Ó¥DÃD¡A¥u¬O³o­Ó°ÝÃD±`±`³Q°Ý¨ì¡C¦b Linux ªºÀô¹Ò¤U¡A§A¥i¥H°õ¦æ¡G
\begin{tscreen}
\begin{verbatim}
        /sbin/lilo -u
\end{verbatim}
\end{tscreen}


§A¤]¥i¥H¨Ï¥Î {\ttfamily dd} ³o­Ó«ü¥O§â³Q LILO ©ÒÀx¦sªº³Æ¥÷¡A copy ¨ì¶}¾÷ºÏ°Ï¤W¡C¦pªG§A·Q­n³o¼Ë°µ¡A½Ð°Ñ¦Ò LILO ªº¤å¥ó¡C

¦b DOS »P Windows ªºÀô¹Ò¤U¡A§A¥i¥H¨Ï¥Î³o­Ó DOS «ü¥O¡G
\begin{tscreen}
\begin{verbatim}
        FDISK /MBR
\end{verbatim}
\end{tscreen}

MBR ¬O Master Boot Record(¥D­n¶}¾÷°O¿ý)ªºÁY¼g¡A¥¦·|¥Î¤@­Ó°®²bªº DOS ¶}¾÷ºÏ°Ï¡A´À´«­ì¥»ªº¶}¾÷ºÏ°Ï¡A¦Ó¥B³o­Ó°Ê§@¤£·|¼vÅT partition table ¡C¤@¨Ç¦³¼äÂ}ªº¤H (purists) ¨Ã¤£¦P·N³o¤@ÂI¡A¥i¬O´N³s LILO ªº­ì§@ªÌ¡A Werner Almesberger ¡A³£¦P·N¦¹§@ªk¡C³o­Ó§@ªkÂ²³æ¡A¦Ó¥B¦³¥Î¡C

{\itshape Q. ¦pªG§Ú¿ò¥¢¤F§Úªº kernel {\itshape  »P \/} §Úªº¶}¾÷ºÏ¤ù¡A§Ú­n¦p¦ó¶}¾÷ ? \/}



¦pªG§A¨Ã¨S¦³¤@±i¤w·Ç³Æ¦nªº¶}¾÷ºÏ¤ù¡A³ÌÂ²³æªº§@ªk¥i¯à¬O­n¨Ì·Ó§AªººÏºÐ±±¨î¾¹Ãþ«¬ (IDE ©Î SCSI) ¨ú±o¤@¥÷ Slackware kernel ¡A¦p¦P¤§«e©Ò­zªº ``§Ú¦p¦ó¥ÎXXXÅX°Êµ{¦¡»s§@¤@±i¶}¾÷ºÏ¤ù ?'' ¡CµM«á§A´N¥i¥H¥Î³o­Ó kernel ¶}¾÷¡A±µµÛ­×²z¦³·lÃaªº¦a¤è¡C

§A¨ú±oªº kernel ¥i¯à¨S¦³»P§A·Q­nªººÏºÐºØÃþ©M partition ¬Û¹ïÀ³ªº root ³]³Æ¶°¡CÁ|¨Ò¨Ó»¡¡A Slackware ªº generic SCSI kernel ¦³»P \url{/dev/sda2} ¬Û¹ïÀ³ªº root³]³Æ¶°¡AµM¦Ó¡A§Úªº root Linux partition ¬O¦b \url{/dev/sda8} ¡C¦b¦¹±¡ªp¤U¡A kernel ¤¤ªº root ³]³Æ±N¥²¶·³Q§ïÅÜ¡C

§A¤´µM¥i¥H§ïÅÜ kernel ªº root ³]³Æ»P ramdisk ªº³]©w¡AÁa¨Ï§A¤â¤W¥u¦³¤@­Ó kernel ©M¬YºØ¨ä¥¦ªº§@·~¨t²Î¡A¹³ DOS ¡C

{\ttfamily rdev} ÂÇµÛ§ïÅÜ¦b kernel ÀÉ®×¸Ì¡A¦b©T©w¦ì²¾¦ì¸m (offset) ¤Wªº­È¡A¨Ó§ïÅÜ kernel ªº³]©w¡A¦]¦¹¡A¦pªG§A¤â¤W¦³¤@­Ó hex ½s¿è¾¹ (on whatever systems you do still have running) ¡A§A¥i¥H§¹¦¨¬Û¦Pªº¨Æ -- ¨Ò¦p¦b DOS Àô¹Ò¤Uªº Norton Utilities Disk Editor ¡C±µµÛ¡A§A»Ý­n¶i¦æÀË¬d¡A¦pªG¥²­nªº¸Ü¡A§A±o§ïÅÜ kernel ÀÉ®×¸Ì¡A¦b¥H¤U¦ì²¾¦ì¸m¤Wªº­È¡G
\nidx{ramdisk word}\ncdx{rdev}

\begin{tscreen}
\begin{verbatim}
HEX(16¶i¦ì)     DEC(10¶i¦ì)  DESCRIPTION(¥Î³~´y­z)
0x01F8           504          RAMDISK wordªº§C¦r¤¸²Õ (Low byte of RAMDISK word)
0x01F9           505          RAMDISK wordªº°ª¦r¤¸²Õ (High byte of RAMDISK word)
0x01FC           508          Root minor³]³Æ¸¹½X - ¸Ô¨£¨ä«á
0X01FD           509          Root major³]³Æ¸¹½X - ¸Ô¨£¨ä«á
\end{verbatim}
\end{tscreen}


Ãö©ó ramdisk word ¤§¸ÑÄÀ¡A¼g¦b¤§«eªº \ref{SettingRamdiskWord} {(Setting the ramdisk word)} ³o¸`¸Ì¡C

Major »P minor ³]³Æ¸¹½X¥²¶·³]¦¨§A·Q­n±¾§Aªº root filesystem ©ó¨ä¤Wªº³]³Æ¡C¤@¨Ç¥i¨Ñ¿ï¾Üªº¦³¥Î°Ñ¦Ò¼Æ­È¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
DEVICE          MAJOR MINOR
/dev/fd0            2     0   ²Ä¤@¥x³nºÐ¾÷
/dev/hda1           3     1   ¦b²Ä¤@ÁûIDEµwºÐ¤Wªºpartition 1
/dev/sda1           8     1   ¦b²Ä¤@ÁûSCSIµwºÐ¤Wªºpartition 1
/dev/sda8           8     8   ¦b²Ä¤@ÁûSCSIµwºÐ¤Wªºpartition 8
\end{verbatim}
\end{tscreen}

¤@¥¹§A³]©w¤F³o¨Ç­È¡A±µ¤U¨Ó§A¥i¥H±N³o­ÓÀÉ®×¼g¤J¤@±iºÏ¤ù¤º¡A§A¥i¥H§Q¥Î Norton Utilities Disk Editor ¡A¤£µM´N¬O§Q¥Î¦W¬° {\ttfamily rawrite.exe} ªº³o¤äµ{¦¡¡C³o¤äµ{¦¡¦b©Ò¦³ªº distribution ³£§ä±o¨ì¡C³o¤äµ{¦¡¬O¤@¤ä¦bDOSÀô¹Ò¤U°õ¦æªºµ{¦¡¡A¥¦¯à±NÀÉ®×¼g¤J¤@±i ``raw'' disk ¡A±q¶}¾÷ºÏ°Ï¶}©l¼g¤J¡A¦Ó¤£¬O±NÀÉ®×¼g¤JÀÉ®×¨t²Î¡C¦pªG§A¨Ï¥Î Norton Utilities ¡A§A¥²¶·±NÀÉ®×¼g¤J¤@±i¹êÅéºÏ¤ù¡A±qºÏ¤ùªºÀY¶}©l¼g¤J¡C

{\itshape Q. §Ú­n¦p¦ó»s§@ boot/root ºÏ¤ùªºÃB¥~³Æ¥÷ ? \/}



¦]¬°ºÏ©Ê´C¤¶¥i¯à¦b¤@¬q®É¶¡«á¾D¹J·l®`¡A§AÀ³¸Ó«O¯d´X±i§Aªº±Ï´©ºÏ¤ùªº³Æ¥÷¡A¥H¨¾­ì¨Óªº¨º¤@¤ù¤£¯à³Q¹q¸£Åª¨ú¡C

»s§@¥ô¦óºÏ¤ùªº³Æ¥÷¡A¥]¬A¶}¾÷¥Î»P¤½¥Îµ{¦¡ (utility) ºÏ¤ù¡A³ÌÂ²³æªº¤èªk¬O§Q¥Î {\ttfamily dd} ³o­Ó«ü¥O¡A¥h copy ­ì¨Ó¨º±iºÏ¤ùªº¤º®e¨ì§AµwºÐ¤Wªº¤@­ÓÀÉ®×¤§¤¤¡AµM«á¦A¥Î¬Û¦Pªº«ü¥O±N³o­ÓÀÉ®× copy ¦^¤@±i·sºÏ¤ù¤W¡C½Ðª`·N¡A§A¨Ã¤£»Ý­n¡A¤]¤£À³¸Ó¥h mount ³o±iºÏ¤ù¡A¦]¬° {\ttfamily dd}§Q¥Îraw³]³Æ¤¶­±¡C

­n copy ­ìºÏ¤ù¡A½Ð¿é¤J¥H¤U«ü¥O¡G
\begin{tscreen}
\begin{verbatim}
        dd if=DEVICENAME of=FILENAME
\end{verbatim}
\end{tscreen}


¦b¦¹¡A \url{DEVICENAME} ¬O«ü³o¥xºÏºÐ¾÷ªº³]³Æ¦W (Ä¶«ö¡G/dev/fd0) ¡A¦Ó \url{FILENAME} ¬O«ü(¦s¦bµwºÐ¤Wªº)¿é¥XÀÉ®×ÀÉ¦W¡C¬Ù²¤ {\ttfamily count} °Ñ¼ÆÅý {\ttfamily dd} ¥hcopy¾ã±iºÏ¤ù (¦pªG¬O°ª±K«×ºÏ¤ù¡A¦³ 2880 ­Ó blocks) ¡C

­n§â±q¤W­±±o¨ìªºÀÉ®× copy ¨ì¤@±i·sºÏ¤ù¤W¡A½Ð´¡¤J¤@±i·sºÏ¤ù¨Ã¿é¤J¬Û¤Ïªº«ü¥O¡G
\begin{tscreen}
\begin{verbatim}
        dd if=FILENAME of=DEVICENAME
\end{verbatim}
\end{tscreen}


½Ðª`·N¡A¥H¤Wªº°Q½×¬O°²³]§A¥u¦³¤@¥x³nºÐ¾÷¡C°²¦p¬Û¦PºØÃþªº³nºÐ¾÷§A¦³¨â¥x¡A§A¥i¥H§Q¥Î¹³¤U­±ªº«ü¥O¥h copy ºÏ¤ù¡G
\begin{tscreen}
\begin{verbatim}
        dd if=/dev/fd0 of=/dev/fd1
\end{verbatim}
\end{tscreen}


{\itshape Q. §Ú¦p¦ó¯à¦b¨C¤@¦¸¶}¾÷®É¡A¤£¥Î¿é¤J {``}ahaxxxx=nn,nn,nn{''} ?\/}

\nidx{kernel, parameters}

·í¤@¥xºÏºÐ³]³Æ¤£¯à³Q¦Û°Ê°»´ú®É¡A´N¦³¥²­n´£¨Ñ kernel «ü©wªº³]³Æ°Ñ¼Æ¦r¦ê¡A½Ñ¦p¡G
\begin{tscreen}
\begin{verbatim}
        aha152x=0x340,11,3,1
\end{verbatim}
\end{tscreen}


³o¦æ°Ñ¼Æ¦r¦ê¥i¥H§Q¥Î LILO ¥H¼ÆºØ¤èªk´£¨Ñµ¹ kernel ¡G

\begin{itemize}
\item  ¨C¦¸·í¨t²Î¥H LILO ¶}¾÷®É¡A§A¥i¥H¦b©R¥O¦C¿é¤J¥¦¡C¦ý¬O¨C¦¸³o¼Ë°µ·|«Ü·Ð¡C
\item  §A¥i¥H¨Ï¥Î LILO ªº {\ttfamily lock} ³o­ÓÃöÁä¦r¡A¨Ï LILO Àx¦s³o¦æ©R¥O¦C¡A¨Ã°µ¬°¹w³]ªº©R¥O¦C¡A³o¼Ë¨C·í¶}¾÷®É¡A LILO ´N·|¨Ï¥Î¬Û¦Pªº¿ï¶µ¡C
\item  §A¥i¥H¦b LILO ªº²ÕºAÀÉ¤¤¡A¨Ï¥Î {\ttfamily append=} ³o­Ó±Ô­z¡C½Ðª`·N°Ñ¼Æ¦r¦ê¥²¶·³QÂù¤Þ¸¹ (quotes) §¨¦í¡C
\end{itemize}


Á|¨Ò¨Ó»¡¡A¤@¦æ¨Ï¥Î¤W­z°Ñ¼Æ¦r¦êªº¼Ë¥»©R¥O¦C±Nªø¦¨³o¼Ë¡G
\begin{tscreen}
\begin{verbatim}
        zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
\end{verbatim}
\end{tscreen}


¦p¦¹±N·|¶Ç»¼³]³Æ°Ñ¼Æ¦r¦êµ¹ kernel ¡A¦P®É¤]­n¨D kernel §â root ³]³Æ³]©w¨ì \url{/dev/sda1} ¡A¨Ã¥BÀx¦s¾ã¦æ©R¥O¦C¡AÅý¥H«á¶}¾÷®É³£¯à¦A¨Ï¥Î³o­Ó©R¥O¦C¡C

¥H¤U¬O¤@­Ó APPEND ±Ô­zªº¼Ë¥»¡G
\begin{tscreen}
\begin{verbatim}
        APPEND = "aha152x=0x340,11,3,1"
\end{verbatim}
\end{tscreen}


½Ðª`·N°Ñ¼Æ¦r¦ê¦b©R¥O¦C¤W {\itshape  ¤£¯à \/} ³QÂù¤Þ¸¹§¨¦í¡A¦ý¬O°Ñ¼Æ¦r¦ê¦b {\ttfamily APPEND} ±Ô­z¤¤ {\itshape  ¤@©w­n \/} ³QÂù¤Þ¸¹§¨¦í¡C

¥t¥~¤]½Ðª`·N¡A¬°¤F¯àÅý°Ñ¼Æ¦r¦ê°_§@¥Î¡A kernel ¤º¥²¶·¦³²Å¦X³o­ÓºÏºÐÃþ«¬ªºÅX°Êµ{¦¡¡C¦pªG¨S¦³¡A¨º»ò´N¨S¦³ªF¦è·|¥h±µ¨ü (listen for) ³o­Ó°Ñ¼Æ¦r¦ê¡A©Ò¥H§A±N¥²¶·­«·s«Ø³y¤@­Ó¥]§t«ü©wÅX°Êµ{¦¡ªº kernel ¡C¦³Ãö­«·s«Ø¥ß kernel ªº²Ó¸`¡A½Ð¦Ü¥Ø¿ý \url{/usr/src/linux} ¾\Åª¨ä README ÀÉ¡A¥H¤Î Linux FAQ »P Installation HOWTO ¡C Alternatively ¡A§A¥i¥H¬°³oºØºÏºÐÃþ«¬¨ú±o¤@­Ó generic kernel ¨Ã¥B¦w¸Ë¥¦¡C

¦bÅéÅç LILO ¦w¸Ë¤§«e¡A±j¯P«ØÄ³ÅªªÌ¥ýÅª¹L LILO ¤å¥ó¡C¤£¤p¤ß¨Ï¥Î {\ttfamily BOOT} ±Ô­z±N·|·lÃa partition ¡C

{\itshape Q. ¦b¶}¾÷ªº®É­Ô¡A¥X²{¤F {``}{\ttfamily A: cannot execute B}{''} ªº¿ù»~°T®§¡C¬°¤°»ò ?\/}

\nidx{hardcoded locations}

µ{¦¡¦WºÙ¦³¦n´XºØ¤£¦Pªº¼gªk³Q¼g¦º (hardcoded) ¦b¤£¦Pªº¤½¥Îµ{¦¡¸Ì¡C³o¨Ç¼gªk¤£·|¦b¨C­Ó¦a¤è³£µo¥Í¡A¦ý¬O¥¦­Ì¥i¯à»¡©ú¤F¬°¤°»ò¤@­ÓÅã¦Ó©ö¨£ªº¥i°õ¦æÀÉ¡A¤£¯à¦b§Aªº¨t²Î¤W³Qµo²{¡AÁa¨Ï§A¬Ý¨ì¥¦´N¦b¨º¸Ì¡C§A¥i¥H§ä¥X¬O§_¤@­Ó¤wª¾ªºµ{¦¡¦³¥t¤@ºØ³Q¼g¦ºªº¦WºÙ¡A§A¥i¥H§Q¥Î {\ttfamily strings} ³o­Ó«ü¥O¡A¨Ã¥B§Q¥ÎºÞ¹D¤èªk (Ä¶«ö¡G piping, $|$) ±N¿é¥X³z¹L {\ttfamily grep} §e²{¥X¨Ó¡C

¤wª¾Ãö©ó¼g¦ºªº¨Ò¤l¦³¡G
\begin{itemize}
\item  ¦b¬Y¨Çª©¥»¤¤¡A {\ttfamily Shutdown} ¦³§â \url{/etc/reboot} ¼g¦º¦b¨äµ{¦¡½X¤º¡A©Ò¥H {\ttfamily reboot} ¥²¶·³Q©ñ¸m¦b \url{/etc} ³o­Ó¥Ø¿ý¤U¡C
\item  ¦]¬°¦³¤£¯à°÷§ä¨ì {\ttfamily init} ªº kernel ¦s¦b¡A {\ttfamily init} ¤w¦Ü¤Ö¬°¤@­Ó¤H±a¨Ó°ÝÃD¡C
\end{itemize}


¬°¤F­×¥¿³o¨Ç°ÝÃD¡A¤£¬O²¾°Ê³o¨Çµ{¦¡¨ì¥¿½Tªº¥Ø¿ý¡A´N¬O§ó§ï³]©wÀÉ (e.g. \url{inittab})¥H«ü¦V¥¿½Tªº¥Ø¿ý¡C°²¦p¦³©ÒÃhºÃ¡A´N½Ð¥ý§âµ{¦¡¦p¦P¥¦­Ì¦b§AµwºÐ¤W¤@¼Ë¡A©ñ¤J¬Û¦Pªº¥Ø¿ý¡A¨Ã¥B¦p¦P¥¦­ÌÅã²{¦b§AµwºÐ¤W¤@¼Ë¡A¨Ï¥Î¬Û¦Pªº \url{inittab} »P \url{/etc/rc.d} ÀÉ¡C

{\itshape Q. §Úªº kernel ¤ä´© ramdisk ¡A¦ý¬O«oªì©l¤Æ 0K ªº ramdisk ¡C¬°¤°»ò ?\/}



·í kernel ¥¿¦b¶i¦æ¶}¾÷°Ê§@®É¡A¦b°ÝÃDµo¥Í¤§³B¡A·|¥X²{¤@­Ó¹³³o¼Ëªº kernel °T®§¡G \nidx{ramdisk}
\begin{verbatim}
        Ramdisk driver initialized : 16 ramdisks of 0K size
\end{verbatim}


³o¥i¯à¬O¦]¬° size ¤w³Q kernel °Ñ¼Æ¦b¶}¾÷®É³]¦¨ 0 ¡C³o¥i¯à¬O¥Ñ©ó¤@­Ó overlooked LILO²ÕºA³]©wÀÉ°Ñ¼Æ©Ò¾É­P¡G
\begin{tscreen}
\begin{verbatim}
    ramdisk= 0
\end{verbatim}
\end{tscreen}


¦b¬Y¨Ç¸ûÂÂªº distributions ¸Ì¡A³o­Ó·|³Q¥]§t¦b LILO ²ÕºA³]©wÀÉ¼Ë¥»¤¤¡A³o©ñ¦b¨º¸Ì¬O¬°¤F override ¥ô¦ó kernel ­ì¥ýªº³]©w¡C¦pªG§A¦³³o¼Ëªº¤@¦æ¡A½Ð²¾°£¤§¡C

½Ðª`·N¡A¦pªG¥ø¹Ï¨Ï¥Î¤@­Ó¤w³Q³]©w¦¨ 0 size ªº ramdisk ¡A³o¼Ëªº¦æ¬°±N·|¾É­P¤£¥i¹w´úªºµ²ªG¡A¦P®É¤]·|Åý kernel ¤£ª¾¦p¦ó¬O¦n¡C




 \appendix 

\section{¸ê·½»P«ü¥Ü -- Resources and pointers}

\label{references}

·í®³¨ú¤@­Ó®M¥ó®É¡A°£«D§A¦³¦nªº²z¥Ñ¡A§_«h½Ð¤@©w­n®³³Ì·sªºª©¥»¡C




\subsection{¹w¥ý°µ¦nªº Bootdisks -- Pre-made Bootdisks}

\label{PreMade}

³o¨Ç¬O distribution bootdisks ªº¨Ó·½¡C {\itshape  ½Ð¿ï¾Ü¬M®g¯¸¥x¤U¸ü¥H´î¤Ö³o¨Ç¥D¾÷ªº­t²ü¡C \/}

\begin{itemize}
\item \nameurl{http://metalab.unc.edu/pub/Linux/distributions/slackware/bootdsks.144/}{Slackware bootdisks}, \nameurl{http://metalab.unc.edu/pub/Linux/distributions/slackware/rootdsks/}{rootdisks} »P \nameurl{http://www.slackware.com/getslack/}{ Slackware ¬M®g¯¸¥x }
\item \nameurl{http://metalab.unc.edu/pub/Linux/distributions/redhat/current/i386/images/}{RedHat bootdisks} »P \nameurl{http://www.redhat.com/mirrors.html}{Red Hat ¬M®g¯¸¥x }
\item \nameurl{ftp://ftp.debian.org/pub/debian/dists/stable/main/disks-i386/current/}{Debian bootdisks} »P \nameurl{ftp://ftp.debian.org/pub/debian/README.mirrors.html}{Debian ¬M®g¯¸¥x }
\end{itemize}


°£¤F distribution bootdisks ¥H¥~¡A¤]¥i¥H±o¨ì¥H¤Uªº±Ï´©ºÏ¤ù¬M¹³ÀÉ¡C°£«D¦³¥t¥~¯S§O«ü©w¡A§_«h³o¨Ç³£¥i¦b
\nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html}{} ªº¥Ø¿ý¤¤§ä¨ì¡C

\begin{itemize}
\item  {\ttfamily tomsrtbt}, ¥Ñ Tom Oehser »s§@¡A¬O¤@±i¥H kernel 2.0 ¬°°òÂ¦¦Ó»s§@¥X¨Óªº³æ¤ù¸Ë boot/root ºÏ¤ù¡Awith a large set of features and support programs¡C¥¦¤ä´© IDE ¡B SCSI ¡BºÏ±a¡Bºô¸ô¥d¡B PCMCIA µ¥ÁÙ¦³«Ü¦h¨ä¥¦³]³Æ¡C¨ä¤¤¦³¤j¬ù 100 ºØ¤u¨ãµ{¦¡»P¤u¨ã¥i¥H¥Î¨Ó­×Å@»P³Æ¥÷ºÏºÐ¡C¦¹®M¥ó¤]¥]§t¤@¨Ç script ¥Î¨Ó¸ÑÄ¶»P­««Øºc¬M¹³ÀÉ¡A¥H«K©ó¦b¥²­n®É¥i¥H¥[¤J·sªº material ¡C 



\item {\ttfamily rescue02}, ¥Ñ John Comyns »s§@¡A¬O¤@±i¥H kernel 1.3.84 ¬°°òÂ¦¦Ó»s§@¥X¨Óªº±Ï´©ºÏ¤ù¡A¨ä¤ä´© IDE ¡B Adaptec 1542 »P NCR53C7,8xx ¡C¥¦¨Ï¥Î ELF ¨â¶i¦ìÀÉ¡A¦ý¬O«o¦³¨¬°÷ªº«ü¥O¥H§Q¨ä¯à¦b¥ô¦ó¨t²Î¤W¨Ï¥Î¡C¥¦¾Ö¦³¯à¦b¶}¾÷«á¤~³Q¸ü¤Jµ¹©Ò¦³¨ä¥¦ SCSI ¥d¨Ï¥Îªº¼Ò²Õ¡C¦ý¥¦¤]³\¤£¯à¦b¥u¦³ 4 mb ÀH¾÷¦s¨ú°O¾ÐÅéªº¨t²Î¤W°õ¦æ¡A¦]¬°¥¦¥Î¨ì¤F 3 mb ªºram disk¡C 



\item {\ttfamily resque\_disk-2.0.22}, ¥Ñ Sergei Viznyuk »s§@¡A¬O¤@®M¥H kernel 2.0.22 ¬°°òÂ¦¡A¤º«Ø¤ä´© IDE »P³\¦h¤£¦Pªº SCSI ±±¨î¥d¡A¥H¤Î ELF/AOUT ªº¥þ¥\¯à boot/root ºÏ¤ù¡C¦P®É¤]¥]§t³\¦h¼Ò²Õ¡A¥H¤Î¥Î¨Ó­×î¦¤Î³Æ¥÷µwºÐªº¦³¥Î¤u¨ãµ{¦¡¡C 



\item {\ttfamily \nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/images}{cramdisk}} ¬M¹³ÀÉ¡A¥H kernel 2.0.23 ¬°°òÂ¦¡A¥i¨Ï¥Î¦b 4 meg »P 8 meg ªº¾÷¾¹¤W¡C¥¦­Ì¥]§t¤F¼Æ¾Ç¼ÒÀÀ¾¹»Pºô¸ô¤u¨ã (PPP»Pdialin script¡BNE2000¡B3C509)¡A©Î¬O¥­¦æ°ð ZIP ºÏºÐ¾÷ªº¤ä´©¡C³o¨ÇºÏ¤ù¬M¹³ÀÉ¥i¦b³Æ¦³ 4MB ÀH¾÷¦s¨ú°O¾ÐÅéªº 386 ¥D¾÷¤W¶}¾÷¡C MSDOS ¤ä´©¤]³Q¥]§t¦b¨ä¤¤¡A¦]¦¹§A¥i¥H±qºô¸ô¤W¤U¸ü¥¦¨ì DOS partition ¤W¡C 

\end{itemize}





\subsection{±Ï´©®M¥ó -- Rescue packages}



¥Ø«e¥i¥H±q metalab.unc.edu ¨ú±o¼ÆºØ»s§@±Ï´©ºÏ¤ùªº®M¥ó¡C§Q¥Î³o¨Ç®M¥ó¡A§A¥i¥H«ü©w¥]§t¤@²ÕÀÉ®×¡A±µµÛ³nÅé´N·|¦Û°Ê¦a¶i¦æ bootdisk ªº»s§@ (¦Û°Ê¤Æµ{«×·|¦³©Ò¤£¦P)¡C½Ð¬Ý \nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html}{} ¥H¨ú±o¶i¤@¨Bªº¸ê°T¡C

{\itshape  ½Ð¥J²ÓÀË¬dÀÉ®×¤é´Á \/}¡C¤@¨Ç®M¥ó¦³¼Æ¦~¥¼³Q§ó·s¡A¦Ó³o¨Ç®M¥ó±NµLªk¤ä´©¡u¸ü¤J¦Ü ramdisk ¤§À£ÁY root filesystem ¡vªº»s§@¡C´N¥Ø«e©Òª¾¡A \nameurl{http://www.croftj.net/~fawcett/yard/index.html}{Yard} ¬O°ß¤@¥i¤ä´©¦¹ªº®M¥ó¡C




\subsection{LILO -- the Linux loader}



¥Ñ Werner Almesberger ¼¶¼g¡C¤@­ÓÀu¨qªº boot loader ¡A¨ä¤å¥ó¥]§t¤F¶}¾÷ºÏ°Ï¤º®eªº¸ê°T¡A¥H¤Î¶}¾÷¬yµ{ªºªì´Á¶¥¬q¡C

½Ð±q \nameurl{ftp://tsx-11.mit.edu/pub/linux/packages/lilo/}{} ¥HFTP¤U¸ü¡C¤]¥i¥H±q Metalab »P¬M®g¯¸¥x¤º¨ú±o¡C




\subsection{Linux FAQ »P HOWTOs}



³o¨Ç¤å¥ó¥i¥H±q½Ñ¦h¨Ó·½¤¤¨ú±o¡C³o¨Ç¤å¥ó¥i¥H±q½Ñ¦h¨Ó·½¤¤¨ú±o¡C½Ð¨£ usenet ·s»D½×¾Â {\ttfamily news.answers} »P {\ttfamily comp.os.linux.announce}¡C

³o¨Ç FAQ ¥i¥H±q \nameurl{http://linuxdoc.org/FAQ/Linux-FAQ.html}{} ¤¤¨ú±o¡A¦Ó HOWTOs ¥i¥H±q \nameurl{http://linuxdoc.org/HOWTO/HOWTO-INDEX.html}{} ¤¤¨ú±o¡C¤j³¡¤À Linux ¤å¥ó¥i¥H¦b \nameurl{http://linuxdoc.org/}{The Linux Documentation Project homepage} ¤¤§ä±o¨ì¡C




\subsection{Ramdisk¨Ï¥Î¤èªk -- Ramdisk usage}

\nidx{ramdisk}

¦³Ãö·sªºramdisk µ{¦¡½X¦p¦ó¹B§@ªº§¹¾ã±Ô­z¡A¥i¥H¦bÀHªþ©ó Linux kernel ªº¤å¥ó¤¤§ä¨ì¡C½Ð¬Ý \url{/usr/src/linux/Documentation/ramdisk.txt} ¡C³o¥÷¤å¥ó¬O¥Ñ Paul Gortmaker ©Ò½s¼g¡A¦P®É¥]§t¤F¤@¸`Ãö©ó»s§@À£ÁYªº ramdisk ¡C




\subsection{Linux¶}¾÷¬yµ{ -- The Linux boot process}

\nidx{boot process}

­Y·Q¤F¸ÑÃö©óLinux¶}¾÷¬yµ{ªº§ó¦h²Ó¸`¡A¥H¤U¦³¤@¨Ç«ü¥Ü¤å¥ó¡G

\begin{itemize}
\item  ¦b \nameurl{http://linuxdoc.org/LDP/sag/c1596.html}{}{\itshape Linux System Administrators' Guide\/} ¤¤¡A¦³¤@¸`¬OÃö©ó booting ¡C
\item  ¦b \nameurl{http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-t-21.ps.gz}{}LILO ``Technical overview'' ¤¤¡A¾Ö¦³Ãö©ó¶}¾÷¬yµ{¤@ª½¨ì kernel ±q¦ó³B³Q±Ò°Ê¤§¨M©w©Ê (definitive) §Þ³N¤W low-level ªº±Ô­z¡C
\item Source code ¬O§A¥Ã»·ªº«ü«n¡C¥H¤U¬O¤@¨Ç»P¶}¾÷¬yµ{¦³Ãöªº kernel files ¡C¦pªG§A¦³ Linux ®Ö¤ßªº­ì©l½X¡A§A¥i¥H¦b§A¾÷¾¹¤Wªº \url{/usr/src/linux} ¤§¤¤§ä¨ì³o¨ÇÀÉ®×¡F¦¹¥~¡A Shigo Yamguchi (\onlynameurl{shigio@tamacom.com})¦³«D±`´Îªº \nameurl{http://www.tamacom.com/tour/linux/index.html}{hypertext kernel browser} ¡A¥i¥H¥Î¨ÓÅª kernel source files ¡C¥H¤U¬O¤@¨Ç¥i¨Ñ°Ñ¦Òªº¦³ÃöÀÉ®×¡G
                                                                   
\begin{description}
\url{arch/i386/boot/bootsect.S} and \url{setup.S}
¥]§t bootsector ¦Û¤vªº²Õ¦X½X¡C

\url{arch/i386/boot/compressed/misc.c}
¥]§t¥¼À£ÁYªº kernel µ{¦¡½X¡C

\url{arch/i386/kernel/}
¥]§t¤F kernel ªì©l¤Æµ{¦¡½Xªº¥Ø¿ý¡C \url{setup.c} ©w¸q¤F ramdisk ªº word ¡C

\url{drivers/block/rd.c}
¥]§t ramdisk ªºÅX°Êµ{¦¡¡C {\ttfamily rd\_load} »P {\ttfamily rd\_load\_image} ³o¨â­Óµ{§Ç±q¤@­Ó³]³Æ¤¤¸ü¤J°Ï¶ô (blocks) ¨ì ramdisk ¤º¡C {\ttfamily identify\_ramdisk\_image} ³o­Óµ{§Ç¨M©w§ä¨ìªº filesystem ¬O¤°»òºØÃþ¡AÁÙ¦³¥¦¬O§_¬O³QÀ£ÁYªº filesystem ¡C

\end{description}
\end{itemize}





\section{LILO boot error codes}

\nidx{LILO ,error codes}

¦³Ãö³o¨Ç¿ù»~½Xªº°ÝÃD®É±`¦b Usenet ¤W³Q¤H´£¨ì¡A©Ò¥H§Ú­Ì¥HªA°Èªº¤ß±¡±N¥¦­Ìªí¦C¦p¤U¡C³o¥÷ºK­n¤Þ¥Î¦Û Werner Almsberger ªº \nameurl{http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-u-21.ps.gz}{LILO User Documentation} ¡C

·í LILO ¸ü¤J¦Û¤v®É¡A¿Ã¹õ¤W·|Åã¥Ü {\ttfamily LILO} ³o­Ó¦r¡C¨C¤@­Ó¦r¥À (letter) ·|¦b°õ¦æ¬Y­Ó¯S©w°Ê§@¤§«e©Î¤§«á³Q¦L¦b¿Ã¹õ¤W¡C¦pªG LILO ¦b¬YÂI¤W¤£¯à§¹¦¨¥ô°È¡A¨ì¦¹¬°¤î©Ò¦L¥Xªº¦r¥À¥i¥H¥Î¨Ó¿ë»{¥Xµo¥Í¤F¤°»ò°ÝÃD¡C

\begin{description}
\item[(nothing)] \mbox{}

LILO §¹¥þ¨S¦³³Q¸ü¤J¡C LILO ¤£¬O¨S¦³³Q¦w¸Ë¦n¡A´N¬O LILO ¶}¾÷ºÏ°Ï©Ò¦bªº partition ¨Ã«D¨Ï¥Î¤¤ªº partition ¡C



\item[L] \mbox{}

²Ä¤@¶¥¬qªº boot loader ¤w³Q¸ü¤J¨Ã±Ò°Ê¡A¦ý¬OµLªk¸ü¤J²Ä¤G¶¥¬qªº boot loader ¡C³o¨Ç¤G¦ì¼Æªº¿ù»~½X«ü¥X°ÝÃDÄÝ©ó¤°»òºØÃþ¡C(½Ð¬Ý "Disk error codes" ³o¤@¸`¡C)³o­Ó±¡ªp³q±`¬O«ü´CÅé¿ù»~©Î¬O´X¦ó¤£¬Û°t (geometry mismatch)(Á|¨Ò¨Ó»¡¡A¿ù»~ªººÏºÐ°Ñ¼Æ)¡C



\item[LI] \mbox{}

²Ä¤@¶¥¬qªº boot loader ¯à°÷¸ü¤J²Ä¤G¶¥¬qªº boot loader ¡A¦ý¬O«o¤£¯à°÷°õ¦æ¥¦¡C³o­Ó±¡§Î¬O¦]¬° geometry mismatch §í©Î¬O¦b¨S¦³°õ¦æ map installer ªº±¡ªp¤U¡A²¾°Ê¤F \url{/boot/boot.b} ©Ò³y¦¨¡C



\item[LIL] \mbox{}

²Ä¤G¶¥¬qªº boot loader ¤w³Q±Ò°Ê¡A¦ý¬O«o¤£¯à±q map file ¸ü¤J descriptor table ¡C¤@¯ë¦Ó¨¥¡A³o¬O¦]¬°´CÅé¿ù»~©Î¬O geometry mismatch ©Ò³y¦¨¡C



\item[LIL?] \mbox{}

²Ä¤G¶¥¬qªº boot loader ³Q¸ü¤J¨ì¤@­Ó¤£¥¿½Tªº¦ì§}¡C¤@¯ë¦Ó¨¥¡A³o¬O¦]¬° subtle geometry mismatch  ¡A©Î¬O¦b¨S¦³°õ¦æ map installer ªº±¡ªp¤U¡A²¾°Ê¤F /boot/boot.b ©Ò³y¦¨¡C



\item[LIL-] \mbox{}

Descriptor table ·l·´¡C³o­Ó±¡§Î¬O¦]¬° geometry mismatch §í©Î¬O¦b¨S¦³°õ¦æ map installer ªº±¡ªp¤U¡A²¾°Ê¤F /boot/map ©Ò³y¦¨¡C



\item[LILO] \mbox{}

LILO ªº©Ò¦³³¡¤À§¡¤w¦¨¥\¸ü¤J¡C

\end{description}


¦pªG¦b LILO ¥¿¸ÕµÛ¸ü¤J boot image ®É¡A BIOS µo¥X¤@­Ó¿ù»~°T¸¹¡A¨º»ò¬Û¹ï¬Mªº (respective)¿ù»~½X·|Åã¥Ü¥X¨Ó¡C¿ù»~½Xªº½d³ò±q {\ttfamily 0x00} ¨ì {\ttfamily 0xbb} ¡C½Ð¬Ý LILO User Guide for an explanation of these ¡C




\section{Root filesystem ¦Cªí¼Ë¥» -- Sample root filesystem listings}

\label{Listings}
\nidx{root filesystem}



\begin{tscreen}
\begin{verbatim}
/:
drwx--x--x   2 root     root         1024 Nov  1 15:39 bin
drwx--x--x   2 root     root         4096 Nov  1 15:39 dev
drwx--x--x   3 root     root         1024 Nov  1 15:39 etc
drwx--x--x   4 root     root         1024 Nov  1 15:39 lib
drwx--x--x   5 root     root         1024 Nov  1 15:39 mnt
drwx--x--x   2 root     root         1024 Nov  1 15:39 proc
drwx--x--x   2 root     root         1024 Nov  1 15:39 root
drwx--x--x   2 root     root         1024 Nov  1 15:39 sbin
drwx--x--x   2 root     root         1024 Nov  1 15:39 tmp
drwx--x--x   7 root     root         1024 Nov  1 15:39 usr
drwx--x--x   5 root     root         1024 Nov  1 15:39 var

/bin:
-rwx--x--x   1 root     root        62660 Nov  1 15:39 ash
-rwx--x--x   1 root     root         9032 Nov  1 15:39 cat
-rwx--x--x   1 root     root        10276 Nov  1 15:39 chmod
-rwx--x--x   1 root     root         9592 Nov  1 15:39 chown
-rwx--x--x   1 root     root        23124 Nov  1 15:39 cp
-rwx--x--x   1 root     root        23028 Nov  1 15:39 date
-rwx--x--x   1 root     root        14052 Nov  1 15:39 dd
-rwx--x--x   1 root     root        14144 Nov  1 15:39 df
-rwx--x--x   1 root     root        69444 Nov  1 15:39 egrep
-rwx--x--x   1 root     root          395 Nov  1 15:39 false
-rwx--x--x   1 root     root        69444 Nov  1 15:39 fgrep
-rwx--x--x   1 root     root        69444 Nov  1 15:39 grep
-rwx--x--x   3 root     root        45436 Nov  1 15:39 gunzip
-rwx--x--x   3 root     root        45436 Nov  1 15:39 gzip
-rwx--x--x   1 root     root         8008 Nov  1 15:39 hostname
-rwx--x--x   1 root     root        12736 Nov  1 15:39 ln
-rws--x--x   1 root     root        15284 Nov  1 15:39 login
-rwx--x--x   1 root     root        29308 Nov  1 15:39 ls
-rwx--x--x   1 root     root         8268 Nov  1 15:39 mkdir
-rwx--x--x   1 root     root         8920 Nov  1 15:39 mknod
-rwx--x--x   1 root     root        24836 Nov  1 15:39 more
-rws--x--x   1 root     root        37640 Nov  1 15:39 mount
-rwx--x--x   1 root     root        12240 Nov  1 15:39 mt
-rwx--x--x   1 root     root        12932 Nov  1 15:39 mv
-r-x--x--x   1 root     root        12324 Nov  1 15:39 ps
-rwx--x--x   1 root     root         5388 Nov  1 15:39 pwd
-rwx--x--x   1 root     root        10092 Nov  1 15:39 rm
lrwxrwxrwx   1 root     root            3 Nov  1 15:39 sh -> ash
-rwx--x--x   1 root     root        25296 Nov  1 15:39 stty
-rws--x--x   1 root     root        12648 Nov  1 15:39 su
-rwx--x--x   1 root     root         4444 Nov  1 15:39 sync
-rwx--x--x   1 root     root       110668 Nov  1 15:39 tar
-rwx--x--x   1 root     root        19712 Nov  1 15:39 touch
-rwx--x--x   1 root     root          395 Nov  1 15:39 true
-rws--x--x   1 root     root        19084 Nov  1 15:39 umount
-rwx--x--x   1 root     root         5368 Nov  1 15:39 uname
-rwx--x--x   3 root     root        45436 Nov  1 15:39 zcat

/dev:
lrwxrwxrwx   1 root     root            6 Nov  1 15:39 cdrom -> cdu31a
brw-rw-r--   1 root     root      15,   0 May  5  1998 cdu31a
crw-------   1 root     root       4,   0 Nov  1 15:29 console
crw-rw-rw-   1 root     uucp       5,  64 Sep  9 19:46 cua0
crw-rw-rw-   1 root     uucp       5,  65 May  5  1998 cua1
crw-rw-rw-   1 root     uucp       5,  66 May  5  1998 cua2
crw-rw-rw-   1 root     uucp       5,  67 May  5  1998 cua3
brw-rw----   1 root     floppy     2,   0 Aug  8 13:54 fd0
brw-rw----   1 root     floppy     2,  36 Aug  8 13:54 fd0CompaQ
brw-rw----   1 root     floppy     2,  84 Aug  8 13:55 fd0D1040
brw-rw----   1 root     floppy     2,  88 Aug  8 13:55 fd0D1120
brw-rw----   1 root     floppy     2,  12 Aug  8 13:54 fd0D360
brw-rw----   1 root     floppy     2,  16 Aug  8 13:54 fd0D720
brw-rw----   1 root     floppy     2, 120 Aug  8 13:55 fd0D800
brw-rw----   1 root     floppy     2,  32 Aug  8 13:54 fd0E2880
brw-rw----   1 root     floppy     2, 104 Aug  8 13:55 fd0E3200
brw-rw----   1 root     floppy     2, 108 Aug  8 13:55 fd0E3520
brw-rw----   1 root     floppy     2, 112 Aug  8 13:55 fd0E3840
brw-rw----   1 root     floppy     2,  28 Aug  8 13:54 fd0H1440
brw-rw----   1 root     floppy     2, 124 Aug  8 13:55 fd0H1600
brw-rw----   1 root     floppy     2,  44 Aug  8 13:55 fd0H1680
brw-rw----   1 root     floppy     2,  60 Aug  8 13:55 fd0H1722
brw-rw----   1 root     floppy     2,  76 Aug  8 13:55 fd0H1743
brw-rw----   1 root     floppy     2,  96 Aug  8 13:55 fd0H1760
brw-rw----   1 root     floppy     2, 116 Aug  8 13:55 fd0H1840
brw-rw----   1 root     floppy     2, 100 Aug  8 13:55 fd0H1920
lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H360 -> fd0D360
lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H720 -> fd0D720
brw-rw----   1 root     floppy     2,  52 Aug  8 13:55 fd0H820
brw-rw----   1 root     floppy     2,  68 Aug  8 13:55 fd0H830
brw-rw----   1 root     floppy     2,   4 Aug  8 13:54 fd0d360
brw-rw----   1 root     floppy     2,   8 Aug  8 13:54 fd0h1200
brw-rw----   1 root     floppy     2,  40 Aug  8 13:54 fd0h1440
brw-rw----   1 root     floppy     2,  56 Aug  8 13:55 fd0h1476
brw-rw----   1 root     floppy     2,  72 Aug  8 13:55 fd0h1494
brw-rw----   1 root     floppy     2,  92 Aug  8 13:55 fd0h1600
brw-rw----   1 root     floppy     2,  20 Aug  8 13:54 fd0h360
brw-rw----   1 root     floppy     2,  48 Aug  8 13:55 fd0h410
brw-rw----   1 root     floppy     2,  64 Aug  8 13:55 fd0h420
brw-rw----   1 root     floppy     2,  24 Aug  8 13:54 fd0h720
brw-rw----   1 root     floppy     2,  80 Aug  8 13:55 fd0h880
brw-rw----   1 root     disk       3,   0 May  5  1998 hda
brw-rw----   1 root     disk       3,   1 May  5  1998 hda1
brw-rw----   1 root     disk       3,   2 May  5  1998 hda2
brw-rw----   1 root     disk       3,   3 May  5  1998 hda3
brw-rw----   1 root     disk       3,   4 May  5  1998 hda4
brw-rw----   1 root     disk       3,   5 May  5  1998 hda5
brw-rw----   1 root     disk       3,   6 May  5  1998 hda6
brw-rw----   1 root     disk       3,  64 May  5  1998 hdb
brw-rw----   1 root     disk       3,  65 May  5  1998 hdb1
brw-rw----   1 root     disk       3,  66 May  5  1998 hdb2
brw-rw----   1 root     disk       3,  67 May  5  1998 hdb3
brw-rw----   1 root     disk       3,  68 May  5  1998 hdb4
brw-rw----   1 root     disk       3,  69 May  5  1998 hdb5
brw-rw----   1 root     disk       3,  70 May  5  1998 hdb6
crw-r-----   1 root     kmem       1,   2 May  5  1998 kmem
crw-r-----   1 root     kmem       1,   1 May  5  1998 mem
lrwxrwxrwx   1 root     root           12 Nov  1 15:39 modem -> ttyS1
lrwxrwxrwx   1 root     root           12 Nov  1 15:39 mouse -> psaux
crw-rw-rw-   1 root     root       1,   3 May  5  1998 null
crwxrwxrwx   1 root     root      10,   1 Oct  5 20:22 psaux
brw-r-----   1 root     disk       1,   1 May  5  1998 ram
brw-rw----   1 root     disk       1,   0 May  5  1998 ram0
brw-rw----   1 root     disk       1,   1 May  5  1998 ram1
brw-rw----   1 root     disk       1,   2 May  5  1998 ram2
brw-rw----   1 root     disk       1,   3 May  5  1998 ram3
brw-rw----   1 root     disk       1,   4 May  5  1998 ram4
brw-rw----   1 root     disk       1,   5 May  5  1998 ram5
brw-rw----   1 root     disk       1,   6 May  5  1998 ram6
brw-rw----   1 root     disk       1,   7 May  5  1998 ram7
brw-rw----   1 root     disk       1,   8 May  5  1998 ram8
brw-rw----   1 root     disk       1,   9 May  5  1998 ram9
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 ramdisk -> ram0

***  §Ú¥u§â¨Ñ§Ú¥Ø«eªº IDE partition §Q¥Îªº³]³Æ¥]¬A¶i¨Ó¡C
***  ¦pªG§A¨Ï¥Î SCSI ¡A¨º»ò½Ð§ï¥Î /dev/sdXX ªº³]³Æ¡C

crw-------   1 root     root       4,   0 May  5  1998 tty0
crw-w-----   1 root     tty        4,   1 Nov  1 15:39 tty1
crw-------   1 root     root       4,   2 Nov  1 15:29 tty2
crw-------   1 root     root       4,   3 Nov  1 15:29 tty3
crw-------   1 root     root       4,   4 Nov  1 15:29 tty4
crw-------   1 root     root       4,   5 Nov  1 15:29 tty5
crw-------   1 root     root       4,   6 Nov  1 15:29 tty6
crw-------   1 root     root       4,   7 May  5  1998 tty7
crw-------   1 root     tty        4,   8 May  5  1998 tty8
crw-------   1 root     tty        4,   9 May  8 12:57 tty9
crw-rw-rw-   1 root     root       4,  65 Nov  1 12:17 ttyS1
crw-rw-rw-   1 root     root       1,   5 May  5  1998 zero

/etc:
-rw-------   1 root     root          164 Nov  1 15:39 conf.modules
-rw-------   1 root     root          668 Nov  1 15:39 fstab
-rw-------   1 root     root           71 Nov  1 15:39 gettydefs
-rw-------   1 root     root          389 Nov  1 15:39 group
-rw-------   1 root     root          413 Nov  1 15:39 inittab
-rw-------   1 root     root           65 Nov  1 15:39 issue
-rw-r--r--   1 root     root          746 Nov  1 15:39 ld.so.cache
-rw-------   1 root     root           32 Nov  1 15:39 motd
-rw-------   1 root     root          949 Nov  1 15:39 nsswitch.conf
drwx--x--x   2 root     root         1024 Nov  1 15:39 pam.d
-rw-------   1 root     root          139 Nov  1 15:39 passwd
-rw-------   1 root     root          516 Nov  1 15:39 profile
-rwx--x--x   1 root     root          387 Nov  1 15:39 rc
-rw-------   1 root     root           55 Nov  1 15:39 shells
-rw-------   1 root     root          774 Nov  1 15:39 termcap
-rw-------   1 root     root           78 Nov  1 15:39 ttytype
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 utmp -> ../var/run/utmp
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 wtmp -> ../var/log/wtmp

/etc/pam.d:
-rw-------   1 root     root          356 Nov  1 15:39 other

/lib:
-rwxr-xr-x   1 root     root        45415 Nov  1 15:39 ld-2.0.7.so
lrwxrwxrwx   1 root     root           11 Nov  1 15:39 ld-linux.so.2 -> ld-2.0.7.so
-rwxr-xr-x   1 root     root       731548 Nov  1 15:39 libc-2.0.7.so
lrwxrwxrwx   1 root     root           13 Nov  1 15:39 libc.so.6 -> libc-2.0.7.so
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcom_err.so.2 -> libcom_err.so.2.0
-rwxr-xr-x   1 root     root         6209 Nov  1 15:39 libcom_err.so.2.0
-rwxr-xr-x   1 root     root       153881 Nov  1 15:39 libcrypt-2.0.7.so
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcrypt.so.1 -> libcrypt-2.0.7.so
-rwxr-xr-x   1 root     root        12962 Nov  1 15:39 libdl-2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libdl.so.2 -> libdl-2.0.7.so
lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libext2fs.so.2 -> libext2fs.so.2.4
-rwxr-xr-x   1 root     root        81382 Nov  1 15:39 libext2fs.so.2.4
-rwxr-xr-x   1 root     root        25222 Nov  1 15:39 libnsl-2.0.7.so
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libnsl.so.1 -> libnsl-2.0.7.so
-rwx--x--x   1 root     root       178336 Nov  1 15:39 libnss_files-2.0.7.so
lrwxrwxrwx   1 root     root           21 Nov  1 15:39 libnss_files.so.1 -> libnss_files-2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libpam.so.0 -> libpam.so.0.64
-rwxr-xr-x   1 root     root        26906 Nov  1 15:39 libpam.so.0.64
lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libpam_misc.so.0 -> libpam_misc.so.0.64
-rwxr-xr-x   1 root     root         7086 Nov  1 15:39 libpam_misc.so.0.64
-r-xr-xr-x   1 root     root        35615 Nov  1 15:39 libproc.so.1.2.6
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libpwdb.so.0 -> libpwdb.so.0.54
-rw-r-r---   1 root     root       121899 Nov  1 15:39 libpwdb.so.0.54
lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libtermcap.so.2 -> libtermcap.so.2.0.8
-rwxr-xr-x   1 root     root        12041 Nov  1 15:39 libtermcap.so.2.0.8
-rwxr-xr-x   1 root     root        12874 Nov  1 15:39 libutil-2.0.7.so
lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libutil.so.1 -> libutil-2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libuuid.so.1 -> libuuid.so.1.1
-rwxr-xr-x   1 root     root         8039 Nov  1 15:39 libuuid.so.1.1
drwx--x--x   3 root     root         1024 Nov  1 15:39 modules
drwx--x--x   2 root     root         1024 Nov  1 15:39 security

/lib/modules:
drwx--x--x   4 root     root         1024 Nov  1 15:39 2.0.35

/lib/modules/2.0.35:
drwx--x--x   2 root     root         1024 Nov  1 15:39 block
drwx--x--x   2 root     root         1024 Nov  1 15:39 cdrom

/lib/modules/2.0.35/block:
drwx------   1 root     root         7156 Nov  1 15:39 loop.o

/lib/modules/2.0.35/cdrom:
drwx------   1 root     root        24108 Nov  1 15:39 cdu31a.o

/lib/security:
-rwx--x--x   1 root     root         8771 Nov  1 15:39 pam_permit.so

***  ¨Ñ mount ®É¨Ï¥Îªº Directory stubs

/mnt:
drwx--x--x   2 root     root         1024 Nov  1 15:39 cdrom
drwx--x--x   2 root     root         1024 Nov  1 15:39 floppy

/proc:

/root:
-rw-------   1 root     root          176 Nov  1 15:39 .bashrc
-rw-------   1 root     root          182 Nov  1 15:39 .cshrc
-rwx--x--x   1 root     root          455 Nov  1 15:39 .profile
-rw-------   1 root     root         4014 Nov  1 15:39 .tcshrc

/sbin:
-rwx--x--x   1 root     root        23976 Nov  1 15:39 depmod
-rwx--x--x   2 root     root       274600 Nov  1 15:39 e2fsck
-rwx--x--x   1 root     root        41268 Nov  1 15:39 fdisk
-rwx--x--x   1 root     root         9396 Nov  1 15:39 fsck
-rwx--x--x   2 root     root       274600 Nov  1 15:39 fsck.ext2
-rwx--x--x   1 root     root        29556 Nov  1 15:39 getty
-rwx--x--x   1 root     root         6620 Nov  1 15:39 halt
-rwx--x--x   1 root     root        23116 Nov  1 15:39 init
-rwx--x--x   1 root     root        25612 Nov  1 15:39 insmod
-rwx--x--x   1 root     root        10368 Nov  1 15:39 kerneld
-rwx--x--x   1 root     root       110400 Nov  1 15:39 ldconfig
-rwx--x--x   1 root     root         6108 Nov  1 15:39 lsmod
-rwx--x--x   2 root     root        17400 Nov  1 15:39 mke2fs
-rwx--x--x   1 root     root         4072 Nov  1 15:39 mkfs
-rwx--x--x   2 root     root        17400 Nov  1 15:39 mkfs.ext2
-rwx--x--x   1 root     root         5664 Nov  1 15:39 mkswap
-rwx--x--x   1 root     root        22032 Nov  1 15:39 modprobe
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 reboot -> halt
-rwx--x--x   1 root     root         7492 Nov  1 15:39 rmmod
-rwx--x--x   1 root     root        12932 Nov  1 15:39 shutdown
lrwxrwxrwx   1 root     root            6 Nov  1 15:39 swapoff -> swapon
-rwx--x--x   1 root     root         5124 Nov  1 15:39 swapon
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 telinit -> init
-rwx--x--x   1 root     root         6944 Nov  1 15:39 update

/tmp:

/usr:
drwx--x--x   2 root     root         1024 Nov  1 15:39 bin
drwx--x--x   2 root     root         1024 Nov  1 15:39 lib
drwx--x--x   3 root     root         1024 Nov  1 15:39 man
drwx--x--x   2 root     root         1024 Nov  1 15:39 sbin
drwx--x--x   3 root     root         1024 Nov  1 15:39 share
lrwxrwxrwx   1 root     root           10 Nov  1 15:39 tmp -> ../var/tmp

/usr/bin:
-rwx--x--x   1 root     root        37164 Nov  1 15:39 afio
-rwx--x--x   1 root     root         5044 Nov  1 15:39 chroot
-rwx--x--x   1 root     root        10656 Nov  1 15:39 cut
-rwx--x--x   1 root     root        63652 Nov  1 15:39 diff
-rwx--x--x   1 root     root        12972 Nov  1 15:39 du
-rwx--x--x   1 root     root        56552 Nov  1 15:39 find
-r-x--x--x   1 root     root         6280 Nov  1 15:39 free
-rwx--x--x   1 root     root         7680 Nov  1 15:39 head
-rwx--x--x   1 root     root         8504 Nov  1 15:39 id
-r-sr-xr-x   1 root     bin          4200 Nov  1 15:39 passwd
-rwx--x--x   1 root     root        14856 Nov  1 15:39 tail
-rwx--x--x   1 root     root        19008 Nov  1 15:39 tr
-rwx--x--x   1 root     root         7160 Nov  1 15:39 wc
-rwx--x--x   1 root     root         4412 Nov  1 15:39 whoami

/usr/lib:
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libncurses.so.4 -> libncurses.so.4.2
-rw-r-r---   1 root     root       260474 Nov  1 15:39 libncurses.so.4.2

/usr/sbin:
-r-x--x--x   1 root     root        13684 Nov  1 15:39 fuser
-rwx--x--x   1 root     root         3876 Nov  1 15:39 mklost+found

/usr/share:
drwx--x--x   4 root     root         1024 Nov  1 15:39 terminfo

/usr/share/terminfo:
drwx--x--x   2 root     root         1024 Nov  1 15:39 l
drwx--x--x   2 root     root         1024 Nov  1 15:39 v

/usr/share/terminfo/l:
-rw-------   1 root     root         1552 Nov  1 15:39 linux
-rw-------   1 root     root         1516 Nov  1 15:39 linux-m
-rw-------   1 root     root         1583 Nov  1 15:39 linux-nic

/usr/share/terminfo/v:
-rw-------   2 root     root         1143 Nov  1 15:39 vt100
-rw-------   2 root     root         1143 Nov  1 15:39 vt100-am

/var:
drwx--x--x   2 root     root         1024 Nov  1 15:39 log
drwx--x--x   2 root     root         1024 Nov  1 15:39 run
drwx--x--x   2 root     root         1024 Nov  1 15:39 tmp

/var/log:
-rw-------   1 root     root            0 Nov  1 15:39 wtmp

/var/run:
-rw-------   1 root     root            0 Nov  1 15:39 utmp

/var/tmp:
\end{verbatim}
\end{tscreen}





\section{¤u¨ãµ{¦¡ºÏ¤ù (utility disk) ¥Ø¿ý¦Cªí¼Ë¥» -- Sample utility disk directory listing}

\label{utilitylist}
\nidx{utility diskette}

\begin{tscreen}
\begin{verbatim}
total 579
-rwxr-xr-x   1 root     root        42333 Jul 28 19:05 cpio
-rwxr-xr-x   1 root     root        32844 Aug 28 19:50 debugfs
-rwxr-xr-x   1 root     root       103560 Jul 29 21:31 elvis
-rwxr-xr-x   1 root     root        29536 Jul 28 19:04 fdisk
-rw-r-r---   1 root     root       128254 Jul 28 19:03 ftape.o
-rwxr-xr-x   1 root     root        17564 Jul 25 03:21 ftmt
-rwxr-xr-x   1 root     root        64161 Jul 29 20:47 grep
-rwxr-xr-x   1 root     root        45309 Jul 29 20:48 gzip
-rwxr-xr-x   1 root     root        23560 Jul 28 19:04 insmod
-rwxr-xr-x   1 root     root          118 Jul 28 19:04 lsmod
lrwxrwxrwx   1 root     root            5 Jul 28 19:04 mt -> mt-st
-rwxr-xr-x   1 root     root         9573 Jul 28 19:03 mt-st
lrwxrwxrwx   1 root     root            6 Jul 28 19:05 rmmod -> insmod
-rwxr-xr-x   1 root     root       104085 Jul 28 19:05 tar
lrwxrwxrwx   1 root     root            5 Jul 29 21:35 vi -> elvis
\end{verbatim}
\end{tscreen}


\end{document}
