Charles.Forsyth20060303-partialeea662d19 years agoHistory
411 lines · 8.5 KB · Text
RawDownload
.TH 9LOAD 10.8.SH NAME9load, ld, 9pxeload \- PC bootstrap program.SH SYNOPSIS.I "(Under MS-DOS).br[.I drive:][.I path.RB ] ld[.I 9load].SH DESCRIPTIONOn the PC, bootstrap programs from Plan 9 are used to boot Inferno as well(hence the naming convention)..I 9loadand.I ldare programs that reside in a FAT file system and bootstrap Inferno..I 9loadloads the kernel, but it cannot be run from DOS; use.I ldto bootstrap (by starting.IR 9load )if DOS is running..I 9loadis run automatically by the boot procedures described below;it cannot be run directly by hand.There are three bootstrap sequences:.IP \-BIOS, MBR, disk partition PBS,.IR 9load ,kernel.IP \-BIOS, floppy PBS,.IR 9load ,kernel.IP \-BIOS, MBR, DOS,.IR ld ,.IR 9load ,kernel..PPDetails follow..PP.I 9loadis a bootstrap program that loads and starts a program,typically the kernel, on a PC.It is run by the PC partition boot sector program (PBS),which usually resides in the firstsector of the active partition.A copy of the Plan 9 PBS is kept in.BR /Inferno/386/pbs ,but due to the ``cylinder-head-sector'' (CHS) addressing mode of old BIOSes, it can onlyoperate up to 8.5GB into the disk.Plan 9 partitions further into the diskcan only be booted using.BR /Inferno/386/pbslba ,and then only if the machine's BIOS supportslinear block addressing (LBA) mode for disk transfers..PPWhen booting from floppy or hard disk, the BIOS loads thefirst sector of the medium at location 0x7C00.  In thecase of a floppy, this is the PBS.  In the case of a harddisk it it the master boot record (MBR).The MBR copies itself to address.BR 0x600 ,finds the active partition and loads its PBS at address.BR 0x7C00 .A copy of the Plan 9 MBR is kept in.BR /Inferno/386/mbr ;some commercial MBRs cannot read sectorspast 2GB.The Plan 9 MBR can read sectors up to 8.5GB intothe disk, and further if the BIOS supports LBA.The single file.B /Inferno/386/mbrdetects whether the BIOS supports LBA andacts appropriately, defaulting to CHS modewhen LBA is not present.The PBSs cannot do this due to code size considerations.The Plan 9 MBR is suitable for booting non-Plan 9operating systems,and (modulo the large disk constraints just described)non-Plan 9 MBRs are suitable for booting Plan 9..PPThus the default sequence is: BIOS, MBR, PBS,.IR 9load ,kernel..PPBecause it contains many device drivers for differentdisks and networks,.I 9loadis larger than 64K and cannot be run as a DOS.RB `` .com ''executable.A stripped-down version that knows about disks but not networks,called.I ld(really.BR ld.com ),fits in 64K and can be used under DOS to load and start a program (default.IR 9load )from the FAT16 partition.Its command line argument is of the same format as the.I bootfilespecifiers described below.This profusion of loaders is unfortunate, but at least.I ldand.I 9loadare compiled from the same source..PP.I 9loadbegins execution at address.B 0x80010000(64K) andloads the.I bootfileat the entry address specified by the header,usually.BR 0x80100020 .After loading, control is passed to the entry location..PPFinally,.I 9pxeloadis a version of.I 9loadthat can be booted using the PXE downloadfound on some ethernet card BIOSs..PPIn summary,Inferno and Plan 9 can be booted on a PC three different ways:either by booting MS-DOS and using.I ldto start.I 9loadin the appropriate directory,by booting directly from an Inferno/Plan 9 boot floppy or diskpartitionprepared using.B formatto install the appropriate files and bootstrap sectors(see.IR prep (8)),or by using a PXE capable BIOS to boot.I 9pxeloaddirectly over the ethernet..PPThe.IR bootfile ,which may be compressed with.IR gzip (1),can be specified to.I 9loadas a.B bootfile=entry in.IR plan9.ini ,or if booting from the ethernet, by a BOOTP server.If the.B plan9.inifile contains multiple.B bootfile=entries,.I 9loadwill present a numerical menu of the choices; typethe corresponding number to select an entry..PPThe format of the.I bootfilename is.IB device ! fileor.IB device ! partition ! file\f1.If.BI ! fileis omitted, the default for the particular.I deviceis used.Supported.I devicesare.TF \fLethern.TP.BI fd nAn MS-DOS floppy disk..I Nspecifies the floppy drive, either0 or 1.The.I bootfileis the contents of the MS-DOS.IR file .There is no default file.For compatibility with hard disks, a.I partitionmay be given, but only.B dosis recognized:.BI fd0!dos! file\f1..TP.BI ether nEthernet..I Nspecifies the Ethernet device number.If a.I partitionis specified, it is taken to be the name of a host machinefrom which to load the kernel..I fileis determined by the.B /lib/ndb(see.IR ndb (6))entry for this PC..TP.BI sd CnNon-floppy disk.The device name format is described in.IR sd (3).A.I partitionmust be given and mustname a partition containing a FAT file system.The name.B dosrefers to the first DOS partition on a given device.It is common for Inferno/Plan 9 partitions to contain a smallFAT file system for configuration.By convention, this partition is called.BR 9fat .There is no default partition or pathname..PD.PPWhen.I 9loadstarts running at physical address 0x10000,it switches to 32-bit mode.It then double maps the first 16Mb of physical memory tovirtual addresses 0 and 0x80000000.Physical memory from 0x300000 upwards is used as dataspace.Next, in order to find configuration information,.I 9loadsearches all units on devices.BR fdand.BI sd Cn \fR,in that order, for a file called.B plan9\eplan9.inior.B plan9.ini(see.IR plan9.ini (10.6))on a partition named.B dosor .BR 9fat .If one is found, searching stops and the file is read into memoryat physical address 0x1200where it can be found later by any loaded.IR bootfile .Some options in.B plan9.iniare used by.IR 9load :.TF bootfile=manual.TP.B console.TP.B baudSpecifies the console device and baud rate if not a display..TP.BI ether nEthernet interfaces. These can be used to load the.I bootfileover a network.Probing for Ethernet interfaces is too prone to error..TP.BI bootfile= bootfileSpecifies the.IR bootfile .This option is overridden by a command-line argument..TP.B bootfile=autoDefault..TP.B bootfile=localLike.IR auto ,but do not attempt to load over the network..TP.B bootfile=manualAfter determining which devices are available for loading from,enter prompt mode..PD.PPWhen the search for.B plan9.iniis done,.I 9loadproceeds to determine which bootfile to load.If there was no.I bootfileoption,.I 9loadchooses a defaultfrom the following prioritized device list:.EX	fd sd ether.EE.I 9loadthen attempts to load the.I bootfileunlessthe.B bootfile=manualoption was given, in which case prompt mode is entered immediately.If the default device is.BR fd ,.I 9loadwill prompt the user for input before proceeding with thedefault bootfile load after 5 seconds;this prompt is omitted ifa command-line argument or.I bootfileoptionwas given..PP.I 9loadprints the list of available.IR device sandenters prompt mode on encountering any erroror if directed to do so by a.B bootfile=manualoption.In prompt mode, the user is required to typea.IB bootfilein response to the.L "Boot from:prompt..PP.I 9loadparses the master boot record and Plan 9 partition tables(see.IR prep (8)),leaving partitioning information appended to thein-memory contents of.I plan9.inifor the.IR bootfile .This is used by.IR sd (3)to initialize partitions so that afile system in a partition can be found and mounted as the root file system.A more extensive partitioning is typically done by system initialisation in.B osinit.dis(see.IR root (3))..PPAcontrol-Pcharacter typed at any time on the console causes.B 9loadto perform a hardware reset(Ctrl-Alt-Del can also be used on a PC keyboard)..PPWhen loaded from a PBS (rather than from.IR ld.com ),.I 9loadmust be contiguously allocated onthe disk.See .IR dossrv (4)for information on ensuring this..SH FILES.RI [ drive :][.I path.RB ] 9load.br.RI [ drive :][.I path.RB ] ld.br.IB "FAT filesystem" :\eplan9\eplan9.ini.br.IB "FAT filesystem" :\eplan9.ini.SH SOURCE.B /os/boot/pc.SH "SEE ALSO".IR plan9.ini (10.6),.IR prep (8).SH BUGSMuch of the work done by.B 9loadis duplicated by the loaded kernel..PPIf.I lddetects an installed MS-DOS Extended Memory Manager,it attempts to de-install it, but the techniqueused may not always work.It is safer not to install the Extended Memory Manager before running.IR ld .