[OpenBIOS] [PATCH 2/10] Ignore extraneous partitions

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Aug 10 12:48:52 CEST 2011


On 09/08/11 22:54, William Hahne wrote:

> BootX will only check the first few partitions from mac-parts to find
> the Mac OS partition. So it must expect drivers and void partitions to
> be ignored. This patch makes it so that if you specify the partition
> cd:1 and partition 1 is a driver it will keep checking partitions until
> reaching the first non-driver and non-void partition.
>
> Index: packages/mac-parts.c
> ===================================================================
> --- packages/mac-parts.c (revision 1041)
> +++ packages/mac-parts.c (working copy)
> @@ -200,15 +203,26 @@
> } else {
> /* Another partition was explicitly requested */
> - SEEK( bs * parnum );
> - READ( &par, sizeof(par) );
> +
> + /* We have to find the first valid partition corresponding to the
> given number.
> +   This is because Apple sometimes includes a bunch of extra partitions
> that
> +   BootX expects to be ignored */
> + while (parnum < par.pmMapBlkCnt) {
> + SEEK( bs * parnum );
> + READ( &par, sizeof(par) );
> - if( (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsValid) &&
> -    (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsAllocated) &&
> -    (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsReadable) ) {
> + /* Check if valid, also device driver partitions are expected to be
> ignored */
> + if( (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsValid) &&
> +    (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsAllocated) &&
> +    (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsReadable) &&
> +    !(__be32_to_cpu(par.pmPartStatus) & kPartitionIsRealDeviceDriver)) {
> - offs = (long long)__be32_to_cpu(par.pmPyPartStart) * bs;
> - size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;
> + offs = (long long)__be32_to_cpu(par.pmPyPartStart) * bs;
> + size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;
> + break;
> + }
> +
> + parnum++;
> }
> }

I remember last time I reworked this, I had to spend a lot of time 
reading the Apple HFS documentation with regard to this. Could you add a 
link to the documentation on the Apple site into the commit message, and 
confirm whether this is something I missed which is documented or it's 
new behaviour that you have discoverd through testing.


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the OpenBIOS mailing list