\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{ ÖìººÅ© }}}
\date{v4.0, April 2000,
·­ÒëÈÕÆÚ: 27 July 2000}
\abstract{±¾ÎÄÃèÊöÈçºÎÉè¼ÆÓë½¨ÔìÄã×Ô¼ºµÄ Linux boot/root ´ÅÆ¬¡£ÕâÐ©´ÅÆ¬ÄÜÓÃÀ´µ±×ö¾ÈÔ®´ÅÆ¬ (rescue disks) £¬»òÊÇÄÜÓÃÀ´²âÊÔÐÂÏµÍ³Ôª¼þ (components) ¡£ÔÚÆóÍ¼½¨ÔìÄã×Ô¼ºµÄ bootdisk Ö®Ç°£¬ÄãÓ¦¸ÃÒªÏàµ±ÊìÏ¤ÏµÍ³¹ÜÀí¹¤×÷¡£Èç¹ûÄãÖ»ÊÇÏëÒªÒ»ÕÅ½ô¼±Ê±Ê¹ÓÃµÄ¾ÈÔ®´ÅÆ¬£¬Çë²Î¿¼ \ref{PreMade} {(Pre-made bootdisks)} ¡£}


\begin{document}
\maketitle
\tableofcontents

\section{Ç°ÑÔ -- Preface}



