Author Topic: Why Installer breaks boot for Macs and how to fix it  (Read 8185 times)

0 Members and 1 Guest are viewing this topic.

tempolo

  • Member
  • Posts: 82
    • My own Hackintosh page
Why Installer breaks boot for Macs and how to fix it
« on: July 19, 2009, 05:52:32 PM »
I found out why, when accidentally installing Chameleon to a Mac's boot disk using the 2.0 RC1 installer, the Mac would not boot from it any more:

The installer marks the Legacy MBR's protective partition entry as active, which is must not do (see http://en.wikipedia.org/wiki/GUID_Partition_Table). Doing so invalidates the GPT (GUID Partition Table) format, and the Mac doesn't like this.

The fix is easy: Change the first sector's byte at offset 0x1BE from 0x80 to 0x00.  This change can be performed with a sector editor such as iBored, or probably also with fdisk (dunno - please comment if you know).

And the following code in the installer scripts ("postinstall") appears to be the culprit for this damage:
Quote
# If table is GPT make the first partition active (BadAxe compatibility).
[ "${partitiontable}" = "GPT" ] && bootslice=1
if [[ "${partitiontable}" = "GPT" ]]; then
   fdisk -e ${bootdisk} <<-MAKEACTIVE
   print
   flag ${bootslice}
   write
   y
   quit
   MAKEACTIVE
fi

I have no idea what "BadAxe" means, but this operation (making the protected partition active) clearly violates the rules for a valid Protective MBR and should therefore be removed.

zef

  • Administrator
  • Posts: 265
Re: Why Installer breaks boot for Macs and how to fix it
« Reply #1 on: July 19, 2009, 07:47:26 PM »
@tempolo:

I have an external USB disk with an active 0xEE partition on it. It boots fine on my gf's macbook.
The "BadAxe compatibilty" is a misleading term. Intel's recent BIOSes (including Bad Axe) won't execute the MBR code if it has no active partition on that disk.
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

Dazzzz

  • Entrant
  • Posts: 2
Re: Why Installer breaks boot for Macs and how to fix it
« Reply #2 on: August 21, 2009, 02:14:27 AM »
I have managed to kill the ability to boot from two hard drives installing Chameleon on my Mac. I launched the installer and it failed and since then I cannot boot to the internal hard drive. I was able to boot to an external hard drive and tried to install Chameleon on it and now I can no longer boot to it either.

After these two problems I found this post. I have downloaded iBored, but cannot find the sector in question to change. I also have Drive Genius 2 and looked at the disk with its sector editor, but again can't find the sector in question.

I'd be greatly appreciative if someone could help me with this as the only way I know how to fix this problem is to repartition/reformat my hard drives, which is a pain as I'll have to backup over 1.2TB of data first and then copy it back which will take hours.

Memorial

  • Entrant
  • Posts: 9
Re: Why Installer breaks boot for Macs and how to fix it
« Reply #3 on: August 21, 2009, 04:29:34 AM »
I am not sure exactly as I do not have this problem, but you can undo the fdisk setting and simple set the first partition on the disk (the GPT partition) to active.

Dazzzz

  • Entrant
  • Posts: 2
Re: Why Installer breaks boot for Macs and how to fix it
« Reply #4 on: August 21, 2009, 04:42:58 AM »
I'm not sure how to do this. Can you please describe the procedure?

Thanks

Memorial

  • Entrant
  • Posts: 9
Re: Why Installer breaks boot for Macs and how to fix it
« Reply #5 on: August 21, 2009, 05:04:35 AM »
It's straight foreword. Boot into system (if you can, or boot DVD if you cannot), then start terminal and do the following
Code: [Select]
   
fdisk -e $bootdisk
   print
   flag 1
   write
   quit
 

Here, $bootdisk is the device of your drive (/dev/rdisk0) for example. After you input write, you have to agree to edit the MBR and reboot. There might be issues with using this disk boot windows, because Chameleon uses (or at least used to use) a special version of fdisk that makes sure windows read the MBT properly.