123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- .TH 9LOAD 8
- .SH NAME
- 9load, ld, 9pxeload \- PC bootstrap program
- .SH SYNOPSIS
- .I "(Under MS-DOS)
- .br
- [
- .I drive
- :][
- .I path
- .RB ] ld
- [
- .I 9load
- ]
- .SH DESCRIPTION
- .I 9load
- and
- .I ld
- are programs that reside in a FAT file system and bootstrap Plan 9.
- .I 9load
- loads the kernel, but it cannot be run from DOS; use
- .I ld
- to bootstrap (by starting
- .IR 9load )
- if DOS is running.
- .I 9load
- is 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.
- .PP
- Details follow.
- .PP
- .I 9load
- is 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 first
- sector of the active partition.
- A copy of the Plan 9 PBS is kept in
- .BR /386/pbs ,
- but due to the ``cylinder-head-sector'' (CHS) addressing mode of old BIOSes, it can only
- operate up to 8.5GB into the disk.
- Plan 9 partitions further into the disk
- can only be booted using
- .BR /386/pbslba ,
- and then only if the machine's BIOS supports
- linear block addressing (LBA) mode for disk transfers.
- .PP
- When booting from floppy or hard disk, the BIOS loads the
- first sector of the medium at location 0x7C00. In the
- case of a floppy, this is the PBS. In the case of a hard
- disk 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 /386/mbr ;
- some commercial MBRs cannot read sectors
- past 2GB.
- The Plan 9 MBR can read sectors up to 8.5GB into
- the disk, and further if the BIOS supports LBA.
- The single file
- .B /386/mbr
- detects whether the BIOS supports LBA and
- acts appropriately, defaulting to CHS mode
- when LBA is not present.
- The PBSs cannot do this due to code size considerations.
- The Plan 9 MBR is suitable for booting non-Plan 9
- operating systems,
- and (modulo the large disk constraints just described)
- non-Plan 9 MBRs are suitable for booting Plan 9.
- .PP
- Thus the default sequence is: BIOS, MBR, PBS,
- .IR 9load ,
- kernel.
- .PP
- Because it contains many device drivers for different
- disks and networks,
- .I 9load
- is 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 bootfile
- specifiers described below.
- This profusion of loaders is unfortunate, but at least
- .I ld
- and
- .I 9load
- are compiled from the same source.
- .PP
- .I 9load
- begins execution at address
- .B 0x80010000
- (64K) and
- loads the
- .I bootfile
- at the entry address specified by the header,
- usually
- .BR 0x80100020 .
- After loading, control is passed to the entry location.
- .PP
- Finally,
- .I 9pxeload
- is a version of
- .I 9load
- that can be booted using the PXE download
- found on some ethernet card BIOSs.
- .PP
- In summary,
- Plan 9 can be booted on a PC three different ways:
- either by booting MS-DOS and using
- .I ld
- to start
- .I 9load
- in the appropriate directory,
- by booting directly from a Plan 9 boot floppy or disk
- partition
- prepared using
- .B format
- to install the appropriate files and bootstrap sectors
- (see
- .IR prep (8)),
- or by using a PXE capable BIOS to boot
- .I 9pxeload
- directly over the ethernet.
- .PP
- The
- .IR bootfile ,
- which may be compressed with
- .IR gzip (1),
- can be specified to
- .I 9load
- as a
- .B bootfile=
- entry in
- .IR plan9.ini ,
- or if booting from the ethernet, by a BOOTP server.
- If the
- .B plan9.ini
- file contains multiple
- .B bootfile=
- entries,
- .I 9load
- will present a numerical menu of the choices; type
- the corresponding number to select an entry.
- .PP
- The format of the
- .I bootfile
- name is
- .IB device ! file
- or
- .IB device ! partition ! file\f1.
- If
- .BI ! file
- is omitted, the default for the particular
- .I device
- is used.
- Supported
- .I devices
- are
- .TF \fLethern
- .TP
- .BI fd n
- An MS-DOS floppy disk.
- .I N
- specifies the floppy drive, either
- 0 or 1.
- The
- .I bootfile
- is the contents of the MS-DOS
- .IR file .
- There is no default file.
- For compatibility with hard disks, a
- .I partition
- may be given, but only
- .B dos
- is recognized:
- .BI fd0!dos! file\f1.
- .TP
- .BI ether n
- Ethernet.
- .I N
- specifies the Ethernet device number.
- If a
- .I partition
- is specified, it is taken to be the name of a host machine
- from which to load the kernel.
- .I file
- is determined by the
- .B /lib/ndb
- (see
- .IR ndb (6))
- entry for this PC.
- .TP
- .BI sd Cn
- Non-floppy disk.
- The device name format is described in
- .IR sd (3).
- A
- .I partition
- must be given and must
- name a partition containing a FAT file system.
- The name
- .B dos
- refers to the first DOS partition on a given device.
- It is common for Plan 9 partitions to contain a small
- FAT file system for configuration.
- By convention, this partition is called
- .BR 9fat .
- There is no default partition or pathname.
- .PD
- .PP
- When
- .I 9load
- starts running at physical address 0x10000,
- it switches to 32-bit mode.
- It then double maps the first 16Mb of physical memory to
- virtual addresses 0 and 0x80000000.
- Physical memory from 0x300000 upwards is used as data
- space.
- Next, in order to find configuration information,
- .I 9load
- searches all units on devices
- .BR fd
- and
- .BI sd Cn \fR,
- in that order, for a file called
- .B plan9\eplan9.ini
- or
- .B plan9.ini
- (see
- .IR plan9.ini (8))
- on a partition named
- .B dos
- or
- .BR 9fat .
- If one is found, searching stops and the file is read into memory
- at physical address 0x1200
- where it can be found later by any loaded
- .IR bootfile .
- Some options in
- .B plan9.ini
- are used by
- .IR 9load :
- .TF bootfile=manual
- .TP
- .B console
- .TP
- .B baud
- Specifies the console device and baud rate if not a display.
- .TP
- .BI ether n
- Ethernet interfaces. These can be used to load the
- .I bootfile
- over a network.
- Probing for Ethernet interfaces is too prone to error.
- .TP
- .BI bootfile= bootfile
- Specifies the
- .IR bootfile .
- This option is overridden by a command-line argument.
- .TP
- .B bootfile=auto
- Default.
- .TP
- .B bootfile=local
- Like
- .IR auto ,
- but do not attempt to load over the network.
- .TP
- .B bootfile=manual
- After determining which devices are available for loading from,
- enter prompt mode.
- .PD
- .PP
- When the search for
- .B plan9.ini
- is done,
- .I 9load
- proceeds to determine which bootfile to load.
- If there was no
- .I bootfile
- option,
- .I 9load
- chooses a default
- from the following prioritized device list:
- .EX
- fd sd ether
- .EE
- .I 9load
- then attempts to load the
- .I bootfile
- unless
- the
- .B bootfile=manual
- option was given, in which case prompt mode is entered immediately.
- If the default device is
- .BR fd ,
- .I 9load
- will prompt the user for input before proceeding with the
- default bootfile load after 5 seconds;
- this prompt is omitted if
- a command-line argument or
- .I bootfile
- option
- was given.
- .PP
- .I 9load
- prints the list of available
- .IR device s
- and
- enters prompt mode on encountering any error
- or if directed to do so by a
- .B bootfile=manual
- option.
- In prompt mode, the user is required to type
- a
- .IB bootfile
- in response to the
- .L "Boot from:
- prompt.
- .PP
- .I 9load
- parses the master boot record and Plan 9 partition tables
- (see
- .IR prep (8)),
- leaving partitioning information appended to the
- in-memory contents of
- .I plan9.ini
- for the
- .IR bootfile .
- This is used by
- .IR sd (3)
- to initialize partitions so that
- .IR kfs (4)
- file systems can be mounted as the root file system.
- A more extensive partitioning is typically done by
- .I fdisk
- and
- .I prep
- as part of
- .I termrc
- or
- .I cpurc
- (see
- .IR cpurc (8)).
- .PP
- A
- control-P
- character typed at any time on the console causes
- .B 9load
- to perform a hardware reset
- (Ctrl-Alt-Del can also be used on a PC keyboard).
- .PP
- When loaded from a PBS (rather than from
- .IR ld.com ),
- .I 9load
- must be contiguously allocated on
- the disk.
- See
- .IR dossrv (4)
- for information on ensuring this.
- .PP
- .I 9pxeload
- differs slightly in operation from
- .IR 9load .
- It is initially loaded by the PXE BIOS at physical address 0x7C00.
- Only devices which can be automatically configured,
- e.g. most PCI ethernet adapters,
- will be recognised.
- If the file
- .IB /cfg/pxe/ XXXXXXXXXXXX
- can be located via a DHCP server,
- where
- .B XXXXXXXXXXXX
- is the MAC address of a recognised ethernet adapter,
- the contents are obtained and used as a
- .IR plan9.ini .
- .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 /sys/src/boot/pc
- .SH "SEE ALSO"
- .IR plan9.ini (8),
- .IR prep (8)
- .SH BUGS
- .PP
- Much of the work done by
- .B 9load
- is duplicated by the loaded kernel.
- .PP
- If
- .I ld
- detects an installed MS-DOS Extended Memory Manager,
- it attempts to de-install it, but the technique
- used may not always work.
- It is safer not to install the Extended Memory Manager before running
- .IR ld .
- .PP
- The way
- .I 9pxeload
- obtains the information normally found in a disc
- .I plan9.ini
- file,
- and thereby the kernel to load and boot,
- is not ideal and may change in the future.
|