On 03/12/12 22:30, Amadeusz Sławiński wrote:
Code for reference (and in case I need to use it again :P)
printk("mac-parts: counted %d partitions\n", __be32_to_cpu(par.pmMapBlkCnt)); for (d = 1; d<= __be32_to_cpu(par.pmMapBlkCnt); d++) { SEEK( bs * d ); READ(&par, sizeof(par) );
printk("Partition: %d\n", d);
printk("pmSig: %x\n", __be16_to_cpu(par.pmSig)); printk("pmSigPad: %x\n", __be16_to_cpu(par.pmSigPad)); printk("pmMapBlkCnt: %x\n", __be32_to_cpu(par.pmMapBlkCnt)); printk("pmPyPartStart: %x\n", __be32_to_cpu(par.pmPyPartStart));
printk("pmPartBlkCnt: %x\n", __be32_to_cpu(par.pmPartBlkCnt)); printk("pmPartName: %s\n", par.pmPartName); printk("pmPartType: %s\n", par.pmPartType);
printk("pmLgDataStart: %x\n", __be32_to_cpu(par.pmLgDataStart)); printk("pmDataCnt: %x\n", __be32_to_cpu(par.pmDataCnt)); printk("pmPartStatus: %x\n", __be32_to_cpu(par.pmPartStatus)); printk("pmLgBootStart: %x\n", __be32_to_cpu(par.pmLgBootStart)); printk("pmBootSize: %x\n", __be32_to_cpu(par.pmBootSize)); printk("pmBootLoad: %x\n", __be32_to_cpu(par.pmBootLoad)); printk("pmBootLoad2: %x\n", __be32_to_cpu(par.pmBootLoad2)); printk("pmBootEntry: %x\n", __be32_to_cpu(par.pmBootEntry)); printk("pmBootEntry2: %x\n", __be32_to_cpu(par.pmBootEntry2)); printk("pmBootCksum: %x\n", __be32_to_cpu(par.pmBootCksum)); printk("pmPartType: %s\n", par.pmProcessor); printk("filler: %s\n", par.filler);
printk("\n"); }
Output Max OS X 10.2 disk 1:
mac-parts: counted 10 partitions Partition: 1 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 1 pmPartBlkCnt: 3f pmPartName: Apple pmPartType: Apple_partition_map pmLgDataStart: 0 pmDataCnt: 3f pmPartStatus: 17 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 2 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 40 pmPartBlkCnt: 38 pmPartName: Macintosh pmPartType: Apple_Driver43 pmLgDataStart: 0 pmDataCnt: 38 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: 2400 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 7b04 pmPartType: filler: ptDR
Partition: 3 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 78 pmPartBlkCnt: 8c pmPartName: Macintosh pmPartType: Apple_Driver43_CD pmLgDataStart: 0 pmDataCnt: 8c pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: c400 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 934b pmPartType: filler: CDrv
Partition: 4 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 0 pmPartBlkCnt: 0 pmPartName: pmPartType: Apple_Void pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 5 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 104 pmPartBlkCnt: 38 pmPartName: Macintosh pmPartType: Apple_Driver_ATAPI pmLgDataStart: 0 pmDataCnt: 38 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: 2600 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 70da pmPartType: filler: ptDR
Partition: 6 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 13c pmPartBlkCnt: 8c pmPartName: Macintosh pmPartType: Apple_Driver_ATAPI pmLgDataStart: 0 pmDataCnt: 8c pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: f200 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 8b46 pmPartType: filler: ATPI
Partition: 7 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 1c8 pmPartBlkCnt: 200 pmPartName: Patch Partition pmPartType: Apple_Patches pmLgDataStart: 0 pmDataCnt: 200 pmPartStatus: 1 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 1 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 8 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 0 pmPartBlkCnt: 0 pmPartName: pmPartType: Apple_Void pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 9 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 3c8 pmPartBlkCnt: 1381e0 pmPartName: Mac_OS_X pmPartType: Apple_HFS pmLgDataStart: 0 pmDataCnt: 1381e0 pmPartStatus: 4000007f pmLgBootStart: 3af0 pmBootSize: c1000 pmBootLoad: 1c00000 pmBootLoad2: 0 pmBootEntry: 1c00cb0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: powerpc filler:
Partition: 10 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 1385a8 pmPartBlkCnt: b258 pmPartName: pmPartType: Apple_Free pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Output Mac OS X 10.0
mac-parts: counted 10 partitions Partition: 1 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 1 pmPartBlkCnt: 3f pmPartName: Apple pmPartType: Apple_partition_map pmLgDataStart: 0 pmDataCnt: 3f pmPartStatus: 17 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 2 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 40 pmPartBlkCnt: 38 pmPartName: Macintosh pmPartType: Apple_Driver43 pmLgDataStart: 0 pmDataCnt: 38 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: 2400 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: eb19 pmPartType: filler: ptDR
Partition: 3 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 78 pmPartBlkCnt: 78 pmPartName: Macintosh pmPartType: Apple_Driver43_CD pmLgDataStart: 0 pmDataCnt: 78 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: c800 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: e9ad pmPartType: filler: CDrv
Partition: 4 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 0 pmPartBlkCnt: 0 pmPartName: pmPartType: Apple_Void pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 5 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: f0 pmPartBlkCnt: 38 pmPartName: Macintosh pmPartType: Apple_Driver_ATAPI pmLgDataStart: 0 pmDataCnt: 38 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: 2600 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 3cd4 pmPartType: filler: ptDR
Partition: 6 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 128 pmPartBlkCnt: 78 pmPartName: Macintosh pmPartType: Apple_Driver_ATAPI pmLgDataStart: 0 pmDataCnt: 78 pmPartStatus: 37f pmLgBootStart: 0 pmBootSize: ea00 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: ce67 pmPartType: filler: ATPI
Partition: 7 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 1a0 pmPartBlkCnt: 200 pmPartName: Patch Partition pmPartType: Apple_Patches pmLgDataStart: 0 pmDataCnt: 200 pmPartStatus: 1 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 4 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 8 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 0 pmPartBlkCnt: 0 pmPartName: pmPartType: Apple_Void pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Partition: 9 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 3a0 pmPartBlkCnt: 11a788 pmPartName: Mac_OS_X pmPartType: Apple_HFS pmLgDataStart: 0 pmDataCnt: 11a788 pmPartStatus: 4000007f pmLgBootStart: 3af0 pmBootSize: b4000 pmBootLoad: 1c00000 pmBootLoad2: 0 pmBootEntry: 1c005b4 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: powerpc filler:
Partition: 10 pmSig: 504d pmSigPad: 0 pmMapBlkCnt: a pmPyPartStart: 11ab28 pmPartBlkCnt: 254d0 pmPartName: pmPartType: Apple_Free pmLgDataStart: 0 pmDataCnt: 0 pmPartStatus: 0 pmLgBootStart: 0 pmBootSize: 0 pmBootLoad: 0 pmBootLoad2: 0 pmBootEntry: 0 pmBootEntry2: 0 pmBootCksum: 0 pmPartType: filler:
Thanks a lot for this - this is extremely useful!
Based upon this, it looks as if OS X 10.0 and OS X 10.2 should boot with the standard CHRP boot procedure since kPartitionAUXIsBootValid is set on both the OS partitions. However, I realise now that I broke this with my interpose refactoring in an attempt to accommodate Mac disk images I had that *didn't* set this flag. I see that I also misunderstood the direct partition boot, but this was because of an existing bug failing to match the partition because the pmType string "powerpc" was not checked in a case-insensitive manner as per the CHRP specification. Sigh.
The other interesting thing is that kPartitionAUXIsBootValid is not set on your OS 10.4 upgrade disk. If you try and boot from this directly from a reset, can Apple's Open Firmware actually boot it? Or does it have to be launched from OS X?
ATB,
Mark.