9LOAD(10.8)                                           9LOAD(10.8)

          9load, ld, 9pxeload - PC bootstrap program

          (Under MS-DOS)
          [ drive :][ path ]ld [ 9load ]

          On the PC, bootstrap programs from Plan 9 are used to boot
          Inferno as well (hence the naming convention).  9load and ld
          are programs that reside in a FAT file system and bootstrap
          Inferno.  9load loads the kernel, but it cannot be run from
          DOS; use ld to bootstrap (by starting 9load) if DOS is run-
          ning.  9load is run automatically by the boot procedures
          described below; it cannot be run directly by hand.  There
          are three bootstrap sequences:

          -    BIOS, MBR, disk partition PBS, 9load, kernel

          -    BIOS, floppy PBS, 9load, kernel

          -    BIOS, MBR, DOS, ld, 9load, kernel.

          Details follow.

          9load is a bootstrap program that loads and starts a pro-
          gram, 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 trans-

          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 con-
          siderations.  The Plan 9 MBR is suitable for booting non-

     9LOAD(10.8)                                           9LOAD(10.8)

          Plan 9 operating systems, and (modulo the large disk con-
          straints 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 com-
          piled 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 parti-
          tion prepared using format to install the appropriate files
          and bootstrap sectors (see prep(8)), or by using a PXE capa-
          ble 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 cor-
          responding 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

          fdn     An MS-DOS floppy disk.  N specifies the floppy
                  drive, either 0 or 1.  The bootfile is the contents
                  of the MS-DOS file. There is no default file.  For
                  compatibility with hard disks, a partition may be
                  given, but only dos is recognized: fd0!dos!file.
          ethern  Ethernet.  N specifies the Ethernet device number.
                  If a partition is specified, it is taken to be the
                  name of a host machine from which to load the

     9LOAD(10.8)                                           9LOAD(10.8)

                  kernel.  file is determined by the /lib/ndb (see
                  ndb(6)) entry for this PC.
          sdCn    Non-floppy disk.  The device name format is
                  described in sd(3). A partition must be given and
                  must name a partition containing a FAT file system.
                  The name dos refers to the first DOS partition on a
                  given device.  It is common for Inferno/Plan 9 par-
                  titions to contain a small FAT file system for con-
                  figuration.  By convention, this partition is called
                  9fat.  There is no default partition or pathname.

          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

          baud             Specifies the console device and baud rate
                           if not a display.
          ethern           Ethernet interfaces. These can be used to
                           load the bootfile over a network.  Probing
                           for Ethernet interfaces is too prone to
                           Specifies the bootfile. This option is
                           overridden by a command-line argument.
          bootfile=auto    Default.
          bootfile=local   Like auto, but do not attempt to load over
                           the network.
          bootfile=manual  After determining which devices are avail-
                           able for loading from, enter prompt mode.

          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 priori-
          tized device list:
               fd sd ether
          9load 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 omit-
          ted if a command-line argument or bootfile option was given.

     9LOAD(10.8)                                           9LOAD(10.8)

          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:'

          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

          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.

          [drive:] [ path ]9load
          [drive:] [ path ]ld
          FAT filesystem:\plan9\plan9.ini
          FAT filesystem:\plan9.ini


          plan9.ini(10.6), prep(8)

          Much of the work done by 9load is duplicated by the loaded

          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.