{\bfseries  Õâ·ÝÎÄ¼þ¿ÉÄÜÒÑ¾­¹ýÆÚÁË¡£ } Èç¹û±êÌâÒ³ÉÏµÄÈÕÆÚ¾à½ñÒÑ³¬¹ý 6 ¸öÔÂ£¬ÄÇ÷áÇë²éÔÄ \nameurl{http://www.croftj.net/~fawcett/Bootdisk-HOWTO/index.html}{Bootdisk-HOWTO homepage} ¿´¿´ÊÇ·ñÒÑÓÐ½ÏÐÂµÄ°æ±¾¡£

ËäÈ»±¾ÎÄÒÔ text ¸ñÊ½Ò²ÊÇ¿ÉÒÔÔÄ¶Á£¬µ«ÊÇÒòÎªÓ¡Ë¢·ûºÅµÄ¹ØÏµ£¬ {\itshape  ×îºÃ \/} »¹ÊÇÒÔ Postscript ({\ttfamily .ps}) ¡¢ PDF »ò HTML µÄ¸ñÊ½À´ÔÄ¶Á¡£




\subsection{°æ±¾×¢ÒâÊÂÏî -- Version notes}

\nidx{kernel, versions}

Graham Chapman ÊÇÔ­±¾ Bootdisk-HOWTO µÄ×÷Õß£¬ËûÒ»Ö±Ìá¹©Ö§Ô®µ½ version 3.1 ¡£ Tom Fawcett ´óÔ¼ÊÇÔÚ kernel v2 ÎÊÊÐÊ±³ÉÎªºÏ×÷×÷Õß¡£ËûÊÇ±¾ÎÄÄ¿Ç°µÄÎ¬»¤Õß¡£

ÎÄÖÐ×ÊÑ¶ÊÇ¸øÔÚ {\bfseries Intel} Æ½Ì¨ÉÏÔË×÷µÄ Linux Ê¹ÓÃ¡£ÆäÖÐÐí¶à×ÊÑ¶Ò²ÐíÄÜÓ¦ÓÃÔÚÆäËüÆ½Ì¨µÄ Linux £¬µ«ÊÇÎÒÃÇ²¢Ã»ÓÐ³¢ÊÔÔÚÆäËüÆ½Ì¨ÖÆ×÷ bootdisk £¬Ò²Ã»ÓÐÏà¹ØµÄ×ÊÑ¶¡£Èç¹ûÄãÓÐÔÚÆäËüÆ½Ì¨ÉÏÖÆ×÷ bootdisk µÄ¾­Ñé£¬ÇëÓëÎÒÃÇÁªÂç¡£




\subsection{ÉÐÎ´Íê³ÉµÄÊÂ }



ÓÐÈÎºÎ×ÔÔ¸ÕßÂð ?

\begin{enumerate}
\item  ÇëÃèÊö (»òÊÇÁ´½áµ½ÁíÒ»·ÝÓÐÐðÊöµÄÎÄ¼þ)ÈçºÎÖÆ×÷ÆäËü¿É¿ª»úµÄÀà´ÅÆ¬ÎïÆ·£¬ÖîÈç CDROMs, ZIP disks Óë LS110 disks ¡£
            
\item  ÇëÃèÊöÈçºÎ´¦Àí¾Þ´óµÄ \url{libc.so} ¹²Ïíº¯Ê½¿â¡£»ù±¾ÉÏ¿ÉÑ¡Ôñ»ñÈ¡½Ï¾É¡¢½ÏÐ¡µÄº¯Ê½¿â£¬»òÊÇÉ¾¼õÏÖÓÐµÄº¯Ê½¿â¡£
\item  ÖØÐÂ·ÖÎö distribution bootdisks Óë¸üÐÂ "How the Pros do it" ÕâÒ»½Ú¡£
           
\item  É¾¼õÐðÊö¹Øì¶ÈçºÎÉý¼¶ÏÖÓÐ distribution bootdisks µÄÕÂ½Ú¡£ This is usually more trouble than it's worth.
\item  ÖØÐ´ / ÈóÊÎ Troubleshooting ÕâÒ»½Ú¡£
\end{enumerate}





\subsection{»ØÓ¦Óë¸ÐÐ» -- Feedback and credits}



ÎÒ½ÓÊÜÈÎºÎ¹Øì¶±¾ÎÄÄÚÈÝÖ®»ØÓ¦£¬ÎÞÂÛÊÇºÃÊÇ»µ¡£ÎÒ/ÎÒÃÇ ÒÑÁ¦ÇóÕâ·ÝÎÄ¼þÄÚµÄÖ¸ÁîÓë×ÊÑ¶ÊÇÕýÈ·¶ø¿É¿¿µÄ¡£Èç¹ûÄã·¢ÏÖÈÎºÎ´íÎó»òÒÅÂ©£¬ÇëÈÃÎÒÖªµÀ¡£ÔÚ×«Ð´Ê±£¬ {\itshape  ÇëÖ¸³öÄãËù²Î¿¼µÄÎÄ¼þÖ®°æ±¾ºÅÂë \/} ¡£

ÎÒÃÇ¸ÐÐ»Ðí¶àÐ­ÖúÐÞÕýÓë¸øÓè½¨ÒéÖ®ÈË¡£ËûÃÇµÄ¹±Ï×Ê¹µÃ±¾ÎÄ±ÈÎÒÃÇ×Ô¼º¶ÀÁ¢Íê³ÉËüÊ±»¹À´µÃ¸üºÃ¡£

Çë¸÷Î»ÀûÓÃÉÏÊöµÄ email µØÖ·£¬¸øÓè×÷ÕßÄãµÄÅúÆÀ¡¢Ö¸ÕýÓëÒÉÎÊ¡£ÎÒ²»½éÒâ³¢ÊÔ»Ø´ðÈÎºÎÎÊÌâ£¬µ«ÊÇÈç¹ûÄãÓÐÌØ¶¨ÎÊÌâÊÇ¹Øì¶ÄãµÄ bootdisk ²»ÄÜÔË×÷£¬ÄÇ÷áÇëÏÈÔÄ¶Á \ref{Troubleshooting} {(Troubleshooting)} ¡£




\subsection{É¢²¼Õþ²ß -- Distribution policy}

Copyright \copyright{} 1995,1996,1997,1998,1999,2000 by Tom Fawcett and Graham Chapman. ±¾ÎÄ¿ÉÒÔÔÚ \nameurl{http://linuxdoc.org/copyright.html}{Linux Documentation Project License} µÄÌõ¼þÏÂÁ÷Í¨¡£Èç¹ûÄãÎ´ÄÜÄÃµ½´Ë license £¬ÇëÓë×÷ÕßÁªÂç¡£

±¾ÎÄÊÇÒ»·ÝÃâ·ÑÎÄ¼þ¡£ÎÒÃÇ·¢ÐÐËüÊÇÏ£ÍûËüÄÜÓÐÖúì¶Äã£¬µ«ÊÇ {\bfseries  ²»ÄÜ¸øÄãÈÎºÎ±£Ö¤ } £»±¾ÎÄÒ²Ã»ÓÐ {\bfseries  ¾ßÓÐÉÌÒµÄÜÁ¦ } »ò {\bfseries  ÊÊºÏÌØ¶¨ÓÃÍ¾ } µÄ±£Ö¤¡£






\section{¼ò½é -- Introduction}



Linux ¿ª»ú´ÅÆ¬ (boot disks) ÔÚºÜ¶àÇé¿öÏÂÊÇºÜÓÐÓÃµÄ£¬ÖîÈç
\begin{itemize}
\item  ²âÊÔÒ»¸öÐÂµÄºËÐÄ (kernel)¡£
\item  ´Ó´Åµú´íÎóÖÐ¸´Ô­ (ÕâÀà´íÎó´ÓÒÅÊ§¿ª»ú´ÅÇøµ½´Åµú¶ÁÐ´Í·»ÙËð¶¼ÓÐ¿ÉÄÜ) ¡£
\item ÐÞ¸´Ò»¸öÌ±»¾ (disabled) µÄÏµÍ³
\item °²È«µØÉý¼¶ÁÙ½ç¹²ÓÃ (critical) µÄÏµÍ³µµ°¸ (ÖîÈç \url{libc.so}) ¡£
\end{itemize}


ÓÐºÃ¼¸ÖÖ»ñµÃ boot disks µÄ·½·¨£º

\begin{itemize}
\item  Ê¹ÓÃ·¢ÐÐÌ×¼þ (distribution) ÏñÊÇ Slackware ËùÌá¹©µÄ¡£ËüÖÁÉÙÄÜÈÃÄã¿ª»ú¡£
          
\item  Ê¹ÓÃ¾ÈÔ®Ì×¼þ (package) ½¨ÔìÓÃÀ´×öÎª¾ÈÔ®´ÅÆ¬µÄ´ÅÆ¬¡£
          
\item  Ñ§Ï°Ã¿Ò»ÖÖ disk ÔË×÷ÏµÍ³Ê±ËùÐèµÄ¶«Î÷£¬È»áá×Ô¼ºÖÆ×÷¡£
\end{itemize}


ÓÐÐ©ÈËÑ¡Ôñ×îááÒ»ÖÖ·½·¨£¬Èç´ËËûÃÇÄÜ¿¿×Ô¼º¶¯ÊÖ×ö¡£ÕâÑù×Ó£¬Èç¹ûÄ³´¦·¢ÉúÎÊÌâ£¬¾ÍÄÜÕÒ
³ö°ì·¨È¥½â¾öÎÊÌâ¡£´ËÍâÒ²¿ÉÒÔÑ§µ½ºÜ¶àÓÐ¹Ø Linux ÈçºÎÔË×÷µÄÖªÊ¶¡£

±¾ÎÄ¼ÙÉè¶ÁÕßÒÑÊìÏ¤»ù±¾µÄ Linux ÏµÍ³¹ÜÀí¹ÛÄî¡£¾ÙÀýÀ´Ëµ£¬ÄãÓ¦¸ÃÖªµÀÓÐ¹ØÄ¿Â¼¡¢ filesystems ÓëÈíµúÆ¬µÄÒéÌâ¡£ÄãÒ²Ó¦¸ÃÖªµÀÈçºÎÊ¹ÓÃ {\ttfamily mount} Óë {\ttfamily df} ¡£Äã»¹Ó¦¸ÃÖªµÀ \url{/etc/passwd} Óë \url{fstab} ÕâÁ½¸öµµ°¸µÄÓÃÍ¾ÒÔ¼°ËüÃÇ¿´ÆðÀ´ÏñÊ²÷á¡£×îáá£¬ÄãÓ¦¸ÃÖªµÀ HOWTO ÎÄ¼þÄÚ´ó²¿·ÖµÄÖ¸Áî£¬¶¼ÒªÒÔ root µÄÉí·ÝÀ´Ö´ÐÐ¡£

¸Õ¿ªÊ¼ÖÆ×÷Äã×Ô¼ºµÄ bootdisk ÊÇºÜ¸´ÔÓµÄ¡£Èç¹ûÄãÎ´Ôø¶Á¹ý Linux FAQ ÓëÏà¹ØÎÄ¼þ£¬ÖîÈç Linux Installation HOWTO Óë Linux Installation Guide £¬ÄÇ÷áÄã²»Ó¦¸Ã³¢ÊÔ½¨Ôì¿ª»ú´ÅÆ¬¡£Èç¹ûÄãÖ»ÐèÒª½ô¼±Ê±ÓÃµÄ bootdisk £¬ÏÂÔØÒ»¸ö±ðÈËÊÂÏÈÍê³ÉµÄ bootdisk ÄÃÀ´ÓÃ»á {\itshape  ¸ü \/} ÎªÈÝÒ×¡£Çë²Î¿¼ÏÂÃæµÄ \ref{PreMade} {(Pre-made bootdisks)} ÒÔµÃÖªÔÚÄÄÀï¿ÉÒÔÕÒµ½ÕâÐ©¶«Î÷¡£




\section{BootdisksÓë¿ª»úÁ÷³Ì -- Bootdisks and the boot process}

\nidx{boot process}

bootdisk »ù±¾ÉÏÊÇ·ÅÔÚÈíµúÆ¬ÄÚµÄÒ»¸öÐ¡ÐÍ¶ø×Ô×ãµÄ Linux ÏµÍ³¡£Ëü±ØÐëÖ´ÐÐÐí¶àºÍÍêÕûÓÖ full-size µÄ Linux ÏµÍ³ÏàÍ¬µÄ¹¦ÄÜ¡£ÔÚ½¨Ôì bootdisk Ö®Ç°£¬ÄãÓ¦¸ÃÁË½â»ù±¾µÄ Linux ¿ª»úÁ÷³Ì¡£ÎÒÃÇÔÚ´ËÖ»×ö»ù±¾µÄ½éÉÜ£¬µ«ÒÑ×ã¹»ÈÃÄãÁË½â±¾ÎÄÖ®ááµÄÄÚÈÝ¡£ºÜ¶àÏ¸½ÚÓëÌæ´úÑ¡ÏîÒÑ±»Ê¡ÂÔ¡£




\subsection{¿ª»úÁ÷³Ì -- The boot process}

\nidx{boot sector}

ËùÓÐ PC ÏµÍ³¿ªÊ¼¿ª»úÁ÷³Ì¶¼ÊÇ½åÓÉÖ´ÐÐ ROM (Ã÷È·µØËµ£¬¾ÍÊÇ \idx{BIOS}) ÖÐµÄ³ÌÊ½£¬´Ó¿ª»ú´Åµú»úµÄµÚ 0 ´ÅÇø¡¢µÚ 0 ´ÅÖùÔØÈë¿É¹©¿ª»úµÄ´ÅÇø¡£¿ª»ú´Åµú»úÍ¨³£ÊÇµÚÒ»Ì¨Èíµú»ú (Èç DOS µÄ {\ttfamily A²Û } Óë Linux µÄ \url{/dev/fd0})¡£½ÓÖø BIOS »á³¢ÊÔÖ´ÐÐÕâ¸ö´ÅÇø¡£ÔÚ´ó²¿·Ö¿É¿ª»úµÄ disks ÉÏ£¬µÚ 0 ´ÅÇø¡¢µÚ 0 ´ÅÖù°üº¬ÒÔÏÂÁ½ÕßÖ®Ò»£º

\begin{itemize}
\item  ¿ª»úÔØÈë³ÌÊ½ (boot loader £¬Èç LILO)µÄ³ÌÊ½Âë£¬Ëü»áÕÒ³ö kernel ËùÔÚÎ»ÖÃ£¬½ÓÖøÔØÈë²¢Ö´ÐÐËüÒÔÆô¶¯¿ª»ú³ÌÐò¡£
\item  Ò»¸ö×÷ÒµÏµÍ³ kernel µÄ¿ªÍ· (start) £¬ÖîÈç Linux ¡£
\end{itemize}


Èç¹ûÒ»¸ö Linux kernel ÒÑÀûÓÃ raw-copied µÄ·½Ê½ÖÃÈëÒ»ÕÅ´ÅÆ¬ÄÚ£¬ÄÇ÷áÕâÕÅ´ÅÆ¬µÄµÚÒ»¸ö´ÅÇø¾ÍÊÇ Linux kernel ±¾ÉíµÄµÚÒ»¸ö´ÅÇø¡£Õâ¸ö´ÅÇø½«´Ó¿ª»úÉè±¸ÔØÈë kernel µÄÊ£âÅ²¿·ÖÒÔ¼ÌÐø¿ª»úÁ÷³Ì¡£

Ò»µ© kernel ÔØÈëÍê±Ï£¬Ò»Ð©»ù±¾Éè±¸Ò²Íê³É³õÊ¼»¯ (initialization) ¡£È»ááÏµÍ³½«³¢ÊÔ´ÓÄ³¸öÉè±¸ÔØÈëÒÔ¼°¹ÒÉÏ (mount) {\bfseries \idx{root filesystem}} ¡£ËùÎ½µÄ root filesystem Ö»ÊÇÒ»¸ö±»¹ÒÉÏµ±×÷ ``\url{/}'' Ä¿Â¼µÄ filesystem ¡£ kernel ±ØÐë±»¸æÖª¿É´ÓÄÄÀïÕÒµ½´Ë root filesystem £»Èç¹û kernel ÔÚÄÇÀïÕÒ²»µ½Ò»¸ö¿ÉÔØÈëµÄÓ°Ïñµµ (image) £¬ÏµÍ³¾Í»áÍ£Ö¹ÔË×÷ (halt) ¡£

ÔÚÄ³Ð©¿ª»úÇé¿öÏÂ -- ³£³£ÊÇ´ÓÈíµúÆ¬¿ª»ú -- root filesystem »á±»ÔØÈëµ½ {\bfseries \idx{ramdisk}} ÖÐ£¬Ò²¾ÍÊÇ±»ÏµÍ³Ëù´æÈ¡µÄ RAM £¬ÈçÍ¬ÏµÍ³´æÈ¡´ÅµúÒ»°ã¡£ÎªºÎÏµÍ³»áÔØÈëµ½ ramdisk µÄÀíÓÉÓÐ¶þ¡£µÚÒ»£¬ RAM ÊÇ¼¸¸ö±ÈÈíµúÆ¬¿ìµÄÓÐÐò´ÅÐÔÌå£¬ËùÒÔÏµÍ³ÔÚÆäÉÏÔË×÷½Ï¿ì£» µÚ¶þ£¬ kernel ¿ÉÒÔ´ÓÈíµúÆ¬ÔØÈëÒ»¸ö {\bfseries \idx{Ñ¹ËõµÄfilesystem}} ²¢ÇÒÔÚ½âÑ¹Ëõáá·Åµ½ ramdisk ÉÏ£¬Èç´Ë¿ÉÈÃ¸ü¶àµÄµµ°¸´¢´æÔÚÈíµúÆ¬ÉÏ¡£

Ò»µ© root filesystem ±»ÔØÈë²¢¹ÒÉÏ£¬Äã»á¿´µ½Ò»ÐÐÑ¶Ï¢Ïñ£º
\begin{verbatim}
        VFS: Mounted root (ext2 filesystem) readonly.
\end{verbatim}


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

´ËÊ±ÏµÍ³»áÔÚ root filesystem ÉÏÕÒµ½ {\ttfamily init} ³ÌÊ½ ( ÔÚ \url{/bin} or \url{/sbin}) ²¢Ö´ÐÐËü¡£ \url{init} ¶ÁÈ¡ËüµÄ×éÌ¬Éè¶¨µµ (configuration file) \url{/etc/inittab} £¬ÕÒ³öµµÖÐ±êÃ÷ {\ttfamily sysinit} µÄÒ»ÐÐ£¬²¢Ö´ÐÐ±»Ö¸ÃûµÄscript¡£Õâ¸ö {\ttfamily sysinit} script Í¨³£ÀàËÆ \url{/etc/rc} »ò \url{/etc/init.d/boot} ÕâÁ½¸öµµ¡£Õâ¸ö script ÊÇÒ»×é½¨Á¢»ù±¾ÏµÍ³·þÎñµÄ shell Ö¸Áî£¬ÖîÈç£º

\begin{itemize}
\item  ¶ÔËùÓÐ´ÅµúÖ´ÐÐ {\ttfamily fsck},
\item  ÔØÈë±Ø±¸µÄºËÐÄÄ£×é (modules),
\item  Æô¶¯ swapping,
\item  ½øÐÐÍøÂ·³õÊ¼»¯,
\item  ½«Ö¸¶¨ÔÚ {\ttfamily \cdx{fstab}} ÄÚµÄ´Åµú¹ÒÉÏ¡£
\end{itemize}


Õâ¸ö script ³£»áÆô¶¯ÆäËü¸÷ÖÖ²»Í¬µÄ scripts Ö´ÐÐÄ£×éµÄ (modular) ³õÊ¼»¯¡£¾ÙÀýÀ´Ëµ£¬ÔÚÒ»°ãµÄ SysVinit ¼Ü¹¹ÏÂ£¬ \url{/etc/rc.d/} Õâ¸öÄ¿Â¼°üº¬Ò»¸ö¸´ÔÓµÄ×ÓÄ¿Â¼¼Ü¹¹£¬ÆäÖÐµÄµµ°¸Ö¸³öÈçºÎÆô¶¯Óë¹Ø±Õ´ó²¿·ÖµÄÏµÍ³·þÎñ¡£È»¶ø£¬ÔÚÒ»ÕÅ bootdisk ÉÏ£¬ÕâÑùµÄ sysinit script ³£³£ÊÇ·Ç³£¼òµ¥µÄ¡£

µ± sysinit script ½áÊøáá£¬¿ØÖÆÈ¨»Øµ½ {\ttfamily init} ÉÏ£¬½ÓÖø½øÈë {\itshape  Ô¤ÉèµÄrunlevel\/} £¬´ËÔ¤ÉèµÄ runlevel ÒÔ {\ttfamily initdefault} Õâ¸ö¹Ø¼ü×Ö±»Ö¸¶¨ÔÚ \url{inittab} ÄÚ¡£´Ë runlevel line Í¨³£Ö¸¶¨Ò»¸öÏñ  {\ttfamily \cdx{getty}} µÄ³ÌÊ½£¬Õâ¸ö³ÌÊ½¸ºÔð´¦Àí console Óë ttys Ö®¼äµÄÍ¨Ñ¶¡£ÊÂÊµÉÏ£¬¾ÍÊÇ {\ttfamily getty} ³ÌÊ½ÔÚÓ©Ä»ÉÏÓ¡³öÊìÏ¤µÄ ``{\ttfamily login:}'' ÌáÊ¾¡£ {\ttfamily getty} ³ÌÊ½²¢×ª¶øºô½Ð {\ttfamily login} ³ÌÊ½ÒÔ´¦Àí login ÊÇ·ñÓÐÐ§£¬²¢ì¶Ö®áá½¨Á¢ user sessions ¡£




\subsection{´ÅµúÀàÐÍ -- Disk types}



Èç¹ûÄãÒÑÁË½â»ù±¾µÄ¿ª»úÁ÷³Ì£¬ÄÇ÷áÎÒÃÇÏÖÔÚ¿ÉÒÔ¶¨ÒåËùÉæ¼°µ½Ö®¸÷ÖÖ²»Í¬ÀàÐÍµÄ´Åµú¡£ÎÒÃÇ½«´Åµú·ÖÀà³ÉËÄÖÖ¡£±¾ÎÄÓëÔÚ´ËÌÖÂÛËù³ÆÖ® ``´Åµú (disk)'' ³ý·ÇÓÐÌØ±ðÉùÃ÷£¬·ñÔò¶¼ÊÇÖ¸ÈíµúÆ¬£¬ËäÈ»¾ø´ó²¿·ÖµÄÌÖÂÛÒ²Í¬Ñù¿ÉÓ¦ÓÃÔÚÓ²µúÉÏ¡£

\begin{description}


\item[boot] \mbox{}

Ò»ÕÅ°üº¬¿É±»Æô¶¯Ö® kernel µÄ´ÅÆ¬¡£ÕâÕÅ´ÅÆ¬±»ÓÃÀ´Æô¶¯ kernel £¬½ÓÖøÕâ¸ö kernel »áÔØÈëÔÚÁíÒ»ÕÅ´ÅÆ¬ÉÏµÄ root file system ¡£ÔÚ bootdisk ÉÏµÄ kernel Í¨³£±ØÐë±»¸æÖªµ½ÄÄÈ¥ÕÒËüµÄ root filesystem ¡£

bootdisk ³£»á´ÓÁíÒ»ÕÅ´ÅÆ¬ÔØÈëÒ»¸ö root filesystem £¬µ«ÊÇÏà·´µØ£¬ bootdisk Ò²ÓÐ¿ÉÄÜ±»Éè¶¨³ÉÔØÈëÓ²µúµÄ root filesystem ¡£Ò»°ãÔÚ²âÊÔÐÂ kernel Ê±»áÕâÑù×ö (ÊÂÊµÉÏ£¬ ``{\ttfamily make zdisk}'' »á×Ô¶¯µØ´Ó kernel µÄÔ­Ê¼ÂëÖÆÔì³öÕâÑùµÄÒ»ÕÅ bootdisk ¡£



\item[root] \mbox{}

ÔÚÆä filesystem ÉÏ°üº¬ÔË×÷ Linux ÏµÍ³±Ø±¸µµ°¸µÄÒ»ÕÅ´ÅÆ¬¡£ÕâÕÅ´ÅÆ¬²»Ò»¶¨ÓÐ kernel »ò boot loader ¡£ \nidx{root disk}

Ò»µ© kernel ±»Æô¶¯áá£¬ root disk ¾Í¿ÉÒÔ¶ÀÁ¢ì¶ÆäËü´ÅÆ¬À´ÔË×÷ÏµÍ³¡£Í¨³£ root disk µÄÄÚÈÝ»á±»×Ô¶¯µØ copy µ½ RAM ¶ø³ÉÎª ramdisk ¡£ÕâÊ¹µÃ root disk µÄ´æÈ¡±äµÃ¸üÎª¿ìËÙ£¬¶øÇÒ¿ÉÊÍ·ÅÒ»Ì¨Èíµú»ú¸ø¹¤¾ß³ÌÊ½´ÅÆ¬ (utility disk)¡£



\item[boot/root] \mbox{}

Ò»ÕÅÍ¬Ê±°üº¬ kernel Óë root filesystem µÄ´ÅÆ¬¡£»»¾ä»°Ëµ£¬ÕâÕÅ´ÅÆ¬°üº¬²»ÓÃÓ²µú¶øÄÜÆô¶¯ÓëÔË×÷ Linux ÏµÍ³Ö®ËùÓÐ±Ø±¸ÏîÄ¿¡£ÕâÖÖ´ÅÆ¬µÄÓÅµãÔÚì¶¼òµ¥Çá±ã -- Ã¿Ò»Ïî±Ø±¸µÄ¶«Î÷¶¼·ÅÔÚÍ¬Ò»ÕÅ´ÅÆ¬ÉÏ¡£È»¶ø£¬ËæÖøµµ°¸ size µÄÖð½¥Ôö¼Ó£¬ÈÃËùÓÐ¶«Î÷¶¼´æÔÚÍ¬Ò»ÕÅ´ÅÆ¬ÉÏ¾ÍÔ½ÏÔÀ§ÄÑ£¬ÉõÖÁÀûÓÃÑ¹ËõÒ²Ò»Ñù¡£



\item[utility] \mbox{}

Ò»ÕÅ°üº¬ filesystem µÄ´ÅÆ¬£¬µ«ÊÇ²¢²»ÊÇÒª¹ÒÉÏ×öÎª root file system À´Ê¹ÓÃ¡£ÕâÕÅ´ÅÆ¬¿ÉÊÓÎª¶îÍâµÄ×ÊÁÏÆ¬ (data disk) ¡£Äã¿ÉÒÔÀûÓÃÕâÖÖ´ÅÆ¬°ÑÔ­±¾¹ý¶à¶ø²»ÄÜ·ÅÔÚ root disk ÉÏµÄ¹¤¾ß³ÌÊ½·ÅÔÚÆäÉÏ¡£
\nidx{utility diskette}

\end{description}


Ò»°ã¶øÑÔ£¬µ±ÎÒÃÇÌá¼° ``½¨ÔìÒ»ÕÅ bootdisk'' Ê±£¬ÊÇÖ¸Ôì³ö boot ( kernel ) Óë root (files) ÕâÁ½¸ö²¿·Ö¡£ÕâÁ½¸ö²¿·Ö²»ÊÇ·ÅÔÚÒ»Æð (Ò»ÕÅµ¥ÕÅµÄboot/root disk) £¬¾ÍÊÇÁ½ÕÅ·Ö¿ªµÄ´ÅÆ¬ (boot + root disks) ¡£¶Ô¾ÈÔ®´ÅÆ¬¶øÑÔ×î¾ßµ¯ÐÔÖ®×ö·¨£¬¿ÉÄÜÊÇÊ¹ÓÃÁ½ÕÅ·Ö¿ªµÄ boot Óë root ´ÅÆ¬£¬ÔÙ¼ÓÉÏÒ»ÕÅ»ò¶àÕÅµÄ utility diskettes ÒÔ´¦Àí¶à³öÀ´µÄ¶«Î÷¡£




\section{½¨Á¢Ò»¸öroot filesystem -- Building a root filesystem}

\label{BuildRoot}

Ôì³ö root filesystem Éæ¼°Ñ¡ÔñÄÜÈÃÏµÍ³Õý³£ÔË×÷Ëù±Ø±¸µÄµµ°¸¡£ÔÚÕâÒ»½ÚÖÐ£¬ÎÒÃÇ½«ÐðÊöÈçºÎ½¨ÔìÒ»¸ö {\itshape \idx{ Ñ¹ËõµÄ root filesystem}\/} ¡£ÔÚ´ÅÆ¬ÉÏ½¨ÔìÒ»¸öÖ±½Ó¹ÒÉÏ×öÎª¸ùÄ¿Â¼ (root) Ö®Î´¾­Ñ¹ËõµÄ filesystem ÊÇ½Ï²»ÆÕ±éµÄ¹ÛÄî£»Õâ¸öÌæ´ú·½°¸ÐðÊöÔÚ \ref{NonRamdiskRoot} {(Non-ramdisk Root Filesystem)} ÕâÒ»½ÚÖÐ¡£




\subsection{¸Å¹Û -- Overview}



root filesystem ±ØÐë°üº¬Ö§Ô®ÍêÕû Linux ÏµÍ³ÔË×÷ËùÐèµÄÃ¿Ò»¸öÏîÄ¿¡£ÎªÁËÄÜ¹»´ï³ÉÕâ¸öÄ¿µÄ£¬ÕâÕÅ´ÅÆ¬±ØÐë°üÀ¨ÄÜÈÃ Linux ÏµÍ³ÔË×÷×îÆðÂë (minimum) µÄÐèÇó£º

\begin{itemize}
\item  »ù±¾µÄµµ°¸ÏµÍ³¼Ü¹¹£¬
\item  ×îÆðÂëµÄÄ¿Â¼£º {\ttfamily /dev, /proc, /bin, /etc, /lib, /usr, /tmp},
\item  »ù±¾µÄ¹¤¾ß³ÌÊ½£º {\ttfamily sh, ls, cp, mv}, etc.,
\item  ×îÆðÂëµÄ×éÌ¬Éè¶¨µµ£º {\ttfamily rc, inittab, fstab}, etc.,
\item  Éè±¸µµ£º {\ttfamily /dev/hd*, /dev/tty*, /dev/fd0}, etc.,
\item  Runtime º¯Ê½¿âÒÔÌá¹©¹¤¾ß³ÌÊ½ËùÊ¹ÓÃÖ®»ù±¾¹¦ÄÜ (functions) ¡£
\end{itemize}


µ±È»£¬ÈÎºÎÏµÍ³Ö»ÓÐÔÚÄãÄÜì¶ÆäÉÏÖ´ÐÐÄ³Ð©¶«Î÷Ê±²Å»áÏÔµÃÓÐÓÃ£¬¶øÒ»ÕÅ root ´ÅÆ¬Í¨³£Ö»ÓÐÔÚÄãÄÜ×öµ½ÒÔÏÂÊÂÇéÊ±²Å»áÏÔµÃÓÐÓÃ£º

\begin{itemize}
\item  ¼ì²éÁíÒ»Ì¨´Åµú»úµÄ file system £¬¾ÙÀýÀ´Ëµ£¬¼ì²éÄãÓ²µúÉÏµÄ root file system £¬Äã±ØÐëÄÜ¹»´ÓÁíÒ»Ì¨´Åµú»úÆô¶¯ Linux £¬ÀýÈçÄã¿ÉÒÔÓÃÒ»ÕÅ root ´ÅÆ¬°ìµ½Õâ¼þÊÂ¡£È»ááÄã¿ÉÒÔÔÚÄãÔ­±¾µÄ root ´Åµú»úÎ´±»¹ÒÉÏÊ±£¬¶ÔÆäÖ´ÐÐ {\ttfamily \cdx{fsck} } ¡£
\item  Ê¹ÓÃµµ°¸ (archive) ÓëÑ¹Ëõ¹¤¾ß³ÌÊ½£¬ÖîÈç {\ttfamily cpio, tar, gzip} Óë {\ttfamily ftape} £¬´Ó±¸·Ý (backup) »Ö¸´´¢´æËùÓÐ»ò²¿·ÖÄãÔ­±¾ root ´Åµú»úµÄ×ÊÁÏ¡£
\end{itemize}


ÎÒÃÇ½«ÐðÊöÈçºÎ½¨ÔìÒ»¸ö {\itshape  Ñ¹ËõµÄ \/} filesystem £¬¾ÍÊÇÆ½Ê±±»Ñ¹ËõÔÚ´ÅÆ¬ÉÏ£¬Ö»ÓÐµ±¿ª»úÊ±£¬²Å»á½âÑ¹Ëõáá´æÈëramdisk ¡£
\nidx{compressed root filesystem}
ÓÃÑ¹Ëõ filesystem µÄ·½Ê½£¬Äã¿ÉÒÔÔÚÒ»ÕÅ±ê×¼µÄ 1440K ´ÅÆ¬ÉÏ·ÅÈëºÜ¶àµµ°¸ (´óÔ¼ 6 megabytes) ¡£ÒòÎª filesystem ±È´ÅÆ¬´óºÜ¶à£¬ÎÒÃÇ²»ÄÜÖ±½Ó°ÑËü½¨ÔÚ´ÅÆ¬ÉÏ¡£ÎÒÃÇ±ØÐëÔÚÆäËüµØ·½½¨Á¢Ëü£¬Ñ¹ËõËü£¬È»ááÔÙ°ÑËü copy µ½´ÅÆ¬ÉÏ¡£




\subsection{ÖÆ×÷ filesystem -- Creating the filesystem}

\label{CreatingRootFS}

ÎªÁË½¨ÔìÈç´ËµÄÒ»¸ö filesystem £¬ÄãÐèÒªÒ»¸ö¶à³ö¶ø¹»´óµÄÉè±¸£¬ÄÜ¹»ÈÃÄãÔÚÑ¹ËõÖ®Ç°´æ·ÅËùÓÐµÄµµ°¸¡£Äã½«ÐèÒªÒ»¸öÄÜ¹»´æ·Å´óÔ¼ 4 megabytesµµ°¸µÄÉè±¸¡£ÓÐÒÔÏÂ¼¸ÖÖÑ¡Ôñ£º

\begin{itemize}
\item  Ê¹ÓÃ {\bfseries \idx{ramdisk}} (DEVICE = \url{/dev/ram0})¡£ÔÚÕâÖÖÇé¿öÏÂ£¬¼ÇÒäÌå±»Ä£Äâ³ÉÒ»Ì¨´Åµú»ú¡£ Ramdisk ±ØÐë´óµ½ÄÜ¹»´æ·ÅÒ»¸öÊÊµ±´óÐ¡µÄ filesystem ¡£Èç¹ûÄãÊ¹ÓÃ LILO £¬Çë¼ì²éÄãµÄ×éÌ¬Éè¶¨µµ (\url{/etc/lilo.conf}) £¬ÕÒµ½Ò»ÐÐÏñ
\begin{verbatim}
 RAMDISK = nnn
\end{verbatim}

\nidx{RAMDISK\_SIZE, LILO parameter}
ÕâÐÐ¾ö¶¨¿ÉÒÔ·ÖÅä¸ø ramdisk µÄ RAM Ö®¼«´óÖµ¡£Ô¤ÉèÖµÊÇ 4096K £¬ÕâÓ¦¸ÃÊÇ×ã¹»ÁË¡£ÄãÓ¦¸Ã²»¿ÉÄÜ³¢ÊÔÔÚÒ»Ì¨ÉÙì¶ 8MB RAM µÄµçÄÔÉÏÊ¹ÓÃÈç´ËµÄ ramdisk ¡£

Çë¼ì²éÒÔÈ·ÈÏÄãÓÐÒ»¸öÉè±¸µµÏñÊÇ \url{/dev/ram0, /dev/ram} »òÊÇ \url{/dev/ramdisk} ¡£Èç¹ûÃ»ÓÐ£¬Çë×Ô¼ºÒÔ {\ttfamily mknod} (major number 1, minor 0)Ôì³ö \url{/dev/ram0} ¡£
\item  Èç¹ûÄãÓÐÒ»¸öÎ´Ê¹ÓÃÇÒ¹»´óµÄÓ²µú partition (²î²»¶à¼¸megabytes´ó¾Í¿ÉÒÔÁË)£¬¾ÍÊ¹ÓÃËü°É¡£
\item  Ê¹ÓÃÒ»¸ö {\bfseries \idx{loopback device}} £¬Õâ¿ÉÒÔ°ÑÒ»¸ö´Åµúµµ°¸µ±×öÊÇÒ»Ì¨Éè±¸À´Ê¹ÓÃ¡£Ê¹ÓÃ loopback device Ê±£¬Äã¿ÉÒÔÔÚÓ²µúÉÏÔì³öÒ»¸ö  3 megabyte µÄµµ°¸£¬²¢ì¶ÆäÉÏ½¨Ôì filesystem ¡£

¼üÈë {\ttfamily man losetup} ÕÒÑ°Ö¸ÁîÒÔÊ¹ÓÃ loopback devices ¡£Èç¹ûÄãÃ»ÓÐ {\ttfamily losetup} £¬Äã¿ÉÒÔ´Ó \nameurl{ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/}{} Ä¿Â¼ÖÐ£¬ \url{util-linux} Ì×¼þ (package) ÄÚÏàÈÝ°æ±¾Ö® {\ttfamily mount} Óë {\ttfamily unmount} µÄËæ¸½ÎïÖÐÕÒµ½Ëü¡£

Èç¹ûÔÚÄãµÄÏµÍ³ÉÏÃ»ÓÐ loop device µµ (\url{/dev/loop0}, \url{/dev/loop1}, etc.)£¬ÄÇ÷áÄã±ØÐëÓÃ ``{\ttfamily mknod /dev/loop0 b 7 0}'' ×Ô¼ºÔì³öÒ»¸ö¡£Ò»µ©°²×°ºÃÕâÐ©ÌØ±ðµÄ {\ttfamily mount} Óë {\ttfamily umount} ¶þ½øÎ»µµ£¬¾ÍÇëÔÚÒ»Ì¨ÈÝÁ¿¹»´óµÄÓ²µúÉÏÔì³öÒ»¸öÔÝ´æµµ (temporary file)(eg, \url{/tmp/fsfile}) ¡£Äã¿ÉÒÔÊ¹ÓÃÏñÕâÑù×ÓµÄÖ¸Áî£º
\begin{tscreen}
dd if=/dev/zero of=/tmp/fsfile bs=1k count={\itshape nnn\/}
\end{tscreen}

ÒÔÔì³öÒ»¸ö {\itshape nnn\/}-block µÄµµ°¸¡£

ÇëÊ¹ÓÃ×Ô¼ºµÄµµÃûÈ¡´úÒÔÏÂµÄ DEVICE ¡£µ±ÄãÏÂÁË mount Ö¸Áî£¬ÄãÍ¬Ê±Òª¼ÓÉÏ ``{\ttfamily -o loop}'' Ñ¡ÏîÒÔ¸æÖª mount ÊÇÊ¹ÓÃ loopback device ¡£ \nidx{loopback device}
¾ÙÀýÀ´Ëµ£º
\begin{verbatim}
        mount -o loop -t ext2 /tmp/fsfile /mnt
\end{verbatim}


ÒÔ¹ÒÉÏ loopback device µÄ·½Ê½£¬°Ñ \url{/tmp/fsfile} ¹ÒÉÏ {\ttfamily /mnt} Õâ¸ö mount point ¡£ÓÃ {\ttfamily df} Ö¸Áî¿ÉÈÃÄã¿´µ½ÒÔÉÏµÄ½á¹û¡£
\end{itemize}


ÔÚÄãÑ¡ÔñÆäÖÐÒ»ÖÖ·½·¨áá£¬Çë×¼±¸ DEVICE ÒÔ£º
\begin{verbatim}
        dd if=/dev/zero of=DEVICE bs=1k count=4096
\end{verbatim}


ÕâÐÐÖ¸ÁîËÍ³öÒ»¶Ñ 0 °ÑDEVICEÌîÂú¡£ÓÃ 0 ÌîÂú device ÊÇ¹Ø¼üµÄÒ»²½£¬ÒòÎª filesystemÖ®áá½«»á±»Ñ¹Ëõ£¬ËùÒÔËùÓÐÎ´Ê¹ÓÃµÄ²¿·ÖÓ¦±»ÓÃ 0 ÌîÂúÒÔ´ïµ½×î´óµÄÑ¹Ëõ±È¡£ÎÞÂÛºÎÊ±Äã´ÓÄãµÄ root filesystem É¾³ýµµ°¸£¬Çë¼ÇµÃÕâ¸öÊÂÊµ¡£Êµ¼ÊÉÏ filesystem Ö»ÊÇÊÍ³ö (de-allocate) ÕâÐ© blocks £¬ {\itshape µ«ÊÇ²¢Ã»ÓÐÔÙ°ÑËüÃÇÌîÎª 0 \/}¡£Èç¹ûÄãÖ´ÐÐ¹ýºÜ¶à´ÎÉ¾³ýÓë copy µÄ¶¯×÷£¬ÄãµÄÑ¹Ëõ filesystem ×îáá»á±È±ØÒªµÄ´ó³öºÜ¶à¡£

\nidx{inodes, allocation}
ÏÂÒ»²½¾ÍÊÇÔì³ö filesystem ¡£ Linux kernel ³ÐÈÏÁ½ÖÖÄÜÈÃ root disks ×Ô¶¯µØ±» copy µ½ ramdisk ÉÏµÄ file system ¡£ËüÃÇÊÇ minix Óë ext2 £¬ÆäÖÐ ext2 ÊÇ±È½ÏÊÜ»¶Ó­µÄ¡£Èç¹ûÊ¹ÓÃ ext2 £¬Äã»á·¢ÏÖÊ¹ÓÃ {\ttfamily -i} Ñ¡ÏîÖ¸¶¨±ÈÔ¤ÉèÖµ¸ü¶àµÄ inodes ÊÇÓÐÖúÒæµÄ£»ÎÒÃÇ½¨ÒéÓÃ {\ttfamily -i 2000} £¬ÕâÑùÄã¾Í²»»áÓÃÍê inodes ¡£Èç¹û²»ÓÃÉÏÊöÑ¡Ïî£¬Äã¿ÉÒÔÒÆ³ýÐí¶à²»±ØÒªµÄ {\ttfamily /dev} µµ°¸ÒÔ½ÚÊ¡ inodes ¡£ {\ttfamily mke2fs} Ô¤Éè»áÔì³ö 360 ¸ö inodesÔÚÒ»ÕÅ 1.44Mb µÄ´ÅÆ¬ÉÏ¡£ÎÒ·¢ÏÖÔÚÎÒÄ¿Ç°µÄ¾ÈÔ® root ´ÅÆ¬ÉÏ£¬ 120 ¸ö inodes ÊÇÏàµ±×ã¹»ÁË£¬µ«ÊÇÈç¹ûÄã°ÑËùÓÐµÄÉè±¸µµ¶¼·ÅÈë {\ttfamily /dev} Ä¿Â¼ÖÐ£¬ÄÇ÷áÄãºÜÈÝÒ×»á³¬¹ý 360 ¸öinodes ¡£Ê¹ÓÃÑ¹ËõµÄ root filesystem ¿ÉÈÃÄãÓµÓÐ½Ï´óµÄ filesystem £¬Í¬Ê±Ô¤Éè»áÓÐ¸ü¶àµÄ inodes £¬µ«ÊÇÄãÈÔÈ»±ØÐëÒª²»¾ÍÊÇ¼õÉÙµµ°¸ÊýÁ¿£¬Òª²»¾ÍÊÇÔö¼Ó inodes ÊýÄ¿¡£

Òò´Ë£¬ÄãËùÊ¹ÓÃµÄÖ¸Áî¿´ÆðÀ´»áÏñÕâÑù£º
\begin{verbatim}
        mke2fs -m 0 -i 2000 DEVICE
\end{verbatim}


(Èç¹ûÄãÊ¹ÓÃµÄÊÇÒ»¸ö loopback device £¬ÄÇ÷áÇëÓÃÄãÄ¿Ç°ËùÓÃµÄ´Åµúµµ°¸Ìæ»»µôÉÏÃæµÄ DEVICE ¡£)
\nidx{loopback device}

{\ttfamily mke2fs} Ö¸Áî»á×Ô¶¯µØÕì²â¿É»ñµÃµÄ¿Õ¼ä£¬È»ááÒÀ¾ÝÕì²â¶Ô×ÔÉí½øÐÐ×éÌ¬Éè¶¨¡£ ``{\ttfamily -m 0}'' ²ÎÊý±ÜÃâ±£Áô¿Õ¼ä¸ø root £¬Òò´Ë¿ÉÌá¹©¸ü¶à¿ÉÓÃµÄ´Åµú¿Õ¼ä¡£

ÏÂÒ»²½£¬¹ÒÉÏÕâ¸ö device £º

\begin{verbatim}
        mount -t ext2 DEVICE /mnt
\end{verbatim}
 
(Èç¹û mount point ²¢²»´æÔÚ£¬Äã±ØÐë×ÔÐÐÔì³öÒ»¸ö mount point {\ttfamily /mnt} ¡£) ÔÚÊ£ÏÂµÄÕÂ½ÚÖÐ£¬ËùÓÐµÄÄ¿µÄ (destination) Ä¿Â¼¶¼±»¼ÙÉèÊÇÏà¶Ôì¶ {\ttfamily /mnt} ¡£




\subsection{ÒÆÖ²µµ°¸ÏµÍ³ -- Populating the filesystem}



ÒÔÏÂÊÇÄãµÄ root filesystem ×îÆðÂë¸ÃÓÐµÄÄ¿Â¼

´Ë´¦Ëù³ÊÏÖÖ®Ä¿Â¼¼Ü¹¹½ö¹© root diskette Ê¹ÓÃ¡£ÕæÕýµÄ Linux ÏµÍ³ÓÐÒ»Ì×¸üÎª¸´ÔÓÇÒÉè¼ÆÁ¼ºÃµÄ¼Ü¹¹·½·¨£¬³ÆÎª \onlynameurl{Filesystem Hierarchy Standard} £¬Ëü¾ö¶¨µµ°¸Ó¦¸ÃÈçºÎ·ÅÖÃ¡£
:

\begin{itemize}
\item \url{/dev} -- ÀïÃæ´æ·ÅÉè±¸µµ (Devices) £¬Îª´ï³É I/O ¹¤×÷ËùÐè
\item \url{/proc} -- Directory stub required by the proc filesystem
\item \url{/etc} -- ÀïÃæ´æ·ÅÏµÍ³×éÌ¬Éè¶¨µµ
\item \url{/sbin} -- ÖØÒªµÄ (critical) ÏµÍ³¶þ½øÎ»Ö´ÐÐµµ (binaries)
\item \url{/bin} -- ±»ÈÏÎªÊÇÏµÍ³Ò»²¿·ÖµÄ»ù±¾¶þ½øÎ»Ö´ÐÐµµ
\item \url{/lib} -- Ìá¹© run-time Ö§Ô®µÄ¹²Ïíº¯Ê½¿â
\item \url{/mnt} -- Î¬»¤ÆäËü´ÅµúËùÓÃµÄ´Åµú¹ÒÈëµã (mount point)
\item \url{/usr} -- ¶îÍâµÄ¹¤¾ß³ÌÊ½ÓëÓ¦ÓÃ³ÌÊ½
\end{itemize}


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

ÉÏÊöÄ¿Â¼µÄÆäÖÐÈý¸öÔÚ root filesystem ÉÏ»áÊÇ¿ÕµÄ£¬ËùÒÔËüÃÇÖ»ÐèÒªÓÃ {\ttfamily mkdir} Ôì³öÀ´¡£ \url{/proc} Ä¿Â¼»ù±¾ÉÏÊÇÒ»¸ö°Ñ proc filesystem ·ÅÖÃì¶ÆäÏÂµÄ stub ¡£ \url{/mnt} Óë \url{/usr} ÕâÁ½¸öÄ¿Â¼Ö»ÊÇÔÚ boot/root ÏµÍ³ÔË×÷Ê±ËùÊ¹ÓÃµÄ mount points ¡£Òò´ËÔÙÖØ¸²Ò»´Î£¬ÕâÐ©Ä¿Â¼Ö»ÐèÒª±»Ôì³öÀ´¾Í¿ÉÒÔÁË¡£

Ê£ÏÂµÄËÄ¸öÄ¿Â¼ÃèÊöì¶ÒÔÏÂ¸÷½Ú¡£




\subsubsection{/dev}



\nidx{device (dev) directory}

\url{/dev} Ä¿Â¼°üº¬Ò»ÈºÌØ±ðµÄµµ°¸£¬ÕâÐ©µµ°¸ÊÇ¸øÏµÍ³ÉÏËùÓÐÉè±¸Ê¹ÓÃµÄ£¬ÕâÑùµÄ /dev Ä¿Â¼Ã¿¸ö Linux ÏµÍ³¶¼Ò»¶¨»áÓÐ¡£Õâ¸öÄ¿Â¼±¾ÉíÊÇÒ»¸öÆÕÍ¨Ä¿Â¼£¬¿ÉÒÔÒÔÒ»°ãµÄ·½·¨ÓÃ {\ttfamily mkdir} Ôì³öÀ´¡£È»¶ø£¬ÕâÐ©ÌØ±ðµÄµµ°¸±ØÐëÒÔÌØ±ðµÄ·½·¨ÓÃ {\ttfamily \cdx{mknod}} Ö¸ÁîÔì³öÀ´¡£

µ«»¹ÊÇÓÐÒ»Ìõ½Ý¾¶ -- Ö±½Ó copy ÄãÏÖÓÐ \url{/dev} Ä¿Â¼µÄÄÚÈÝ£¬È»ááÔÙÇå³ýÄã²»ÏëÒªµÄÉè±¸µµ¡£Î¨Ò»µÄÒªÇóÊÇ copy ÕâÐ©ÌØ±ðµÄÉè±¸µµÊ±£¬ÒªÓÃ {\ttfamily -R} Ñ¡Ïî¡£Õâ¸öÑ¡Ïî»á copy Õû¸öÄ¿Â¼ÖÐµÄµµ°¸£¬µ«ÊÇ²»»á copy ÕâÐ©µµ°¸µÄÄÚÈÝ¡£ÇëÈ·¶¨Ê¹ÓÃ {\itshape ´óÐ´×ÖÄ¸ R\/} ¡£Õâ¸öÖ¸ÁîÊÇ£º
\begin{verbatim}
        cp -dpR /dev /mnt
\end{verbatim}


ÔÚ´ËÎÒÃÇ¼ÙÉè´ÅÆ¬ÊÇ±»¹ÒÔÚ \url{/mnt} µ×ÏÂ¡£ {\ttfamily dp} Ñ¡Ïî (switches) È·±£ symbolic links ÊÇÒÔ links µÄ·½Ê½À´ copy £¬¶ø²»ÊÇ copy Á´½áµµËùÖ¸ÏòµÄ target file £¬Í¬Ê±Ô­±¾µÄµµ°¸ÊôÐÔÒ²±»±£Áô£¬Òò´Ë±£ÁôÁËµµ°¸µÄËùÓÐÈ¨×ÊÑ¶¡£

Èç¹ûÄãÏëÒªÓÃ¸ßÄÑ¶È¼¼ÇÉÍê³ÉÕâ¸öÈÎÎñ£¬¾ÍÀûÓÃ {\ttfamily ls -l} ÁÐ³öÄãÏëÒªµÄÉè±¸µµÖ® major Óë minor device numbers £¬È»ááÔÙÓÃ {\ttfamily mknod} ÔÚ´ÅÆ¬ÉÏÔì³öËüÃÇ¡£

ÎÞÂÛÈçºÎ copy ÕâÐ©Éè±¸µµ£¬»¹ÊÇÒª¼ì²éÈÎºÎÄãËùÐèÖ®Éè±¸µµ (device special file) ÊÇ·ñÒÑ·ÅÈëÕâÕÅ¾ÈÔ®´ÅÆ¬ÖÐ¡£¾ÙÀýÀ´Ëµ£¬ {\ttfamily \cdx{ftape}} Ê¹ÓÃ´Å´øÉè±¸£¬Èç¹ûÄãÏëÒª´Ó bootdisk ´æÈ¡ÈíÊ½´Å´ø»ú£¬Äã¾ÍÐèÒª copy ËùÓÐÓÐ¹ØµÄÉè±¸µµ¡£

Çë×¢Òâ£¬Ã¿Ò»¸öÉè±¸µµÐèÒªÒ»¸ö inode £¬µ« \idx{inodes} Ò»Ö±¶¼ÊÇÏ¡ÉÙµÄ×ÊÔ´£¬ÌØ±ðÊÇÔÚ´ÅÆ¬ filesystems ÉÏ¡£Òò´Ë£¬´Ó´ÅÆ¬ÉÏµÄ \url{/dev} Ä¿Â¼ÒÆ³ýÈÎºÎÄãËù²»ÐèÒªµÄÉè±¸µµÊÇÓÐÒâÒåµÄ¡£¾ÙÀýÀ´Ëµ£¬Èç¹ûÄãÃ»ÓÐ SCSI ´Åµú£¬Äã¿ÉÒÔ·ÅÐÄµØÒÆ³ýËùÓÐÒÔ {\ttfamily sd} ¿ªÍ·µÄÉè±¸µµ¡£Í¬ÑùµØ£¬Èç¹ûÄã²¢²»ÏëÊ¹ÓÃÄãµÄÐòÁÐ²º (serial port) £¬ÄÇ÷áÄãÒ²¿ÉÒÔÒÆ³ýËùÓÐÒÔ {\ttfamily cua} ¿ªÍ·µÄÉè±¸µµ¡£

{\itshape  ÇëÈ·¶¨´ÓÕâ¸öÄ¿Â¼·ÅÈëÁËÒÔÏÂµµ°¸µÄ£º \/}
{\ttfamily console, kmem, mem, null, ram0 and tty1}.




\subsubsection{/etc}

\nidx{etc directory}

Õâ¸öÄ¿Â¼°üº¬ÁËÖØÒªµÄ×éÌ¬Éè¶¨µµ¡£ÔÚ´ó²¿·ÖµÄÏµÍ³ÉÏ£¬ÕâÐ©µµ°¸±»·ÖÎªÈý¸öÈº×é£º

\begin{enumerate}
\item  Ò»Ö±¶¼ÊÇ±Ø±¸µÄ£¬ {\itshape e.g.\/} {\ttfamily rc, fstab, passwd} ¡£
\ncdx{rc}\ncdx{fstab}\ncdx{passwd}
\item  ¿ÉÄÜÊÇ±Ø±¸µÄ£¬µ«ÊÇÃ»ÓÐÈËÄÜÊ®·ÖÈ·¶¨¡£
\item  ÍµÅÜ½øÀ´µÄÀ¬±¨¡£
\end{enumerate}


Í¨³£¿ÉÒÔÓÃÒÔÏÂÖ¸ÁîÊ¶³öÄÄÐ©ÊÇ·Ç»ù±¾µÄµµ°¸£º

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


Õâ¸öÖ¸Áî½«µµ°¸ÒÀ¾ÝÉÏ´Î±»´æÈ¡µÄÈÕÆÚ£¬ÒÔÏÈÔçááÍí (reverse) µÄË³ÐòÁÐ³ö£¬ËùÒÔÈç¹ûÓÐÈÎºÎµµ°¸²»»á±»´æÈ¡£¬ÄÇ÷áËüÃÇ¾Í¿ÉÒÔ´Ó root ´ÅÆ¬ÖÐÉ¾È¥¡£

ÔÚÎÒµÄ root ´ÅÆ¬ÉÏ£¬ÎÒµÄ×éÌ¬µµÊýÄ¿ÒÑ¼õÖÁ 15 ¸ö¡£Õâ¿É¼õÉÙÎÒ´¦ÀíÒÔÏÂÈýÖÖµµ°¸µÄ¹¤×÷£º

\begin{enumerate}
\item  ÎÒ±ØÐëÎª boot/root ÏµÍ³½øÐÐ×éÌ¬Éè¶¨µÄµµ°¸£º

\begin{enumerate}
\item \url{rc.d/*} -- ÏµÍ³Æô¶¯Óë¸Ä±ä run level µÄ scripts
\item {\ttfamily \cdx{fstab}} -- Òª±»¹ÒÉÏµÄ file systems Çåµ¥
\item {\ttfamily \cdx{inittab}} -- ¸ø {\ttfamily init} process µÄ²ÎÊý£¬ì¶¿ª»úÊ±Æô¶¯µÄµÚÒ»¸ö process ¡£ \ncdx{init}
\end{enumerate}

\item  ÎÒÃÇÓ¦¸ÃÎª boot/root ÏµÍ³ÕûÀíµÄµµ°¸£º
\begin{enumerate}
\item {\ttfamily \cdx{passwd}} -- ÖØÒªµÄÊ¹ÓÃÕß¡¢ home Ä¿Â¼µÈÆäËüÏîÄ¿µÄÇåµ¥¡£
\item \url{group} -- Ê¹ÓÃÕßÈº×é¡£ \nidx{user groups}
\item \url{shadow} -- Ê¹ÓÃÕßµÄÃÜÂë¡£Äã¿ÉÄÜÃ»ÓÐÕâ¸öµµ¡£ \nidx{shadow passwords}
\item \url{termcap} -- the terminal capability database.
\end{enumerate}


Èç¹ûÏµÍ³°²È« (security) ¶ÔÄãºÜÖØÒª£¬ÄÇ÷á \url{passwd} Óë \url{shadow} Ó¦¸Ã±»É¾¼õ£¬ÒÔ±ÜÃâ½«Ê¹ÓÃÕßÃÜÂë copy ³öÏµÍ³£¬ÕâÑùµ±Äã´Ó´ÅÆ¬¿ª»úÊ±£¬²»ÏëÒªµÄ logins »á±»¾Ü¾ø¡£ \nidx{restoring files}

ÇëÈ·¶¨ {\ttfamily \cdx{passwd}} ÖÁÉÙ°üº¬ÁË {\ttfamily root} ¡£Èç¹ûÄãÒªÈÃÆäËûµÄÊ¹ÓÃÕß login £¬ÇëÈ·¶¨ËûÃÇµÄ home Ä¿Â¼Óë shells ¶¼´æÔÚ¡£

\url{termcap} £¬ÖÕ¶Ë»ú×ÊÁÏ¿â£¬Ò»°ã¶øÑÔÓÐ¼¸°Ù¸ö kilobytes ¡£Äã boot/root ´ÅÆ¬µÄ°æ±¾Ó¦¸Ã±»É¾¼õµ½Ö»°üº¬ÄãËùÊ¹ÓÃµÄÖÕ¶Ë»ú£¬ÕâÍ¨³£¾ÍÊÇ {\ttfamily linux} »ò {\ttfamily linux-console} ÏîÄ¿ (entry) ¡£
\item The rest.  They work at the moment, so I leave them alone.
\end{enumerate}


Out of this, ÎÒÊµ¼ÊÉÏÖ»±ØÐëÉè¶¨Á½¸öµµ£¬¶øËüÃÇËùÓ¦°üº¬µÄÏîÄ¿¾ªÈËµØÉÙ¡£
\begin{itemize}
\item \url{rc} Ó¦¸Ã°üº¬£º
\begin{verbatim}
        #!/bin/sh
        /bin/mount -av
        /bin/hostname Kangaroo
\end{verbatim}


ÇëÈ·¶¨ÉÏÊöµÄÄ¿Â¼¶¼ÊÇÕýÈ·µÄ¡£Äã²¢²»ÐèÒªÕæµØÈ¥Ö´ÐÐ {\ttfamily \cdx{hostname}} -- Èç¹ûÄãÖ´ÐÐÖ»ÊÇÈÃÏµÍ³±È½ÏºÃ¿´ (Òë×¢£ºÈç´ËÏµÍ³»áÓÐ¸öÃû×Ö) ¡£
\item {\ttfamily \cdx{fstab}} Ó¦¸ÃÖÁÉÙÒª°üº¬£º

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


Äã¿ÉÒÔ´ÓÄãÏÖ´æµÄ \url{fstab} copy ÄãÏëÒªµÄÏîÄ¿£¬µ«ÊÇÄã²¢²»Ó¦¸Ã×Ô¶¯µØ¹ÒÉÏÄãÓ²µúÈÎºÎµÄ partitions £»Çë¶ÔÕâÐ©ÏîÄ¿Ê¹ÓÃ {\ttfamily noauto} ¹Ø¼ü×Ö (Òë×¢£ºÓÃ noauto ´úÌæ default ) ¡£µ±Ê¹ÓÃ bootdisk Ê±£¬ÄãµÄÓ²µú¿ÉÄÜÊÇÔçÒÑËð»µ»ò¹ÒÁË¡£
\end{itemize}


ÄãµÄ {\ttfamily \cdx{inittab}} Ó¦¸Ã±»¸Ä±ä£¬ÒÔÊ¹ÆäÖÐ {\ttfamily sysinit} ÕâÐÐÄÜÖ´ÐÐ \url{rc} »òÎÞÂÛÊ²÷á½«±»Ö´ÐÐµÄ»ù±¾¿ª»ú script ¡£Í¬Ê±£¬Èç¹ûÄãÏëÒªÈ·±£²»¿É´ÓÐòÁÐ²º login £¬ÇëÔÚËùÓÐÐÐÎ²°üÀ¨ \url{ttys} »ò \url{ttyS} µÄ \url{getty} ÏîÄ¿Ç°¼ÓÉÏ¡¸\#¡¹·ûºÅ (comment out) ¡£Çë±£Áô \url{tty} ²ºÒÔÈÃÄã¿ÉÒÔÔÚ console Ç° login ¡£

Ò»¸ö×îÆðÂëµÄ {\ttfamily \cdx{inittab}} µµ¿´ÆðÀ´ÑùÕâÑù£º
\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}} µµ¶¨ÒåÁËÏµÍ³ÔÚ¸÷ÖÖ²»Í¬µÄÇé¿öÖÐ½«Ö´ÐÐÊ²÷áÏîÄ¿£¬°üÀ¨ startup ¡¢ÇÐ»»ÖÁ¶àÊ¹ÓÃÕßÄ£Ê½µÈµÈ¡£Çë×ÐÏ¸µØ¼ì²éÔÚ \url{inittab} ÖÐ±»Ìá¼°µÄµµ°¸Ãû³Æ (filenames) £»Èç¹û {\ttfamily init} ²»ÄÜÕÒµ½ËùÌá¼°µÄ³ÌÊ½£¬ÄÇ÷á bootdisk ½«»áÍ£Ö¹ÔË×÷£¬¶øÄãÉõÖÁ²»»áµÃµ½´íÎóÑ¶Ï¢¡£

\nidx{hardcoded locations}

Çë×¢Òâ£¬Ä³Ð©³ÌÊ½²»ÄÜ±»ÒÆµ½ÆäËüµØ·½£¬ÒòÎªÆäËü³ÌÊ½ÒÑÔÚ×«Ð´Ê±£¬¾Í°ÑËüÃÇµÄµµ°¸Î»ÖÃÐ´ËÀÁË (hardcode) ¡£¾ÙÀýÀ´ËµÔÚÎÒµÄÏµÍ³ÉÏ£¬ \url{/etc/shutdown} ÒÑ°Ñ \url{/etc/reboot} µÄÎ»ÖÃÐ´ËÀÔÚÆäÖÐ¡£Èç¹ûÎÒÒÆ¶¯ÁË \url{reboot} µ½ \url{/bin/reboot}£¬È»ááÏÂ´ïÒ»¸ö {\ttfamily shutdown} Ö¸Áî£¬½«»áÒòÎªÕÒ²»µ½ {\ttfamily reboot} µµ¶ø·¢Éú´íÎó¡£

\nidx{etc directory}

Ê£ÏÂÀ´µÄ£¬¾ÍÊÇ copy ÔÚÄã \url{/etc} Ä¿Â¼ÖÐµÄËùÓÐÎÄ×Öµµ (text files) £¬ÔÙ¼ÓÉÏÔÚÄã \url{/etc} Ä¿Â¼ÖÐ£¬ÄãÎÞ·¨È·¶¨ÄãÐè²»ÐèÒªµÄËùÓÐ¿ÉÖ´ÐÐµµ¡£ÐèÒªÖ¸Ê¾ (guide) Õß£¬Çë²Î¿¼ÔÚ \ref{Listings} {(Sample roodisk directory listings)} µÄÑù±¾Çåµ¥¡£Ò²ÐíÖ»Òª copy ÕâÐ©µµ°¸¾Í×ã¹»ÁË£¬µ«ÊÇÏµÍ³²îÒì»áÓÐºÜ´óµÄÓ°Ïì£¬ËùÒÔÄãÎÞ·¨È·¶¨ÄãÏµÍ³ÉÏÏàÍ¬µÄµµ°¸×éºÏ£¬¾ÍÒ»¶¨µÈì¶Çåµ¥ÖÐµÄµµ°¸¡£Î¨Ò»È·¶¨µÄ·½·¨¾ÍÊÇ´Ó {\ttfamily inittab} ÖøÊÖ£¬²¢ÕÒ³öÐèÒªÊ²÷á¡£

ÏÖÔÚ´ó²¿·ÖµÄÏµÍ³Ê¹ÓÃ \url{/etc/rc.d/} Ä¿Â¼£¬ÆäÖÐ°üº¬¸ø²»Í¬ run levels µÄshell scripts ¡£×îÆðÂë»áÓÐÒ»¸öµ¥Ò»µÄ \url{rc} script£¬µ«ÊÇ½ö´ÓÄãÏÖ´æµÄÏµÍ³ copy {\ttfamily \cdx{inittab}} Óë \url{/etc/rc.d} ÕâÁ½¸öÄ¿Â¼£¬È»ááÉ¾¼õ \url{rc.d} Ä¿Â¼ÖÐµÄ shell scripts ÒÔÒÆ³ýºÍ´ÅÆ¬ÏµÍ³»·¾³ÎÞ¹ØµÄ processing £¬»áÊÇ½ÏÎª¼òµ¥µÄ×ö·¨¡£




\subsubsection{/bin Óë /sbin}

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

\url{/bin} Ä¿Â¼ÊÇÒ»¸ö·ÅÖÃÎªÁËÖ´ÐÐ»ù±¾×÷Òµ (operations) ¶øËùÐèÖ®¶îÍâ¹¤¾ß³ÌÊ½µÄ·½±ãºÃµØ·½£¬ÕâÐ©¹¤¾ß³ÌÊ½ÖîÈç {\ttfamily ls}, {\ttfamily mv}, {\ttfamily cat} Óë {\ttfamily dd} ¡£ {\ttfamily }bin/ Óë \url{/sbin} ÕâÁ½¸öÄ¿Â¼µÄµµ°¸Çåµ¥¡õÀýÇë¼û \ref{Listings} {(Sample rootdisk directory listings)} ¡£µ«¡õÀýÖÐ²¢Ã»ÓÐ°üÀ¨ÈÎºÎ´Ó±¸·Ý¸´Ô­Ê±ËùÐèÖ®¹¤¾ß³ÌÊ½£¬ÖîÈç {\ttfamily cpio}, {\ttfamily tar} Óë {\ttfamily gzip} ¡£ÕâÊÇÒòÎªÎÒ°ÑÕâÐ©¶«Î÷·ÅÔÚÁíÒ»ÕÅ (separate) ¹¤¾ß³ÌÊ½´ÅÆ¬ÉÏ£¬ÒÔ½ÚÊ¡ boot/root ´ÅÆ¬µÄ¿Õ¼ä¡£Ò»µ© boot/root ´ÅÆ¬±»¿ª»úÆô¶¯£¬¾Í»á±» copy µ½ ramdisk ²¢ÊÍ·ÅÈíµú»ú£¬ÈÃÈíµú»úÄÜ¹ÒÉÏÁíÒ»ÕÅ´ÅÆ¬£¬¾ÍÊÇ¹¤¾ß³ÌÊ½Æ¬¡£ÎÒÍ¨³£°ÑËü¹ÒÉÏµ±×ö \url{/usr} ¡£

¹¤¾ß³ÌÊ½´ÅÆ¬ (\idx{utility diskette}) µÄÖÆ×÷±»ÃèÊöÔÚÏÂÃæ \ref{UtilityDisk} {(Building a utility disk)} Õâ½Ú¡£±£ÁôÒ»·ÝÏàÍ¬°æ±¾Ö®±¸·ÝÓÃ¹¤¾ß³ÌÊ½µÄcopyÊÇ±È½ÏºÃµÄ£¬Õâ¸ö±¸·ÝÓÃ¹¤¾ß³ÌÊ½±»ÓÃÀ´ÖÆ×÷±¸·Ý£¬Èç´ËÄã¾Í²»ÓÃÀË·ÑÊ±¼äÔÚ³¢ÊÔ°²×°²»ÄÜ¶ÁÈ¡Äã±¸·Ý´Å´øµÄ°æ±¾¡£

ÇëÈ·¶¨Äã°üÀ¨ÁËÒÔÏÂ³ÌÊ½£º {\ttfamily init}, {\ttfamily getty} »òÏàµÈµÄ³ÌÊ½, {\ttfamily login}, {\ttfamily mount}, Ä³ÖÖ¿ÉÒÔÖ´ÐÐÄãrc scripts µÄ shell, ÒÔ¼°Ò»¸ö´Ó {\ttfamily sh} Ö¸ÏòÕâ¸ö shell µÄ link ¡£

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




\subsubsection{/lib}

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

ÔÚ \url{/lib} ÖÐ£¬ÄãÒª·ÅÈë±ØÒªµÄ¹²Ïíº¯Ê½¿â (libraries) ÓëÔØÈë³ÌÊ½ (loaders) ¡£Èç¹ûÎÞ·¨ÔÚÄãµÄ \url{/lib} Ä¿Â¼ÖÐÕÒµ½±ØÒªµÄº¯Ê½¿â£¬ÄÇ÷áÏµÍ³½«²»ÄÜ¹»¿ª»ú¡£Èç¹ûÄãºÜÐÒÔË£¬Äã¿ÉÄÜ»á¿´µ½¸æËßÄãÎªÊ²÷á»á·¢ÉúÈç´ËÇé¿öµÄ´íÎóÑ¶Ï¢¡£

\ncdx{libc.so}
½üÀ´Ã¿Ò»¸ö³ÌÊ½ÖÁÉÙ¶¼ÒªÇó \url{libc} º¯Ê½¿â£¬ \url{libc.so.}{\itshape N\/} £¬ÆäÖÐ {\itshape N\/} ÊÇÄ¿Ç°°æ±¾µÄ±àºÅ¡£Çë¼ì²éÄãµÄ \url{/lib} Ä¿Â¼¡£ \url{Libc.so.N} Í¨³£ÊÇÒ»¸ö symlink £¬ËüÖ¸ÏòÒ»¸ö¾ßÓÐÍêÕû°æ±¾±àºÅµÄµµÃû£º

\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}


ÔÚÕâ¸öÇé¿öÏÂ£¬Äã»áÏëÒª \url{libc-2.1.1.so} ¡£ÎªÁËÕÒµ½ÆäËüº¯Ê½¿â£¬ÄãÓ¦¸ÃÒª¿´¹ýËùÓÐÄã´òËã°üÀ¨µÄ¶þ½øÎ»µµ£¬²¢ÇÒÓÃ {\ttfamily \cdx{ldd}} Ö¸Áî¼ì²éËüÃÇµÄÏàÒÀÐÔ¡£¾ÙÀýÀ´Ëµ£º

\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}

ÔÚÓÒÊÖ±ßµÄÃ¿Ò»¸öµµ°¸ÊÇÒ»¶¨ÒªÓÐµÄ¡£ÓÐÐ©µµ°¸¿ÉÄÜÊÇÒ»¸ö symbolic link ¡£

Çë×¢ÒâÄ³Ð©º¯Ê½¿â {\itshape  Ïàµ±µØ´ó \/}£¬¶øÇÒ²¢²»ÄÜÇáÒ×µØÅäºÏÄãµÄ root filesystem ¡£¾ÙÀýÀ´Ëµ£¬ÉÏÊöµÄ \url{libc.so} ´óÔ¼ÓÐ 4 megabytes ¡£Òò´Ë£¬ÔÚÄã copy ËüÃÇµ½Äã root filesystem µÄÍ¬Ê±£¬Äã¿ÉÄÜÐèÒª³ýÈ¥Ò»Ð©º¯Ê½¿â¡£Çë¿´ \ref{Slimfast} {(Reducing root filesystem size)} ÕâÒ»½ÚÒÔÁË½â instructions ¡£

\nidx{loaders}

ÔÚ \url{/lib} ÄÚ£¬ÄãÒ²±ØÐë°üÀ¨Ò»¸ö loader ¹©ÕâÐ©º¯Ê½¿âÊ¹ÓÃ¡£Õâ¸ö loader ²»ÊÇ \url{ld.so} (¸ø A.OUT º¯Ê½¿âÊ¹ÓÃ)£¬¾ÍÊÇ \url{ld-linux.so} (¸ø ELF º¯Ê½¿âÊ¹ÓÃ)¡£½ÏÐÂ°æµÄ {\ttfamily ldd} »áÈçÍ¬ÉÏÊöµÄÀý×Ó£¬ÕýÈ·µØ¸æËßÄãÐèÒªÄÄÒ»ÖÖ loader £¬È»¶ø¾É°æµÄ¾Í²»»á¡£Èç¹ûÄã²¢²»È·¶¨ÄãÐèÒªÄÄÒ»ÖÖ loader £¬¾Í¶Ôº¯Ê½¿âÖ´ÐÐ {\ttfamily file} Ö¸Áî¡£¾ÙÀýÀ´Ëµ£º
\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} Ö¸³ö {\ttfamily 4.7.2} °æÊÇ¸ø A.OUT º¯Ê½¿âÊ¹ÓÃ£¬¶ø {\ttfamily ELF} Ö¸³ö {\ttfamily 5.4.33} ÒÔ¼° {\ttfamily 2.1.1} °æÊÇ¸ø ELF Ê¹ÓÃ¡£ \nidx{ELF}

Çë copy ÄãËùÐèÒªµÄÖ¸¶¨ loader(s) µ½ÄãËù½¨Á¢µÄ root filesystem ¡£Õë¶ÔËù°üÀ¨µÄ¶þ½øÎ»µµ£¬º¯Ê½¿âÓë loaders Ó¦¸Ã±» {\itshape  ×ÐÏ¸µØ¼ì²é \/} ¡£Èç¹û kernel ²»ÄÜÔØÈëËùÐèµÄº¯Ê½¿â£¬ÄÇ÷á kernel ¾Í»áÔÚÃ»ÓÐ´íÎóÑ¶Ï¢µÄÇé¿öÏÂÍ£Ö¹ÔË×÷¡£




\subsection{¶Ô PAM Óë NSS µÄÌá¹© -- Providing for PAM and NSS}

\label{PAMandNSS}

ÄãµÄÏµÍ³¿ÉÄÜ»áÐèÒª¶¯Ì¬µØÔØÈëÎ´±» \url{ldd} Ëù¼ûµÄº¯Ê½¿â¡£Èç¹ûÄãÃ»ÓÐÌá¹©º¯Ê½¿â¸øÕâÐ©ÏîÄ¿£¬ÄÇ÷áÄã»áÔÚµÇÂ¼ (log in) »òÊ¹ÓÃÄãµÄ bootdisk Ê±ÔâÓöµ½À§ÄÑ¡£




\subsubsection{PAM (Pluggable Authentication Modules)}



Èç¹ûÄãµÄÏµÍ³Ê¹ÓÃ PAM (Pluggable Authentication Modules) £¬ÄÇ÷áÄã±ØÐëÔÚÄãµÄ bootdiskÉÏÎª PAM ×öÒ»Ð©Ô¤±¸¡£¼ò¶øÑÔÖ®£¬ PAM ÊÇÒ»ÖÖ¸´ÔÓ¾«ÃÜµÄÄ£×é»¯·½·¨£¬Õë¶ÔÊ¹ÓÃÕßÈÏÖ¤ÒÔ¼°¿ØÖÆÊ¹ÓÃÕß¶Ô·þÎñµÄ´æÈ¡¡£Ò»¸ö¾ö¶¨ÄãµÄÏµÍ³ÊÇ·ñÊ¹ÓÃ PAM µÄ¼òµ¥·½·¨£¬ÊÇ¶ÔÄãµÄ \url{login} ¿ÉÖ´ÐÐµµÖ´ÐÐ \url{ldd} £»Èç¹ûÊä³ö°üÀ¨ \url{libpam.so} £¬Äã¾ÍÐèÒª PAM ¡£

ÐÒÔËµØ£¬°²È«ÐÔÍ¨³£²¢·Ç bootdisk Ëù¹ØÐÄµÄÒéÌâ£¬ÒòÎªÈÎºÎ¶Ô»úÆ÷ÓÐÊµ¼Ê´æÈ¡È¨µÄÈË£¬Í¨³£ÄÜ×öÈÎºÎËûÃÇÎÞÂÛÈçºÎÏë×öµÄÊÂ¡£Òò´Ë£¬Äã¿ÉÒÔÓÐÐ§µØ¹Ø±Õ PAM £¬Ö»ÒªÔÚÄãµÄ root filesystem Ôì³öÒ»¸ö¼òµ¥µÄ \url{/etc/pam.conf} µµ£¬Õâ¸öµµ¿´ÆðÀ´ÏñÕâÑù£º

\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}


Çë¼ÇµÃÒ² copy \url{/lib/security/pam\_permit.so} Õâ¸öµµµ½ÄãµÄ root filesystem ¡£Õâ¸öº¯Ê½¿âÖ»ÓÐ´óÔ¼ 8K £¬Òò´ËËüÖ»Õ¼ÓÃ¼«Ð¡Á¿µÄ overhead ¡£

Çë¼ÇµÃÕâ¸ö×éÌ¬Éè¶¨ÔÊÐíÈÎºÎÈË¶ÔÕâÌ¨»úÆ÷ÉÏµÄµµ°¸ÒÔ¼°·þÎñÓÐÍêÕûµÄ´æÈ¡È¨¡£Èç¹ûÄãÒòÄ³ÖÖÀíÓÉ¶øÔÚºõÄã bootdisk µÄ°²È«ÐÔ£¬ÄÇ÷áÄã¾Í±ØÐë copy Ò»Ð©»òÊÇÈ«²¿ÄãÓ²µúµÄ PAM setup µ½ÄãµÄ root filesystem ¡£ÇëÈ·¶¨Ôø×ÐÏ¸µØ¶Á¹ý PAM ÎÄ¼þ£¬²¢ÇÒ copy ÈÎºÎÔÚ \url{/lib/security} ÖÐËùÐèÒªµÄº¯Ê½¿âµ½ÄãµÄ root filesystem ÉÏ¡£

ÄãÍ¬Ê±±ØÐë°üº¬ \url{/lib/libpam.so} µ½ÄãµÄ bootdisk ÉÏ¡£µ«ÊÇÄãÒÑÖªÕâ¼þÊÂ£¬ÒòÎªÄãÒÑ¶Ô \url{/bin/login} Ö´ÐÐ¹ý ldd £¬Õâ¶¯×÷ÏÔÊ¾ÁËÆäÏàÒÀÐÔ¡£




\subsubsection{NSS (Name Service Switch)}



Èç¹ûÄãÕýÊ¹ÓÃ glibc (aka libc6) £¬Äã¾Í±ØÐëÎªÃû³Æ·þÎñ (name switch) ½øÐÐÔ¤±¸£¬·ñÔòÄã»áÎÞ·¨ log in ¡£ \url{/etc/nsswitch.conf} Õâ¸öµµ°¸¿ØÖÆ×ÊÁÏ¿â¶Ô¸÷Ê½·þÎñÖ®ËÑÑ° (lookups) ¡£Èç¹ûÄã²¢²»´òËã´ÓÍøÂ·ÉÏ´æÈ¡·þÎñ (±ÈÈçËµ£º DNS»ò NIS ËÑÑ°)£¬ÄÇ÷áÄãÖ»ÐèÒª×¼±¸Ò»¸ö¼òµ¥µÄ \url{nsswitch.conf} µµ£¬Õâ¸öµµ°¸¿´ÆðÀ´ÏñÕâÑù£º

\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}


ÕâÑù¾ÍÖ¸¶¨Ã¿Ò»Ïî·þÎñÖ»±» local files Ìá¹©¡£ÄãÍ¬Ê±ÐèÒª°üÀ¨ \url{/lib/libnss\_files.so.}{\itshape X\/} £¬ÔÚ´Ë {\itshape X\/} ÊÇ 1 µÄ»°ÊÇÖ¸ glibc 2.0 £¬¶ø 2 µÄ»°ÊÇÖ¸ glibc 2.1 ¡£Õâ¸öº¯Ê½¿â½«±»ÒÔ¶¯Ì¬·½Ê½ÔØÈëÒÔ´¦Àíµµ°¸ËÑÑ°¡£

Èç¹ûÄã´òËã´ÓÄãµÄ bootdisk ´æÈ¡ÍøÂ·£¬ÄÇ÷áÄã»áÏëÒªÖÆ×÷Ò»¸ö¸ü¾«ÇÉ¸´ÔÓµÄ \url{nsswitch.conf} µµ¡£Ï¸½ÚÇë²Î¿¼ \url{nsswitch} man page¡£×îáá£¬Çë¼ÇµÃÄã±ØÐëÎªÄãËùÖ¸¶¨µÄÃ¿Ò»Ïî {\itshape ·þÎñ (service)\/} £¬°Ñ \url{/lib/libnss\_}{\itshape service\/}\url{.so.1} µµ·ÅÈë bootdisk ÖÐ¡£




\subsection{Ä£×é -- Modules}

\nidx{modules}

Èç¹ûÄãÓÐÒ»¸öÄ£×é»¯µÄ kernel £¬Äã±ØÐë¿¼Á¿ÔÚ¿ª»úáá£¬ÄãÏëÒª´ÓÄãµÄ bootdisk ÉÏÔØÈëÄÄÒ»ÖÖÄ£×é¡£Äã¿ÉÄÜ»áÏëÒª°üÀ¨ {\ttfamily ftape} Óë {\ttfamily zftape} Ä£×é (Èç¹ûÄãµÄ±¸·Ý´Å´øÊÇfloppy tape)£¬ÒÔ¼°¸ø SCSI Éè±¸ÓÃµÄÄ£×é (Èç¹ûÄãÓÐ SCSI Éè±¸)£¬Ò²¿ÉÄÜÊÇ PPP »ò SLIP Ö§Ô®µÄÄ£×é (Èç¹ûÄãÔÚ½ô¼±Çé¿öÏÂÏëÒª´æÈ¡ÍøÂ·)¡£

ÕâÐ©Ä£×é¿ÉÄÜ»á±»·ÅÔÚ \url{/lib/modules} ¡£ÄãÍ¬Ê±Ò²Ó¦¸Ã°üÀ¨ {\ttfamily insmod}, {\ttfamily rmmod} Óë {\ttfamily lsmod} ¡£¸ù¾ÝÄãÊÇ·ñÏëÒª×Ô¶¯µØÔØÈëÄ£×é£¬Äã¿ÉÄÜÒ²Òª°üÀ¨ {\ttfamily modprobe}, {\ttfamily depmod} Óë {\ttfamily swapout} ¡£Èç¹ûÄãÊ¹ÓÃ {\ttfamily kerneld}£¬ÇëÓë \url{/etc/conf.modules} Ò»Æð°üÀ¨½øÀ´¡£

È»¶ø£¬Ê¹ÓÃÄ£×éµÄÖ÷ÒªÓÅµãÔÚì¶Äã¿ÉÒÔ°Ñ·Ç¹Ø¼ü (non-critical)Ä£×éÒÆµ½ utility disk ÉÏ£¬ÔÚÐèÒªÓÃµ½Ê±²ÅÔØÈë£¬ÕâÑùÔÚÄãµÄ root disk ÉÏ»áÊ¹ÓÃ±È½ÏÉÙµÄ¿Õ¼ä¡£Èç¹ûÄãÒª´¦ÀíÐí¶à²»Í¬µÄÉè±¸£¬Õâ¸ö·½·¨±È½¨Á¢Ò»¸öÄÚ½¨Ö§Ô®Ðí¶àÉè±¸µÄ¾Þ´ó kernel À´µÃºÃ¡£

Çë×¢Òâ£¬ÎªÁËÆô¶¯ (boot) Ò»¸öÑ¹ËõµÄ ext2 filesystem £¬Äã±ØÐëÓÐ ramdisk ÓëÄÚ½¨ ext2 Ö§Ô®¡£ {\itshape  ËüÃÇ²»ÄÜ¹»ÒÔÄ£×éµÄ·½Ê½±»Ìá¹©¡£ \/}




\subsection{Ò»Ð©×îááµÄÏ¸½Ú -- Some final details}



Ä³Ð©ÏµÍ³³ÌÊ½£¬ÖîÈç {\ttfamily login} £¬µ± \url{/var/run/utmp} µµÓë \url{/var/log} Ä¿Â¼²»´æÔÚÊ±£¬»á·¢³ö¾¯¸æ¡£ËùÒÔ£º

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


×îáá£¬ÔÚÄãÉè¶¨ (set up) ÍêËùÓÐÄãËùÐèµÄº¯Ê½¿âáá£¬Ö´ÐÐ {\ttfamily ldconfig} ÒÔÔÚ root filesystemÉÏÖØÐÂÖÆ×÷ (remake) \url{/etc/ld.so.cache} ¡£Õâ¸ö cache »á¸æËß loader µ½ÄÄÀïÕÒµ½º¯Ê½¿â¡£ÒªÖØÐÂÖÆ×÷ \url{ld.so.cache}£¬ÇëÏÂ´ïÒÔÏÂÖ¸Áî£º
\begin{verbatim}
        chdir /mnt; chroot /mnt /sbin/ldconfig
\end{verbatim}


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

{\ttfamily chroot} ÊÇ±ØÒªµÄ£¬ÒòÎª {\ttfamily ldconfig} ×ÜÊÇ»áÎª root filesystem ÖØÐÂÖÆ×÷ cache ¡£




\subsection{Wrapping it up}

\label{WrappingItUp}

Ò»µ©ÄãÍê³É root filesystem µÄ½¨¹¹¹¤×÷£¬¾Í unmount Ëü£¬½«Ö® copy ³ÉÒ»¸öµµ°¸²¢Ñ¹ËõËü£º
\begin{verbatim}
        umount /mnt
        dd if=DEVICE bs=1k | gzip -v9 > rootfs.gz
\end{verbatim}


½áÊøáá£¬Äã»áÓÐÒ»¸öÃûÎª \url{rootfs.gz} µÄµµ°¸£¬Õâ¾ÍÊÇÄã±»Ñ¹Ëõ¹ýµÄ root filesystem¡£ÄãÓ¦¸Ã¼ì²éËüµÄ size ÒÔÈ·±£ËüÄÜ·ÅÔÚÒ»ÕÅÈíµúÆ¬ÉÏ£»Èç¹û²»ÐÐ£¬Äã¾Í±ØÐë»ØËÝ²¢ÒÆ³ýÒ»Ð©µµ°¸¡£ \ref{Slimfast} {(Reducing root filesystem size)} Õâ½ÚÓÐÒ»Ð©ÌáÊ¾£¬¸æËßÄãÓÐ¹Ø¼õÉÙ root filesystem µÄ size ¡£




\section{Ñ¡ÔñÒ»¸ö kernel -- Choosing a kernel}

\nidx{kernel, choosing}

ÏÖÔÚ£¬ÄãÒÑÓÐÒ»¸öÍêÕûµÄ±»Ñ¹Ëõ¹ýµÄroot filesystem¡£ÏÂÒ»²½ÊÇÒª½¨Á¢»òÊÇÑ¡ÔñÒ»¸ö kernel ¡£ÔÚ´ó²¿·ÖµÄÇé¿öÏÂ£¬ copy ÄãÄ¿Ç°ËùÊ¹ÓÃµÄ kernel ²¢ÇÒ´ÓËüÆô¶¯ÈíµúÆ¬ÊÇ¿ÉÄÜµÄ¡£È»¶ø£¬»áÓÐÒ»Ð©Çé¿ö£¬Äã»áÏ£Íû½¨Á¢Ò»¸ö¶ÀÁ¢µÄ (separate) kernel ¡£

ÀíÓÉÖ®Ò»ÊÇ size µÄ¿¼Á¿¡£Èç¹ûÄãÕý½¨Á¢Ò»ÕÅµ¥Ò»µÄ boot/root ´ÅÆ¬£¬ kernel ½«»áÊÇ´ÅÆ¬ÉÏ×î´óµÄµµ°¸Ö®Ò»£¬Ò²Òò´ËÄã±ØÐë¾¡¿ÉÄÜµØ¼õÉÙ kernel µÄ size ¡£ÎªÁË¼õÉÙ kernel size £¬ÇëÓÃÄÜÖ§Ô®ËùÏëÒªµÄÏµÍ³Ö®±ØÒª×îÆðÂëµÄÉè±¸À´½¨Á¢ kernel ¡£ÕâÊÇÖ¸¶ªÈ¥ÄãËù²»ÏëÒªµÄÃ¿Ò»Ïî¡£ÍøÂ·¹¦ÄÜÊÇ¿ÉÒÔ¶ªÈ¥µÄºÃÑ¡Ôñ£¬ÁíÍâ»¹ÓÐµ±ÔË×÷ÄãµÄ boot/root filesystem Ê±£¬ÈÎºÎÄãËù²»ÐèÒªµÄ´Åµú»úÓëÆäËüÉè±¸µÄÖ§Ô®¡£ÈçÍ¬Ç°Êö£¬ÄãµÄ kernel ±ØÐëÓÐ ramdisk Óë ext2 Ö§Ô®ÄÚ½¨ì¶ÆäÖÐ¡£

Èç¹ûÄãÒÑÍê³ÉÒ»Ì××îÆðÂëµÄ (minimum) Éè±¸×éºÏÒÔ±ãì¶½«Ö®·ÅÈë kernel ÖÐ£¬ÄÇ÷á½ÓÏÂÀ´ÄãÐèÒª¿ªÊ¼½øÐÐÒª°ÑÊ²÷á¼ÓÈë»ØÀ´¡£»òÐíÒ»Ì× boot/root ´ÅÆ¬×éÖ®×î³£¼ûÓÃÍ¾£¬ÊÇÎªÁËÒªÄÜ¼ì²éÓë»Ø¸´ (restore) Ò»¸öÒÑËð»ÙµÄ root file system £¬¶øÎªÁË´ï³ÉÕâ¸öÄ¿±ê£¬ÄãÐèÒª kernel µÄÖ§Ô®¡£¾ÙÀýÀ´Ëµ£¬Èç¹ûÄãµÄ±¸·Ý¶¼·ÅÔÚ´Å´øÉÏ£¬²¢Ê¹ÓÃ Ftape ´æÈ¡ÄãµÄ´Å´ø»ú£¬ÄÇ÷á£¬Èç¹ûÄãÊ§È¥ÁËÄãÄ¿Ç°µÄroot driveÓëº¬ÓÐ Ftape µÄ drive £¬Äã½«²»ÄÜ¹»´ÓÄãµÄ±¸·Ý´Å´ø½øÐÐ»Ø¸´´¢´æ¡£Äã½«±ØÐëÖØÐÂ°²×° Linux £¬ÏÂÔØ²¢ÖØ×° \cdx{ftape} £¬È»ááÊÔÖø¶ÁÈ¡ÄãµÄ±¸·Ý¡£

´Ë´¦µÄÒªµãÊÇ£¬ÎÞÂÛÄãÒÑ¼ÓÈëÊ²÷á I/O Ö§Ô®µ½ÄãµÄ kernel ÄÚÒÔÖ§Ô®±¸·Ý£¬ÄãÍ¬Ê±Ò²Ó¦¸Ã°ÑËüÃÇ¼ÓÈëµ½ÄãµÄ boot/root kernel ÖÐ¡£

\nidx{kernel, building from source}

Êµ¼Ê½¨Ôì kernel µÄ³ÌÐòÏêÊöÔÚËæ¸½ì¶ kernel µÄÎÄ¼þÖÐ¡£Äã¿ÉÒÔÇáÒ×µØÕÕÖøÖ¸Ê¾½øÐÐ£¬ËùÒÔ¿ÉÒÔ \url{/usr/src/linux} ÎªÆðµã¡£Èç¹ûÄãÔÚ½¨Ôì kernel ÉÏÓÐÀ§ÄÑ£¬Äã»òÐí²»Ó¦¸ÃÆóÍ¼²»ÔñÊÖ¶ÎµØ½¨Ôì boot/root systems ¡£Çë¼ÇµÃÓÃ ``{\ttfamily make zImage}''Ñ¹Ëõ kernel ¡£




\section{°ÑËüÃÇ·ÅÔÚÒ»Æð£ºÖÆ×÷´ÅÆ¬(×é) -- Putting them together: Making the diskette(s)}



½øÐÐµ½ÕâÀï£¬ÄãÒÑ¾­ÓÐÒ»¸ö kernel ÓëÒ»¸öÑ¹ËõµÄ root filesystem ¡£Èç¹ûÄãÕýÔÚÖÆ×÷Ò»ÕÅ boot/root ´ÅÆ¬£¬Çë¼ì²éËüÃÇµÄ size £¬ÒÔÈ·¶¨ËüÃÇ¶¼ÄÜ·ÅÔÚÍ¬Ò»ÕÅ´ÅÆ¬ÉÏ¡£Èç¹ûÄãÕýÔÚÖÆ×÷Ò»Ì×Á½ÕÅ´ÅÆ¬µÄ boot + root ´ÅÆ¬×é¡£Çë¼ì²é root filesystem ÒÔÈ·¶¨ËüÄÜ·ÅÔÚÒ»ÕÅ´ÅÆ¬ÉÏ¡£

ÄãÓ¦¸Ã¾ö¶¨ÊÇ·ñÊ¹ÓÃ LILO ÒÔÆô¶¯ bootdiskµÄ kernel ¡£Ìæ´úµÄ·½·¨ÊÇÖ±½Ó°Ñ kernel copy µ½´ÅÆ¬ÉÏ£¬È»áá²»Ê¹ÓÃ LILO ¿ª»ú¡£Ê¹ÓÃ LILO µÄºÃ´¦ÔÚì¶ÈÃÄãÄÜ¹»Ìá¹©Ò»Ð©²ÎÊý¸ø kernel £¬ÕâÐ©²ÎÊý¶Ô³õÊ¼»¯Ó²ÌåÀ´Ëµ¿ÉÄÜÊÇ±ØÒªµÄ(Çë¼ì²éÄãÏµÍ³ÉÏµÄ \url{/etc/lilo.conf} µµ¡£Èç¹ûÕâ¸öµµ´æÔÚ£¬¶øÇÒÓÐÒ»ÐÐÏñ``{\ttfamily append=...}''£¬Äã¿ÉÄÜÐèÒªÕâ¸öÌØµã (feature))¡£Ê¹ÓÃ LILO µÄÈ±µãÔÚì¶½¨Ôì bootdisk ±äµÃ¸üÎª¸´ÔÓ£¬²¢ÇÒÕ¼ÓÃÉÔÏÓ½Ï¶àµÄ¿Õ¼ä¡£Äã½«±ØÐëÉè¶¨Ò»¸öÐ¡ÐÍ¶ø¶ÀÁ¢µÄ filesystem £¬ÎÒÃÇ³ÆÖ®Îª {\itshape kernel filesystem\/}£¬ÔÚÆäÖÐÄã´«ËÍ kernel ÒÔ¼°Ò»Ð© LILO ËùÐèµÄÆäËüµµ°¸¡£

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

Èç¹ûÄã½«ÒªÊ¹ÓÃ LILO £¬Çë¼ÌÐø¶ÁÏÂÈ¥£»Èç¹ûÄãÒªÖ±½Ó´«ËÍ kernel £¬ÏÈÌø¹ý´Ë£¬Ö±½Óµ½ \ref{TransferringWithoutLILO} {(Without using LILO)} ÕâÒ»½Ú¡£




\subsection{ÓÃ LILO ´«ËÍ kernel -- Transferring the kernel with LILO}

\label{TransferringWithLILO}

ÄãËù±ØÐë×öµÄµÚÒ»¼þÊÂÊÇÎª LILO ±àÐ´Ò»¸öÐ¡ÐÍµÄ×éÌ¬µµ¡£Õâ¸öµµ¿´ÆðÀ´ÏñÕâÑù£º
\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}

¹Øì¶ÕâÐ©²ÎÊýµÄËµÃ÷Çë¿´ LILO's user documentation ¡£Äã»òÐíÒ²»áÏë´ÓÄãÓ²µúÉÏµÄ \url{/etc/lilo.conf} µµ£¬¼ÓÈëÒ»ÐÐ {\ttfamily append=...} µ½Õâ¸ö×éÌ¬µµÖÐ¡£

°ÑÕâ¸ö×éÌ¬µµ´æ³É \url{bdlilo.conf} ¡£

ÏÖÔÚÄã±ØÐëÖÆ×÷Ò»¸öÐ¡ÐÍµÄµµ°¸ÏµÍ³£¬ÎÒÃÇ³ÆÖ®Îª {\itshape kernel filesystem\/} £¬ÓÐ±ðì¶ root filesystem ¡£

Ê×ÏÈ£¬Ö¸³öÕâ¸ö filesystem Ó¦¸Ã»áÓÐ¶à´ó¡£ÓÃ blocks ¼ÆËãÄã kernel µÄ size (Õâ¸ö size ÓÃ ``{\ttfamily ls -l KERNEL}'' ÏÔÊ¾³öÀ´£¬ÊÇ±» 1024 Ëù³ý²¢Ç¿ÆÈ½øÎ»)£¬È»áá¼Ó 50 ¡£Õâ¸ö 50 blocks ÊÇ¹À¼ÆµÄ¿Õ¼ä£¬Îª inodes ÓëÆäËüµµ°¸ËùÐè¡£Èç¹ûÄãÏëÒª£¬Äã¿ÉÒÔ¾«È·µØ¼ÆËãÕâ¸öÊý×Ö£¬»òÊÇ¾ÍÓÃ 50 ¾ÍºÃÁË¡£Èç¹ûÄãÕýÔÚÖÆ×÷Á½ÕÅ´ÅÆ¬µÄ´ÅÆ¬×é£¬Äã»á¸ß¹ÀÕâ¸ö¿Õ¼ä£¬ÒòÎªÎÞÂÛÈçºÎµÚÒ»ÕÅ´ÅÆ¬Ö»¸ø kernel Ê¹ÓÃ¡£ÎÒÃÇ³ÆÕâ¸öÊý×Ö»á {\ttfamily KERNEL\_BLOCKS} ¡£

Çë°ÑÈíµúÆ¬·ÅÈëÈíµú»ú (ÎªÇó¼ò±ã£¬ÎÒÃÇ¼ÙÉèÊÇ \url{/dev/fd0})£¬È»ááÔÚÆäÉÏÖÆ×÷ ext2 kernel filesystem ¡£
\begin{verbatim}
        mke2fs -i 8192 -m 0 /dev/fd0 KERNEL_BLOCKS
\end{verbatim}


\nidx{inodes, allocation}
``{\ttfamily -i 8192}'' Ö¸¶¨ÎÒÃÇÏëÒªÃ¿ 8192 bytes Ò»¸ö node ¡£½ÓÏÂÀ´£¬ mount Õâ¸ö filesystem £¬ÒÆ³ý \url{lost+found} Ä¿Â¼£¬È»ááÎª LILO Ôì³ö \url{dev} Óë \url{boot} ÕâÁ½¸öÄ¿Â¼£º
\begin{verbatim}
        mount /dev/fd0 /mnt
        rm -rf /mnt/lost+found
        mkdir /mnt/{boot,dev}
\end{verbatim}


ÔÙÀ´£¬Ôì³öÉè±¸µµ \url{/dev/null} Óë \url{/dev/fd0} ¡£²»ÓÃÑ°ÕÒÉè±¸ºÅÂë£¬ÄãÖ»Òª´ÓÄãµÄÓ²µúÉÏÓÃ {\ttfamily -R} copyËüÃÇ£º
\begin{verbatim}
        cp -R /dev/{null,fd0} /mnt/dev
\end{verbatim}
 
LILO ÐèÒªÒ»·ÝËüµÄ boot loader µÄ copy £¬ \url{boot.b} £¬Äã¿ÉÒÔ´ÓÄãµÄÓ²µúµÃµ½Ëü¡£ËüÍ¨³£ÊÇ·ÅÔÚ \url{/boot} Ä¿Â¼ÄÚ¡£
\begin{verbatim}
        cp /boot/boot.b /mnt/boot
\end{verbatim}

×îáá£¬Ëæ¸½ÄãµÄ kernel £¬ copy ÄãÔÚÉÏÒ»½ÚËù±àÐ´µÄ LILO ×éÌ¬µµ¡£ËüÃÇÁ½Õß¿ÉÒÔ±»·ÅÔÚ¸ùÄ¿Â¼ÏÂ¡£
\begin{verbatim}
        cp bdlilo.conf KERNEL /mnt
\end{verbatim}

LILO ËùÐèµÄÃ¿Ò»ÏîÏÖÔÚ¶¼ÔÚ kernel filesystemÉÏ£¬ËùÒÔÄãÒÑ×¼±¸ºÃÈ¥Ö´ÐÐËü¡£ LILO µÄ {\ttfamily -r} ÆìºÅ(flag)±»ÓÃ×÷°²×° boot loader ÔÚÄ³¸öÆäËüµÄ root ÉÏ£º
\begin{verbatim}
        lilo -v -C bdlilo.conf -r /mnt
\end{verbatim}


LILO Ó¦¸Ã¿ÉÒÔÔÚÎÞ´íµÄÇé¿öÏÂÖ´ÐÐ£¬ÔÚ´ËÖ®áá£¬Äã¿ÉÒÔ¿´¿´ÄãµÄ kernel filesystem £¬Ó¦¸Ã³¤µÃÏñÕâÑù£º
\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}

Èç¹ûµµ°¸ size ºÍÄã×Ô¼ºµÄ filesystem ÓÐÉÔÎ¢²»Í¬£¬Çë²»ÓÃµ£ÐÄ¡£

ÏÖÔÚÇë°Ñ´ÅÆ¬ÁôÔÚÈíµú»úÄÚ£¬È»ááÇ°½øµ½ \ref{SettingRamdiskWord} {(Setting the ramdisk word)} ÕâÒ»½Ú¡£




\subsection{²»Ê¹ÓÃ LILO À´´«ËÍ kernel -- Transferring the kernel without LILO}

\label{TransferringWithoutLILO}

Èç¹ûÄã {\itshape  ²» \/} Ê¹ÓÃLILO£¬ÄÇ÷á¾ÍÓÃ {\ttfamily dd} Ö¸ÁîÀ´´«ËÍ kernel ¸ø bootdisk £º
\begin{verbatim}
        % dd if=KERNEL of=/dev/fd0 bs=1k
        353+1 records in
        353+1 records out
\end{verbatim}


ÔÚÕâ¸öÀý×ÓÖÐ£¬ {\ttfamily dd} Ð´ÈëÁË 353 ¸öÍêÕû¼ÇÂ¼(records) + 1¸öpartial record £¬ËùÒÔ kernel Õ¼ÓÃÁË 354 ¸öÈíµúÆ¬µÄ blocks ¡£Õâ¸öÊý×Ö³ÆÎª {\ttfamily KERNEL\_BLOCKS} £¬Çë¼ÇµÃËü£¬Õâ¸öÊý×ÖÒª¸øÏÂÒ»½ÚÊ¹ÓÃ¡£

×îáá£¬ÇëÉè¶¨ root device ÎªÈíµúÆ¬×Ô¼º£¬È»ááÔÙÉè¶¨ root Òª±»ÔØÈë³É read/write £º
\begin{verbatim}
        rdev /dev/fd0 /dev/fd0
        rdev -R /dev/fd0 0
\end{verbatim}


\ncdx{rdev}

ÔÚµÚ¶þ¸ö {\ttfamily rdev} Ö¸ÁîÖÐ£¬ÇëÐ¡ÐÄµØÊ¹ÓÃ {\ttfamily -R} ¡£




\subsection{Éè¶¨ramdisk -- Setting the ramdisk word}

\label{SettingRamdiskWord}

ÔÚ kernel imageÄÚµÄÊÇ {\itshape ramdisk word\/} £¬Ëü°éËæÆäËüÑ¡Ïî£¬Ö¸¶¨ÁË root filesystem Ó¦¸ÃÔÚÄÄÀï±»ÕÒµ½¡£Õâ¸ö word »á±»ÒÔ {\ttfamily rdev} Ö¸Áî£¬À´½øÐÐ´æÈ¡ÓëÉè¶¨£¬¶øËüµÄÄÚÈÝ±»½âÊÍÈçÏÂ£º

\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}


Èç¹û bit 15 ±»Éè¶¨£¬ÔÚ¿ª»úÊ± (boot-up) £¬»áÌáÊ¾Äã°ÑÒ»ÕÅÐÂµÄÈíµúÆ¬·ÅÈëÈíµú»úÖÐ¡£Õâ¶ÔÒ»Ì×Ë«´ÅÆ¬µÄ¿ª»ú´ÅÆ¬×éÀ´ËµÊÇ±ØÒªµÄ¡£

ÒÀ¾ÝÄãÊÇ½¨ÔìÒ»ÕÅµ¥Ò»µÄ boot/root ´ÅÆ¬£¬»¹ÊÇÁ½ÕÅ "boot + root" µÄ´ÅÆ¬×é£¬ÕâÀï»á²úÉúÁ½ÖÖÇé¿ö¡£

\begin{enumerate}
\item  Èç¹ûÄãÊÇ½¨ÔìÒ»ÕÅµ¥Ò»´ÅÆ¬£¬Ñ¹ËõµÄ root filesystem »á±»·ÅÖÃÔÚ kernel Ö®áá£¬ËùÒÔ offset »áÊÇµÚÒ»¿é free block (Õâ¸öÖµÓ¦¸Ã»áÓë {\ttfamily KERNEL\_BLOCKS} ÏàµÈ) ¡£ Bit 14 »á±»Éè¶¨Îª 1 £¬¶ø bit 15 »á±»Éè¶¨Îª 0 ¡£

¾ÙÀýÀ´Ëµ£¬¼ÙÉèÄãÕý½¨ÔìÒ»ÕÅµ¥Ò»´ÅÆ¬£¬¶ø root filesystem ½«×Ô block 253 (10½øÎ»)¿ªÊ¼¡£ÄÇ÷á£¬ ramdisk word ÖµÓ¦¸ÃÊÇ 253 (10½øÎ») £¬ bit 14 ÉèÎª 1 ¶ø bit 15 ÉèÎª 0 ¡£Òª¼ÆËãÕâ¸öÖµ£¬Äã¿ÉÒÔ¼òµ¥µØ¼ÓÒ»¼ÓÕâ¸ö 10 ½øÎ»Êý×Ö¡£ 253 + (2\^{}14) = 253 + 16384 = 16637 ¡£Èç¹ûÄã²¢²»Ê®·ÖÁË½âÕâ¸öÊý×Ö´ÓºÎ¶øÀ´£¬°ÑÕâÊý×Ö·Åµ½¹¤³Ì¼ÆËã»úÉÏ£¬È»áá°ÑËü×ª»»Îª 2 ½øÎ»£¬
\item  Èç¹ûÄã½¨ÔìµÄÊÇÒ»Ì×Ë«´ÅÆ¬×é£¬ÄÇ÷á root filesystem ½«×ÔµÚ¶þÕÅ´ÅÆ¬µÄ block 0 ¿ªÊ¼£¬ËùÒÔ offset Îª 0 ¡£ Bit 14 ÉèÎª 1 ¶ø bit 15 ÉèÎª 1 ¡£ÔÚÕâ¸öÇé¿öÏÂ£¬ 10 ½øÎ»ÖµÊÇ 2\^{}14 + 2\^{}15 = 49152 ¡£
\end{enumerate}


\nidx{ramdisk word}\ncdx{rdev}

ÔÚ×ÐÏ¸µØÎª ramdisk word ¼ÆËãáá£¬ÇëÓÃ {\ttfamily rdev -r} Éè¶¨Ëü¡£Çë×¢ÒâÒªÊ¹ÓÃ {\itshape 10 ½øÎ» \/} Öµ¡£Èç¹ûÄãÊ¹ÓÃ LILO £¬´«¸ø {\ttfamily rdev} µÄÒýÊýÔÚ´ËÓ¦¸ÃÊÇ {\itshape mounted kernel path\/} £¬±ÈÈçËµ \url{/mnt/vmlinuz}£»Èç¹ûÄãÓÃ {\ttfamily dd} À´ copy kernel £¬Ìæ»»³ÉÊ¹ÓÃÈíµú»úÃû³Æ({\itshape  ±ÈÈçËµ \/}\url{/dev/fd0})¡£
\begin{verbatim}
        rdev -r KERNEL_OR_FLOPPY_DRIVE  VALUE
\end{verbatim}


Èç¹ûÄãÊ¹ÓÃ LILO £¬ÏÖÔÚÇë°Ñ´ÅÆ¬ unmount ¡£




\subsection{´«ËÍroot filesystem -- Transferring the root filesystem}



×îááÒ»²½ÊÇÒª´«ËÍ root filesystem ¡£

\begin{itemize}
\item  Èç¹û root filesystem ½«±»·ÅÖÃÔÚ×öÎª kernel Ö® {\itshape  ÏàÍ¬ \/} ´ÅÆ¬ÉÏ£¬ÇëÊ¹ÓÃ {\ttfamily dd} Ö¸Áî¼°Æä {\ttfamily seek} Ñ¡Ïî´«ËÍËü£¬Õâ»áÖ¸¶¨ÒªÌø¹ý¶àÉÙ¸ö blocks £º
\begin{verbatim}
        dd if=rootfs.gz of=/dev/fd0 bs=1k seek=KERNEL_BLOCKS
\end{verbatim}

\item  Èç¹û root filesystem »á±»·ÅÖÃÔÚ {\itshape  µÚ¶þÕÅ \/} ´ÅÆ¬ÉÏ£¬Çë×Ô´Åµú»úÖÐÄÃ×ßµÚÒ»ÕÅÈíµúÆ¬È»áá·ÅÈëµÚ¶þÕÅ´ÅµúÆ¬£¬½ÓÖø½« root filesystem ´«ËÍµ½ÆäÉÏ£º
\begin{verbatim}
        dd if=rootfs.gz of=/dev/fd0 bs=1k
\end{verbatim}
\end{itemize}


¹§Ï²Äã£¬ÒÑ¾­Íê³ÉÁË£¡

ÔÚ°Ñ bootdisk Å²Îª½ô¼±Ê¹ÓÃÖ®Ç°£¬Çë¼ÇµÃÏÈ²âÊÔËü !Èç¹ûÄãµÄ³ÉÆ·²»ÄÜÖ´ÐÐ£¬Çë¼ÌÐø¶ÁÏÂÈ¥¡£




\section{ÎÊÌâ½â¾ö -- Troubleshooting, or The Agony of Defeat}

\label{Troubleshooting}
\nidx{Troubleshooting}

µ±½¨Ôì bootdisks Ê±£¬¿ªÊ¼µÄ¼¸´Î³¢ÊÔ½á¹û³£³£ÊÇÎÞ·¨¿ª»ú¡£½¨ÔìÒ»ÕÅ root disk µÄÒ»°ã·½·¨ÊÇ×éºÏÀ´×ÔÄãÏÖÓÐÏµÍ³µÄÔª¼þ (compnents) £¬½ÓÖø³¢ÊÔÓëµÃµ½Õâ¸öÒÔ´ÅÆ¬Îª»ù´¡µÄÏµÍ³ (diskette-based system) £¬Ö±µ½ËüÔÚ console ÉÏÏÔÊ¾Ñ¶Ï¢¡£Ò»µ©Ëü¿ªÊ¼ÓëÄã½»Ì¸£¬Õâ³¡Õ½¶·¾Í½áÊøÒ»°ëÁË£¬ÒòÎªÄã¿ÉÒÔÁË½âËüÔÚ±§Ô¹Ê²÷á£¬¶øÇÒÄã¿ÉÒÔ½â¾ö¸ö±ðµÄÎÊÌâÖ±ÖÁÏµÍ³ÄÜÆ½Ë³µØÔË×÷¡£Èç¹ûÏµÍ³Í£Ö¹ÔË×÷¶øÃ»ÓÐÈÎºÎËµÃ÷£¬ÒªÕÒµ½ÕâÔ­Òò»áÊÇÒ»¼þÀ§ÄÑµÄÊÂ¡£ÎªÁËÈÃÏµÍ³ÄÜÆô¶¯µ½ÄÜÓëÄã½»Ì¸µÄ½×¶Î£¬ÕâÐèÒªÊ¹ÓÃµ½ºÃ¼¸ÖÖÔª¼þ£¬¶øÇÒÕâÐ©Ôª¼þÒª¾­¹ýÕýÈ·µØ×éÌ¬¡£ÒÔÏÂÊÇµ÷²éÏµÍ³ÎÞ·¨ÓëÄã½»Ì¸Ö®ÎÊÌâµÄ½¨Òé³ÌÐò£º

\begin{itemize}
\item  Äã»á¿´µ½Ò»ÐÐÑ¶Ï¢ÏñÕâÑù£º
\begin{verbatim}
kernel panic: VFS: Unable to mount root fs on XX:YY
\end{verbatim}

ÕâÊÇ³£¼ûµÄÎÊÌâ£¬¶øËüÖ»ÓÐÒ»Ð©Ô­Òò¡£Ê×ÏÈ£¬Çë¸ù¾Ý device code Çåµ¥¼ì²é device {\itshape XX:YY\/} £»ËüÊÇÕýÈ·µÄ root device Âð ?Èç¹û²»ÊÇ£¬ÄÇÄã¿ÉÄÜÃ»ÓÐ×ö¹ý {\ttfamily rdev -R} £¬»òÕßÊÇÄãÊÇ¶Ô´íÎóµÄ image Ö´ÐÐrdev -R¡£Èç¹û device code ÊÇÕýÈ·µÄ£¬ÄÇ÷áÇë×ÐÏ¸µØ¼ì²é±»±àÒëµ½Äã kernel ÄÚµÄ device Çý¶¯³ÌÊ½¡£ÇëÈ·¶¨ËüÓÐÄÚ½¨ÈíµúÆ¬¡¢ ext2 filesystem Ö§Ô®¡£
\item  Èç¹ûÄã¿´µ½Ðí¶à´íÎóÑ¶Ï¢ÏñÊÇ£º
\begin{verbatim}
end_request: I/O error, dev 01:00 (ramdisk), sector NNN
\end{verbatim}

ÕâÊÇ ramdisk driver Ëù±¨¸æµÄ I/O ´íÎóÑ¶Ï¢£¬¿ÉÄÜÊÇÒòÎª kernel Õý³¢ÊÔÐ´Èë³¬Ô½ÁËÉè±¸µÄ½áÎ²¡£ÄãµÄ ramdisk ÒòÎªÌ«Ð¡¶ø²»ÄÜ³ÖÓÐÄãµÄ root filesystem ¡£Çë¼ì²éÄãµÄ bootdisk kernel µÄ³õÊ¼»¯Ñ¶Ï¢£¬ÕÒÒ»ÐÐÏñÊÇ£º
\begin{verbatim}
        Ramdisk driver initialized : 16 ramdisks of 4096K size
\end{verbatim}

ÇëÕë¶Ô root filesystem{\itshape  Î´¾­Ñ¹ËõµÄ \/}size¼ì²éÉÏÊöµÄ size ¡£Èç¹û ramdisks ²»¹»´ó£¬ÄÇ¾ÍÈÃËü¸ü´ó°É¡£
\item  Çë¼ì²é root disk Êµ¼ÊÉÏÓÐ°üº¬ÄãËùÈÏÎªÓ¦¸Ã±»°üº¬µÄÄ¿Â¼¡£ Copy µ½´íÎóµÄ level ÊÇÈÝÒ×·¸µÄ´íÎó£¬ÒÔÖÂì¶µ½×îááÔÚÄãµÄ root ´ÅµúÆ¬ÉÏ£¬Äã»áÓÐÏñÊÇ \url{/rootdisk/bin} µÄÄ¿Â¼£¬¶ø·Ç \url{/bin}¡£
\item  Çë¼ì²éÊÇ·ñÓÐ \url{/lib/libc.so} £¬¶øËüÊÇ·ñÓÐÓëÄãÓ²µúÄÚ \url{/lib} Ä¿Â¼ÖÐËùÏÔÊ¾Ö®ÏàÍ¬ link ¡£
\item  Çë¼ì²éÄã¼È´æÏµÍ³ \url{/dev} Ä¿Â¼ÄÚµÄ symbolic links ÊÇ·ñÍ¬Ê±Ò²´æÔÚì¶ÄãµÄ root ´ÅµúÆ¬ filesystem ÉÏ£¬ÔÚ´Ë£¬ÄÇÐ© links ÊÇÁ¬ÍùÄãÒÑ°üÀ¨ÔÚÄã root ´ÅµúÆ¬ÉÏµÄ devices ¡£ÓÈÆäÊÇÔÚºÜ¶àÇé¿öÏÂ£¬ \url{/dev/console} linksÊÇ×î»ù±¾µÄ¡£
\nidx{device (dev) directory}
\item  Çë¼ì²éÄãÊÇ·ñÒÑ°üÀ¨ÁË \url{/dev/tty1, /dev/null, /dev/zero,
/dev/mem, /dev/ram} Óë \url{/dev/kmem} ÕâÐ©µµ°¸¡£
\item  Çë¼ì²éÄãµÄ kernel ×éÌ¬Éè¶¨ - ¶Ôì¶Ö±µ½µÇÂ¼µã (login point) ËùÐèÖ®ËùÓÐ×ÊÔ´µÄÖ§Ô®±ØÐë±»ÄÚ½¨£¬²»ÄÜÊ¹ÓÃÄ£×é¡£ËùÒÔ {\itshape ramdisk Óë ext2 Ö§Ô®±ØÐë±»ÄÚ½¨ \/} ¡£
\item  Çë¼ì²éÄãµÄ kernel root device Óë ramdisk Éè¶¨ÊÇ·ñÕýÈ·¡£
\end{itemize}


ÒÔÉÏÒÑ¾­º­¸ÇÒ»°ã²¿·Ö£¬ÒÔÏÂÊÇÒ»Ð©¸üÌØ¶¨µÄµµ°¸Óë¼ì²éÏîÄ¿£º

\begin{enumerate}
\item  ÇëÈ·¶¨ {\ttfamily init} ÊÇÒÔ \url{/sbin/init} »ò \url{/bin/init} µÄÐÎÊ½±»°üÀ¨½øÀ´¡£²¢ÇÒÈ·ÈÏËüÊÇ¿ÉÖ´ÐÐµÄ¡£
\item  ÇëÖ´ÐÐ {\ttfamily ldd init} ÒÔ¼ì²é init µÄº¯Ê½¿â¡£Í¨³£Õâ¸ö¾ÍÊÇ \url{libc.so} £¬µ«ÊÇÇëÎÞÂÛÈçºÎ»¹ÊÇ¼ì²éÒ»ÏÂ¡£ÇëÈ·¶¨ÄãÒÑ·ÅÈëÁË±Ø±¸µÄº¯Ê½¿âÓë loaders¡£
\item  ÇëÈ·¶¨Äã°ÑÕýÈ·µÄ loader ¸øÄãµÄº¯Ê½¿â -- \url{ld.so} ÊÇ¸ø a.out ¶ø \url{ld-linux.so} ÊÇ¸ø ELF ¡£ \nidx{loaders}
\item  ÇëÕë¶Ô {\ttfamily getty} (»òÄ³ÖÖÀàËÆ {\ttfamily getty} µÄ³ÌÊ½£¬ÖîÈç {\ttfamily agetty}, {\ttfamily mgetty} »ò {\ttfamily getty\_ps})µÄºô½Ð£¬¼ì²éÄãbootdisk filesystemÉÏµÄ \url{/etc/inittab}¡£ÇëÕë¶ÔÄãÓ²µúµÄ \url{inittab} ¼ì²éÁ½´Î¡£ÔÙ¼ì²éÄãËùÊ¹ÓÃµÄ³ÌÊ½µÄ man pages ÒÔÈ·¶¨ÕâÐ©ÊÇÓÐÒâÒåµÄ¡£ \url{inittab} ¿ÉÄÜÊÇ×î¹îÒìµÄ²¿·Ö£¬ÒòÎªËüµÄÓï·¨ÓëÄÚÈÝ£¬ÒÀ¾ÝËùÊ¹ÓÃµÄ init ³ÌÊ½ÓëÏµÍ³±¾ÖÊ¶øÓÐËù²»Í¬¡£½â¾öµÄÎ¨Ò»Ö®µÀ¾ÍÊÇÈ¥ÔÄ¶Á {\ttfamily init} Óë {\ttfamily inittab} µÄman pages£¬È»ááÔÙÕýÈ·µØ×ö³ö¼È´æÏµÍ³¿ª»úÊ±Ëù×öµÄÊÂ¡£Çë¼ì²éÒÔÈ·¶¨ \url{/etc/inittab} ÓÐÒ»¸öÏµÍ³³õÊ¼»¯µÄ¼ÇÂ¼ (entry) ¡£ËüÓ¦¸Ã°üÀ¨Ò»¸öÖ¸ÁîÒÔÖ´ÐÐ±Ø¶¨´æÔÚµÄÏµÍ³³õÊ¼»¯ script ¡£
\item  ÈçÍ¬ {\ttfamily init} £¬¶ÔÄãµÄ {\ttfamily getty} Ö´ÐÐ {\ttfamily ldd} ÒÔÁË½âËüÐèÒªÊ²÷á£¬Í¬Ê±È·¶¨±Ø±¸µÄº¯Ê½¿âµµ°¸Óë loaders ÊÇ·ñ±»·ÅÈëÄãµÄ root filesystem ¡£
\item  ÇëÈ·ÈÏÄãÒÑ·ÅÈëÒ»¸ö shell ³ÌÊ½ (e.g., {\ttfamily bash} or {\ttfamily ash})£¬ËüÄÜ¹»Ö´ÐÐÄãËùÓÐµÄ rc scripts ¡£\nidx{shells}
\item  Èç¹ûÔÚÄãµÄ¾ÈÔ®´ÅÆ¬ÉÏ£¬ÓÐÒ»¸ö \url{/etc/ld.so.cache} µÄµµ°¸£¬ÇëÖØÐÂÖÆ×÷ (remake) Ëü¡£
\end{enumerate}


Èç¹û {\ttfamily init} Æô¶¯£¬µ«ÊÇÄãÈ´µÃµ½Ò»ÐÐÑ¶Ï¢ÏñÊÇ£º
\begin{verbatim}
        Id xxx respawning too fast: disabled for 5 minutes  
\end{verbatim}

ËüÊÇÀ´×Ôì¶ {\ttfamily init} £¬Í¨³£Ö¸³ö {\ttfamily getty} »ò {\ttfamily login} ±»ÖÕ½áÖ»Òª init Æô¶¯¡£Çë¼ì²é {\ttfamily getty} Óë {\ttfamily login} µÄ¿ÉÖ´ÐÐµµÓëÏàÒÀµÄº¯Ê½¿â¡£ÇëÈ·¶¨ÔÚ \url{/etc/inittab} ÄÚµÄºô½Ð (invocations) ÊÇÕýÈ·µÄ¡£Èç¹ûÄãµÃµ½À´×Ô {\ttfamily getty} µÄÆæ¹ÖÑ¶Ï¢£¬Ëü¿ÉÄÜÊÇÖ¸ \url{/etc/inittab} ÄÚµÄºô½Ð¸ñÊ½ÊÇ´íÎóµÄ¡£

Èç¹ûÄãµÃµ½Ò»¸ö login ÌáÊ¾ (prompt) £¬È»ááÄãÊäÈëÒ»¸öÓÐÐ§µÄ login name £¬µ«ÊÇÏµÍ³È´Á¢¼´ÌáÊ¾ÄãÒªÊäÈëÁíÒ»¸ö login name £¬ÄÇ÷áÕâ¸öÎÊÌâ¿ÉÄÜÊÇ³öÔÚ PAM »ò NSS ¡£Çë¿´ \ref{PAMandNSS} {(PAM and NSS)} ÕâÒ»½Ú¡£ÎÊÌâÒ²¿ÉÄÜÊÇÄãÊ¹ÓÃ shadow passwords ¶øÄãÈ´Ã»ÓÐ copy \url{/etc/shadow} µ½ÄãµÄ bootdisk ÉÏ¡£

Èç¹ûÄã³¢ÊÔÈ¥Ö´ÐÐÄ³¸ö¿ÉÖ´ÐÐµµ£¬ÖîÈç {\ttfamily df} £¬¶øÕâ¸öÖ´ÐÐµµÊÇÔÚÄãµÄ¾ÈÔ®´ÅÆ¬ÉÏ£¬Ö´ÐÐÊ±È´³öÏÖÏñÕâÑùµÄÑ¶Ï¢£º {\ttfamily df: not found} £¬ÕâÊ±Çë¼ì²éÁ½¼þÊÂ£º(1)ÇëÈ·¶¨°üº¬¶þ½øÎ»µµµÄÄ¿Â¼ÓÐÉè¶¨ÔÚÄãµÄ PATH £¬(2)ÇëÈ·¶¨ÄãÓÐ³ÌÊ½ËùÐèµÄº¯Ê½¿â (Óë loaders)¡£




\section{ÆäËü¸÷ÖÖÖ÷Ìâ -- Miscellaneous topics}






\subsection{¼õÉÙ root filesystem µÄ size -- Reducing root filesystem size}

\label{Slimfast}

ÓÐÊ± root filesystem »áÒòÌ«´ó¶øÎÞ·¨ÈûÈëÒ»ÕÅÈíµúÆ¬ÄÚ£¬ÉõÖÁÔÚÑ¹Ëõ¹ýáá»¹ÊÇÕâÑù¡£ÕâÀïÓÐÒ»Ð©·½·¨¿É¼õÉÙ filesystem µÄ size £º

\begin{enumerate}
\item {\itshape  Ôö¼Ó´ÅµúÆ¬ÃÜ¶È (density)\/} ¡£
ÒÀÕÕÔ¤Éè£¬ÈíµúÆ¬»áÒÔ 1440 K À´½øÐÐ¸ñÊ½»¯£¬µ«ÊÇÏÖÔÚÒ²ÓÐ¸ü¸ßÃÜ¶ÈµÄ¸ñÊ½¡£ \url{fdformat}»áÎªÒÔÏÂ sizes µÄ´ÅÆ¬½øÐÐ¸ñÊ½»¯£º 1600, 1680, 1722, 1743, 1760, 1840, ÒÔ¼° 1920 ¡£´ó²¿·ÖµÄ 1440 K Èíµú»ú¿ÉÖ§Ô® 1722 K £¬ÎÒÒ»Ö±¶¼ÊÇÊ¹ÓÃÕâ¸öÀ´ÖÆ×÷ bootdisks ¡£Çë²Î¿¼ {\ttfamily fdformat} man pageÓë \url{/usr/src/linux/Documentation/devices.txt} ¡£
\item  {\itshape  Ìæ»»ÄãµÄ shell\/} ¡£
Ò»Ð©ÔÚ Linux ÉÏ¹ãÊÜ»¶Ó­µÄ shells £¬ÖîÈç {\ttfamily bash} Óë {\ttfamily tcsh} £¬ÊÇÏàµ±´óÇÒÐèÒªÐí¶àº¯Ê½¿â¡£ Light-weight µÄÑ¡Ôñì¶ÊÇ´æÔÚ£¬ÖîÈç {\ttfamily ash}, {\ttfamily lsh}, {\ttfamily kiss} Óë {\ttfamily smash}£¬ËüÃÇÐ¡ºÜ¶à¶øÇÒÖ»ÐèÒªºÜÉÙ (»òÊÇ²»ÐèÒª)º¯Ê½¿â¡£´ó²¿·ÖÕâÐ©ÓÃÀ´´úÌæµÄ shells ¿ÉÒÔÔÚ \nameurl{http://metalab.unc.edu/pub/Linux/system/shells/}{} ÕÒµÃµ½¡£ÇëÈ·¶¨ÄãËùÊ¹ÓÃµÄÈÎºÎ shell £¬ÄÜ¹»Ö´ÐÐÄã·ÅÔÚÄã bootdisk ÄÚµÄËùÓÐ \url{rc} µµ°¸ÖÐµÄÖ¸Áî¡£
\nidx{shells}
\item {\itshape  É¾È¥º¯Ê½¿âÓë¶þ½øÎ»µµ \/}¡£
ºÜ¶àº¯Ê½¿âÓë¶þ½øÎ»µµÒ»°ã¶øÑÔÊÇÎ´±»É¾È¥µÄ (°üÀ¨debugging symbols)¡£Èç¹ûÈç´Ë£¬¶ÔÕâÐ©µµ°¸Ö´ÐÐ {\ttfamily file} »á¸æËßÄã ``{\ttfamily not stripped}'' ¡£
\nidx{libraries}
µ± copy ¶þ½øÎ»µµµ½ÄãµÄ root filesystem Ê±£¬ÕâÊÇÒ»¸öºÃÁ·Ï°È¥Ê¹ÓÃ£º
\begin{verbatim}
      objcopy --strip-all FROM TO
\end{verbatim}


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

µ± copy º¯Ê½¿âÊ±£¬ÇëÈ·¶¨Ê¹ÓÃµÄÊÇ {\ttfamily strip-debug} ¶ø²»ÊÇ {\ttfamily strip-all} ¡£
\item  Èç¹ûÄãÔÚÖÆ×÷ root filesystem Ê±£¬É¾³ý»òÒÆ¶¯¹ý¶àµµ°¸£¬ÇëÔÙÖØÐÂÖÆ×÷Ò»´Î¡£Çë¿´ÉÏÊö¹Øì¶²»ÒªÔÚ filesystem ÄÚÓÐ dirty blocks Ö®ÖØÒªÐÔµÄ×¢ÒâÊÂÏî¡£
\item  {\itshape  ÒÆ¶¯·Ç¹Ø¼üµµ°¸µ½¹¤¾ß´ÅÆ¬ (utility disk) ÉÏ \/} ¡£
Èç¹ûÄãµÄÒ»Ð©¶þ½øÎ»µµ¶Ô boot »ò login À´Ëµ²¢·ÇÁ¢¼´ÐèÒª£¬ÄÇ÷áÄã¾Í¿ÉÒÔ°ÑËüÃÇÒÆµ½¹¤¾ß´ÅÆ¬ÉÏ¡£Ï¸½ÚÇë¿´ \ref{UtilityDisk} {(Building a utility disk)} ÕâÒ»½Ú¡£ÄãÍ¬Ñù¿É¿¼ÂÇ°Ñ modules ÒÆµ½¹¤¾ß´ÅÆ¬ÉÏ¡£
\nidx{utility diskette}
\end{enumerate}





\subsection{Non-ramdisk root filesystems}

\label{NonRamdiskRoot}
\nidx{ramdisk}

\ref{BuildRoot} {(Building a root filesystem)} ÕâÒ»½ÚÔø¸øÓèÖ¸Ê¾ÒÔ½¨ÔìÒ»¸öÑ¹ËõµÄ root filesystem £¬Ëü»áÔÚÏµÍ³¿ª»úÊ±±»ÔØÈëµ½ ramdisk ¡£Õâ¸ö·½·¨ÓÐÐí¶àÓÅµã£¬ËùÒÔÍ¨³£¶¼²ÉÓÃ´Ë·¨¡£È»¶ø£¬Ò»Ð©Ö»ÓÐÒ»µãµã¼ÇÒäÌåµÄÏµÍ³ÎÞ·¨¸ºµ£´Ë·¨ËùÐèµÄ RAM £¬Òò´Ë£¬ÕâÐ©ÏµÍ³±ØÐëÊ¹ÓÃÖ±½Ó´ÓÈíµúÆ¬¹ÒÉÏµÄ root filesystems ¡£

ÕâÑùµÄ filesystems Êµ¼ÊÉÏ±ÈÑ¹ËõµÄ root filesystems ¸üÈÝÒ×½¨Ôì£¬ÒòÎªËüÃÇ¿ÉÒÔ±»ÔìÔÚÒ»ÕÅ´ÅÆ¬ÉÏ£¬¶ø·ÇÄ³¸öÆäËüµÄÉè±¸ÉÏ£¬ÁíÍâ£¬ËüÃÇÒ²²»±Ø±»Ñ¹Ëõ¡£µ±Òìì¶Ç°ÊöµÄÖ¸Ê¾Ê±£¬ÎÒÃÇ½«ÐðÊö¸Ã³ÌÐòµÄÒªµã¡£Èç¹ûÄãÑ¡ÔñÕâÑù×ö£¬Çë¼ÇµÃÄã¿É»ñµÃµÄÊ£âÅ {\itshape  ¿Õ¼ä»á±äÉÙ \/} ¡£

\begin{enumerate}
\item  Çë¼ÆËãÄã½«ÓÐ¶àÉÙ¿Õ¼ä¿É¹© root files Ê¹ÓÃ¡£

Èç¹ûÄã½¨ÔìµÄÊÇÒ»ÕÅµ¥Ò»µÄ boot/root ´ÅÆ¬£¬Äã±ØÐëÈÃËùÓÐ¸ø kernel µÄ blocks ÒÔ¼°ËùÓÐ¸ø root filesystem µÄ blocks ¶¼ÄÜÈÝÄÉì¶Í¬Ò»ÕÅ´ÅÆ¬ÉÏ¡£
\item  Ê¹ÓÃ {\ttfamily mke2fs} £¬ÔÚÊÊµ± size µÄÈíµúÆ¬ÉÏÔì³öÒ»¸ö root filesystem ¡£
\item  ÈçÍ¬Ç°ÊöµÄ·½·¨Ö³Èëì¶´Ë filesystem ¡£
\item  Íê³Éáá£¬ unmount ´Ë filesystem ²¢ÇÒ´«ËÍËüÊ¹Ö®³ÉÎªÒ»¸ö´ÅÆ¬µµ°¸£¬µ«ÊÇ {\itshape  ²»ÒªÑ¹ËõËü \/} ¡£
\item  ÒÔÇ°ÊöÖ®·½·¨£¬°Ñ kernel ´«ËÍµ½Ò»ÕÅÈíµúÆ¬ÉÏ¡£µ±¼ÆËã ramdisk word Ê±£¬ {\itshape  °Ñ bit 14 Éè³É 0\/} £¬ÒÔÖ¸Ê¾²»Òª°Ñ root filesystem ÔØÈëµ½ ramdisk ¡£ÇëÒÔÇ°ÊöÖ®·½·¨Ö´ÐÐ {\ttfamily rdev} Ö¸Áî¡£ \nidx{ramdisk word}\ncdx{rdev}
\item  ÈçÍ¬ÒÔÍù£¬´«ËÍ´Ë root filesystem ¡£
\end{enumerate}


ÓÐºÃ¼¸ÖÖ½Ý¾¶Äã¿É²ÉÓÃ¡£Èç¹ûÄã½¨ÔìµÄÊÇÒ»Ì×Ë«´ÅÆ¬×é£¬Äã¿ÉÒÔÖ±½Ó°ÑÍêÕûµÄ root filesystem½¨ÔìÔÚµÚ¶þÕÅ´ÅÆ¬ÉÏ£¬¶øÇÒÄã²¢²»ÐèÒª°ÑËü´«ËÍ³ÉÒ»¸öÓ²µúµµ°¸È»ááÔÙ´æ»Ø´ÅÆ¬ÉÏ¡£Í¬ÑùµØ£¬Èç¹ûÄã½¨ÔìµÄÊÇÒ»ÕÅµ¥Ò»µÄ boot/root ´ÅÆ¬¶øÇÒÊ¹ÓÃ LILO £¬Äã¿ÉÒÔÔÚÕûÕÅ´ÅÆ¬ÉÏ½¨Á¢ {\itshape  µ¥Ò»µÄ \/}filesystem£¬°üº¬ kernel ¡¢ LILO files Óë root files £¬È»ááÖ»ÒªÖ´ÐÐ LILO ×öÎª×îááÒ»²½¡£




\subsection{½¨ÔìÒ»ÕÅ¹¤¾ß´ÅÆ¬ -- Building a utility disk}

\label{UtilityDisk}
\nidx{utility diskette}

½¨ÔìÒ»ÕÅ¹¤¾ß´ÅÆ¬Ïà¶ÔÀ´Ëµ¼òµ¥¶àÁË -- Ö»ÒªÔÚÒ»ÕÅÒÑ¸ñÊ½»¯µÄ´ÅÆ¬ÉÏÔì³öÒ»¸ö filesystem £¬È»áá copy µµ°¸ì¶ÆäÉÏ¼´¿É¡£ÎªÁË¸ú bootdisk Ò»ÆðÊ¹ÓÃËü£¬ÇëÔÚÏµÍ³Æô¶¯ÒÔáá£¬ÓÃÊÖ¶¯µÄ·½Ê½ mount Ëü¡£

ÔÚÇ°ÃæµÄÖ¸Ê¾ÖÐ£¬ÎÒÃÇÔøÌá¼° utility disk ¿ÉÒÔ±» mount ×öÎª \url{/usr} ¡£ÔÚÕâ¸öÇé¿öÏÂ£¬¶þ½øÎ»µµ¿ÉÒÔ±»·ÅÔÚÄã utility disk Ö® \url{/bin} Ä¿Â¼ÄÚ£¬ÒÔ±ãì¶½« \url{/usr/bin} ÉèÈëÄãµÄ path ÖÐ¿ÉÒÔ´æÈ¡ËüÃÇ¡£¶þ½øÎ»µµËùÐèÖ®ÆäËüº¯Ê½¿â±»·ÅÔÚ utility disk Ö® \url{/lib} Ä¿Â¼ÄÚ¡£

µ±Éè¼Æ utilitu disk Ê±£¬ÓÐ¼¸¸öÖØµãÒª¼Ç×¡£º

\begin{enumerate}
\item  ²»Òª°Ñ¹Ø¼üµÄÏµÍ³¶þ½øÎ»µµ»òº¯Ê½¿â·Åµ½ utility disk ÉÏ£¬ÒòÎªÖ±µ½ÏµÍ³Ë³ÀûÆô¶¯Ö®Ç°£¬ utility disk ²»»á±»¹ÒÉÏ£¬ÆäÉÏµÄµµ°¸Ò²ÎÞ·¨¹©ÏµÍ³Ê¹ÓÃ¡£
\item  Äã²»ÄÜÍ¬Ê±´æÈ¡Ò»ÕÅÈíµúÆ¬ÓëÒ»Ì¨´Å´ø»ú¡£ÒâÖ¸Èç¹ûÄãÓÐÒ»Ì¨´Å´ø»ú£¬ÄÇ÷áµ±ÄãÕýÔÚÊ¹ÓÃ (mount) utility disk Ê±£¬Äã½«²»ÄÜ´æÈ¡ÄÇÌ¨´Å´ø»ú¡£
\item  ´æÈ¡ utility disk ÉÏµÄµµ°¸»áºÜÂý¡£
\end{enumerate}


\ref{utilitylist} {(Sample utility disk directory listing)} Ìá¹©ÁËutility diskµÄµµ°¸Ö®Ñù±¾¡£ÒÔÏÂÊÇÒ»Ð©½¨Òé¹Øì¶Ò»Ð©Äã»á·¢ÏÖÓÐÓÃµÄµµ°¸£º¼ì²éÓë²Ù×÷´ÅÆ¬({\ttfamily format, fdisk})¡¢ filesystems ({\ttfamily mke2fs, fsck, debugfs, isofs.o})µÄ³ÌÊ½£¬Ð¡ÐÍµÄÎÄÊé±à¼­Æ÷ ({\ttfamily elvis, jove})£¬Ñ¹ËõÓëµµ°¸¹¤¾ß ({\ttfamily gzip, tar, cpio, afio}), ´Å´ø¹¤¾ß ({\ttfamily mt, tob, taper})£¬Í¨Ñ¶¹¤¾ß ({\ttfamily ppp.o, slip.o, minicom})Óë¸øÉè±¸Ê¹ÓÃµÄ¹¤¾ß ({\ttfamily setserial, mknod})¡£




\section{How the pros do it}

\label{Pros}

Äú¿ÉÄÜÒÑ¾­×¢Òâµ½£¬ÄÇÐ©±»ÖîÈç Slackware¡¢RedHat¡¢Debian µÈÖ÷Òª distribution ËùÊ¹ÓÃµÄ bootdisks £¬ËÆºõ±È±¾ÎÄÖÐËùÃèÊöµÄ»¹ÒªÀ´µÃ¸´ÔÓÐí¶à¡£×¨ÒµµÄ distribution bootdisks ÒÔÔÚ´ËËùÌá³öµÄÏàÍ¬Ô­ÔòÎª»ù´¡£¬µ«ÊÇ²ÉÓÃ¸÷Ê½¸÷ÑùµÄ¼¼ÇÉ£¬ÒòÎªËüÃÇµÄ bootdisks ÓÐÒ»Ð©¶îÍâµÄÐèÇó¡£µÚÒ»£¬ËüÃÇ±ØÐëÄÜ¹»ÔÚ¸÷ÖÖ²»Í¬µÄÓ²ÌåÉÏÔË×÷£¬ËùÒÔËüÃÇ±ØÐëÄÜ¹»ÓëÊ¹ÓÃÕß»¥¶¯£¬²¢ÇÒÄÜÔØÈë¸÷Ê½¸÷ÑùµÄÉè±¸Çý¶¯³ÌÊ½¡£µÚ¶þ£¬ËüÃÇ±ØÐë×¼±¸ÒÔÐí¶à²»Í¬µÄ°²×°Ñ¡Ïî¡¢²»Í¬µÄ×Ô¶¯»¯³Ì¶ÈÀ´ÔË×÷¡£×îáá£¬ distribution bootdisks Í¨³£½áºÏÁË°²×°´ÅÆ¬Óë¾ÈÔ®´ÅÆ¬µÄÄÜÁ¦¡£

\nidx{initial ramdisk (initrd)}

Ä³Ð© bootdisks Ê¹ÓÃÃûÎª {\itshape initrd\/}({\itshape initial ramdisk\/})µÄÌØÐÔ¡£Õâ¸öÌØÐÔ´óÔ¼ÔÚ 2.0.x °æÊ±ÒýÈë£¬ËüÔÊÐí kernel ÒÔÁ½½×¶Î¿ª»ú¡£µ± kernel ¿ª»úÊ±£¬Ëü´Ó boot disk ÔØÈëÒ»¸öinitial ramdiskÓ³Ïñµµ¡£Õâ¸ö initial ramdisk ÊÇÒ»¸ö root filesystem £¬°üº¬Ò»¸öÔÚÕæÕýµÄ root fs ±»ÔØÈëÖ®Ç°ËùÖ´ÐÐµÄ³ÌÊ½¡£Õâ¸ö³ÌÊ½Í¨³£»á¼ì²é×÷Òµ»·¾³£¬ ÒÔ¼°/»ò ÒªÇóÊ¹ÓÃÕßÑ¡Ôñ²»Í¬µÄ¿ª»úÑ¡Ïî£¬ÀýÈçÑ¡Ôñ´ÓÄÄÒ»¸öÉè±¸ÔØÈëÕæÕýµÄ rootdisk ¡£Ò»°ãÀ´Ëµ£¬Ëü»áÔØÈëÎ´±»ÄÚ½¨ÔÚ kernel ÄÚµÄ¶îÍâÄ£×é¡£µ±Õâ¸ö³õÊ¼»¯ (initial) ³ÌÊ½½áÊø (exit) Ê±£¬ kernel ¾ÍÔØÈëÕæÕýµÄ root Ó³Ïñµµ£¬¿ª»ú¶¯×÷½«ÒÀÒ»°ãÇé¿ö¼ÌÐøÖ´ÐÐÏÂÈ¥¡£ÈôÒª½øÒ»²½µÃÖª {\ttfamily initrd} µÄ×ÊÑ¶£¬ÇëÏêÔÄÄã»úÆ÷ÉÏµÄ \nameurl{file:/usr/src/linux/Documentation/initrd.txt}{/usr/src/linux/Documentation/initrd.txt} £¬ÒÔ¼° \nameurl{ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz}{} ¡£

ÒÔÏÂÊÇÃ¿Ò»¼Ò distributionµÄ°²×°´ÅÆ¬ÈçºÎÔË×÷µÄÕªÒª£¬Õâ·ÝÕªÒªÒÔ¼ìÔÄ (inspect) ËüÃÇµÄfilesystems ÒÔ¼°/»ò ËüÃÇµÄÔ­Ê¼ÂëÎª»ù´¡¡£ÎÒÃÇ²»±£Ö¤Õâ·Ý×ÊÑ¶ÍêÈ«ÕýÈ·ÎÞÎó£¬»òÊÇ×Ô´Ó°æ±¾notedÒÔÀ´£¬ÕâÐ©ÔË×÷·½Ê½Î´±»¸Ä±ä¡£

Slackware(v.3.1) Ê¹ÓÃÒ»ÖÖÓë \ref{TransferringWithLILO} {(Transferring the kernel with LILO)} Õâ½ÚËùÃèÊöÀàËÆµÄÇ°ÏòÊ½ (straightforward) LILO ¿ª»ú·¨¡£ Slackware µÄ bookdisk ÀûÓÃ LILO µÄ {\ttfamily  Ñ¶Ï¢ } ²ÎÊýÓ¡³öÒ»¸ö bootup Ñ¶Ï¢ ({``}{\ttfamily Welcome to the Slackware Linux boot kernel disk!}{''}) ¡£¼ÙÈç±ØÒªµÄ»°£¬ÕâÀï»áÖ¸Ê¾Ê¹ÓÃÕßÊäÈëÒ»¸ö¿ª»ú²ÎÊýÐÐ(boot parameter line)¡£ÔÚ¿ª»úÖ®áá£¬Ò»¸örootµµ°¸ÏµÍ³»á´ÓµÚ¶þÕÅ´ÅÆ¬ÔØÈë¡£´ËÊ±Ê¹ÓÃÕß»½Æð(invoke)Ò»¸ö {\ttfamily setup} script£¬Õâ¸öscript½«Æô¶¯°²×°³ÌÐò¡£Slackware²¢·ÇÊ¹ÓÃÒ»¸öÄ£×é»¯ kernel £¬Ïà·´µØ£¬ËüÌá¹©Ðí¶à²»Í¬µÄ kernel £¬²¢ÇÒ¿¿Ê¹ÓÃÕß×Ô¼ºÑ¡ÔñÒ»¸ö·ûºÏ Ëû/Ëý Ó²ÌåÐèÇóµÄ kernel ¡£

RedHat(v.4.0) Ò²Ê¹ÓÃ LILO ¿ª»ú·¨¡£Ëü´ÓµÚÒ»ÕÅ´ÅÆ¬ÔØÈëÒ»¸öÑ¹ËõµÄ ramdisk £¬Õâ¶¯×÷Ö´ÐÐÒ»¸ö custom {\ttfamily init} ³ÌÊ½¡£Õâ¸ö³ÌÊ½²éÑ¯Çý¶¯³ÌÊ½£¬È»áá£¬¼ÙÈç±ØÒªµÄ»°£¬´Ó supplemental ´ÅÆ¬ÔØÈë¶îÍâµÄµµ°¸¡£

Debian(v1.3) ¿ÉÄÜÊÇ×î¸´ÔÓµÄ°²×°´ÅÆ¬¼¯¡£ËüÊ¹ÓÃ SYSLINUX loader È¥°²ÅÅ¸÷Ê½¸÷ÑùµÄÔØÈëÑ¡Ïî£¬È»ááÊ¹ÓÃÒ»¸ö {\ttfamily initrd} Ó³ÏñµµÖ¸Ê¾Ê¹ÓÃÕßÍê³É°²×°³ÌÐò¡£ËüÏÔÈ»Ê¹ÓÃÁËÒ»¸ö¿ÍÖÆ»¯µÄ {\ttfamily init} ÓëÒ»¸ö¿ÍÖÆ»¯µÄ shell Á½Õß¡£




\section{³£¼ûÎÊÌâ (FAQ) ÁÐ±í -- Frequently Asked Question (FAQ) list}



{\itshape Q. ÎÒ´ÓÎÒµÄ boot/root ´ÅÆ¬¿ª»ú£¬µ«ÊÇÊ²÷á¶¼ÅÜ²»³öÀ´¡£ÎÒÏÖÔÚÔõ÷á°ì ?\/}



Çë¿´Ö®Ç°µÄ \ref{Troubleshooting} {(Troubleshooting)} Õâ½Ú¡£

{\itshape Q. Slackware/Debian/RedHat µÄ bootdisk ÈçºÎÔË×÷ ?\/}



Çë¿´Ö®Ç°µÄ \ref{Pros} {(What the pros do)} Õâ½Ú¡£

{\itshape Q. ÎÒÒªÈçºÎÒÔ XYZ Çý¶¯³ÌÊ½ÖÆ×÷Ò»ÕÅ¿ª»ú´ÅÆ¬ ?\/}



×î¼òµ¥µÄ·½·¨ÊÇÈ¥´ÓÀëÄã×î½üµÄ Slackware Ó³ÉäÕ¾ÄÃµ½Ò»¸ö Slackware µÄ kernel ¡£ Slackware µÄ kernel ÊÇÒ»°ãµÄ (generic) kernel £¬ÕâÐ© kernel ÆóÍ¼½«Ðí¶àÉè±¸µÄÇý¶¯³ÌÊ½¾¡¿ÉÄÜµØ°üº¬ì¶ÆäÖÐ£¬Òò´Ë£¬¼ÙÈçÄãÓÐÒ»¸ö SCSI»òIDE¿ØÖÆÆ÷£¬ÊÔÊÔ¿´£¬ºÜÓÐ¿ÉÄÜËüµÄÇý¶¯³ÌÊ½»áÔÚ Slackware µÄ kernel µ±ÖÐ¡£

ÕÒµ½ \url{a1} Ä¿Â¼£¬²¢ÇÒÒÀ¾ÝÄãËùÓµÓÐµÄ¿ØÖÆÆ÷ÖÖÀà£¬Ñ¡Ôñ IDE »ò SCSI Á½ÕßÖ®Ò»µÄ kernel ¡£¶ÔËùÑ¡ÔñµÄ kernel ¼ìÊÓÆä xxxxkern.cfg µµ£¬²¢ÇÒÈ¥ÁË½âÕâ·Ý kernel ÖÐËùÓµÓÐµÄÇý¶¯³ÌÊ½¡£Èç¹ûÄãÏëÒªÊ¹ÓÃµÄÉè±¸ÔÚÕâ·ÝÁÐ±íÖÐ£¬ÄÇ÷áÕâ¸ö·ûºÏµÄ kernel ¾ÍÓ¦¸ÃÄÜÓÃÀ´¿ª»ú¡£ÏÂÔØ xxxxkern.tgz µµ£¬²¢ÇÒÓÃÖ®Ç°ÔÚÓÐ¹Ø making boot disks µÄÕÂ½ÚÖÐËùÃèÊöÖ®·½·¨£¬ copy Ëüµ½ÄãµÄ¿ª»ú´ÅÆ¬ÖÐ¡£
\nidx{device drivers}

È»ááÄã±ØÐë¼ì²éÔÚ kernel ÖÐµÄ root Éè±¸£¬Ê¹ÓÃ {\ttfamily rdev zImage} Õâ¸öÖ¸Áî¡£½ÓÖø rdev ½«ÏÔÊ¾Ä¿Ç°ÔÚ kernel ÖÐµÄ root Éè±¸¡£Èç¹ûÕâºÍÄãËùÏëÒªµÄ root Éè±¸²»Í¬£¬ÄÇ÷áÊ¹ÓÃ {\ttfamily rdev} ¸Ä±äËü¡£¾ÙÀýÀ´Ëµ£¬ÎÒÊÔµÄ kernel Éè¶¨µ½ \url{/dev/sda2} £¬µ«ÊÇÎÒµÄ root SCSI partition ÊÇ \url{/dev/sda8} ¡£ÎªÁËÄÜÊ¹ÓÃ root ´ÅÆ¬£¬Äã½«±ØÐëÊ¹ÓÃÕâ¸öÖ¸Áî {\ttfamily rdev zImage }dev/fd0/ ¡£

¼ÙÈçÄã»¹ÏëÖªµÀÈçºÎ set up Ò»ÕÅ Slackware µÄ root ´ÅÆ¬£¬Õâ¾ÍÒÑ¾­³¬³öÕâ·Ý HOWTO µÄ¡õÎ§£¬ËùÒÔÎÒ½¨ÒéÄã²éÔÄ Linux Install Guide £¬»òÊÇÉè·¨È¡µÃ Slackware distribution ¡£ÏêÇéÇë¿´ÔÚÕâ·Ý HOWTO ÖÐ£¬±êÌâÎª ``Reference'' µÄÕÂ½Ú¡£

{\itshape Q. ÎÒÈçºÎÒÔÐÂµÄµµ°¸¸üÐÂÎÒµÄ root ´ÅÆ¬ ? \/}

\nidx{root filesystems, updating}

×î¼òµ¥µÄ·½·¨ÊÇ´Ó rootdisk copy µµ°¸ÏµÍ³»ØÄãËùÊ¹ÓÃµÄÄÇ¸ö DEVICE (´ÓÖ®Ç°µÄ \ref{CreatingRootFS} {(Creating the filesystem)} Õâ½Ú¶øµÃµÄ)¡£È»áá¹ÒÉÏÕâ¸öµµ°¸ÏµÍ³²¢ÇÒ½øÐÐ¸Ä±ä¶¯×÷¡£Äã±ØÐë¼Ç×¡ÄãµÄ root µµ°¸ÏµÍ³´ÓÄÄÀï¿ªÊ¼£¬ÒÔ¼°ËüÕ¼ÁË¶àÉÙ block£º
\begin{verbatim}
        dd if=/dev/fd0 bs=1k skip=ROOTBEGIN count=BLOCKS | gunzip > DEVICE
        mount -t ext2 DEVICE /mnt
\end{verbatim}

ÔÚÍê³É¸Ä±äÖ®áá£¬ÈçÍ¬Ö®Ç°Ò»Ñù½øÐÐÏÂÈ¥ (ÔÚ \ref{WrappingItUp} {(Wrapping it up)} Õâ½ÚÖÐ) £¬²¢ÇÒ°Ñ root filesystem ´«ËÍ»ØÄÇÕÅ´ÅÆ¬ÉÏ¡£Èç¹ûÄã²¢Ã»ÓÐ¸Ä±äÐÂµÄ root filesystem µÄÆôÊ¼Î»ÖÃ£¬ÄãÓ¦¸Ã²»ÓÃÔÙÖØ´« kernel £¬»òÊÇÖØÐÂ¼ÆËã ramdisk µÄ word¡£

{\itshape Q. ÎÒÒªÈçºÎÒÆ³ý LILO £¬ºÃÈÃÎÒÄÜÔÙÓÃ DOS ¿ª»ú ? \/}

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

Õâ¸öÎÊÌâ²¢·ÇÕæµÄÊÇ Bootdisk µÄÒ»¸öÖ÷Ìâ£¬Ö»ÊÇÕâ¸öÎÊÌâ³£³£±»ÎÊµ½¡£ÔÚ Linux µÄ»·¾³ÏÂ£¬Äã¿ÉÒÔÖ´ÐÐ£º
\begin{tscreen}
\begin{verbatim}
        /sbin/lilo -u
\end{verbatim}
\end{tscreen}


ÄãÒ²¿ÉÒÔÊ¹ÓÃ {\ttfamily dd} Õâ¸öÖ¸Áî°Ñ±» LILO Ëù´¢´æµÄ±¸·Ý£¬ copy µ½¿ª»ú´ÅÇøÉÏ¡£Èç¹ûÄãÏëÒªÕâÑù×ö£¬Çë²Î¿¼ LILO µÄÎÄ¼þ¡£

ÔÚ DOS Óë Windows µÄ»·¾³ÏÂ£¬Äã¿ÉÒÔÊ¹ÓÃÕâ¸ö DOS Ö¸Áî£º
\begin{tscreen}
\begin{verbatim}
        FDISK /MBR
\end{verbatim}
\end{tscreen}

MBR ÊÇ Master Boot Record(Ö÷Òª¿ª»ú¼ÇÂ¼)µÄËõÐ´£¬Ëü»áÓÃÒ»¸öÇ¬¾»µÄ DOS ¿ª»ú´ÅÇø£¬Ìæ»»Ô­±¾µÄ¿ª»ú´ÅÇø£¬¶øÇÒÕâ¸ö¶¯×÷²»»áÓ°Ïì partition table ¡£Ò»Ð©ÓÐ½àñ±µÄÈË (purists) ²¢²»Í¬ÒâÕâÒ»µã£¬¿ÉÊÇ¾ÍÁ¬ LILO µÄÔ­×÷Õß£¬ Werner Almesberger £¬¶¼Í¬Òâ´Ë×÷·¨¡£Õâ¸ö×÷·¨¼òµ¥£¬¶øÇÒÓÐÓÃ¡£

{\itshape Q. Èç¹ûÎÒÒÅÊ§ÁËÎÒµÄ kernel {\itshape  Óë \/} ÎÒµÄ¿ª»ú´ÅÆ¬£¬ÎÒÒªÈçºÎ¿ª»ú ? \/}



Èç¹ûÄã²¢Ã»ÓÐÒ»ÕÅÒÑ×¼±¸ºÃµÄ¿ª»ú´ÅÆ¬£¬×î¼òµ¥µÄ×÷·¨¿ÉÄÜÊÇÒªÒÀÕÕÄãµÄ´Åµú¿ØÖÆÆ÷ÀàÐÍ (IDE »ò SCSI) È¡µÃÒ»·Ý Slackware kernel £¬ÈçÍ¬Ö®Ç°ËùÊöµÄ ``ÎÒÈçºÎÓÃXXXÇý¶¯³ÌÊ½ÖÆ×÷Ò»ÕÅ¿ª»ú´ÅÆ¬ ?'' ¡£È»ááÄã¾Í¿ÉÒÔÓÃÕâ¸ö kernel ¿ª»ú£¬½ÓÖøÐÞÀíÓÐËð»µµÄµØ·½¡£

ÄãÈ¡µÃµÄ kernel ¿ÉÄÜÃ»ÓÐÓëÄãÏëÒªµÄ´ÅµúÖÖÀàºÍ partition Ïà¶ÔÓ¦µÄ root Éè±¸¼¯¡£¾ÙÀýÀ´Ëµ£¬ Slackware µÄ generic SCSI kernel ÓÐÓë \url{/dev/sda2} Ïà¶ÔÓ¦µÄ rootÉè±¸¼¯£¬È»¶ø£¬ÎÒµÄ root Linux partition ÊÇÔÚ \url{/dev/sda8} ¡£ÔÚ´ËÇé¿öÏÂ£¬ kernel ÖÐµÄ root Éè±¸½«±ØÐë±»¸Ä±ä¡£

ÄãÈÔÈ»¿ÉÒÔ¸Ä±ä kernel µÄ root Éè±¸Óë ramdisk µÄÉè¶¨£¬×ÝÊ¹ÄãÊÖÉÏÖ»ÓÐÒ»¸ö kernel ºÍÄ³ÖÖÆäËüµÄ×÷ÒµÏµÍ³£¬Ïñ DOS ¡£

{\ttfamily rdev} ½åÖø¸Ä±äÔÚ kernel µµ°¸Àï£¬ÔÚ¹Ì¶¨Î»ÒÆÎ»ÖÃ (offset) ÉÏµÄÖµ£¬À´¸Ä±ä kernel µÄÉè¶¨£¬Òò´Ë£¬Èç¹ûÄãÊÖÉÏÓÐÒ»¸ö hex ±à¼­Æ÷ (on whatever systems you do still have running) £¬Äã¿ÉÒÔÍê³ÉÏàÍ¬µÄÊÂ -- ÀýÈçÔÚ DOS »·¾³ÏÂµÄ Norton Utilities Disk Editor ¡£½ÓÖø£¬ÄãÐèÒª½øÐÐ¼ì²é£¬Èç¹û±ØÒªµÄ»°£¬ÄãµÃ¸Ä±ä kernel µµ°¸Àï£¬ÔÚÒÔÏÂÎ»ÒÆÎ»ÖÃÉÏµÄÖµ£º
\nidx{ramdisk word}\ncdx{rdev}

\begin{tscreen}
\begin{verbatim}
HEX(16½øÎ»)     DEC(10½øÎ»)  DESCRIPTION(ÓÃÍ¾ÃèÊö)
0x01F8           504          RAMDISK wordµÄµÍ×ÖÔª×é (Low byte of RAMDISK word)
0x01F9           505          RAMDISK wordµÄ¸ß×ÖÔª×é (High byte of RAMDISK word)
0x01FC           508          Root minorÉè±¸ºÅÂë - Ïê¼ûÆäáá
0X01FD           509          Root majorÉè±¸ºÅÂë - Ïê¼ûÆäáá
\end{verbatim}
\end{tscreen}


¹Øì¶ ramdisk word Ö®½âÊÍ£¬Ð´ÔÚÖ®Ç°µÄ \ref{SettingRamdiskWord} {(Setting the ramdisk word)} Õâ½ÚÀï¡£

Major Óë minor Éè±¸ºÅÂë±ØÐëÉè³ÉÄãÏëÒª¹ÒÄãµÄ root filesystem ì¶ÆäÉÏµÄÉè±¸¡£Ò»Ð©¿É¹©Ñ¡ÔñµÄÓÐÓÃ²Î¿¼ÊýÖµÈçÏÂ£º
\begin{tscreen}
\begin{verbatim}
DEVICE          MAJOR MINOR
/dev/fd0            2     0   µÚÒ»Ì¨Èíµú»ú
/dev/hda1           3     1   ÔÚµÚÒ»¿ÅIDEÓ²µúÉÏµÄpartition 1
/dev/sda1           8     1   ÔÚµÚÒ»¿ÅSCSIÓ²µúÉÏµÄpartition 1
/dev/sda8           8     8   ÔÚµÚÒ»¿ÅSCSIÓ²µúÉÏµÄpartition 8
\end{verbatim}
\end{tscreen}

Ò»µ©ÄãÉè¶¨ÁËÕâÐ©Öµ£¬½ÓÏÂÀ´Äã¿ÉÒÔ½«Õâ¸öµµ°¸Ð´ÈëÒ»ÕÅ´ÅÆ¬ÄÚ£¬Äã¿ÉÒÔÀûÓÃ Norton Utilities Disk Editor £¬²»È»¾ÍÊÇÀûÓÃÃûÎª {\ttfamily rawrite.exe} µÄÕâÖ§³ÌÊ½¡£ÕâÖ§³ÌÊ½ÔÚËùÓÐµÄ distribution ¶¼ÕÒµÃµ½¡£ÕâÖ§³ÌÊ½ÊÇÒ»Ö§ÔÚDOS»·¾³ÏÂÖ´ÐÐµÄ³ÌÊ½£¬ËüÄÜ½«µµ°¸Ð´ÈëÒ»ÕÅ ``raw'' disk £¬´Ó¿ª»ú´ÅÇø¿ªÊ¼Ð´Èë£¬¶ø²»ÊÇ½«µµ°¸Ð´Èëµµ°¸ÏµÍ³¡£Èç¹ûÄãÊ¹ÓÃ Norton Utilities £¬Äã±ØÐë½«µµ°¸Ð´ÈëÒ»ÕÅÊµÌå´ÅÆ¬£¬´Ó´ÅÆ¬µÄÍ·¿ªÊ¼Ð´Èë¡£

{\itshape Q. ÎÒÒªÈçºÎÖÆ×÷ boot/root ´ÅÆ¬µÄ¶îÍâ±¸·Ý ? \/}



ÒòÎª´ÅÐÔÃ½½é¿ÉÄÜÔÚÒ»¶ÎÊ±¼äááÔâÓöËðº¦£¬ÄãÓ¦¸Ã±£Áô¼¸ÕÅÄãµÄ¾ÈÔ®´ÅÆ¬µÄ±¸·Ý£¬ÒÔ·ÀÔ­À´µÄÄÇÒ»Æ¬²»ÄÜ±»µçÄÔ¶ÁÈ¡¡£

ÖÆ×÷ÈÎºÎ´ÅÆ¬µÄ±¸·Ý£¬°üÀ¨¿ª»úÓÃÓë¹«ÓÃ³ÌÊ½ (utility) ´ÅÆ¬£¬×î¼òµ¥µÄ·½·¨ÊÇÀûÓÃ {\ttfamily dd} Õâ¸öÖ¸Áî£¬È¥ copy Ô­À´ÄÇÕÅ´ÅÆ¬µÄÄÚÈÝµ½ÄãÓ²µúÉÏµÄÒ»¸öµµ°¸Ö®ÖÐ£¬È»ááÔÙÓÃÏàÍ¬µÄÖ¸Áî½«Õâ¸öµµ°¸ copy »ØÒ»ÕÅÐÂ´ÅÆ¬ÉÏ¡£Çë×¢Òâ£¬Äã²¢²»ÐèÒª£¬Ò²²»Ó¦¸ÃÈ¥ mount ÕâÕÅ´ÅÆ¬£¬ÒòÎª {\ttfamily dd}ÀûÓÃrawÉè±¸½éÃæ¡£

Òª copy Ô­´ÅÆ¬£¬ÇëÊäÈëÒÔÏÂÖ¸Áî£º
\begin{tscreen}
\begin{verbatim}
        dd if=DEVICENAME of=FILENAME
\end{verbatim}
\end{tscreen}


ÔÚ´Ë£¬ \url{DEVICENAME} ÊÇÖ¸ÕâÌ¨´Åµú»úµÄÉè±¸Ãû (Òë°´£º/dev/fd0) £¬¶ø \url{FILENAME} ÊÇÖ¸(´æÔÚÓ²µúÉÏµÄ)Êä³öµµ°¸µµÃû¡£Ê¡ÂÔ {\ttfamily count} ²ÎÊýÈÃ {\ttfamily dd} È¥copyÕûÕÅ´ÅÆ¬ (Èç¹ûÊÇ¸ßÃÜ¶È´ÅÆ¬£¬ÓÐ 2880 ¸ö blocks) ¡£

Òª°Ñ´ÓÉÏÃæµÃµ½µÄµµ°¸ copy µ½Ò»ÕÅÐÂ´ÅÆ¬ÉÏ£¬Çë²åÈëÒ»ÕÅÐÂ´ÅÆ¬²¢ÊäÈëÏà·´µÄÖ¸Áî£º
\begin{tscreen}
\begin{verbatim}
        dd if=FILENAME of=DEVICENAME
\end{verbatim}
\end{tscreen}


Çë×¢Òâ£¬ÒÔÉÏµÄÌÖÂÛÊÇ¼ÙÉèÄãÖ»ÓÐÒ»Ì¨Èíµú»ú¡£¼ÙÈçÏàÍ¬ÖÖÀàµÄÈíµú»úÄãÓÐÁ½Ì¨£¬Äã¿ÉÒÔÀûÓÃÏñÏÂÃæµÄÖ¸ÁîÈ¥ copy ´ÅÆ¬£º
\begin{tscreen}
\begin{verbatim}
        dd if=/dev/fd0 of=/dev/fd1
\end{verbatim}
\end{tscreen}


{\itshape Q. ÎÒÈçºÎÄÜÔÚÃ¿Ò»´Î¿ª»úÊ±£¬²»ÓÃÊäÈë {``}ahaxxxx=nn,nn,nn{''} ?\/}

\nidx{kernel, parameters}

µ±Ò»Ì¨´ÅµúÉè±¸²»ÄÜ±»×Ô¶¯Õì²âÊ±£¬¾ÍÓÐ±ØÒªÌá¹© kernel Ö¸¶¨µÄÉè±¸²ÎÊý×Ö´®£¬ÖîÈç£º
\begin{tscreen}
\begin{verbatim}
        aha152x=0x340,11,3,1
\end{verbatim}
\end{tscreen}


ÕâÐÐ²ÎÊý×Ö´®¿ÉÒÔÀûÓÃ LILO ÒÔÊýÖÖ·½·¨Ìá¹©¸ø kernel £º

\begin{itemize}
\item  Ã¿´Îµ±ÏµÍ³ÒÔ LILO ¿ª»úÊ±£¬Äã¿ÉÒÔÔÚÃüÁîÁÐÊäÈëËü¡£µ«ÊÇÃ¿´ÎÕâÑù×ö»áºÜ·³¡£
\item  Äã¿ÉÒÔÊ¹ÓÃ LILO µÄ {\ttfamily lock} Õâ¸ö¹Ø¼ü×Ö£¬Ê¹ LILO ´¢´æÕâÐÐÃüÁîÁÐ£¬²¢×öÎªÔ¤ÉèµÄÃüÁîÁÐ£¬ÕâÑùÃ¿µ±¿ª»úÊ±£¬ LILO ¾Í»áÊ¹ÓÃÏàÍ¬µÄÑ¡Ïî¡£
\item  Äã¿ÉÒÔÔÚ LILO µÄ×éÌ¬µµÖÐ£¬Ê¹ÓÃ {\ttfamily append=} Õâ¸öÐðÊö¡£Çë×¢Òâ²ÎÊý×Ö´®±ØÐë±»Ë«ÒýºÅ (quotes) ¼Ð×¡¡£
\end{itemize}


¾ÙÀýÀ´Ëµ£¬Ò»ÐÐÊ¹ÓÃÉÏÊö²ÎÊý×Ö´®µÄÑù±¾ÃüÁîÁÐ½«³¤³ÉÕâÑù£º
\begin{tscreen}
\begin{verbatim}
        zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
\end{verbatim}
\end{tscreen}


Èç´Ë½«»á´«µÝÉè±¸²ÎÊý×Ö´®¸ø kernel £¬Í¬Ê±Ò²ÒªÇó kernel °Ñ root Éè±¸Éè¶¨µ½ \url{/dev/sda1} £¬²¢ÇÒ´¢´æÕûÐÐÃüÁîÁÐ£¬ÈÃÒÔáá¿ª»úÊ±¶¼ÄÜÔÙÊ¹ÓÃÕâ¸öÃüÁîÁÐ¡£

ÒÔÏÂÊÇÒ»¸ö APPEND ÐðÊöµÄÑù±¾£º
\begin{tscreen}
\begin{verbatim}
        APPEND = "aha152x=0x340,11,3,1"
\end{verbatim}
\end{tscreen}


Çë×¢Òâ²ÎÊý×Ö´®ÔÚÃüÁîÁÐÉÏ {\itshape  ²»ÄÜ \/} ±»Ë«ÒýºÅ¼Ð×¡£¬µ«ÊÇ²ÎÊý×Ö´®ÔÚ {\ttfamily APPEND} ÐðÊöÖÐ {\itshape  Ò»¶¨Òª \/} ±»Ë«ÒýºÅ¼Ð×¡¡£

ÁíÍâÒ²Çë×¢Òâ£¬ÎªÁËÄÜÈÃ²ÎÊý×Ö´®Æð×÷ÓÃ£¬ kernel ÄÚ±ØÐëÓÐ·ûºÏÕâ¸ö´ÅµúÀàÐÍµÄÇý¶¯³ÌÊ½¡£Èç¹ûÃ»ÓÐ£¬ÄÇ÷á¾ÍÃ»ÓÐ¶«Î÷»áÈ¥½ÓÊÜ (listen for) Õâ¸ö²ÎÊý×Ö´®£¬ËùÒÔÄã½«±ØÐëÖØÐÂ½¨ÔìÒ»¸ö°üº¬Ö¸¶¨Çý¶¯³ÌÊ½µÄ kernel ¡£ÓÐ¹ØÖØÐÂ½¨Á¢ kernel µÄÏ¸½Ú£¬ÇëÖÁÄ¿Â¼ \url{/usr/src/linux} ÔÄ¶ÁÆä README µµ£¬ÒÔ¼° Linux FAQ Óë Installation HOWTO ¡£ Alternatively £¬Äã¿ÉÒÔÎªÕâÖÖ´ÅµúÀàÐÍÈ¡µÃÒ»¸ö generic kernel ²¢ÇÒ°²×°Ëü¡£

ÔÚÌåÑé LILO °²×°Ö®Ç°£¬Ç¿ÁÒ½¨Òé¶ÁÕßÏÈ¶Á¹ý LILO ÎÄ¼þ¡£²»Ð¡ÐÄÊ¹ÓÃ {\ttfamily BOOT} ÐðÊö½«»áËð»µ partition ¡£

{\itshape Q. ÔÚ¿ª»úµÄÊ±ºò£¬³öÏÖÁË {``}{\ttfamily A: cannot execute B}{''} µÄ´íÎóÑ¶Ï¢¡£ÎªÊ²÷á ?\/}

\nidx{hardcoded locations}

³ÌÊ½Ãû³ÆÓÐºÃ¼¸ÖÖ²»Í¬µÄÐ´·¨±»Ð´ËÀ (hardcoded) ÔÚ²»Í¬µÄ¹«ÓÃ³ÌÊ½Àï¡£ÕâÐ©Ð´·¨²»»áÔÚÃ¿¸öµØ·½¶¼·¢Éú£¬µ«ÊÇËüÃÇ¿ÉÄÜËµÃ÷ÁËÎªÊ²÷áÒ»¸öÏÔ¶øÒ×¼ûµÄ¿ÉÖ´ÐÐµµ£¬²»ÄÜÔÚÄãµÄÏµÍ³ÉÏ±»·¢ÏÖ£¬×ÝÊ¹Äã¿´µ½Ëü¾ÍÔÚÄÇÀï¡£Äã¿ÉÒÔÕÒ³öÊÇ·ñÒ»¸öÒÑÖªµÄ³ÌÊ½ÓÐÁíÒ»ÖÖ±»Ð´ËÀµÄÃû³Æ£¬Äã¿ÉÒÔÀûÓÃ {\ttfamily strings} Õâ¸öÖ¸Áî£¬²¢ÇÒÀûÓÃ¹ÜµÀ·½·¨ (Òë°´£º piping, $|$) ½«Êä³öÍ¸¹ý {\ttfamily grep} ³ÊÏÖ³öÀ´¡£

ÒÑÖª¹Øì¶Ð´ËÀµÄÀý×ÓÓÐ£º
\begin{itemize}
\item  ÔÚÄ³Ð©°æ±¾ÖÐ£¬ {\ttfamily Shutdown} ÓÐ°Ñ \url{/etc/reboot} Ð´ËÀÔÚÆä³ÌÊ½ÂëÄÚ£¬ËùÒÔ {\ttfamily reboot} ±ØÐë±»·ÅÖÃÔÚ \url{/etc} Õâ¸öÄ¿Â¼ÏÂ¡£
\item  ÒòÎªÓÐ²»ÄÜ¹»ÕÒµ½ {\ttfamily init} µÄ kernel ´æÔÚ£¬ {\ttfamily init} ÒÑÖÁÉÙÎªÒ»¸öÈË´øÀ´ÎÊÌâ¡£
\end{itemize}


ÎªÁËÐÞÕýÕâÐ©ÎÊÌâ£¬²»ÊÇÒÆ¶¯ÕâÐ©³ÌÊ½µ½ÕýÈ·µÄÄ¿Â¼£¬¾ÍÊÇ¸ü¸ÄÉè¶¨µµ (e.g. \url{inittab})ÒÔÖ¸ÏòÕýÈ·µÄÄ¿Â¼¡£¼ÙÈçÓÐËù»³ÒÉ£¬¾ÍÇëÏÈ°Ñ³ÌÊ½ÈçÍ¬ËüÃÇÔÚÄãÓ²µúÉÏÒ»Ñù£¬·ÅÈëÏàÍ¬µÄÄ¿Â¼£¬²¢ÇÒÈçÍ¬ËüÃÇÏÔÏÖÔÚÄãÓ²µúÉÏÒ»Ñù£¬Ê¹ÓÃÏàÍ¬µÄ \url{inittab} Óë \url{/etc/rc.d} µµ¡£

{\itshape Q. ÎÒµÄ kernel Ö§Ô® ramdisk £¬µ«ÊÇÈ´³õÊ¼»¯ 0K µÄ ramdisk ¡£ÎªÊ²÷á ?\/}



µ± kernel ÕýÔÚ½øÐÐ¿ª»ú¶¯×÷Ê±£¬ÔÚÎÊÌâ·¢ÉúÖ®´¦£¬»á³öÏÖÒ»¸öÏñÕâÑùµÄ kernel Ñ¶Ï¢£º \nidx{ramdisk}
\begin{verbatim}
        Ramdisk driver initialized : 16 ramdisks of 0K size
\end{verbatim}


Õâ¿ÉÄÜÊÇÒòÎª size ÒÑ±» kernel ²ÎÊýÔÚ¿ª»úÊ±Éè³É 0 ¡£Õâ¿ÉÄÜÊÇÓÉì¶Ò»¸ö overlooked LILO×éÌ¬Éè¶¨µµ²ÎÊýËùµ¼ÖÂ£º
\begin{tscreen}
\begin{verbatim}
    ramdisk= 0
\end{verbatim}
\end{tscreen}


ÔÚÄ³Ð©½Ï¾ÉµÄ distributions Àï£¬Õâ¸ö»á±»°üº¬ÔÚ LILO ×éÌ¬Éè¶¨µµÑù±¾ÖÐ£¬Õâ·ÅÔÚÄÇÀïÊÇÎªÁË override ÈÎºÎ kernel Ô­ÏÈµÄÉè¶¨¡£Èç¹ûÄãÓÐÕâÑùµÄÒ»ÐÐ£¬ÇëÒÆ³ýÖ®¡£

Çë×¢Òâ£¬Èç¹ûÆóÍ¼Ê¹ÓÃÒ»¸öÒÑ±»Éè¶¨³É 0 size µÄ ramdisk £¬ÕâÑùµÄÐÐÎª½«»áµ¼ÖÂ²»¿ÉÔ¤²âµÄ½á¹û£¬Í¬Ê±Ò²»áÈÃ kernel ²»ÖªÈçºÎÊÇºÃ¡£




 \appendix 

\section{×ÊÔ´ÓëÖ¸Ê¾ -- Resources and pointers}

\label{references}

µ±ÄÃÈ¡Ò»¸öÌ×¼þÊ±£¬³ý·ÇÄãÓÐºÃµÄÀíÓÉ£¬·ñÔòÇëÒ»¶¨ÒªÄÃ×îÐÂµÄ°æ±¾¡£




\subsection{Ô¤ÏÈ×öºÃµÄ Bootdisks -- Pre-made Bootdisks}

\label{PreMade}

ÕâÐ©ÊÇ distribution bootdisks µÄÀ´Ô´¡£ {\itshape  ÇëÑ¡ÔñÓ³ÉäÕ¾Ì¨ÏÂÔØÒÔ¼õÉÙÕâÐ©Ö÷»úµÄ¸ººÉ¡£ \/}

\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} Óë \nameurl{http://www.slackware.com/getslack/}{ Slackware Ó³ÉäÕ¾Ì¨ }
\item \nameurl{http://metalab.unc.edu/pub/Linux/distributions/redhat/current/i386/images/}{RedHat bootdisks} Óë \nameurl{http://www.redhat.com/mirrors.html}{Red Hat Ó³ÉäÕ¾Ì¨ }
\item \nameurl{ftp://ftp.debian.org/pub/debian/dists/stable/main/disks-i386/current/}{Debian bootdisks} Óë \nameurl{ftp://ftp.debian.org/pub/debian/README.mirrors.html}{Debian Ó³ÉäÕ¾Ì¨ }
\end{itemize}


³ýÁË distribution bootdisks ÒÔÍâ£¬Ò²¿ÉÒÔµÃµ½ÒÔÏÂµÄ¾ÈÔ®´ÅÆ¬Ó³Ïñµµ¡£³ý·ÇÓÐÁíÍâÌØ±ðÖ¸¶¨£¬·ñÔòÕâÐ©¶¼¿ÉÔÚ
\nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html}{} µÄÄ¿Â¼ÖÐÕÒµ½¡£

\begin{itemize}
\item  {\ttfamily tomsrtbt}, ÓÉ Tom Oehser ÖÆ×÷£¬ÊÇÒ»ÕÅÒÔ kernel 2.0 Îª»ù´¡¶øÖÆ×÷³öÀ´µÄµ¥Æ¬×° boot/root ´ÅÆ¬£¬with a large set of features and support programs¡£ËüÖ§Ô® IDE ¡¢ SCSI ¡¢´Å´ø¡¢ÍøÂ·¿¨¡¢ PCMCIA µÈ»¹ÓÐºÜ¶àÆäËüÉè±¸¡£ÆäÖÐÓÐ´óÔ¼ 100 ÖÖ¹¤¾ß³ÌÊ½Óë¹¤¾ß¿ÉÒÔÓÃÀ´ÐÞ»¤Óë±¸·Ý´Åµú¡£´ËÌ×¼þÒ²°üº¬Ò»Ð© script ÓÃÀ´½âÒëÓëÖØ½¨¹¹Ó³Ïñµµ£¬ÒÔ±ãì¶ÔÚ±ØÒªÊ±¿ÉÒÔ¼ÓÈëÐÂµÄ material ¡£ 



\item {\ttfamily rescue02}, ÓÉ John Comyns ÖÆ×÷£¬ÊÇÒ»ÕÅÒÔ kernel 1.3.84 Îª»ù´¡¶øÖÆ×÷³öÀ´µÄ¾ÈÔ®´ÅÆ¬£¬ÆäÖ§Ô® IDE ¡¢ Adaptec 1542 Óë NCR53C7,8xx ¡£ËüÊ¹ÓÃ ELF Á½½øÎ»µµ£¬µ«ÊÇÈ´ÓÐ×ã¹»µÄÖ¸ÁîÒÔÀûÆäÄÜÔÚÈÎºÎÏµÍ³ÉÏÊ¹ÓÃ¡£ËüÓµÓÐÄÜÔÚ¿ª»úáá²Å±»ÔØÈë¸øËùÓÐÆäËü SCSI ¿¨Ê¹ÓÃµÄÄ£×é¡£µ«ËüÒ²Ðí²»ÄÜÔÚÖ»ÓÐ 4 mb Ëæ»ú´æÈ¡¼ÇÒäÌåµÄÏµÍ³ÉÏÖ´ÐÐ£¬ÒòÎªËüÓÃµ½ÁË 3 mb µÄram disk¡£ 



\item {\ttfamily resque\_disk-2.0.22}, ÓÉ Sergei Viznyuk ÖÆ×÷£¬ÊÇÒ»Ì×ÒÔ kernel 2.0.22 Îª»ù´¡£¬ÄÚ½¨Ö§Ô® IDE ÓëÐí¶à²»Í¬µÄ SCSI ¿ØÖÆ¿¨£¬ÒÔ¼° ELF/AOUT µÄÈ«¹¦ÄÜ boot/root ´ÅÆ¬¡£Í¬Ê±Ò²°üº¬Ðí¶àÄ£×é£¬ÒÔ¼°ÓÃÀ´ÐÞ¡õ¼°±¸·ÝÓ²µúµÄÓÐÓÃ¹¤¾ß³ÌÊ½¡£ 



\item {\ttfamily \nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/images}{cramdisk}} Ó³Ïñµµ£¬ÒÔ kernel 2.0.23 Îª»ù´¡£¬¿ÉÊ¹ÓÃÔÚ 4 meg Óë 8 meg µÄ»úÆ÷ÉÏ¡£ËüÃÇ°üº¬ÁËÊýÑ§Ä£ÄâÆ÷ÓëÍøÂ·¹¤¾ß (PPPÓëdialin script¡¢NE2000¡¢3C509)£¬»òÊÇÆ½ÐÐ²º ZIP ´Åµú»úµÄÖ§Ô®¡£ÕâÐ©´ÅÆ¬Ó³Ïñµµ¿ÉÔÚ±¸ÓÐ 4MB Ëæ»ú´æÈ¡¼ÇÒäÌåµÄ 386 Ö÷»úÉÏ¿ª»ú¡£ MSDOS Ö§Ô®Ò²±»°üº¬ÔÚÆäÖÐ£¬Òò´ËÄã¿ÉÒÔ´ÓÍøÂ·ÉÏÏÂÔØËüµ½ DOS partition ÉÏ¡£ 

\end{itemize}





\subsection{¾ÈÔ®Ì×¼þ -- Rescue packages}



Ä¿Ç°¿ÉÒÔ´Ó metalab.unc.edu È¡µÃÊýÖÖÖÆ×÷¾ÈÔ®´ÅÆ¬µÄÌ×¼þ¡£ÀûÓÃÕâÐ©Ì×¼þ£¬Äã¿ÉÒÔÖ¸¶¨°üº¬Ò»×éµµ°¸£¬½ÓÖøÈíÌå¾Í»á×Ô¶¯µØ½øÐÐ bootdisk µÄÖÆ×÷ (×Ô¶¯»¯³Ì¶È»áÓÐËù²»Í¬)¡£Çë¿´ \nameurl{http://metalab.unc.edu/pub/Linux/system/recovery/!INDEX.html}{} ÒÔÈ¡µÃ½øÒ»²½µÄ×ÊÑ¶¡£

{\itshape  Çë×ÐÏ¸¼ì²éµµ°¸ÈÕÆÚ \/}¡£Ò»Ð©Ì×¼þÓÐÊýÄêÎ´±»¸üÐÂ£¬¶øÕâÐ©Ì×¼þ½«ÎÞ·¨Ö§Ô®¡¸ÔØÈëÖÁ ramdisk Ö®Ñ¹Ëõ root filesystem ¡¹µÄÖÆ×÷¡£¾ÍÄ¿Ç°ËùÖª£¬ \nameurl{http://www.croftj.net/~fawcett/yard/index.html}{Yard} ÊÇÎ¨Ò»¿ÉÖ§Ô®´ËµÄÌ×¼þ¡£




\subsection{LILO -- the Linux loader}



ÓÉ Werner Almesberger ×«Ð´¡£Ò»¸öÓÅÐãµÄ boot loader £¬ÆäÎÄ¼þ°üº¬ÁË¿ª»ú´ÅÇøÄÚÈÝµÄ×ÊÑ¶£¬ÒÔ¼°¿ª»úÁ÷³ÌµÄ³õÆÚ½×¶Î¡£

Çë´Ó \nameurl{ftp://tsx-11.mit.edu/pub/linux/packages/lilo/}{} ÒÔFTPÏÂÔØ¡£Ò²¿ÉÒÔ´Ó Metalab ÓëÓ³ÉäÕ¾Ì¨ÄÚÈ¡µÃ¡£




\subsection{Linux FAQ Óë HOWTOs}



ÕâÐ©ÎÄ¼þ¿ÉÒÔ´ÓÖî¶àÀ´Ô´ÖÐÈ¡µÃ¡£ÕâÐ©ÎÄ¼þ¿ÉÒÔ´ÓÖî¶àÀ´Ô´ÖÐÈ¡µÃ¡£Çë¼û usenet ÐÂÎÅÂÛÌ³ {\ttfamily news.answers} Óë {\ttfamily comp.os.linux.announce}¡£

ÕâÐ© FAQ ¿ÉÒÔ´Ó \nameurl{http://linuxdoc.org/FAQ/Linux-FAQ.html}{} ÖÐÈ¡µÃ£¬¶ø HOWTOs ¿ÉÒÔ´Ó \nameurl{http://linuxdoc.org/HOWTO/HOWTO-INDEX.html}{} ÖÐÈ¡µÃ¡£´ó²¿·Ö Linux ÎÄ¼þ¿ÉÒÔÔÚ \nameurl{http://linuxdoc.org/}{The Linux Documentation Project homepage} ÖÐÕÒµÃµ½¡£




\subsection{RamdiskÊ¹ÓÃ·½·¨ -- Ramdisk usage}

\nidx{ramdisk}

ÓÐ¹ØÐÂµÄramdisk ³ÌÊ½ÂëÈçºÎÔË×÷µÄÍêÕûÐðÊö£¬¿ÉÒÔÔÚËæ¸½ì¶ Linux kernel µÄÎÄ¼þÖÐÕÒµ½¡£Çë¿´ \url{/usr/src/linux/Documentation/ramdisk.txt} ¡£Õâ·ÝÎÄ¼þÊÇÓÉ Paul Gortmaker Ëù±àÐ´£¬Í¬Ê±°üº¬ÁËÒ»½Ú¹Øì¶ÖÆ×÷Ñ¹ËõµÄ ramdisk ¡£




\subsection{Linux¿ª»úÁ÷³Ì -- The Linux boot process}

\nidx{boot process}

ÈôÏëÁË½â¹Øì¶Linux¿ª»úÁ÷³ÌµÄ¸ü¶àÏ¸½Ú£¬ÒÔÏÂÓÐÒ»Ð©Ö¸Ê¾ÎÄ¼þ£º

\begin{itemize}
\item  ÔÚ \nameurl{http://linuxdoc.org/LDP/sag/c1596.html}{}{\itshape Linux System Administrators' Guide\/} ÖÐ£¬ÓÐÒ»½ÚÊÇ¹Øì¶ booting ¡£
\item  ÔÚ \nameurl{http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-t-21.ps.gz}{}LILO ``Technical overview'' ÖÐ£¬ÓµÓÐ¹Øì¶¿ª»úÁ÷³ÌÒ»Ö±µ½ kernel ´ÓºÎ´¦±»Æô¶¯Ö®¾ö¶¨ÐÔ (definitive) ¼¼ÊõÉÏ low-level µÄÐðÊö¡£
\item Source code ÊÇÄãÓÀÔ¶µÄÖ¸ÄÏ¡£ÒÔÏÂÊÇÒ»Ð©Óë¿ª»úÁ÷³ÌÓÐ¹ØµÄ kernel files ¡£Èç¹ûÄãÓÐ Linux ºËÐÄµÄÔ­Ê¼Âë£¬Äã¿ÉÒÔÔÚÄã»úÆ÷ÉÏµÄ \url{/usr/src/linux} Ö®ÖÐÕÒµ½ÕâÐ©µµ°¸£»´ËÍâ£¬ Shigo Yamguchi (\onlynameurl{shigio@tamacom.com})ÓÐ·Ç³£°ôµÄ \nameurl{http://www.tamacom.com/tour/linux/index.html}{hypertext kernel browser} £¬¿ÉÒÔÓÃÀ´¶Á kernel source files ¡£ÒÔÏÂÊÇÒ»Ð©¿É¹©²Î¿¼µÄÓÐ¹Øµµ°¸£º
                                                                   
\begin{description}
\url{arch/i386/boot/bootsect.S} and \url{setup.S}
°üº¬ bootsector ×Ô¼ºµÄ×éºÏÂë¡£

\url{arch/i386/boot/compressed/misc.c}
°üº¬Î´Ñ¹ËõµÄ kernel ³ÌÊ½Âë¡£

\url{arch/i386/kernel/}
°üº¬ÁË kernel ³õÊ¼»¯³ÌÊ½ÂëµÄÄ¿Â¼¡£ \url{setup.c} ¶¨ÒåÁË ramdisk µÄ word ¡£

\url{drivers/block/rd.c}
°üº¬ ramdisk µÄÇý¶¯³ÌÊ½¡£ {\ttfamily rd\_load} Óë {\ttfamily rd\_load\_image} ÕâÁ½¸ö³ÌÐò´ÓÒ»¸öÉè±¸ÖÐÔØÈëÇø¿é (blocks) µ½ ramdisk ÄÚ¡£ {\ttfamily identify\_ramdisk\_image} Õâ¸ö³ÌÐò¾ö¶¨ÕÒµ½µÄ filesystem ÊÇÊ²÷áÖÖÀà£¬»¹ÓÐËüÊÇ·ñÊÇ±»Ñ¹ËõµÄ filesystem ¡£

\end{description}
\end{itemize}





\section{LILO boot error codes}

\nidx{LILO ,error codes}

ÓÐ¹ØÕâÐ©´íÎóÂëµÄÎÊÌâÊ±³£ÔÚ Usenet ÉÏ±»ÈËÌáµ½£¬ËùÒÔÎÒÃÇÒÔ·þÎñµÄÐÄÇé½«ËüÃÇ±íÁÐÈçÏÂ¡£Õâ·ÝÕªÒªÒýÓÃ×Ô Werner Almsberger µÄ \nameurl{http://metalab.unc.edu/pub/Linux/system/boot/lilo/lilo-u-21.ps.gz}{LILO User Documentation} ¡£

µ± LILO ÔØÈë×Ô¼ºÊ±£¬Ó©Ä»ÉÏ»áÏÔÊ¾ {\ttfamily LILO} Õâ¸ö×Ö¡£Ã¿Ò»¸ö×ÖÄ¸ (letter) »áÔÚÖ´ÐÐÄ³¸öÌØ¶¨¶¯×÷Ö®Ç°»òÖ®áá±»Ó¡ÔÚÓ©Ä»ÉÏ¡£Èç¹û LILO ÔÚÄ³µãÉÏ²»ÄÜÍê³ÉÈÎÎñ£¬µ½´ËÎªÖ¹ËùÓ¡³öµÄ×ÖÄ¸¿ÉÒÔÓÃÀ´±æÈÏ³ö·¢ÉúÁËÊ²÷áÎÊÌâ¡£

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

LILO ÍêÈ«Ã»ÓÐ±»ÔØÈë¡£ LILO ²»ÊÇÃ»ÓÐ±»°²×°ºÃ£¬¾ÍÊÇ LILO ¿ª»ú´ÅÇøËùÔÚµÄ partition ²¢·ÇÊ¹ÓÃÖÐµÄ partition ¡£



\item[L] \mbox{}

µÚÒ»½×¶ÎµÄ boot loader ÒÑ±»ÔØÈë²¢Æô¶¯£¬µ«ÊÇÎÞ·¨ÔØÈëµÚ¶þ½×¶ÎµÄ boot loader ¡£ÕâÐ©¶þÎ»ÊýµÄ´íÎóÂëÖ¸³öÎÊÌâÊôì¶Ê²÷áÖÖÀà¡£(Çë¿´ "Disk error codes" ÕâÒ»½Ú¡£)Õâ¸öÇé¿öÍ¨³£ÊÇÖ¸Ã½Ìå´íÎó»òÊÇ¼¸ºÎ²»ÏàÅä (geometry mismatch)(¾ÙÀýÀ´Ëµ£¬´íÎóµÄ´Åµú²ÎÊý)¡£



\item[LI] \mbox{}

µÚÒ»½×¶ÎµÄ boot loader ÄÜ¹»ÔØÈëµÚ¶þ½×¶ÎµÄ boot loader £¬µ«ÊÇÈ´²»ÄÜ¹»Ö´ÐÐËü¡£Õâ¸öÇéÐÎÊÇÒòÎª geometry mismatch ÒÖ»òÊÇÔÚÃ»ÓÐÖ´ÐÐ map installer µÄÇé¿öÏÂ£¬ÒÆ¶¯ÁË \url{/boot/boot.b} ËùÔì³É¡£



\item[LIL] \mbox{}

µÚ¶þ½×¶ÎµÄ boot loader ÒÑ±»Æô¶¯£¬µ«ÊÇÈ´²»ÄÜ´Ó map file ÔØÈë descriptor table ¡£Ò»°ã¶øÑÔ£¬ÕâÊÇÒòÎªÃ½Ìå´íÎó»òÊÇ geometry mismatch ËùÔì³É¡£



\item[LIL?] \mbox{}

µÚ¶þ½×¶ÎµÄ boot loader ±»ÔØÈëµ½Ò»¸ö²»ÕýÈ·µÄÎ»Ö·¡£Ò»°ã¶øÑÔ£¬ÕâÊÇÒòÎª subtle geometry mismatch  £¬»òÊÇÔÚÃ»ÓÐÖ´ÐÐ map installer µÄÇé¿öÏÂ£¬ÒÆ¶¯ÁË /boot/boot.b ËùÔì³É¡£



\item[LIL-] \mbox{}

Descriptor table Ëð»Ù¡£Õâ¸öÇéÐÎÊÇÒòÎª geometry mismatch ÒÖ»òÊÇÔÚÃ»ÓÐÖ´ÐÐ map installer µÄÇé¿öÏÂ£¬ÒÆ¶¯ÁË /boot/map ËùÔì³É¡£



\item[LILO] \mbox{}

LILO µÄËùÓÐ²¿·Ö¾ùÒÑ³É¹¦ÔØÈë¡£

\end{description}


Èç¹ûÔÚ LILO ÕýÊÔÖøÔØÈë boot image Ê±£¬ BIOS ·¢³öÒ»¸ö´íÎóÑ¶ºÅ£¬ÄÇ÷áÏà¶ÔÓ³µÄ (respective)´íÎóÂë»áÏÔÊ¾³öÀ´¡£´íÎóÂëµÄ¡õÎ§´Ó {\ttfamily 0x00} µ½ {\ttfamily 0xbb} ¡£Çë¿´ LILO User Guide for an explanation of these ¡£




\section{Root filesystem ÁÐ±íÑù±¾ -- 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

***  ÎÒÖ»°Ñ¹©ÎÒÄ¿Ç°µÄ IDE partition ÀûÓÃµÄÉè±¸°üÀ¨½øÀ´¡£
***  Èç¹ûÄãÊ¹ÓÃ SCSI £¬ÄÇ÷áÇë¸ÄÓÃ /dev/sdXX µÄÉè±¸¡£

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{¹¤¾ß³ÌÊ½´ÅÆ¬ (utility disk) Ä¿Â¼ÁÐ±íÑù±¾ -- 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}
