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 /Inferno/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 /Inferno/386/pbslba, and then only if the machine's BIOS supports linear block addressing (LBA) mode for disk transfers.
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 0x600, finds the active partition and loads its PBS at address 0x7C00. A copy of the Plan 9 MBR is kept in /Inferno/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 /Inferno/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.
Thus the default sequence is: BIOS, MBR, PBS, 9load, kernel.
Because it contains many device drivers for different disks and networks, 9load is larger than 64K and cannot be run as a DOS ``.com'' executable. A stripped-down version that knows about disks but not networks, called ld (really ld.com), fits in 64K and can be used under DOS to load and start a program (default 9load) from the FAT16 partition. Its command line argument is of the same format as the bootfile specifiers described below. This profusion of loaders is unfortunate, but at least ld and 9load are compiled from the same source.
9load begins execution at address 0x80010000 (64K) and loads the bootfile at the entry address specified by the header, usually 0x80100020. After loading, control is passed to the entry location.
Finally, 9pxeload is a version of 9load that can be booted using the PXE download found on some ethernet card BIOSs.
In summary, Inferno and Plan 9 can be booted on a PC three different ways: either by booting MS-DOS and using ld to start 9load in the appropriate directory, by booting directly from an Inferno/Plan 9 boot floppy or disk partition prepared using format to install the appropriate files and bootstrap sectors (see prep(8)), or by using a PXE capable BIOS to boot 9pxeload directly over the ethernet.
The bootfile, which may be compressed with gzip(1), can be specified to 9load as a bootfile= entry in plan9.ini, or if booting from the ethernet, by a BOOTP server. If the plan9.ini file contains multiple bootfile= entries, 9load will present a numerical menu of the choices; type the corresponding number to select an entry.
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 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, 9load searches all units on devices fd and sdCn, in that order, for a file called plan9\plan9.ini or plan9.ini (see plan9.ini(10.6)) on a 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. Some options in plan9.ini are used by 9load:
When the search for plan9.ini is done, 9load proceeds to determine which bootfile to load. If there was no bootfile option, 9load chooses a default from the following prioritized device list:
fd sd ether9load then attempts to load the bootfile unless the bootfile=manual option was given, in which case prompt mode is entered immediately. If the default device is fd, 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 bootfile option was given.
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.
9load parses the master boot record and Plan 9 partition tables (see prep(8)), leaving partitioning information appended to the in-memory contents of plan9.ini for the bootfile. This is used by sd(3) to initialize partitions so that a file 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 osinit.dis (see root(3)).
A control-P character typed at any time on the console causes 9load to perform a hardware reset (Ctrl-Alt-Del can also be used on a PC keyboard).
When loaded from a PBS (rather than from ld.com), 9load must be contiguously allocated on the disk. See dossrv(4) for information on ensuring this.
If 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 ld.
|9LOAD(10.8 )||Rev: Thu Feb 15 14:42:59 GMT 2007|