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

William Hahne will07c5 at gmail.com
Tue Aug 9 23:54:33 CEST 2011


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++;
  }
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110809/9c5c3d0d/attachment-0001.html>


More information about the OpenBIOS mailing list