⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.tex

📁 linux 的引导程序源码The Microsoft&reg Windows&reg Software Development Kit (SDK) provides the documentation
💻 TEX
📖 第 1 页 / 共 5 页
字号:
    \cline{2-3}    & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} \\    \cline{3-3}    & & MS-DOS\hfill\tt /dev/hda1 \\    \cline{3-3}    $\rightarrow$ & & Linux {\tt /}\hfill\tt /dev/hda2 \\    \cline{2-3}  \end{tabular}$$%%endskip%:\begin{verbatim}%;    +--------------------------+%;    | MBR            /dev/hda  |%;    | +------------------------|%;    | | MS-DOS       /dev/hda1 |%;    | |------------------------|%;--> | | Linux /      /dev/hda2 |%;    +--------------------------+%:\end{verbatim}In this example, the \craw{boot} variable could be omitted, becausethe boot sector is on the root partition.\subsubsection{One disk, Linux on a logical partition}If no primary partition is available for Linux, but at least one logicalpartition of an extended partition on the first hard disk contains aLinux file system, the \LILO\ boot sector should be stored in the partitionsector of the extended partition and it should be booted by the originalmaster boot record or by a program like \name{BOOTACTV}.%%beginskip$$  \begin{tabular}{r|c|c|c|}    \cline{2-4}    & \multicolumn{3}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} \\    \cline{3-4}    & & \multicolumn{2}{|l|}{MS-DOS\hfill\tt /dev/hda1} \\    \cline{3-4}    $\rightarrow$ & & \multicolumn{2}{|l|}{Extended\hfill\tt /dev/hda2} \\    \cline{4-4}    & & & Linux\hfill\tt /dev/hda5 \\    \cline{4-4}    & & & $\ldots$\hfill\tt /dev/hda6 \\    \cline{2-4}  \end{tabular}$$%%endskip%:\begin{verbatim}%;    +--------------------------+%;    | MBR            /dev/hda  |%;    | +------------------------|%;    | | MS-DOS       /dev/hda1 |%;    | |------------------------|%;--> | | Extended     /dev/hda2 |%;    | | +----------------------|%;    | | | Linux      /dev/hda5 |%;    | | |----------------------|%;    | | | ...        /dev/hda6 |%;    +--------------------------+%:\end{verbatim}Because many disk partitioning programs refuse to make an extendedpartition (in our example \path{/dev/hda2}) active, you might have touse \name{activate}, which comes with the \LILO\ distribution.OS/2 BootManager should be able to boot \LILO\ boot sectors from logicalpartitions. The installation on the extended partition itself is notnecessary in this case.\subsubsection{Two disks, Linux (at least partially) on the first disk}This case is equivalent to the configurations where only one diskis in the system. The Linux boot sector resides on the first harddisk and the second disk is used later in the boot process.Only the location of the boot sector matters -- everythingelse (\path{/boot/boot.b},\path{/boot/map}, the root file system, a swap partition, otherLinux file systems, etc.) can be located anywhere on the second disk,provided that the constraints described in section \ref{broken} are met.\subsubsection{Two disks, Linux on second disk, first disk has an extended  partition}If there is no Linux partition on the first disk, but there is anextended partition, the \LILO\ boot sector can be stored in the partitionsector of the extended partition and it should be booted by the originalmaster boot record or by a program like \name{BOOTACTV}.%%beginskip$$  \begin{tabular}{r|c|c|c|c|c|c|}    \multicolumn{1}{r}{}    & \multicolumn{3}{c}{\bf First disk} &      \multicolumn{1}{r}{\qquad}      & \multicolumn{2}{c}{\bf Second disk} \\    \cline{2-4}\cline{6-7}    & \multicolumn{3}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} &      & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hdb~}} \\    \cline{3-4}\cline{7-7}    & & \multicolumn{2}{|l|}{MS-DOS\hfill\tt /dev/hda1} &      & & Linux\hfill\tt /dev/hdb1 \\    \cline{3-4}\cline{7-7}    $\rightarrow$ & & \multicolumn{2}{|l|}{Extended\hfill\tt /dev/hda2} &      & & $\ldots$\hfill\tt /dev/hdb2 \\    \cline{4-4}    & & & $\ldots$\hfill\tt /dev/hda5 & & & \\    \cline{4-4}    & & & $\ldots$\hfill\tt /dev/hda6 & & & \\    \cline{2-4}\cline{6-7}  \end{tabular}$$%%endskip%:\begin{verbatim}%4             FIRST DISK                     SECOND DISK%4    +--------------------------+    +--------------------------+%4    | MBR            /dev/hda  |    | MBR            /dev/hdb  |%4    | +------------------------|    | +------------------------|%4    | | MS-DOS       /dev/hda1 |    | | Linux        /dev/hdb1 |%4    | |------------------------|    | |------------------------|%4--> | | Extended     /dev/hda2 |    | | ...          /dev/hdb2 |%4    | | +----------------------|    | |                        |%4    | | | ...        /dev/hda5 |    | |                        |%4    | | |----------------------|    | |                        |%4    | | | ...        /dev/hda6 |    | |                        |%4    +--------------------------+    +--------------------------+%:\end{verbatim}The program \name{activate}, that accompanies \LILO, may have to be used toset the active marker on an extended partition, because MS-DOS' \name{FDISK}and some older version of Linux \name{fdisk} refuse to do that. (Which isgenerally a good idea.)\subsubsection{Two disks, Linux on second disk, first disk has no  extended partition}If there is neither a Linux partition nor an extended partition on the firstdisk, then there's only one place left, where a \LILO\ boot sector could bestored: the master boot record.In this configuration, \LILO\ is responsible for booting all other operatingsystems too.%%beginskip$$  \begin{tabular}{r|c|c|c|c|c|}    \multicolumn{1}{r}{}    & \multicolumn{2}{c}{\bf First disk} &      \multicolumn{1}{r}{\qquad}      & \multicolumn{2}{c}{\bf Second disk} \\    \cline{2-3}\cline{5-6}    $\rightarrow$ & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{      \hfill\tt /dev/hda~}} &      & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hdb~}} \\    \cline{3-3}\cline{6-6}    & & MS-DOS\hfill\tt /dev/hda1 &      & & Linux\hfill\tt /dev/hdb1 \\    \cline{3-3}\cline{6-6}    & & $\ldots$\hfill\tt /dev/hda2 &      & & $\ldots$\hfill\tt /dev/hdb2 \\    \cline{2-3}\cline{5-6}  \end{tabular}$$%%endskip%:\begin{verbatim}%4             FIRST DISK                     SECOND DISK%4    +--------------------------+    +--------------------------+%4--> | MBR            /dev/hda  |    | MBR            /dev/hdb  |%4    | +------------------------|    | +------------------------|%4    | | MS-DOS       /dev/hda1 |    | | Linux        /dev/hdb1 |%4    | |------------------------|    | |------------------------|%4    | | ...          /dev/hda2 |    | | ...          /dev/hdb2 |%4    +--------------------------+    +--------------------------+%:\end{verbatim}You should back up your old MBR before installing \LILO\ and verify that\LILO\ is able to boot your other operating system(s) before relying onthis approach.The line \verb"boot = /dev/hda2" in \path{/etc/lilo.conf} would have to bechanged to \verb"boot = /dev/hda" in this example.\subsubsection{More than two disks}On systems with more than two disks, typically only the first two canbe accessed. The configuration choices are therefore the same as withtwo disks.When attempting to access one of the extra disks, \LILO\ displays awarning message (\raw{Warning: BIOS drive 0x\meta{number} may not beaccessible}) but does not abort. This is done in order to allowthe lucky few whose BIOS (or controller-BIOS) does support more thantwo drives to make use of this feature. By all others, this warningshould be considered a fatal error.Note that the two disks restriction is only imposed by the BIOS.Linux normally has no problems using all disks once it is booted.\subsubsection{\path{/boot} on a DOS partition}\label{viados}Recent kernels support all the functions \LILO\ needs to map files alsoon MS-DOS (or UMSDOS) file systems. Since DOS partitions tend to occupyexactly the places where BIOS restrictions (see section \ref{broken})are invisible, they're an ideal location for \path{/boot} if the nativeLinux file systems can't be used because of BIOS problems.In order to accomplish this, the DOS partition is mounted read-write,a directory (e.g. \path{/dos/linux}) is created, all files from\path{/boot} are moved to that directory, \path{/boot} is replaced bya symbolic link to it, the kernels are also moved to the new directory,their new location is recorded in \path{/etc/lilo.conf}, and finally\path{/sbin/lilo} is run.From then on, new kernels must always be copied into that directory onthe DOS partition before running \path{/sbin/lilo}, e.g. when recompilinga kernel, the standard procedure changes from\begin{verbatim}# make zlilo\end{verbatim}to\begin{verbatim}# make zImage# mv /dos/linux/vmlinuz /dos/linux/vmlinuz.old# mv arch/i386/boot/zImage /dos/linux/vmlinuz# /sbin/lilo\end{verbatim}\emphasize{WARNING:} De-fragmenting such a DOS partition is likely tomake Linux or even the whole system unbootable. Therefore, the DOSpartition should either not be de-fragmented, or a Linux boot diskshould be prepared (and tested) to bring up Linux and to run\path{/sbin/lilo} after the de-fragmentation.\footnote{Setting the``system'' attribute from DOS on the critical files (e.g. everythingin \path{C:$\backslash$LINUX}) may help to protect them from beingrearranged. However, the boot floppy should still be ready, just in case.}\newpage\section{The boot prompt}\label{cmdopt}Immediately after it's loaded, \LILO\ checks whether one of the followingis happening:\begin{itemize}  \item any of the \key{Shift}, \key{Control} or \key{Alt} keys is    pressed.  \item \key{CapsLock} or \key{ScrollLock} is set.\end{itemize}If this is the case, \LILO\ displays the \verb"boot:" prompt and waits forthe name of a boot image (i.e. Linux kernel or other operating system).Otherwise, it boots the default boot image\footnote{%The default boot image is either the first boot image, the image specifiedwith the \craw{default} variable, or the image thathas been selected at the boot prompt.}or -- if adelay has been specified -- waits for one of the listed activitiesuntil that amount of time has passed.At the boot prompt, the name of the image to boot can be entered. Typingerrors can be corrected with \key{BackSpace}, \key{Delete},\key{Ctrl U} and \key{Ctrl X}. A list of known images can be obtained bypressing \key{?} or \key{Tab}.If \key{Enter} is pressed and no file name has been entered, the defaultimage is booted.\subsection{Boot command-line options}\LILO\ is also able to pass command-line options to the kernel.Command-line options are words that follow the name of the bootimage and that are separated by spaces.Example:\begin{verbatim}boot: linux single root=200\end{verbatim}This document only gives an overview of boot options. Please consult PaulGortmaker's BootPrompt-HOWTO for a more complete and more up to date list.You can get it from\path{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/BootPrompt-HOWTO.gz}or from one of the many mirror sites.\subsubsection{Standard options}Recent kernels recognize a large number of options, among them are \raw{debug},\raw{no387}, \raw{no-hlt},\raw{ramdisk=\meta{size}}, \raw{reserve=\meta{base},\meta{size},$\ldots$},\raw{root=\meta{device}}, \raw{ro}, and \raw{rw}.All current \name{init} programs also recognize the option \raw{single}.The options \raw{lock} and \raw{vga} are processed by the boot loader itself.Boot command-line options are always case-sensitive.\raw{single} boots the system in single-user mode. This bypasses mostsystem initialization procedures and directly starts a root shell on theconsole. Multi-user mode can typically be entered by exiting the single-usershell or by rebooting.\raw{root=\meta{device}} changes the root device. This overridessettings that may have been made in the boot image and on the\LILO\ command line. \meta{device} is either the hexadecimal device number%%beginskip\footnote{%This is a list of device numbers of some frequently used devices: \\\begin{tabular}{lllllll}\qquad& {\tt /dev/fd0} & 200\qquad & \tt /dev/hda1 & 301\qquad & /dev/sda1 & 801 \\& {\tt /dev/fd1} & 201 & \tt /dev/hda2 & 302 & /dev/sda2 & 802 \\& \multicolumn{2}{c}{$\cdots$} & \multicolumn{2}{c}{$\cdots$} &\multicolumn{2}{c}{$\cdots$} \\& & & \tt /dev/hdb1 & 341 & /dev/sdb1 & 811 \\& & & \tt /dev/hdb2 & 342 & /dev/sdb2 & 812 \\& \multicolumn{2}{c}{} & \multicolumn{2}{c}{$\cdots$} &\multicolumn{2}{c}{$\cdots$} \\\end{tabular}}%%endskipor the full path name of the device, e.g. \verb"/dev/hda3".%\footnote{The device names are hard-coded in the kernel. Therefore, onlythe ``standard'' names are supported and some less common devices may notbe recognized. In those cases, only numbers can be used.}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -