9boot, 9bootpbs, 9load, 9loadusb, mbr, pbs – PC bootstrap programs|
9boot is a specialized Plan 9 kernel loaded by the PXE download
(BOOTP/DHCP followed by TFTP) found in any reasonable Ethernet
card's BIOS; it bootstraps Plan 9 by using TTFTP (write path name
to TCP port 17015 and read its contents) or PXE to load another
386 or amd64 kernel and start it. |
9bootpbs, 9load and 9loadusb are less–commonly–used variants that reside in a FAT file system under the name 9load and bootstrap Plan 9. 9bootpbs is like 9boot but it can be started by a partition boot sector (PBS), as can 9load and 9loadusb. It is intended to network boot older machines without working PXE ROMs. 9load and 9loadusb read FAT file systems. 9loadusb will use only the BIOS's device drivers, and thus can load from FAT file systems on USB devices. In contrast, 9load will not use BIOS device drivers and cannot read USB devices.
This profusion of loaders is unfortunate, but at least they are compiled from the same source. The division into separate programs is dictated by the need to fit within the first 640K of memory and the need to avoid intermixing BIOS and non–BIOS disk access.
These programs are run automatically by the boot procedures described
below; they cannot be run directly by hand. There are three bootstrap
In summary, Plan 9 is usually booted on a PC by using a PXE–capable BIOS to boot 9boot directly over the ethernet. File servers that must be able to boot when other machines are down boot directly from a Plan 9 disk partition prepared using format to install the appropriate files and bootstrap sectors (see prep(8)).
Some options in plan9.ini are used by 9boot:
9load is a similar bootstrap program, loaded by the PC partition boot sector program (PBS), which usually resides in the first sector of the active disk partition. It is initially loaded at physical address 0x10000 (64K); it begins execution at virtual address 0x80010000. In order to find configuration information, 9load searches all units on devices sd?[0–9]* (all sd devices), for a file called plan9.ini (see plan9.ini(8)) on a FAT partition named dos or 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 bootfile.
When the search for plan9.ini is done, 9load proceeds to determine which bootfile to load. If there was no bootfile option, 9load searches sd?[0–9]* FAT partitions for a kernel (any file named 9pc*, 9k8* or 9k10*) and if it finds exactly one kernel in a given FAT partition, chooses it. 9load then attempts to load the bootfile.
9load prints the list of available devices and enters prompt mode
on encountering any error or if directed to do so by a bootfile=manual
option. In prompt mode, the user is required to type a bootfile
in response to the Boot from: prompt.
The format of the bootfile name is device!file or device!partition!file.
If !file is omitted, the default for the particular device is
used. Supported devices are
When booting from disk, the BIOS loads the first sector of the
medium at location 0x7C00. In the case of a disk, it is the master
boot record (MBR). The MBR copies itself to address 0x600, finds
the active partition and loads its PBS at address 0x7C00. A copy
of the Plan 9 MBR is kept in /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 /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 limitations. 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.
Other facilities and caveats
A control–P character typed at any time on the console causes 9boot to perform a hardware reset (Ctrl–Alt–Del can also be used on a PC keyboard).
9load must be contiguously allocated on the disk. See dossrv(4)
for the means to ensure this.
/386 these programs reside here|
expand–pxe self–decompressing headers for bootstraps and small kernels
/cfg/pxe directory of configuration (plan9.ini) files on your TFTP server
/sys/src/boot/pc first–stage disk boot sectors (MBR, PBS)|
/sys/src/9/pc^(boot exp) PC–bootstrap–specific source
/sys/src/9/^(pc port ip) common kernel source
8l(1), cons(3), booting(8), dhcpd(8), fshalt(8), mkusbboot(8),
Some of the work done by 9boot is duplicated by the loaded kernel,
but usually by the same source code. |
bios and sdB usually only work on the first LBA device in the BIOS's list of boot devices, if they work at all. 9loadusb seems to hang for two minutes when attempting to read via the BIOS on some BIOSes (e.g., Vmware's), then reports a disk timeout on the INT 13 extended read operation.
USB keyboards will only work with 9boot if the BIOS emulates a
PS/2 keyboard (and that is enabled).