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

📄 monitor.8

📁 操作系统设计与实现源码
💻 8
字号:
.TH MONITOR 8.SH NAMEmonitor, edparams \- load and start Minix, modify boot parameters.SH SYNOPSIS.B edparams.I device.RB [ command " ...]".br.B boot.com.I virdisk.SH DESCRIPTION.de SP.if t .sp 0.4.if n .sp..This text describes the Boot Monitor, a boot time interactive program designednot only to load and start Minix, its most important task, but to alsoprovide an easy to use interface to configure Minix and to boot otheroperating systems..PPThe monitor is controlled with an environment that is modeled after theBourne shell.  This environment is filled at startup with default valuesthat depend on the machine the monitor is running on and the environmentsettings saved into the boot parameters sector (the second sector on adevice).  When the environment is loaded, the monitor executes the functionnamed.BR main ,which by default starts a simple menu..PPThe environment can be manipulated at boot time from the monitor prompt,but may also be edited using.B edparamson a given device..B Edparamssimulates the monitor as much as it can, echoing commands it can't executebetween brackets.  It can also be used in Makefiles and scripts by givingit commands as arguments..PPThe MS-DOS version of the monitor, usually named.B boot.comunder DOS, boots Minix from a "DOS virtual disk".  (See below.).SH COMMANDSThe monitor is best described by the commands you can type to the '>'prompt.  This is known as the "monitor mode".  You can enter this mode byhitting the Escape key.  These are the monitor commands:.PP\fIname\fP = [\fBdevice\fP] \fIvalue\fP.SP.RSSet environment variable..brChanges the value of.I nameto.IR value .The optional word.B devicemarks.I nameas being subject to device translation.  (See the section on devices.)  These(name, value) pairs are passed to the kernel who uses them to configureitself.  These variables are passed by default:.SP.B rootdev.RSThis is the device used as your root device.  It is by default set to.BR ram,which means that the device specified by.B ramimagedevwill be loaded into the RAM disk and used as root.  If you change thisvariable then a physical device will be used as root, and the RAM disk willbe uninitialized and have the size specified by.BR ramsize ..RE.SP.B ramimagedev.RSDescribes the device to use to initialize the RAM disk if.B rootdevis set to.BR ram .It's by default set to.BR bootdev ,a special name for the device the monitor booted from..RE.SP.B ramsize.RSThe size of the RAM disk.  If the RAM disk is used for the root file systemthen the root file system is stretched out to.B ramsizeif possible..RE.SP.B processor.RSSet by default to.BR 86 ,.BR 186 ,.BR 286 ,.BR 386 ,.BR 486 ", ..."depending on the hardware you have.  You can set it to a smaller value totest your kernel in a more limited environment..RE.SP.B bus.RSThe type of system bus, either.BR xt ,.BR ator.BR mca .This answers basic questions like: "How many interrupt controllers and howto initialize?"  Or: "Does the keyboard have LEDs?".RE.SP.B memsize.RSKilobytes of conventional memory.  This is the amount of RAM within thefirst megabyte..RE.SP.B emssize.RSKilobytes of extended memory..RE.SP.B video.RSDescribes capabilities of the VDU:.BR mda ,.BR cga ,.B egaor.BR vga ..RE.SP.B chrome.RSEither.B coloror.BR mono ..RE.SP.B console.RSIf set to a hexadecimal value makes the monitor set the BIOS video mode tothis value.  This allows the use of video modes with more rows or columsthan the standard 80x25 mode.  The kernel must of course be able to handlea nonstandard mode.  More parameters may follow the mode number..B Warning:Not all monitors can handle all of the modes, some may generate frequenciesthat can damage your monitor.  Read the manual of card and monitor fordetails..RE.SPTwo variables are only used by the monitor, even though they are passed to thekernel too:.SP.B image.RSThe name of the file containing the kernel image, by default.BR minix .If it refers to a directory however then the newest file inside thedirectory is chosen to be the kernel image.  The names inside.B /minix/are best set to the Minix version you are using, which looks good when themonitor prints its name.  Rules for pretty printing image names:.RS.SPA '/' or '_' is changed to a space..SPThe first letter is changed from lowercase to uppercase..SPAn 'r' if followed by a digit changes to " revision "..RE.RE.SP.B label.RSIf set then only processes marked with this label or without a label areloaded from the image..RE.SP.B Installboot \-bootwill create functions to select images and labels.  These functions will setlabel and image and echo what you selected.  The two numbers separated by acolon used as an image name tell the starting sector and sector count of theimage on disk..RE.SP\fIname\fP() { ... }.RSDefine function..brFunctions may be used to bundle a set of commands, so that you can easilyboot Minix with a different set of parameters then normal.  E.g..SP.RSram() { rootdev=ram; boot }.RE.SPwill allow you to run Minix with the root device on RAM for a change, ifyou normally use a real device as root.  The only pre-set function is.B mainwith default value.BR menu ,which is the default command executed by the monitor.  You can use newlinesafter the ')' token, the monitor will then use a '+' prompt and ask for therest..RE.SP\fIname\fP(\fIkey\fP) { ... }.RSDefine kernel selecting function..brThe menu command uses functions like these to add menu entries to selecta different kernel from a boot disk..B Installboot \-bootproduces these functions when the images are labeled.  The label.B ATwould give:.SP.RSAT(a) {label=AT;image=42:626;echo AT kernel selected;menu}.RE.SPWith the menu option:.SP.RSa	Select AT kernel.RE.SPTyping.B awill then execute the.B ATfunction above..RE.SP\fIname\fP(\fIkey\fP,\fItext\fP) { ... }.RSUser defined menu option..brThis variant may be used to make any menu entry you like:.SP.RSdos(d,Boot MS-DOS) { boot hd1 }.RE.SP.I Textmay be anything, even parentheses if they match..RE.SP.I name.RSCall function..brIf.I nameis a user defined function then its value is expanded and executed in place of.IR name .Try a recursive one like 'rec() {rec;xx}' one day.  You can see the monitorrun out of space with nice messages about using.BR chmem (1)to increase it's heap..RE.SP\fBboot\fP [\fB\-\fP\fIopts\fP].br\fBboot\fP \fIdevice\fP.RSBoot Minix or another O.S..brWithout an argument,.B bootwill load and execute the Minix image named by the.B imagevariable.  With options the variable.B bootoptsis first set to.BI \- optsbefore Minix is started, and unset when Minix returns.  With a.I deviceargument,.B bootloads the boot sector of.I deviceinto memory and jumps to it, starting another operating system.  You wouldnormally use partitions on the first hard disk for this command (hd[1\-4]),using hd0 will also work (choosing the active partition).  One can also bootdevices on the second hard disk (hd[5\-9]) if the bootstrap writer did nothardwire the disk number to disk 0..brSome Operating Systems can only be booted from the active partition, ifyou use a '*', e.g..BR "boot *hd3" ,then partition 3 is first made active.  You'll then need to use.B installboot \-masterwith a fix key to forcefully boot the Minix partition at startup..RE.SP\fBdelay\fP [\fImsec\fP].RSDelay (500 msec default)..brFast booting speed was one of the objectives when this program was created,so a hard disk boot usually takes only a fraction of a second.  If you needsome time (to hit Escape, or stare at the numbers) you can use.B delayto make the monitor pause for a specified amount of time.  To specify a delayjust before Minix is started, you can set the variable.B delayto a number of milliseconds.  Example:.SP.RSmain() {delay 250; delay=500; boot}.RE.SPLook at this carefully, 'delay 250' means: "wait 1/4 sec now!",while 'delay=500' means: "wait 1/2 sec after loading Minix"..SPIf you use.B delay=swapthen the monitor will wait until you have inserted a root diskette and typedRETURN..RE.SP\fBecho\fP \fIword\fP ....RSPrint these words..brUsed to tell you that you just selected image X..RE.SP\fBls\fP [\fIdirectory\fP].RSList contents of a directory..brUseful when looking for kernel images..RE.SP.B menu.RSMenu driven startup..brThis command allows you to execute functions defined with a.IR key .If no menu functions have been defined then.B menuwill use this one hidden built-in function:.SP.RS*(=,Start Minix) { boot }.SP.REKernel selecting functions only add new options to this set, but if youdefine a two argument function yourself then the above one is no longershown, allowing you to customize the menu completely.  Your firstfunction definition should therefore be one that starts Minix..SPMenu entries are shown in the same order as.B setshows them.  If you don't like the order then you have to unset thefunctions and retype them in the proper order..SPIf you type a key then a scheduled trap is killed and the appropriate menufunction is executed.  If you need more time to choose then hit thespacebar.  A key not on the menu also kills a trap, but does nothing more..RE.SP.B save.RSSave environment..brThis will save all the environment variables and functions with nondefaultvalues to the parameter sector (the second sector on the boot device), sothey are automatically set the next time you boot the monitor..RE.SP.B set.RSShow environment..brShow the current values of the environment variables and functions.  Defaultvalues are shown between parentheses to distinguish them from values thatwere explicitly set..RE.SP\fBtrap\fP \fImsec\fP \fIcommand\fP.RSSchedule command..brSchedules a command to be executed after.I msecmilliseconds.  Only the monitor mode cannot be interrupted, a scheduled trapis killed when the prompt is printed.  Example:.SP.RSmain() {trap 10000 boot; menu}.RE.SPThis gives you 10 seconds to choose a menu option before Minix is booted..RE.SP\fBunset\fP \fIname\fP ....RSUnset environment variables..brRemoves the named variables and functions from the environment, and setsspecial variables back to their default values.  This is also the only wayto remove the "device name translation" property from a variable..RE.SP\fBexit\fP.RSExit the monitor.brReboot the machine, exit to Minix or exit to DOS as appropriate..RE.SH DEVICESThe Minix kernel can't do anything with device names, so they have to betranslated to device numbers before they are passed to the kernel.  Thisnumber is found under the st_rdev field (see.BR stat (2))of the file on the boot file system.  The monitor will look for the devicefile with the working directory set to '/dev'.  If it can't find the devicename then it will translate names like 'ram', 'fd1', 'hd6', 'hd3a', and 'sd2'to what it itself thinks the numbers should be..PPThe special name.B bootdevis translated to the name of the device booted from, like 'fd0', or 'hd3', andthen searched for in /dev..B Bootdevcan't be translated to a device other then the fd or hd devices, so SCSIdevices for instance must be named explicitly..SH EXTENSIONSA few extensions have been made to this program for kernel hackers.  Theymay be triggered by setting bits in the flags word in the kernel startupcode (the mpx file.)  The flag bits are:.TP 100x0001Call kernel in 386 mode..TP0x0002Do not make space for the bss areas of processes other then the kernel..TP0x0004Use the stack size set by.BR chmem (1)..TP0x0008Load MM, FS, etc. into extended memory..TP0x0010No need to patch process sizes into the kernel..TP0x0020The kernel can return to the monitor on halt or reboot..SH "MS-DOS MONITOR"Minix-vmd has a version of the monitor that runs under MS-DOS to boota "DOS virtual disk".  It is a simple COM program that interprets an MS-DOSfile as a disk, loads a Minix kernel from the active partition in the sameway as the BIOS based monitor, and executes it to start Minix.  All themonitor commands function in the same way, except for the.B bootcommand, it can only load Minix.  The memory that MS-DOS has in use is copiedout of the way when Minix takes control, and is put back in place when Minixexits.  This memory shuffling also happens when the BIOS disk driver makesBIOS calls, slowing things to a crawl.  It is better to use a Minix driver.The MS-DOS monitor does not work if there is a memory manager active thatruns in 386 protected mode, like EMM386..SH "SEE ALSO".BR chmem (1),.BR stat (2),.BR installboot (8),.BR usage (8),.BR boot (8)..SH BUGSThe.B delaycommand will hang forever on the original IBM PC (not the XT!).  Not that itmatters, as everything takes forever on that box..PPReading the first sector to boot a floppy (e.g..BR "boot fd1" ),is done using whatever floppy parameters boot currently has available.  Thiswill probably always work..PPThe two forms of.B delayare a crock..PPThe word.B emssizecomes from EMS, that has to do with expanded memory, not extended memory..SH ACKNOWLEDGMENTSGuy Helmer, for the floppy sensing code that somehow disappeared into theboot block..PPEarl Chew, for the inspiration his ShoeLace package provided, unless he wantsto file a "look and feel" suit against me, then I will say I modeled it afterthe SunOS ROM boot monitor, which is also true..SH AUTHORKees J. Bot (kjb@cs.vu.nl)

⌨️ 快捷键说明

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