Subject: Re: finding the "raw" partition on portable disks
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 04/18/2007 16:34:28
On Wed, Apr 18, 2007 at 10:01:49PM +0100, David Laight wrote:
> On Wed, Apr 18, 2007 at 03:51:13PM -0500, David Young wrote:
> > I am working to support portability of disks from one architecture to
> > another---for example, i386 to evbmips.
> > 
> > Here is a routine that I wrote to hunt a disk's partition table for the
> > "raw" partition.  The routine prefers the architecture's raw partition
> > (RAW_PART'th partition) but, allowing for the possibility that the
> > RAW_PART'th partition does not span the disk, searches for a partition
> > that does.  What do you think, do I select the raw partition using the
> > right criteria?
> 
> 
> Hmmm fix the kernels?
> The i386 (at least) kernel will always set the RAW_PART to match the
> entire disk, regardless as to what was read from the disk itself.
> 
> Actually i386 (etc) could make the 'c' partition (which is set to the
> mbr partition from which the system booted, and is only used in one
> place [1]) avaiavle for a 'user' partition. It could then contain
> information from the 'd' partition of disks that have come from a
> system where RAW_PART is 'c'.

Unless I am mistaken, I will still have to detect the effective raw
partition, but I can narrow the partitions under consideration to 'c'
and 'd'.

It looks to me like I can eliminate the only use of the 'c' partition by
adding the sectors-offset of the boot partition to dk_labelsector?  I.e.,
making it an offset into the raw disk.  Or have I overlooked something?

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933