\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{´ÓÔ´´úÂë´òÔìÒ»¸ö×îÐ¡»¯µÄLinuxÏµÍ³Êµ×÷Æª}
\author{Greg O'Keefe, {\ttfamily gcokeefe@postoffice.utas.edu.au}}
\date{2000Äê09ÔÂµÚ0.8°æ}
\abstract{ÒÔÏÂ¾ÍÊÇ´ÓÔ´´úÂëÖÐ´òÔìÒ»¸ö×îÐ¡»¯µÄLinuxÏµÍ³µÄ²Ù×÷ËµÃ÷£®ËüÔø¾­ÊÇ\nameurl{http://www.linuxdoc.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html}{´Ó¼ÓµçÆô¶¯µ½BashÌáÊ¾·û(From PowerUp to Bash Prompt)}µÄÒ»²¿·Ö£®µ«ÊÇÎÒ½«ËüÃÇ·ÖÀë¿ªÀ´£¬ÒÔ±ãÊ¹µÃËüÃÇ¸ü¼ò¶Ì¶ø¸üÎª¼¯ÖÐ»¯£®ÎÒÃÇÔÚ´ËËùÒª´òÔìµÄÏµÍ³ÊÇ{\itshape ·Ç³£\/}Ð¡µÄ£¬¶øÇÒ²¢²»×¼±¸×÷Îª¹¤×÷²úÆ·À´Ê¹ÓÃ£®Èç¹ûÄúÏë´ÓÍ·¿ªÊ¼´òÔìÒ»¸öÓÐÊµ¼ÊÓÃÍ¾µÄÏµÍ³£¬Çë²ÎÔÄGerard BeekmansËù×«Ð´µÄ\nameurl{http://www.linuxfromscratch.org}{Linux¿ÕÊÖµÀÊµ×÷Ö¸ÄÏÆª (Linux From Scratch HOWTO)}£®}


\begin{document}
\maketitle
\tableofcontents

\section{ÄúËùÐèÒª¾ß±¸µÄÌõ¼þ}

ÎÒÃÇÊ×ÏÈÒª°²×°Ò»¸öLinux·¢ÐÐÌ×¼þ±ÈÈçÐ¡ºìÃ±(RedHat)µ½Ò»¸ö·ÖÇøÉÏ£¬È»ºó
Ê¹ÓÃËüÀ´ÔÚÁíÒ»¸ö·ÖÇøÉÏ´òÔìÒ»¸öÐÂµÄLinuxÏµÍ³£®ÎÒ½«ÎÒÃÇËùÒª´òÔìµÄÏµÍ³
³ÆÎªÄ¿±ê(target)¶ø°ÑÎÒÃÇËùÊ¹ÓÃÀ´´òÔìÐÂÏµÍ³µÄÏµÍ³³ÆÎªÔ´Í·(source)£®
¿É±ð°ÑÕâ¸öÔ´Í·(source)Í¬ÎÒÃÇÍ¬Ê±Ê¹ÓÃµÄ{\itshape Ô´Âë(source code)\/}Ïà
»ìÏýÁËÅ¶£®:)



Òò´Ë£¬ÄúµÃÐèÒªÒ»Ì¨¾ßÓÐÁ½¸ö¶ÀÁ¢·ÖÇøµÄ»úÆ÷£®Èç¹û¿ÉÄÜ£¬Çë¾¡Á¿Ê¹ÓÃÒ»Ì¨
Ã»ÓÐÖØÒª×ÊÁÏÔÚÀïÍ·µÄ»úÆ÷£¬ÒÔÃâÊý¾ÝÊÜËð£®Äú¿ÉÒÔÊ¹ÓÃÒ»¸öÒÑ¾­´æÔÚµÄ
LinuxÏµÍ³×÷ÎªÔ´Í·ÏµÍ³£¬µ«ÊÇÎÒ²¢²»ÍÆ¼öÕâÖÖ·½Ê½£®Èç¹ûÄú²»É÷ÒÅÂ©ÁËÎÒÃÇ
´òÔìµÄÖ¸ÁîµÄÄ³Ð©²ÎÊý£¬ÄúÓÐ¿ÉÄÜ»áÒâÍâµØÔÚÕâ¸öÏµÍ³ÉÏ°²×°ÁËÒ»Ð©Ã»ÓÐ±ØÒª
µÄ¶«Î÷£¬ÓÐ¿ÉÄÜ»áµ¼ÖÂ²»¼æÈÝºÍ³åÍ»£®



¾ÉÐÍµÄPC»úÓ²¼þ£¬´ó²¿·ÖµÄ486»úÆ÷»òÕß¸üÔçµÄ»úÐÍ£¬ÆäBIOS¶¼ÓÐÒ»Ð©¼«Æä
·³ÈËµÄÏÞÖÆ£®ËüÃÇÃ»ÓÐ°ì·¨¶ÁÈ¡Ó²ÅÌ³¬¹ýÇ°512Õ×Ö®ºóµÄ¿Õ¼ä£®µ±È»£¬Õâ¸ö
¶ÔÓÚLinuxÀ´Ëµ²¢²»ÊÇÊ²Ã´´óÎÊÌâ£¬ÒòÎªÖ»ÒªLinuxÄÜ¹»Òýµ¼Æô¶¯ÁË£¬½«Ê¹ÓÃ
Linux×Ô¼ºµÄ´ÅÅÌIO£¬ÂÔ¹ýBIOSµÄµ÷ÓÃ£®µ«ÊÇÎªÁËÄÜ¹»ÈÃÕâÐ©¾ÉÐÍ»úÆ÷ÄÜ¹»
Òýµ¼Linux£¬ÄÇÃ´LinuxÄÚºË±ØÐë´æ·ÅÔÚÓ²ÅÌµÄÇ°512Õ×Ö®Ç°µÄÄ³¸öÎ»ÖÃ£®Èç¹ûÄú
ÕýºÃÓÐÕâÃ´¸ö¾ÉÐÍ»úÆ÷£¬ÄúµÃ×¼±¸ºÃÒ»¸ö¶ÀÁ¢µÄÇÒÍêÈ«ÔÚÇ°512Õ×·¶Î§ÄÚµÄ
Ó²ÅÌ·ÖÇø£¬²¢½«Æä¹ÒÔØÎª{\ttfamily /boot}£®ÆäËüµÄ·ÖÇø¾Í¿ÉÒÔÔÚÈÎºÎÎ»ÖÃ£¬
¿ÉÒÔÈÎÒâ´¦Àí¶ø²»±Øµ£ÐÄÊÇÔÚÓ²ÅÌµÄÊ²Ã´Î»ÖÃÁË£®



ÉÏÒ»´ÎÎÒ´òÔìÕâ¸öÏµÍ³Ê±£¬ËùÊ¹ÓÃµÄÔ´Í·ÏµÍ³ÊÇÐ¡ºìÃ±6.1(RedHat 6.1)£¬
ÎÒ°²×°ÁË»ù±¾ÏµÍ³£¬¸½¼ÓÓÐÒÔÏÂÈí¼þ°ü¡Ã

\begin{itemize}
\item cpp                       (C++±àÒëÆ÷)
\item egcs                      (ÔöÇ¿ÐÍC±àÒëÆ÷)
\item egcs-c++          (ÔöÇ¿ÐÍC++ÓïÑÔ±àÒëÆ÷)
\item patch             (´ò²¹¶¡³ÌÐò)
\item make                      (±àÒëÅú´¦Àí½âÊÍÆ÷)
\item dev86             (Éè±¸ÎÄ¼þ°ü)
\item ncurses-devel     (ncurses¿â¿ª·¢°ü)
\item glibc-devel       (glibc¿â¿ª·¢°ü)
\item kernel-headers(ÄÚºËÔ´ÂëÍ·ÎÄ¼þ°ü)
\end{itemize}
 

ÎÒ»¹°²×°ÁËX WindowÊÓ´°ÏµÍ³ºÍMozillaÍøÂçä¯ÀÀÆ÷ÒÔ±ã¸üÇáËÉµØÔÄ¶ÁÎÄµµ£¬
¶øÊµ¼ÊÉÏÕâÁ½¸ö¶«¶«²¢²»ÊÇ±ØÒªµÄ£®ÔÚÎÒ¿¢¹¤Ö®Ê±£¬Õâ¸öÔ´Í·ÏµÍ³´ó¸ÅÊ¹ÓÃ
ÁË350Õ×µÄ´ÅÅÌ¿Õ¼ä(¿´ÆðÀ´ÊÇ¶àÁËÒ»Ð©£¬¿ÉÊÇÎÒ»¹ÔÚÄÉÃÆÎªÊ²Ã´ÄØ)£®



¿¢¹¤Ö®Ê±µÄÄ¿±êÏµÍ³Õ¼ÓÃÁË650Õ×´ÅÅÌ¿Õ¼ä£¬µ«ÊÇÕâ¸öÊýÖµ°üº¬ÁËËùÓÐµÄÔ´Âë
ÒÔ¼°ÖÐÍ¾´òÔì³öÀ´µÄÎÄ¼þ£®Èç¹û¿Õ¼ä±È½Ï½ô´Õ£¬ÄúÓ¦¸ÃÔÚÃ¿¸öÈí¼þ°ü¶¼´òÔì
Íê±ÏÖ®ºóÖ´ÐÐÒ»ÏÂ{\ttfamily make clean}À´Çå³ýÁÙÊ±ÎÄ¼þ£®µ±È»ÁË£¬ÎÒ¶ÔÕâ¸ö
Ò²ÊÇÓÐµã³Ô¾ªµÄ£®



×îºó£¬ÄúµÄ×¼±¸ºÃÎÒÃÇËùÒªÓÃÀ´´òÔìÏµÍ³µÄÔ´Âë°ü£®ÕâÐ©¾ÍÊÇÎÒÔÚ±¾ÎÄËùÌÖÂÛ
µÄÈí¼þ°ü£®ÕâÐ©Èí¼þ°ü¶¼¿ÉÒÔ´ÓÔ´ÂëÅÌÀïÃæÕÒµ½£¬»òÕß´Ó¹ú¼Ê»¥ÁªÍøÉÏÕÒµ½£®
ÎÒ»á¸ø³öÃÀ¹úµÄÕ¾µãºÍÎ»ÓÚ°Ä´óÀûÑÇµÄ¾µÏñÕ¾µãµÄµØÖ·£®



\label{downloads}
\begin{itemize}
\item MAKEDEV (Éè±¸Éú³ÉÆ÷°ü)
\nameurl{ftp://tsx-11.mit.edu/pub/linux/sources/sbin}{ÃÀ¹ú}
ÁíÒ»¸öÊÇ
\nameurl{ftp://sunsite.unc.edu/pub/Linux/system/admin}{ÃÀ¹ú}
\item Lilo (LinuxÒýµ¼Æ÷°ü)
\nameurl{ftp://lrcftp.epfl.ch/pub/linux/local/lilo/}{ÃÀ¹ú},
\nameurl{ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/boot/lilo/}{°Ä´óÀûÑÇ}.
\item LinuxÄÚºË°ü(Kernel)
Ê¹ÓÃ\nameurl{http://www.kernel.org}{Ö÷Ò³}ÉÏËùÁÐ¾ÙµÄ¾µÏñÕ¾µã
¶ø×îºÃ²»ÒªÊ¹ÓÃ
\nameurl{ftp://ftp.kernel.org/pub/linux/kernel}{ÃÀ¹ú}
Õ¾µãÏÂÔØ£¬ÒòÎªÕâÐ©µØ·½Í¨³£ÊÇ³¬¸ººÉÔË×ªµÄ£®
\nameurl{ftp://kernel.mirror.aarnet.edu.au/pub/linux/kernel/}{°Ä´óÀûÑÇ} 
\item GNU libc¿â°ü
Æä±¾Éí£¬ÒÔ¼°liuxthreadsÏß³Ì¸½¼Ó¿â¿ÉÔÚÒÔÏÂµØÖ·ÏÂÔØµ½¡Ã
\nameurl{ftp://ftp.gnu.org/pub/gnu/glibc}{ÃÀ¹ú}ºÍ 
\nameurl{ftp://mirror.aarnet.edu.au/pub/gnu/glibc}{°Ä´óÀûÑÇ} 
\item GNU libc¸½¼Ó¿â°ü
Äú¿ÉÄÜ»¹»áÐèÒªlinuxthreadsÏß³Ì¸½¼Ó¿âºÍlibcrypt¼ÓÃÜ¸½¼Ó¿â£®
Èç¹ûlibcryptÃ»ÔÚÄÇ¸öµØ·½ÕÒµ½£¬ÄÇ¾ÍÊÇÒòÎªÃÀ¹ú³ö¿Ú·¨ÂÉÏÞÖÆµÄÔ­Òò£¬
ÄÇÃ´Äú¾Í¿ÉÒÔ´ÓÕâÀïÅªµ½
\nameurl{ftp://ftp.gwdg.de/pub/linux/glibc}{libcrypt¼ÓÃÜ¸½¼Ó¿â}£®
Í¨³£linuxthreadsÏß³Ì¸½¼Ó¿â¸úlibc¿âÊÇ·ÅÔÚÍ¬Ò»¸öµØ·½µÄ£®
\item GNU ncurses
\nameurl{ftp://ftp.gnu.org/gnu/ncurses}{ÃÀ¹ú}
\nameurl{ftp://mirror.aarnet.edu.au/pub/gnu/ncurses}{°Ä´óÀûÑÇ}
\item SysVinit (³õÊ¼»¯½Å±¾°ü)
\nameurl{ftp://sunsite.unc.edu/pub/Linux/system/daemons/init}{ÃÀ¹ú} 
\nameurl{ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/daemons/init}{°Ä´óÀûÑÇ} 
\item GNU Bash (ÃüÁî½âÊÍÆ÷°ü)
\nameurl{ftp://ftp.gnu.org/gnu/bash}{ÃÀ¹ú} 
\nameurl{ftp://mirror.aarnet.edu.au/pub/gnu/bash}{°Ä´óÀûÑÇ} 
\item GNU sh-utils (ÃüÁî½âÊÍÆ÷¹¤¾ß°ü)
\nameurl{ftp://ftp.gnu.org/gnu/sh-utils}{ÃÀ¹ú} 
\nameurl{ftp://mirror.aarnet.edu.au/pub/gnu/sh-utils}{°Ä´óÀûÑÇ} 
\item util-linux (Linux³£ÓÃ¹¤¾ß°ü)
\nameurl{ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/}{ÁíÍâÄ³¸öµØ·½}
\nameurl{ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/misc}{°Ä´óÀûÑÇ}±¾Èí¼þ°ü°üº¬ÓÐ{\ttfamily agetty}ºÍ{\ttfamily login}£®
\end{itemize}




×Ü½áÒ»ÏÂ£¬ÄúËùÐèÒªµÄ¾ÍÊÇ¡Ã
\begin{itemize}
\item Ò»Ì¨¾ßÓÐÁ½¸ö·Ö±ðÊÇ400Õ×ºÍ700Õ×¶ÀÁ¢·ÖÇøµÄ»úÆ÷£¬»òÐíÄú¿ÉÄÜ»áÐèÒªÉÙÒ»Ð©£®
\item Ò»¸öLinux·¢ÐÐÌ×¼þ(Æ©ÈçÒ»¸öRed Hat¹âÅÌ)ºÍ°²×°·½Ê½(Æ©ÈçÒ»¸ö¹âÇý)
\item ÒÔÉÏËùÁÐ¾ÙµÄÔ´ÂëµÄtar°ü£®
\end{itemize}




ÎÒ¼Ù¶¨Äú¿ÉÒÔ×Ô¼º°²×°Ô´Í·ÏµÍ³£¬¶øÓÃ²»ÖøÎÒÀ´°ïÃ¦£®´ÓÕâÀï¿ªÊ¼£¬ÎÒ¼Ù¶¨Ô´Í·
ÏµÍ³ÒÑ¾­°²×°ºÃÁË£®



±¾Ð¡ÏîÄ¿µÄµÚÒ»¸öÀï³Ì±®¾ÍÊÇÊ¹µÃÄÚºËÆô¶¯ÆðÀ´È»ºóËÀÇÌÇÌ£¬ÒòÎªËüÃ»ÕÒµ½
{\ttfamily init}³õÊ¼»¯³ÌÐò£®Ò²¾ÍÊÇËµÎÒÃÇµÃ°²×°Ò»¸öÄÚºËºÍ°²×°lilo£®ÎªÁË
Ë³Àû°²×°lilo£¬ÎÒÃÇÒªÓÃÉÏÔÚÄ¿±êÏµÍ³ÉÏ{\ttfamily /dev}Ä¿Â¼ÏÂµÄÉè±¸ÎÄ¼þ£®
liloÐèÒªËüÃÇÀ´ÊµÏÖµ×²ã±ØÐèµÄ´ÅÅÌ´æÈ¡À´Ð´ÈëÒýµ¼ÉÈÇø£®MAKEDEVÕýÊÇÓÃÀ´
´´½¨ÕâÐ©Éè±¸ÎÄ¼þµÄ½Å±¾³ÌÐò(Äúµ±È»¿ÉÒÔÖ»ÐèÒª´ÓÔ´Í·ÏµÍ³µ±ÖÐ¸´ÖÆ³öÀ´£¬
²»¹ýÕâ¿ÉÊÇ×÷±×²»ÀÍ¶ø»ñÅ¶)£®µ«ÊÇ×îÖØÒªµÄÊÂÇé¾ÍÊÇ£¬ÎÒÃÇÐèÒªÒ»¸öÎÄ¼þ
ÏµÍ³À´·ÅÖÃËùÓÐµÄÕâÐ©¶«Î÷£®




\section{ÎÄ¼þÏµÍ³}

ÎÒÃÇµÄÐÂÏµÍ³ÊÇÒª°²×°ÔÚÎÄ¼þÏµÍ³ÉÏµÄ£®Òò´ËÊ×ÏÈÎÒÃÇµÃÊ¹ÓÃÃüÁî{\ttfamily mke2fs}À´
´´½¨ÎÄ¼þÏµÍ³£¬È»ºó½«Æä¹ÒÔØµ½Ä³¸öµØ·½£®ÎÒ½¨ÒéÊÇ¹ÒÔØµ½{\ttfamily /mnt/target}Õâ¸ö
Ä¿Â¼ÉÏ£®½ÓÏÂÀ´µÄ²Ù×÷ÖÐ£¬ÎÒ¼Ù¶¨¾ÍÓÃÕâ¸öÄ¿Â¼ÁË£®ÎªÁË½ÚÊ¡ÄúµÄ±¦¹óÊ±¼ä£¬Äú¿ÉÒÔ
ÔÚ{\ttfamily /etc/fstab}ÎÄ¼þÀïÃæÌí¼ÓÉÏÕâÒ»Ïî£¬ÒÔ±ãÃ¿´ÎÔ´Í·ÏµÍ³Æô¶¯µÄÊ±ºò¾ÍÄÜ¹»
×Ô¶¯½«Õâ¸öÄ¿Â¼¹ÒÔØÉÏ£®



µ±ÎÒÃÇÆô¶¯ÁËÄ¿±êÏµÍ³£¬·ÅÖÃÔÚ{\ttfamily /mnt/target}ÉÏµÄËùÓÐ¶«Î÷¾Í»á±»µ±³ÉÁË
·ÅÖÃÔÚ{\ttfamily /}¸ùÄ¿Â¼ÉÏ£®



ÎÒÃÇÐèÒªÔÚÄ¿±êÏµÍ³ÉÏ½¨Á¢¹Ì¶¨µÄÄ¿Â¼½á¹¹£®Çë²ÎÔÄ"ÎÄ¼þ²ã´Î½á¹¹±ê×¼(¼ò³ÆFHS£¬
File Heirarchy Standard)"£¬¼ûÓÚ\ref{FHS} {(ÎÄ¼þÏµÍ³)}Ò»½ÚÀ´ÁË½â
ÏêÇé£¬»òÕßÖ»ÐèÒª{\ttfamily cd}ÇÐ»»Ä¿Â¼µ½Ä¿±êÏµÍ³Ëù¹ÒÔØµÄµØ·½È»ºó¾¡¹ÜÖ´ÐÐÒÔ
ÏÂÃüÁî¡Ã 

\begin{verbatim}
 
        mkdir bin boot dev etc home lib mnt root sbin tmp usr var
        cd var; mkdir lock log run spool  
        cd ../usr; mkdir bin include lib local sbin share src
        cd share/; mkdir man; cd man 
        mkdir man1 man2 man3 ... man9
\end{verbatim}


ÒòÎªFHS±ê×¼ºÍ´ó²¿·ÖµÄÈí¼þ°üÔÚÊÖ²áÒ³(man page)·ÅÖÃÎ»ÖÃ´¦ÀíÉÏ²¢²»Ò»ÖÂ£¬
Òò´ËÎÒÃÇÐèÒª×öÒ»¸ö·ûºÅÁ¬½Ó¡Ã

\begin{verbatim}
 
        cd ..; ln -s share/man man
\end{verbatim}





\section{MAKEDEV(Éè±¸Éú³ÉÆ÷)}

ÎÒÃÇÒª°ÑÔ´´úÂë·ÅÖÃµ½Ä¿±êÏµÍ³µÄ{\ttfamily /usr/src}Ä¿Â¼ÏÂÃæ£®Òò´Ë£¬¾Ù¸öÀý
×Ó°É£¬Èç¹ûÄúµÄÄ¿±êÏµÍ³ÊÇ¹ÒÔØÔÚ{\ttfamily /mnt/target}Õâ¸öµØ·½£¬ÇÒÄúµÄtar
°üÊÇ·ÅÔÚ{\ttfamily /root}ÀïÃæ£¬ÄÇÃ´ÄúÒª×öµÄ¾ÍÊÇ¡Ã

\begin{verbatim}
 
        cd /mnt/target/usr/src
        tar -xzvf /root/MAKEDEV-2.5.tar.gz
\end{verbatim}




È»ºó¾Í°ÑÕâÐ©tar°ü¸´ÖÆµ½ÄúÒª½â¿ªËüÃÇµÄµØ·½¾ÍÐÐÁË£®Ç§Íò±ðÃÔºýÁËÅ¶£®;-{$>$}



µ±Äú°²×°Èí¼þµÄÊ±ºò£¬Í¨³£Çé¿öÏÂÄú»á°ÑËüÃÇ°²×°ÔÚÕýÔÚÊ¹ÓÃµÄÏµÍ³ÉÏ£®µ«ÊÇÎÒÃÇ
²¢²»ÏëÕâÃ´×ö£¬ÒòÎªÎÒÃÇÊÇÒª°Ñ{\ttfamily /mnt/target}µ±×ö¸ùÎÄ¼þÏµÍ³(root 
filesystem)£¬¾ÍÊÇÒª°ÑÕâÐ©Èí¼þ°²×°µ½Õâ¸öµØ·½£®²»Í¬µÄÈí¼þ°üÓÐ²»Í¬µÄ´¦Àí
·½Ê½£®±ÈÈçËµMAKEDEVÉè±¸Éú³ÉÆ÷°ü£¬ÄúÒª×öµÄÊÇ¡Ã

\begin{verbatim}
        ROOT=/mnt/target make install
\end{verbatim}




ÄúµÃÏÈÔÚÕâ¸ö°üµ±ÖÐµÄREADMEËµÃ÷ÎÄ¼þºÍINSTALL°²×°ËµÃ÷ÎÄ¼þµ±ÖÐ²é³öÕâÐ©Ñ¡Ïî£¬
»òÕßÖ´ÐÐÃüÁî{\ttfamily ./configure --help}²é¿´°ïÖúËµÃ÷£®



²é¿´Ò»ÏÂMAKEDEV°üµ±ÖÐµÄ{\ttfamily Makefile}ÎÄ¼þ£¬¿´¿´ËüÊÇÔõÑù´¦ÀíÎÒÃÇÔÚÃüÁî
ÐÐµ±ÖÐÉèÖÃµÄ{\ttfamily ROOT}±äÁ¿µÄ£®½ÓÖøÍ¨¹ýÖ´ÐÐ{\ttfamily man ./MAKEDEV.man}À´
²é¿´Ò»ÏÂËüµÄÊÖ²áÒ³£¬¿´¿´ËüÊÇÔõÃ´Æðµ½×÷ÓÃµÄ£®Äú»á·¢ÏÖÉú³ÉÎÒÃÇ×Ô¼ºµÄÉè±¸µÄ
·½Ê½¾ÍÊÇÖ´ÐÐ{\ttfamily cd /mnt/target/dev}È»ºó{\ttfamily ./MAKEDEV generic}£®
ÇëÊ¹ÓÃ{\ttfamily ls}ÃüÁîÀ´¿´¿´Ëü¶¼ÎªÎÒÃÇÉú³ÉÁËÄÄÐ©Éè±¸ÎÄ¼þ°É£®




\section{ÄÚºË}

ÏÂÒ»²½¾ÍÊÇÉú³ÉÄÚºËÁË£®ÎÒ¼ÙÉèÄúÒÔÇ°ÊÇ×ö¹ý±àÒëÄÚºËÕâÖÖÊÂµÄ£¬ËùÒÔÎÒ¾Í³¤»°¶ÌËµ
ÁË£®Èç¹ûÒªÆô¶¯µÄÄÚºËÒÑ¾­×¼±¸ºÃµÄ»°£¬ÄÇÃ´Òª°²×°lilo¾Í»á¸üÈÝÒ×£®Çë·µ»Øµ½
Ä¿±êÏµÍ³µÄ{\ttfamily usr/src}Ä¿Â¼£¬È»ºóÔÚÄÇ¶ù½â¿ªLinuxÄÚºËÔ´Âë£®½øÈëLinux
Ô´ÂëÊ÷({\ttfamily cd linux})È»ºóÊ¹ÓÃÄú×îÏ²»¶µÄ·½Ê½ÅäÖÃÄÚºË£¬±ÈÈç{\ttfamily make
menuconfig}£®Èç¹ûÄúÏëÈÃ×Ô¼ºµÄÇáËÉÒ»Ð©£¬ÄÇÃ´Äú¿ÉÒÔÎª×Ô¼ºÅäÖÃÒ»¸öÃ»ÓÐ
Ä£¿éµÄÄÚºË£®Èç¹ûÄúÒÑ¾­ÅäÖÃÁËÄ£¿é£¬ÄÇÃ´Äú¾ÍµÃ±à¼­{\ttfamily Makefile}ÎÄ¼þ£¬
ÕÒ³ö{\ttfamily INSTALL\_MOD\_PATH}²¢½«ÆäÉèÖÃÎª{\ttfamily /mnt/target}£®



ÏÖÔÚÄú¿ÉÒÔÖ´ÐÐ{\ttfamily make dep}£¬{\ttfamily make bzImage}ÁË£®Èç¹ûÄúÉèÖÃÁËÄ£¿é
Ïî£¬¿ÉÒÔÔÙÖ´ÐÐ{\ttfamily make modules}£¬{\ttfamily make modules\_install}£®°ÑÄÚºË
Ó³ÏóÎÄ¼þ{\ttfamily arch/i386/boot/bzImage}ºÍÏµÍ³º¯ÊýÓ³ÏóÎÄ¼þ{\ttfamily System.map}
¸´ÖÆµ½Ä¿±êÏµÍ³µÄbootÆô¶¯Ä¿Â¼{\ttfamily /mnt/target/boot}ÏÂÃæ£¬È»ºó×¼±¸°²×°
ÏµÍ³Òýµ¼Æ÷liloÁË£®




\section{LiloÏµÍ³Òýµ¼Æ÷}

Lilo°üÀïÃæ´øÓÐÒ»¸öºÜÐ¡ÇÉµÄ½Å±¾£¬Ãû½Ð{\ttfamily QuickInst}£®Çë°ÑliloÔ´Âë°ü
½âÑ¹µ½Ä¿±êÏµÍ³µÄÔ´´úÂëÄ¿Â¼{\ttfamily /mnt/target/usr/src}ÏÂÃæ£¬È»ºóÖ´ÐÐ¸Ã
½Å±¾£¬·½·¨ÊÇ¡Ã{\ttfamily ROOT=/mnt/target ./QuickInst}£®Ëü»áÑ¯ÎÊÄúÒ»Ð©¹ØÓÚ
ÄúÏëÔõÑù°²×°liloµÄÎÊÌâ£®



ÇÐ¼Ç¡ÃÒòÎªÎÒÃÇÒÑ¾­ÉèÖÃ{\ttfamily ROOT}¸ùÏµÍ³ÎªÄ¿±êÏµÍ³·ÖÇøÁË£¬ËùÒÔÄú»Ø´ð
ÌáÎÊÊ±Ëù¸ø³öµÄÎÄ¼þÃûÍ¬ËüÊÇÃÜÇÐÏà¹ØµÄ£®±ÈÈçµ±ËüÑ¯ÎÊÄúÄ¬ÈÏÏëÆô¶¯ÄÄ¸öÄÚºË
µÄÊ±ºò£¬ÄúµÄ»Ø´ðÓ¦¸ÃÊÇ{\ttfamily /boot/bzImage}£¬¶ø{\itshape ²¢²»ÊÇ\/}
{\ttfamily /mnt/target/boot/bzimage}Å¶£®ÎÒ·¢ÏÖÕâ¸ö½Å±¾ÀïÃæÓÐ¸öÐ¡´íÎó£¬Ëü
»áÌáÊ¾Ëµ¡Ã

\begin{verbatim}

        ./QuickInst: /boot/bzImage: no such file 
\end{verbatim}


µ«ÊÇÄú±ÂÀíÕâ¸öÌáÊ¾¾ÍÊÇÁË£¬²»»áÓÐÊÂµÄ£®



ÎÒÃÇ¸ÃÈÃ{\ttfamily QuickInst}°ÑÒýµ¼ÉÈÇø(boot sector)·ÅÔÚºÎ´¦ÎªÍ×ÄØ£¿
µ±ÎÒÃÇÖØÆôÊ±£¬ÎÒÃÇÏ£Íû¿ÉÒÔÑ¡ÔñÒýµ¼½øÈëÔ´Í·ÏµÍ³»òÕßÄ¿±êÏµÍ³»òÕß
ÆäËü¹²´æÓÚÍ¬Ò»Ì¨»úÆ÷µÄÆäËüÏµÍ³£®¶øÇÒÎÒÃÇ»¹Ï£ÍûÎÒÃÇÒªÊ¹ÓÃËù±àÒë
µÄliloÀ´Òýµ¼ÎÒÃÇÐÂÏµÍ³µÄÄÚºË£®ÎÒÃÇÔõÃ´°ÑÕâÁ½¼þÊÂÇéºÏ¶øÎªÒ»ÄØ£¿
ÈÃÎÒÃÇÏÈÅÜÒ»Ð¡»á¶ùÌâ£¬¿´¿´liloÔÚÒ»¸öË«ÖØÆô¶¯µÄLinuxÏµÍ³ÉÏÊÇÔõ
ÑùÒýµ¼DOSµÄ£®ÔÚÕâÑùµÄÒ»¸öÏµÍ³ÉÏµÄ{\ttfamily lilo.conf}ÎÄ¼þµÄÄÚÈÝ¿´
ÆðÀ´¿ÉÄÜ»á¸úÏÂÃæµÄ²î²»¶à¡Ã



\begin{verbatim}
 
prompt  
timeout = 50
default = linux

image = /boot/bzImage 
        label  = linux
        root   = /dev/hda1
        read-only

other = /dev/hda2
        label = dos
\end{verbatim}






Èç¹û»úÆ÷ÊÇÕâÃ´°²×°ÆðÀ´µÄ£¬ÄÇÃ´Ö÷Òýµ¼¼ÇÂ¼(MBR£¬master boot record)¾Í¿ÉÒÔ
±»BIOS¶ÁÈ¡²¢¼ÓÔØ£¬È»ºóMBR¼ÓÔØliloÆô¶¯Òýµ¼Æ÷£¬¶øºóÕßÔò¸ø³öÒ»¸öÌáÊ¾£®Èç¹û
ÄúÔÚÌáÊ¾ºóÃæÊäÈë{\ttfamily dos}£¬lilo¾Í»á´Óhda2¼ÓÔØÒýµ¼¼ÇÂ¼£¬¾Í¼ÓÔØÁËDOS£®



ÎÒÃÇËùÒª×öµÄÊÂÇé¸úÉÏÍ·ÊÇÒ»ÑùµÄ£¬³ýÁËÔÚhda2µÄÒýµ¼¼ÇÂ¼Ó¦¸ÃÊÇÁíÍâÒ»¸ölilo
Òýµ¼¼ÇÂ¼Ö®Íâ£¬Ò²¾ÍÊÇÔÚ{\ttfamily QuickInst}ËùÑ¯ÎÊÒª°²×°µÄÄÇ¸ö£®Òò´ËÀ´×ÔLinux
·¢ÐÐÌ×¼þµÄlilo»á¼ÓÔØÎÒÃÇËù±àÒë°²×°µÄlilo£¬È»ºóÎÒÃÇËù±àÒë°²×°µÄlilo¾Í»á
¼ÓÔØÎÒÃÇËù±àÒë°²×°µÄÄÚºË£®µ±ÄúÖØÆôºó£¬Äú»á¿´µ½Á½´ÎliloµÄÌáÊ¾£®



³¤»°¶ÌËµ£¬µ±{\ttfamily QuickInst}Ñ¯ÎÊÄú¸Ã°ÑÒýµ¼ÉÈÇø(boot sector)·Åµ½Ê²Ã´µØ·½
Ê±£¬Äú¾Í»Ø´ðÄ¿±êÏµÍ³ËùÔÚµÄ·ÖÇø£¬±ÈÈçËµÊÇ¡Ã{\ttfamily /dev/hda2}£®



ÏÖÔÚÀ´ÐÞ¸ÄÄúµÄÔ´Í·ÏµÍ³ÉÏµÄ{\ttfamily lilo.conf}ÅäÖÃÎÄ¼þ£¬ÄÇÃ´¿´ÆðÀ´»áÓÐµãÏñ
Õâ¸öÑù×Ó¡Ã

\begin{verbatim}
 
other = /dev/hda2
        label = target
\end{verbatim}


ÐÞ¸ÄÍê±Ï£¬½ÓÖøÖ´ÐÐlilo°²×°LILO£®ÎÒÃÇÓ¦¸Ã¿ÉÒÔµÚÒ»¸öÒýµ¼½øÈëÄ¿±êÏµÍ³ÁË£®




\section{Glibc¿â}

ÏÂÒ»²½ÎÒÃÇÒª°²×°{\ttfamily init}£¬µ«ÊÇÍ¬ÔËÐÐÔÚLinuxÉÏ¼¸ºõÈ«²¿µÄ³ÌÐòÒ»Ñù£¬
{\ttfamily init}Ê¹ÓÃÁËGNU CÓïÑÔ¿âglibcËùÌá¹©¿âº¯Êý£¬Òò´ËÎÒÃÇÏÈµÃ°ÑÕâ¸ö¶«¶«
°²×°ÉÏ£®



Glibc¿âÊÇÒ»¸öºÜ´ó¶øÇÒºÜ¸´ÔÓµÄÈí¼þ°ü£®ÔÚÎÒÄÇ¸ö¾ÉÐÍµÄ´ø8Õ×ÄÚ´æµÄ386sx/16»úÆ÷
ÉÏ£¬µÃ»¨µôÎÒ90¸öÐ¡Ê±À´Íê³É±àÒë¹¤×÷£®µ«ÊÇÔÚÎÒÄÇ´øÓÐ64Õ×ÄÚ´æµÄÈüÑî(Celeron)
433ÉÏÖ»»¨µôÁË33·ÖÖÓ£®Èç¹ûÄúÖ»ÓÐ8Õ×ÄÚ´æ(»òÕßÉÙµÃÈÃÈË´ò²üµÄÈÝÁ¿)µÄ»°£¬ÄÇ¾Í
×öºÃ¿à°¾µÄ×¼±¸°É£®



glibcµÄ°²×°ÎÄµµ½¨ÒéÔÚ²»Í¬µÄ¶ÀÁ¢·ÖÀëÄ¿Â¼ÀïÃæ±àÒë£®ÕâÑù×ö¾ÍÄÜ¹»ÈÃÄúºÜÇáËÉ
µØÔÙ´Î±àÒë£¬ÒòÎªÄú¿ÉÒÔ¸ÃÄ¿Â¼ÏÂÃæ½ÓÖø±àÒë£®Äú¿ÉÄÜÒ²»áÏëÕâÃ´×ö£¬ÒòÎª¿ÉÒÔÎª
Äú½ÚÊ¡´óÔ¼265Õ×µÄ´ÅÅÌ¿Õ¼äÅ¶!



¸úÆ½³£Ò»Ñù£¬°Ñ{\ttfamily glibc-2.1.3.tar.gz}(»òÕßÆäËü°æ±¾)Õâ¸ötar°ü½âÑ¹µ½
{\ttfamily /mnt/target/usr/src}Õâ¸öÄ¿Â¼ÏÂÃæ£®½ÓÏÂÀ´£¬ÎÒÃÇµÃ°Ñ¸½¼Ó¿âÒ²½âÑ¹
µ½glibc¿âÄ¿Â¼ÏÂÃæ£®ËùÒÔÏÈ{\ttfamily cd glibc-2.1.3}£¬È»ºó½ÓÖøÔÚÕâ¸öÄ¿Â¼ÏÂÃæ
°Ñ{\ttfamily glibc-crypt-2.1.3.tar.gz}ºÍ{\ttfamily glibc-linuxthreads-2.1.3.tar.gz}
ÕâÁ½¸ötar°ü½â¿ª£®



ÏÖÔÚÎÒÃÇ¾Í¿ÉÒÔÉú³É±àÒëÄ¿Â¼£¬ÉèÖÃÑ¡Ïî£¬Ö´ÐÐmake±àÒëºÍ°²×°glibc¿âÁË£®ÕâÐ©
¶¼ÊÇÎÒËùÊ¹ÓÃ¹ýµÄÃüÁî£¬µ«ÊÇ×îºÃÄú×Ô¼ºÔÄ¶ÁÒ»ÏÂÎÄµµ£¬È·ÈÏ×îÊÊºÏÄúµÄ×´¿öµÄ
×ö·¨£®È»¶øÔÚÄú¿ªÊ¼Ç°£¬Äú¿ÉÄÜÐèÒªÖ´ÐÐ{\ttfamily df}ÃüÁîÀ´²é¿´Ò»ÏÂ»¹ÓÐ¶àÉÙ
Ê£Óà¿Õ¼ä£®Äú»¹¿ÉÒÔÔÚ±àÒë²¢°²×°Íê±Ïglibc¿âÖ®ºóÔÙÖ´ÐÐÒ»´Î¿´¿´ÕâÍæÒâ¶ùµ½µ×
µÃÕ¼¶à´óµØ¶ù£®



\begin{verbatim}
        cd ..
        mkdir glibc-build
        ../glibc-2.1.3/configure --enable-add-ons --prefix=/usr
        make
        make install_root=/mnt/target install
\end{verbatim}




×¢ÒâÁË£¬ÎÒÃÇ»¹ÓÐ±ðµÄ·½·¨À´¸æÖªÒ»¸öÈí¼þ°ü¸Ã×°µ½Ê²Ã´µØ·½£®




\section{SysVinit³õÊ¼»¯½Å±¾°ü}

±àÒë²¢°²×°SysVinit¿ÉÖ´ÐÐ´úÂëÊÇ·Ç³£Ö®¼ò½àÃ÷ÁËµÄ£®ÎÒÍµÀÁÒ»´Î£¬¾Í¸øÄú
²Ù×÷ÃüÁî°É£®¼Ù¶¨ÄúÒÑ¾­½âÑ¹²¢ÇÒ½øÈëSysVinitÔ´ÂëÄ¿Â¼ÁË¡Ã



\begin{verbatim}
 cd src
 make
 ROOT=/mnt/target make install
\end{verbatim}




ÁíÍâ»¹ÓÐºÜ¶àÓë{\ttfamily init}Ïà¹ØµÄ½Å±¾£®ÔÚSysVinit°üÀïÃæÓÐÒ»Ð©¹¤×÷
Õý³£µÄ·¶Àý½Å±¾£¬µ«ÊÇÄúµÃ×Ô¸ö¶ùÊÖ¹¤°²×°ÁË£®ËüÃÇÔÚSysVinitÔ´ÂëÊ÷ÖÐ
ÊÇÓÐ²ã´ÎµØ²¼ÖÃÔÚ{\ttfamily debian/etc}ÏÂÃæµÄ£®ÄúÖ»ÐèÒªÖ´ÐÐÀàËÆÕâÑùµÄ
ÃüÁî¡Ã{\ttfamily cd ../debian/etc; cp -r * /mnt/target/etc}£¬Ö±½Ó°Ñ
ËüÃÇ¸´ÖÆµ½Ä¿±êÏµÍ³µÄ{\ttfamily etc}Ä¿Â¼ÏÂÃæ¾ÍÐÐÁË£®µ±È»ÁË£¬Äú×îºÃÊÇ
ÔÚ¸´ÖÆÖ®Ç°²é¿´Ò»ÏÂ£®



µ±ÖØÆôÖ®ºó£¬Ä¿±êÏµÍ³µÄÄÚºË¾Í»á¼ÓÔØ{\ttfamily init}£¬Ò»ÇÐ¶¼¸Ã¸÷¾ÍÆäÎ»ÁË£®
´ËÊ±µÄÎÊÌâ¿ÉÄÜÊÇ½Å±¾²»ÄÜÕý³£ÔËÐÐ£¬ÒòÎªÃ»ÓÐÃüÁî½âÊÍÆ÷{\ttfamily bash}À´
½âÊÍÖ´ÐÐÕâÐ©½Å±¾£®¶øÇÒ{\ttfamily init}»¹»á³¢ÊÔÖ´ÐÐ{\ttfamily getty}£¬µ«ÊÇ
¸ù±¾¾ÍÃ»ÓÐ{\ttfamily getty}¿É¹©ÔËÐÐ£®ÇëÖØÐÂÆô¶¯²¢È·ÈÏÃ»ÓÐÆäËüµÄ´íÎó£®




\section{Ncurses¿â}

ÎÒÃÇËùÐèÒªµÄÏÂÒ»¸ö¶«¶«ÊÇÃüÁî½âÊÍÆ÷Bash£¬¶øbashÐèÒªncurses¿â£¬ËùÒÔ
ÎÒÃÇµÃÏÈ°²×°ÕâÍæÒâ¶ù£®ncurses¿â¿ÉÒÔ´úÌætermcap´¦ÀíÎÄ±¾ÆÁÄ»µÄ»î¼Æ£¬
Í¬Ê±»¹Í¨¹ýÖ§³Ötermcapµ÷ÓÃÌá¹©ÁËÏòºó¼æÈÝÐÔ£®ÎªÁËÓµÓÐÒ»¸ö¼ò½àÐÂ³±µÄ
ÏµÍ³£¬ÎÒ¾õµÃ×îºÃÊÇ½ûÖ¹¾ÉÊ½µÄtermcap·½·¨£®Èç¹ûÄúºóÍ·Òª±àÒëÊ¹ÓÃÁË
termcapµÄ½ÏÀÏµÄÓ¦ÓÃ³ÌÐò£¬Äú¿ÉÄÜ»á²»¶ÏµØÓëÂé·³Îª°éÁË£®µ«ÊÇÄúÖÁÉÙ»á
ÖªµÀÊ²Ã´¶«¶«Ê¹ÓÃÁËÊ²Ã´¶«¶«£®Èç¹ûÄú±ØÐëÒªÓÃ£¬ÄÇÃ´Äú¿ÉÒÔÖØÐÂ±àÒë
ncurses¿â£¬Ê¹Æä´øÓÐtermcapÖ§³Ö£®



ÎÒËùÊ¹ÓÃµÄÃüÁîÊÇ¡Ã



\begin{verbatim}
        ./configure --prefix=/usr --with-install-prefix=/mnt/target --with-shared --disable-termcap 
        make 
        make install
\end{verbatim}





\section{BashÃüÁî½âÊÍÆ÷}

ÎªÁË°Ñbash°²×°µ½ÎÒÔ­ÒÔÎªËü¸Ã´ôµÄµØ·½£¬ÎÒ»¨·ÑÁËºÜ¶àÊ±¼ä×öÁË´óÁ¿ÔÄ¶ÁºÍ
Ë¼¿¼ÒÔ¼°²»¶ÏµØ³¢ÊÔºÍ³ö´í£¬¿ÉÎ½ÊÇÀú¾¡Ç§ÐÁÍò¿à°¡£®ÎÒËµÊ¹ÓÃµÄÅäÖÃÑ¡ÏîÊÇ¡Ã



\begin{verbatim}
 ./configure --prefix=/mnt/target/usr/local --exec-prefix=/mnt/target --with-curses 
\end{verbatim}




Ò»µ©ÄúÒÑ¾­±àÒë²¢°²×°ÁËbashÖ®ºó£¬ÄúÐèÒªÉú³ÉÒ»¸ö·ûºÅÁ¬½Ó£¬¾ÍÏóÕâÑù¡Ã
{\ttfamily cd /mnt/target/bin; ln -s bash sh}£®ÕâÊÇÒòÎª½Å±¾Í¨³£Í·Ò»¾ä
ÊÇÕâÃ´Ð´ÖøµÄ¡Ã



\begin{verbatim}
#!/bin/sh
\end{verbatim}




Èç¹ûÄúÃ»ÓÐÕâÃ´Ò»¸ö·ûºÅÁ¬½Ó£¬ÄÇÃ´ÄúµÄ½Å±¾¾Í²»ÄÜÔËÐÐ£¬ÒòÎªËüÃÇ»áÈ¥Ñ°ÕÒ
{\ttfamily /bin/sh}¶ø·Ç{\ttfamily /bin/bash}£®



Èç¹ûÄúÔ¸Òâ£¬ÄúÒ²¿ÉÒÔµ½ÕâÀïÊ±ÖØÐÂÆô¶¯Ò»´Î£®Äú»á×¢Òâµ½½Å±¾ÕâÒ»´ÎÈ·ÊµÔËÐÐ
ÁË£®ËäÈ»Äú»¹ÊÇÃ»ÄÜµÇÂ¼(login)£¬ÕâÊÇÒòÎª»¹Ã»ÓÐ°²×°{\ttfamily getty}»òÕß
{\ttfamily login}ÕâÐ©³ÌÐò£®




\section{Util-linux (getty ºÍlogin)}

Èí¼þ°üutil-linux°üº¬ÓÐ{\ttfamily agetty}ºÍ{\ttfamily login}£®ÎÒÃÇÐèÒªÕâÁ½¸ö
³ÌÐò²ÅÄÜµÇÂ¼ÏµÍ³(log in)ºÍµÃµ½ÃüÁîÐÐÌáÊ¾·û(bash prompt)£®ÔÚ°²×°Ö®ºó£¬
ÇëÔÚÄ¿±êÏµÍ³µÄ{\ttfamily /sbin}Ä¿Â¼ÏÂÎª{\ttfamily agetty}½¨Á¢Ò»¸ö·ûºÅÁ¬½Óµ½
{\ttfamily getty}£®{\ttfamily getty}ÊÇËùÓÐUnixÀàÏµÍ³µ±ÖÐ±»ÈÏÎªÓ¦¸Ã´ôÔÚÄÇ¸ö
µØ·½µÄ³ÌÐòÖ®Ò»£¬ËùÒÔÉú³ÉÁ¬½ÓµÄÖ÷ÒâÒªÇ¿ÓÚ¸Ä¶¯{\ttfamily inittab}À´ÔËÐÐ
{\ttfamily agetty}£®



¶ÔÓÚutil-linuxÕâ¸ö°ü£¬ÎÒÊ£ÏÂµÄÒ»¸öÎÊÌâ¾ÍÊÇ¸Ã°üµÄ±àÒë£®Õâ¸ö°ü»¹°üº¬
ÓÐ{\ttfamily more}Õâ¸ö³ÌÐò£¬¶øÎÒÃ»·¨ÈÃ{\ttfamily make}½ø³Ì¸ø{\ttfamily more}
ÔÚÄ¿±êÏµÍ³ÉÏ×öÒ»¸öÖ¸Ïòncurses 5¿âµÄÁ¬½Ó£¬¶ø²»ÊÇÔÚÔ´Í·ÏµÍ³ÉÏÖ¸Ïò
ncurses 4¿âµÄÁ¬½Ó£®ÎÒ»áÅ¬Á¦¿Ë·þÕâ¸öÀ§ÄÑµÄ£®



Äú»¹µÃÔÚÄ¿±êÏµÍ³ÉÏ×¼±¸Ò»¸öÃÜÂëÎÄ¼þ{\ttfamily /etc/passwd}£®{\ttfamily login}
µÇÂ¼³ÌÐòÕýÊÇÍ¨¹ý²éÑ¯¸ÃÎÄ¼þÀ´È·ÈÏÄúÊÇ·ñÔÊÐíµÇÂ¼µÄ£®ÒòÎª´Ë´ÎÎÒÃÇÖ»ÊÇ
´òÔìÒ»¸öÍæ¾ßÏµÍ³£¬ËùÒÔÎÒÃÇ¿ÉÒÔÖ»ÉèÖÃ¸ùÏµÍ³ÓÃ»§¾Í¹»ÁË£¬¶øÇÒ²»ÐèÒªÈÎºÎ
ÃÜÂë!! Ö»ÐèÒªÔÚÄ¿±êÏµÍ³µÄÃÜÂëÎÄ¼þ{\ttfamily /etc/passwd}¼ÓÉÏÈçÏÂÒ»ÐÐ¼´¿É¡Ã



\begin{verbatim}
root::0:0:root:/root:/bin/bash
\end{verbatim}




ËùÓÐµÄÓòÊÇÍ¨¹ýÃ°ºÅ(:)·Ö¸ô¿ªµÄ£¬×Ô×óÏòÓÒ·Ö±ð´ú±í¡ÃÓÃ»§Ãû³Æ(user id)£¬
ÃÜÂëÃÜ´®(password)£¬ÓÃ»§ºÅÂë(user number)£¬ÓÃ»§Èº×éºÅÂë(group number)£¬
ÓÃ»§ÕæÊµÐÕÃû(user's name)£¬ÓÃ»§Ö÷Ä¿Â¼(home directory)ºÍÈ±Ê¡ÃüÁî½âÊÍÆ÷
(default shell)£®




\section{Sh-utils}

ÎÒÃÇËù±ØÐëµÄ×îºóÒ»¸öÈí¼þ°ü¾ÍÊÇGNU sh-utils°ü£®ÎÒÃÇ´ËÊ±ËùÐèÒª´ÓÕâ¸ö°üÀïÃæ
µÃµ½µÄÎ¨Ò»µÄ³ÌÐò¾ÍÊÇ{\ttfamily stty}£¬Ëü»áÔÚ{\ttfamily /etc/init.d/rc}ÀïÃæÓÃµ½£®
¶øºóÕßÊÇÓÃÓÚ¸Ä±äÔËÐÐ¼¶±ðºÍ½øÈë³õÊ¼»¯ÔËÐÐ¼¶±ðµÄ½Å±¾£®Êµ¼ÊÉÏÎÒÓÐÒ»¸ö¶øÇÒ
ÓÃ¹ý½ö°üº¬ÓÐ{\ttfamily stty}µÄÈí¼þ°ü£¬µ«ÊÇÈ´ÍüÁËÊÇ´ÓºÎ´¦µÃµ½µÄÁË£®Ê¹ÓÃGNUµÄ
Èí¼þ°üÊÇ¸öºÃÖ÷Òâ£¬ÒòÎªÔÚÀïÍ·»¹ÓÐÆäËüÄúÐèÒªµÄ¶«Î÷£¬Ôö¼ÓÁËÕâÐ©¶«¶«»áÊ¹µÃ
ÏµÍ³¿ÉÓÃÐÔ¸üºÃ£®



ºÃÁË£¬´òÔìÍê±Ï£®ÄúÏÖÔÚÓ¦¸ÃÓµÓÐÒ»¸ö¿ÉÒÔÆô¶¯²¢ÇÒÄÜ¹»ÌáÊ¾ÄúµÇÂ¼µÄÏµÍ³ÁË£®
ÊäÈë``root''£¬Äú¾Í»á½øÈëÃüÁî½âÊÍÆ÷ÁË£®µ«ÊÇÄú×ö²»ÁËºÜ¶àÊÂÇé£¬ÉõÖÁÃ»ÓÐ
Ò»¸ö{\ttfamily ls}ÃüÁî¸øÄú¿´¿´ÄúµÄ×÷Æ·ÀïÃæ¶¼ÓÐÐ©Ê²Ã´¶«Î÷£®ÇëÁ¬Ðø°´Á½´Î
TAB¼ü£¬Äú¾Í»á¿´µ½¿ÉÓÃµÄÃüÁîÁË£®Õâ´ó¸ÅÊÇÕâ¸öÏµÍ³ÖÐ£¬ÎÒËù·¢ÏÖµÄ×îÁîÎÒ
ÂúÒâµÄÊÂÇé£®




\section{¿ÉÓÃÐÔÉÌÈ¶}

¿´ÆðÀ´ºÃÏñÎÒÃÇ´òÔìµÄÊÇÒ»¸öºÁÎÞÓÃ´¦µÄÏµÍ³£®ËµÕæµÄ£¬ÒªÈÃËüÄÜ¹»ÓÐÊµÓÃ
¼ÛÖµÒ²²¢²»ÊÇÊ²Ã´ÄÑÊÂ£®Ê×ÏÈÒª×öµÄÊÂÇéÖ®Ò»¾ÍÊÇÄúÓ¦¸ÃÊ¹µÃ¸ùÎÄ¼þÏµÍ³(root
filesystem)ÒÔ¿É¶ÁÐ´·½Ê½¹ÒÔØÆðÀ´£®SysVinitÈí¼þ°üÀïÃæÓÐ¸ÉÕâ»î¶ùµÄ½Å±¾£¬
¾ÍÔÚ{\ttfamily /etc/init.d/mountall.sh}ÀïÃæ£®»¹Ö´ÐÐÁËÒ»´Î{\ttfamily mount -a}
°ÑËùÓÐÔÚ{\ttfamily /etc/fstab}µ±ÖÐµÄÌõÄ¿ÒÔÄúËùÖ¸¶¨µÄ·½Ê½¹ÒÔØÆðÀ´£®ÇëÔÚ
Ä¿±êÏµÍ³µÄ{\ttfamily etc/rc2.d}Ä¿Â¼ÏÂÉú³ÉÒ»¸öÀàËÆ{\ttfamily S05mountall}
µÄ·ûºÅÁ¬½Ó£®



Äú¿ÉÄÜ»á¿´µ½Õâ¸ö½Å±¾»áÓÃµ½ÄúÉÐÎ´°²×°µÄÃüÁî£®Èç¹ûÕæÊÇÕâÑù£¬ÕÒµ½°üº¬¸Ã
ÃüÁîµÄÈí¼þ°ü²¢°²×°Ö®£®Çë²Î¿´
\ref{finding} {(Ëæ»úÐ¡¼¼ÇÉ(Random Tips))}ÕâÒ»Ð¡½Ú£¬ÁË½âÈçºÎ
²éÕÒÈí¼þ°ü£®



¿´¿´ÔÚ{\ttfamily /etc/init.d}ÀïÃæµÄÆäËü½Å±¾£®ËüÃÇ´ó²¿·Ö¶¼Ó¦¸Ã°üº¬ÔÚÈÎºÎ
Õý¾­µÄÏµÍ³ÀïÃæ£®Ò»´ÎÌí¼ÓÒ»¸ö£¬±ðÍüÁËÒªÈ·¶¨Ìí¼ÓÏÂÒ»¸öÖ®Ç°¸ö¸ö¶¼ÔËÐÐ
ÎÞÎó£®



Çë¶ÔÕÕÎÄ¼þ²ã´Î½á¹¹±ê×¼(File Heirarchy Standard)£¬Çë²Î¿´
\ref{FHS} {(ÎÄ¼þÏµÍ³(Filesystem))}Ò»½Ú£®
ÄÇÀïÓÐÒ»¸öÃüÁîÁÐ±í£¬¶¼ÊÇ¸ÃÔÚ{\ttfamily /bin}ºÍ{\ttfamily /sbin}µÄÃüÁî£®Çë
È·¶¨ÄúÒÑ¾­°ÑÄÇÀïÁÐ¾ÙµÄËùÓÐÃüÁî¶¼°²×°ÔÚÏµÍ³ÉÏÁË£®×îºÃ¾ÍÊÇÔÙÕÒÕÒÏà¹Ø
ÕâÀàÎÊÌâµÄPOSIXÎÄµµÀ´¿´¿´£®



´Ó´Ë£¬ÔÚÕâ¸öÏµÍ³ÀïÃæÌí¼Ó¸ü¶à±ØÒªµÄÈí¼þ°ü¾ÍÕæÊÇ¸öÊÂ¶ùÁË£®Ô½ÊÇÔçÐ©°Ñ±àÒë
¹¤¾ß£¬±ÈÈçËµ{\ttfamily gcc}ºÍ{\ttfamily make}ÕâÐ©Ìí¼Ó½øÈ¥¾ÍÔ½ºÃ£®Ò»µ©ÕâÐ©¶¼
Íê¹¤ÁË£¬Äú¾Í¿ÉÒÔÀûÓÃÄ¿±êÏµÍ³À´×ÔÎÒÉúÏ¢£¬¾Í»áÔ½À´Ô½¼òµ¥ÁË£®




\section{¸ü¶àÐÅÏ¢}


\subsection{Ëæ»úÐ¡¼¼ÇÉ\label{finding}}

Èç¹ûÄúµÄLinuxÏµÍ³ÉÏÔø¾­Ê¹ÓÃRPM°²×°¹ýÓÐÒ»¸ö½Ð×ö{\ttfamily thingy}ÃüÁî£¬¶øÄú
Ïë»ñÖªÕâ¸öÃüÁîµÄÔ´ÂëÀ´Ô´£¬ÄÇÃ´Äú¾ÍÊ¹ÓÃÈçÏÂÃüÁî¡Ã

\begin{verbatim}
        rpm -qif `which thingy`
\end{verbatim}


Èç¹ûÄúÓÐÐ¡ºìÃ±RedHatµÄÔ´Âë¹âÅÌ£¬ÄÇÃ´Äú¾Í¿ÉÒÔÊ¹ÓÃÏÂÁÐÃüÁî°²×°Ô´Âë°üÁË¡Ã

\begin{verbatim}
        rpm -i /mnt/cdrom/SRPMS/what.it.just.said-1.2.srpm
\end{verbatim}




Õâ¸öÃüÁî»á°Ñtar°üÒÔ¼°ÈÎºÎRedHat²¹¶¡°ü·Åµ½{\ttfamily /usr/src/redhat/SOURCES}
Ä¿Â¼ÏÂÃæ£®




\subsection{×ÊÔ´Á´½Ó}

\begin{itemize}
\item  ÓÐÒ»¸ö¹ØÓÚ´ÓÔ´´úÂë±àÒëÈí¼þµÄÐ¡ÐÍÊµ×÷Ö¸ÄÏ(mini-howto)£¬¾ÍÊÇ
\nameurl{http://www.linuxdoc.org/HOWTO/Software-Building.html}{Èí¼þ´òÔìÐ¡Ð¡Êµ×÷Ö¸ÄÏ(Software Building mini-HOWTO)}.
\item ÁíÍâ»¹ÓÐÒ»¸ö¹ØÓÚ´ÓÒ»Çî¶þ°×¿ÕÊÖÆð¼Ò´òÔìÒ»¸öLinuxÏµÍ³µÄÊµ×÷Ö¸ÄÏ£®
¸ÃÎÄ¸üÎª¼¯ÖÐÓÚ´òÔìÒ»¸öÓÐÊµ¼ÊÓ¦ÓÃ¼ÛÖµµÄÏµÍ³£¬¶ø²»½ö½öÊÇÒ»¸öÊµÏ°£®
Çë¿´¡Ã
\nameurl{http://www.linuxfromscratch.org}{LinuxÏµÍ³¿ÕÊÖµÀÊµ×÷Ö¸ÄÏÆª(The Linux From Scratch HOWTO)}£®
\item   \label{FHS}
\nameurl{ftp://tsx-11.mit.edu/pub/linux/docs/linux-standards/fsstnd/}{UnixÎÄ¼þÏµÍ³±ê×¼(Unix File System Standard)} 
»¹ÓÐÒ»¸ö¹ØÓÚUnixÎÄ¼þÏµÍ³±ê×¼µÄ\nameurl{http://www.pathname.com/fhs/}{Á´½Ó}£®Õâ¸ö±ê×¼ÃèÊöÁËÔÚÒ»¸öUnixÏµÍ³ÖÐÊ²Ã´¶«¶«¸Ã´ôÔÚÊ²Ã´Î»ÖÃ
ÒÔ¼°Ô­Òò£®Ëü»¹ÃèÊöÁËÔÚ{\ttfamily /bin}£¬{\ttfamily /sbin}µÈµÈÄ¿Â¼ÖÐ×îÐ¡»¯
µÄÒªÇó£®Èç¹ûÄúµÄÄ¿±êÊÇÒª´òÔìÒ»¸öÐ¡¶øÈ«µÄÏµÍ³£¬ÄÇÃ´Õâ¸ö±ê×¼ÕýÊÇÒ»¸ö
ºÃµÄ²Î¿¼£®
\end{itemize}





\section{Administrivia}


\subsection{°æÈ¨ÉùÃ÷(Copyright)}

±¾ÎÄ°æÈ¨ËùÓÐ£¬¹éÊôGreg O'Keefe£®»¶Ó­ÄúÔÚ×ñÑ­
\nameurl{http://www.gnu.org/copyleft/gpl.html}{GNUÍ¨ÓÃ¹«¹²Ðí¿ÉÖ¤(GNU General Public Licence)}µÄ¸÷ÏîÌõ¿îµÄ
Ç°ÌáÏÂÎÞÐè¸¶·ÑÀ´Ê¹ÓÃ£¬¸´ÖÆ£¬É¢·¢»òÕßÐÞ¸Ä±¾ÎÄ£®
Èç¹ûÄúÔÚÆäËüÎÄµµÀïÃæÊ¹ÓÃÁË±¾ÎÄµÄÈ«ÎÄ»òÕß²¿·Ö£¬ÇëÔÚÃùÐ»Â¼ÌáÌáÎÒ¾ÍÐÐÁË£®

This document is copyright (c) 1999, 2000 Greg O'Keefe. You are welcome
to use, copy, distribute or modify it, without charge, under the terms of the 
\nameurl{http://www.gnu.org/copyleft/gpl.html}{GNUÍ¨ÓÃ¹«¹²Ðí¿ÉÖ¤(GNU General Public Licence)}.
Please acknowledge me if you use all or part of this in another document.




\subsection{Ö÷Ò³}

±¾ÎÄ×îÐÂµÄ°æ±¾¿ÉÔÚ´ËÕÒµ½¡Ã
\nameurl{http://learning.taslug.org.au/power2bash}{From Powerup To Bash Prompt} 

±¾ÎÄµÄÖÐÒë°æ¿ÉÒÔÕÒ
\nameurl{mailto:linuxrat@gnuchina.org}{Linuxrat}Ë÷È¡£®






\subsection{ÄúµÄ·´À¡Òâ¼û}

ÎÒºÜÀÖÒâ´Ó¶ÁÕßÄúÄÇ¶ùµÃÖªÈÎºÎÆÀÂÛ£¬¸Ä½øÒâ¼ûºÍ½¨Òé£®ÇëÐ´ÐÅ¸øÎÒ¡Ã
\nameurl{mailto:gcokeefe@postoffice.utas.edu.au}{Greg O'Keefe}






\subsection{ÃùÐ»Â¼\label{acknowledge}}

±¾ÎÄËùÌá¼°µÄ²úÆ·Ãû³ÆÊÇÏàÓ¦³ÖÓÐÕßµÄÉÌ±ê£¬ÔÚ´ËÎÒÒ»²¢ÖÂÐ»£®



ÎÒÏë¶ÔÒÔÏÂÈËÔ±ÖÂÐ»£¬ÒòÎªËûÃÇµÄ°ïÖú²ÅÓÐÁËÕâÆªÊµ×÷Ö¸ÄÏ£®



\begin{description}
\item[Michael Emery] \mbox{}

ÒòÆäÌáÐÑÎÒ×¢Òâµ½Unios£®

\item[Tim Little] \mbox{}

ÒòÆäÌá¹©ÁË¹ØÓÚ{\ttfamily /etc/passwd}µÄÒ»Ð©ÏßË÷£®

\item[sPaKr on \#linux in efnet] \mbox{}

ÒòÆä·¢ÏÖsyslogdÐèÒª{\ttfamily /etc/services}µÄÖ§³ÖÒÔ¼°½éÉÜ¸øÎÒ
Ê¹ÓÃ¶ÌÓï``rolling your own''À´±íÊö´ÓÔ´Âë´òÔìÏµÍ³£®

\item[Alex Aitkin] \mbox{}

ÒòÆäÒýÆðÁËÎÒ¶ÔVicoÒÔ¼°ËûµÄ``verum ipsum factum''(¶Ô±àÒë½øÒ»²½µÄÀí½â)
µÄ×¢Òâ£®

\item[Dennis Scott] \mbox{}

ÒòÆä¾ÀÕýÁËÎÒµÄÊ®Áù½øÖÆ¼ÆËã´íÎó£®

\item[jdd] \mbox{}

ÒòÆäÖ¸³öÒ»Ð©Æ´Ð´´íÎó£®

\end{description}





\subsection{ÐÞ¶©ÀúÊ·¼ÇÂ¼}


\subsubsection{0.8}

\begin{itemize}
\item  ×î³õ°æ±¾£®×Ô"From PowerUp to Bash Prompt(´Ó¼ÓµçÆô¶¯µ½BashÌáÊ¾·û)"Êµ×÷
Æª·ÖÀë¶ÀÁ¢³öÀ´£®
\end{itemize}





\subsection{Î´À´¼Æ»®(TODO)}

\begin{itemize}
\item  ×ª»»Îªdocbook¸ñÊ½£®
\end{itemize}




\end{document}
