Subject: Re: booting off RAIDframe mirror with i386 -current
To: Simon Burge <simonb@wasabisystems.com>
From: Greg Oster <oster@cs.usask.ca>
List: port-i386
Date: 07/01/2003 23:11:01
Simon Burge writes:
> David Laight wrote:
> 
> > On Wed, Jul 02, 2003 at 12:03:57AM +1000, Simon Burge wrote:
> > > With the following ugly diff I was able to boot successfully off a disk
> > > that had the raid0 set at the start of the disk and without the need
> > > for mucking about with boot partitions or wierd offsets for the 'a'
> > > partition.
> > > 
> > > The "64" should at least be
> > > 
> > > 	#define RF_PROTECTED_SECTORS    64      /* XXX refer to <.../rf_optname
> s.h> */
> > > 
> > > and I don't know (read - "this works and that's all I needed") if
> > > there's a better way of doing this.
> > > 
> > > Anyone more savvy with the i386 bootblocks care to comment?
> > 
> > I had a feeleng that my 'new' bootcode should make this easy!
> > However I think the 64 should be added on at a different point
> > - based on some property of the filesystem.
> > 
> > I don't know the actual layout of the raid0 system, but I recall there
> > is code somewhere that adds in 64 - does that code work?
> 
> Very roughly here is the layout (for i386):
> 
> 	block 0			start of real "a" partition
> 	block 1			disklabel for real disk
> 	block 0-16		space for "bootxx_*" first stage
> 	block 32 (maybe?)	raid label

Correct, assuming partition 'a' here is of type "RAID".
(The component label lives in the 32nd block of the component.
Component "data" starts in block 64. )

> 	block 64		start of raid space
> 	block 65		disklabel for raid space
> 	block 80 (64+16)	start of FFS (or other) filesystem
> 
> > Is that in the code that loads the kernel?
> 
> This is in the bootxx_* code that loads /boot.  /boot itself is fine (it
> uses .../lib/biosdisk.c which deals with adding 64 if the partition type
> in the disk label is RAID) but bootxx_* needs to know whether or not to
> add 64 as well, but currently the code doesn't look at the disklabel
> (space constraints I guess).  So I just took the approach of "if the
> open fails, try adding 64 to all read offsets and try again."
> 
> Simon.
> --
> Simon Burge                            <simonb@wasabisystems.com>
> NetBSD Support and Service:         http://www.wasabisystems.com/

Later...

Greg Oster