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

William Hahne will07c5 at gmail.com
Wed Aug 10 17:23:26 CEST 2011


On Wed, Aug 10, 2011 at 5:48 AM, Mark Cave-Ayland <
mark.cave-ayland at siriusit.co.uk> wrote:

> 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.
>

This is something I discovered through testing and carefully looking through
the BootX source code. I don't know if there is documentation on this or
not.

William Hahne



> 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
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/**mailman/listinfo<http://lists.openbios.org/mailman/listinfo>
> Free your System - May the Forth be with you
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110810/1db90387/attachment.html>


More information about the OpenBIOS mailing list