tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: patch: MFSv3 support (libsa) for boot2 (i386)
On Thu, Dec 29, 2011 at 02:10:22AM +0900, Izumi Tsutsui wrote:
>
> - Kernel and Bootloader search NetBSD partition in MBR.
> - If NetBSD partition is found, kernel checks NetBSD disklabel
> at LABELSECTOR in the NetBSD partition.
> (in sys/kern/disk_subr_mbr.c, but this is machine dependent)
> - The first pbr.S in bootxx is loaded by master MBR or BIOS
> - pbr.S loads the first 16 sectors in the NetBSD partition.
> - The rest of bootxx (boot1.c) check NetBSD disklabel at LABELSECTOR
> and load secondary /boot in partition a:.
The actual 'pc' boot sequence is:
Stages 1-3 (and maybe 4) are common to all OS.
1) Bios loads sector 0 (mbr) of the disk to 0x7c00 and jumps to
the start of it.
2) The mbr code relocates itself somewhere else, then uses the partition
table in the mbr to locate the 'active' [1] partition and then reads
the first sector of the active partition (pbr) to 0x7c00 and jumps to
the start of it.
3) The pbr code has to determine where it was loaded from, it could:
a) reread sector zero and look for a partition of the relevant type
b) have the sector number previously written into the sector data.
The netbsd bootselect mbr passes the sector number in a register
(non-standard) and the pbr code scans the partitions looking for
one that starts in the correct place.
4) The pbr code now reads the rest of the 8k 'boot code' area at the
start of the partition - this is the rest of bootxx_xxxfs.
5) The bootxx code now tries to load the 'boot' program from filesystem,
it checks the following places for a filesystem:
a) the start of the partition
b) 64 sectors (size of raidframe header) after the start of the ptn
c) the 'a' partition described by the disklabel in the 2nd sector
of the partition (offset by 64 if FS_RAID).
If found the 'boot' program is loaded to 0x10000 and executed.
6) The 'boot' program loads the kernel (etc).
This does mean that there is an expectation that the boot filesystem
(the one that contains /boot) is at the start of the bios partition.
You can set things up otherwise, but that requires more care. sysinst
doesn't stop you shooting yourself in the foot!
The /boot program is read using the normal fs structures (not from a
list of disk sector numbers) so updating /boot or the bootxx_xxxfs
code is trivial.
You can split a single mbr/bios partition into multiple filesystems,
or use multiple mbr/bios partitions (which can all be bootable).
The netbsd disklabel describes the disk layout, and is wrtten to the
start of ALL the type 168 (netbsd) partitions.
[1] The bootselect code requests the user select the required partition
and can scan the extended partition.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index