xref: /plan9/sys/src/9/pcboot/words (revision e845aa5be52e98d04ec7a8a4c1051f125fe750fb)
1This is a specialised pc kernel that acts as a bootstrap loader for
2386 and amd64 kernels, and replaces the old 9pxeload, 9load and
39loadusb.  It relies on the pc port (in /sys/src/9/pc) for most of its
4non-portable source files, notably the disk and ethernet drivers, so
5you'll want an up-to-date system (see replica/pull) if installing this
6by hand.  Support for user mode (such as system calls) is almost
7entirely absent.  There is some duplication of code with the pc
8kernel, but we have tried to keep it to a minimum.
9
10Caveats:
11
129boot doesn't scan disks for partition tables since it doesn't contain
13the disk drivers, but `readparts=' in plan9.ini (see
14/sys/src/9/boot/parts.c) will make the loaded kernel read them early
15on.  9load does read partition tables.
16
179loadusb seems to hang for two minutes when attempting to read via the
18bios on some bioses (e.g., vmware's), then reports a disk timeout on
19the INT 13 extended read operation.
20
21
22How these new bootstraps differ from the old 9load and 9pxeload.
23
24The old 9load was a single process derived from (but separately
25evolved from) an old PC kernel, so it needed modified device drivers
26(primarily for ethernet and disk controllers), which was an ongoing
27maintenance nuisance, and not all ethernet controllers had bootstrap
28drivers.  The new bootstraps are just specialised Plan 9 kernels that
29are loaded into the first 640KB of RAM, so they use unmodified Plan 9
30drivers.  There isn't enough room below 512K to include useful support
31for user mode and system calls, but the new bootstraps do implement
32kernel processes.  The 512K limit is imposed by PXE or PBS loading of
33the new bootstraps into the first 512K or 640K.
34
35The old 9load was capable of loading from disks, floppies, USB disks
36or ethernet (via PXE).  Again due to space limitations, we've had to
37focus the new bootstraps more sharply.  9boot loads via PXE and
38nothing else, which is our usual mode of operation.  9load loads from
39non-USB disks (using BIOS INT 13 calls) but not floppies, which ought
40to be obsolete by now.  If you must boot from floppy and are doing so
41now and your BIOS won't boot from USB, do this to arrange to boot from
42USB disk instead:
43
44	a: && cp /386/9loadusb /n/a:/9load
45
469loadusb loads from USB disks only.  BIOSes seem to be easily confused
47by intermixing direct I/O and BIOS calls, thus we keep 9load and
489loadusb distinct.
49
50The new bootstraps can load amd64 as well as 386 kernels, and generate
51Gnu Multiboot tables for their benefit.
52
53The new 9load will look on all available disks for FAT file systems.
54If no bootfile is specified in a plan9.ini, it will examine each file
55system to see if it contains a single Plan 9 kernel (9pc* or 9k8*),
56and if so, will boot it.
57
58The new 9boot contains no disk drivers, so it can't read partition
59tables and populate #ec/sd??part for the kernel's benefit, so if you
60need to access a disk partition early in the kernel's execution (e.g.,
61you have an nvram partition), you'll want to add
62
63readparts=
64
65to the /cfg/pxe file for any such machines.
66
67The new bootstraps should run on more machines than the old ones.  We
68discovered new ways to enable the A20 address line and try them all
69until success.  This may fix various odd memory corruption problems
70seen in the past.  We also discovered that BIOS calls may enable
71interrupts, so we disable them again immediately upon return.  This
72may prevent mysterious resets seen with the old bootstraps.
73
74
75CD booting changes
76
77pbsraw can be up to 2k, so we can print and be nice, uses things
78written up by mk9660.  In any case, it reads a contiguous file and is
79468 bytes long (we dropped the 9fat support here), so it could be used
80to load from any raw partition supporting lba access.
81
82There are corresponding changes to mk9660 to annotate the PBS.  A new
83parameter, -x loader, names a loader that has to be in the root
84directory.  In conjuction with -B, can be used to boot directly from
85the CD.
86
879load was changed to deal with a 9fat image file in the root directory
88of a CD image.  It has to be called bootdisk.img and can be of any
89size (as long as it is contiguous).
90
91
92Memory Map
93
94This is how the bootstraps use memory:
95
960	---------------------
97
9831K	---------------------
99	start of pxe decomp + compressed 9boot
10064K	---------------------
101	start of pbs decomp + compressed 9boot
102	decompresses to 9MB
103	...
104512K	---------------------
105	pxe loader from ROM
106640K	---------------------
107	UMB
1081MB	---------------------
109	kernel
1109MB	---------------------
111	9boot after decomp.
112	decompresses kernel.gz
113	from 13MB to 1MB.
11413MB	---------------------
115	(kernel.gz)
11615MB	---------------------
117	no-man's land
11816MB	---------------------
119	malloc arena for 9boot
120	...
121
122chinese puzzle constraints:
123BIOS calls only work from bottom 1MB (640K, really).
124with paging on, we need to have created page tables for the memory we use.
125a20 has to be enabled before we try to use memory above 1MB.
126