Subject: x86 boot/root wedge identification
To: NetBSD tech-kern <tech-kern@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 10/19/2004 17:01:19
--Apple-Mail-15--335804438
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

Folks...

Perhaps this really belongs on port-i386, but...

I'm working on "root device" support for wedges now.  In theory, this 
should be really really easy... boot loader communicates "this disk, at 
this offset, for this length", and the wedge is matched at some 
appropriate time.

The challenge, at least on some platforms, is the "this disk" part of 
the equation.  Take the i386 port, for example.  The boot loader 
identifies disks by label sector, label "disk type", disk label 
checksum, pack name, and partition number.  These, obviously, are very 
"BSD disklabel"-centric pieces of information.

I would like to make this a little more generic.  I'm thinking of a new 
btinfo_bootwedge structure that is very similar to the btinfo_bootdisk 
structure:

struct btinfo_bootwedge {
	struct btinfo_common common;
	int biosdev;
	daddr_t startblk;
	uint64_t nblks;
	daddr_t matchblk;
	size_t matchsize;
	uint8_t matchdata[1];	/* variable length */
};

"startblk" and "nblks" take are of identifying the wedge within the 
disk.

The identification of the disk is handled by "matchblk", "matchsize", 
and "matchdata".  Instead of passing in parts of a disklabel structure, 
the boot loader will specify a region of the disk to read into memory 
and compare to the data passed by the boot loader.

While this means passing in a lot more data to the kernel, it means you 
can match disklabel information and GPT GUIDs without having to 
actually parse that info in machine-dependent code.

Comments?

         -- Jason R. Thorpe <thorpej@shagadelic.org>

--Apple-Mail-15--335804438
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFBdarTOpVKkaBm8XkRArIzAJ0ZY3/bKL3RzPdJwQj50zM+Ot8XBACfbs6i
0nVkAdSyO73AU0veBGvV6uE=
=MJt8
-----END PGP SIGNATURE-----

--Apple-Mail-15--335804438--