Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: why does dk(4) take precedence in boot device selection???



woods%planix.ca@localhost ("Greg A. Woods") writes:

>Well, perhaps "shove" is the wrong word, but either the boot code is
>lying about where it loads the kernel from and it is filling in
>BTINFO_BOOTWEDGE info when it should not (why the heck would it even
>look on a different device from where it came from and from where it
>found and loaded the kernel!?!?!?), or the code for match_bootwedge() is
>somehow too simplistic and over-eager.



There is no safe way to identify the boot disk from information
passed by the BIOS.

Here is what the MD code for x86 does:


1. BTINFO_ROOTDEVICE

a) bootloader passed root device name as <driver><unit><partition>.
Search for driver instance with the correct name and unit and
pass partition number to MI code. The MI code will later identify
a matching wedge or use the partition number with the disk driver.

b) bootloader passed wedge name as "wedge:"<name>.
The kernel will later search for a wedge with that name.


This is for a bootloader that passes a NetBSD identifier
to the kernel, i.e. one that reads bootdev from boot.cfg.
Nothing depends on BIOS information.



2. BTINFO_BOOTWEDGE

bootloader passed start offset and length of a hard disk partition
and a offset,size and hash of a "boot area".
Search all disks and wedges for a block sequence at that offset with a
matching hash. Pass device, offset and length to the MI code. The MI code
will later search for a matching wedge on that device.
A partition number is provided if the bootloader also passed
a BTINFO_BOOTDISK record. This (or partition 'a') will be used
by the MI code as a fallback if there is no matching wedge.


This is the conventional hard disk boot. It fails to identify the
disk if there are disks or wedges with the same (according to hash)
"boot areas". But the kernel prints a warning if more than one matching
disk is found.



3. BTINFO_BOOTDISK

a) bootloader passed BIOS disk number for floppy and a partition
number. Search the first "fd" driver instance with the correct unit,
pass driver instance and partition number to MI code.

b) bootloader passed BIOS disk number for a hard drive,
a partition number and disklabel data (offset,type,checksum,packname).
Search all disks for a matching disklabel at the passed label offset.
Pass driver instance and partition number to MI code. The MI code
will later identify a matching wedge or use the partition number
with the disk driver.

c) bootloader passed BIOS disk number for a CD
Search for the first "cd" device, you can only boot from unit 0.
Pass driver instance (and partition 0) to MI code.


This is only used for floppy and CD unless you have an old
bootloader that doesn't know about BTINFO_BOOTWEDGE. This could
also mismatch if several hard disks have matching disklabels
(including faked "default labels" if there is no label on disk).
But again, a warning is printed in that case.


-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index