Jump to content

Hackintosh: Chameleon to boot CentOS ( Linux ) in GPT HDD.


1 post in this topic

Recommended Posts

Caveat: This is not truely a triple boot from single harddisk as i have Windows installed on seperate harddisk with MBR. The solution doesn't use rEFIt and gptsync.

 

In Summary, the harddisk with Hackintosh and CentOS installed must become the following GPT and MBR partition types:

 

Partition	GPT Type	MBR Type	  
EFI System	EF00		0xEE
Mac HFS+	  AF00		0xAF
LINUX		 0700		0x83	(Grub must install here, GPT Type code is 0700 the MIcrosoft Basic Data. Either the default "/boot" or "/" are applicable)
LINUX LVM	 8E00		0x8E	(Linux Swap will be 8200, 0x82)

 

If you already know what this means and know how to use gdisk, go ahead and try it out.

 

If not, let's move on....

 

OS Installation

 

My BIOS system has 2 HDD: Windows in one (MBR); Lion and CentOS 6 in the Other (GPT).

 

 

 

1. Windows: Just use Retail DVD to install in FIRST harddisk. Nothing special or important and you can totally ignore this.

 

2. Lion OSX:

 

		Prepare a bootable Lion Installer USB stick (detail instructions can be found on internet)

	Boot your system from the USB stick to run the installer.

	When inside the Lion installer, open Disk Utility to partition the SECOND harddisk.

	You can have any number of partition you like, but for the case here, I split into 2 partitions:

			1st Partition - Macintosh HFS+ Journaled (for LIon)
			2nd Partition - Freespace (for Centos later)

		   Important: Must choose "GUID Partition Table" in the option.

	After partitions are ready, install Lion OSX into first Partition.

	Install Chameleon bootloader to your Lion Partition.

 

(Make very sure that you have installed the bootloader properly and able to boot into Lion right from power up.

Although you can always boot from the USB stick but this can verify whether the CentOS installation later will break your chameleon boot)

 

3. CentOS 6:

 

		Boot your System from CentOS Installer DVD.

	Run the installation.

	When partition, either use the default layout ("/boot" + LVM partitions) or create custom layout (e.g. "/" + swap partitions). Using ext4 here.

	Install GRUB in the Linux Partition (e.g. /dev/sdb3), not the disk itself (e.g /dev/sdb).GRUB version is legacy 0.97 from CentOS 6.2 .

	Finish the installation and reboot.

 

 

Now when the system reboot, it should boot into your chameleon bootloader instead of GRUB. If it starts the GRUB, maybe you have install GRUB in the disk, not the linux partition or the linux partition has become active.

 

For the GRUB installed to disk, it is advisable you reinstalled chameleon to Lion partition and GRUB to Linux partition.

 

 

Fix GPT and create Hybrid MBR

 

Either boot into Lion or CentOS at your convenience. Then install gdisk downloaded from here.

http://sourceforge.n...gptfdisk/0.8.4/

 

1. The instructions are demo with Lion but applicable to CentOS too.

 

2. Open Terminal.Find out the device name of your disk.

 

   Lion
  $Diskutil list

  CentOS
  > sudo parted
  (parted)>  print all

 

3. The current GPT for Hackintosh look like this now (SECOND hard disk in my case, and don't worry abt total space not tally, I have freespaces):

 

Lion
/dev/disk1
  #:					   TYPE NAME					SIZE	   IDENTIFIER
  0:			      GUID_partition_scheme					*500.1 GB  disk1
  1:						EFI					209.7 MB   disk1s1
  2:				   Apple_HFS LionHD					79.9 GB	   disk1s2
  3:						EFI					524.3 MB   disk1s3
  4:					  Linux LVM					85.9 GB	   disk1s4

 

4. Type 'sudo gdisk /dev/disk1'. (CentOS might be /dev/sdb)

 

5. Type 'p' to check GPT partition table and you will see this:

 

Number  Start (sector)	End (sector)  Size	   Code  Name
  1			  40		  409639   200.0 MiB   EF00  EFI System Partition
  2			  409640	   156397567   74.4 GiB	   AF00  LionHD
  3			   156397568	   157421567   500.0 MiB   EF00  EFI System Partition
  4			   157421568	   325193727   80.0 GiB	   8E00  

 

6. Type 't' and then '3' to change the partition type code for linux partition (3rd partition).

 

Command (? for help): t
Partition number (1-4): 3

7. Type '0700'.

 

Hex code or GUID (L to show codes, Enter = AF00): 0700
Changed type of partition to 'Microsoft basic data'

Command (? for help):

 

8. Type 'p' again to check your partition. The partition 3 should be type 0700 now.

 

Number  Start (sector)	End (sector)  Size	   Code  Name
  1			  40		  409639   200.0 MiB   EF00  EFI System Partition
  2			  409640	   156397567   74.4 GiB	   AF00  LionHD
  3			   156397568	   157421567   500.0 MiB   0700  
  4			   157421568	   325193727   80.0 GiB	   8E00  

 

Now we have fixed the GPT and chameleon bootloader is able to see CentOS after we save everything.

Next we have to create the hybrid MBR to boot properly.

 

8. Type 'r' to enter Recovery/transformation mode.

 

Command (? for help): r

Recovery/transformation command (? for help):

 

9. Type 'o' to check MBR table. You should see that there's only one partition in it.

 

10. Type 'h' to start making hybrid MBR.

 

11. Type '2 3 4' to make MBR. This is according to the GPT partition number you have. (Partition 2 is Lion, 3 is Linux, 4 is Linux LVM in this case)

 

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4

 

12. Type 'Y' for first MBR.

 

Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

 

13. Type 'AF' for partition 2 and 'Y' to make it bootable (We are doing this for chameleon to boot on power up)

 

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): AF
Set the bootable flag? (Y/N): Y

 

14. Type '83' for partition 3 and 'N' to make it non-bootable.

 

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default 07): 83
Set the bootable flag? (Y/N): N

 

15. Type '8E' for partition 4 and 'N'. (if this is Linux Swap, use '82')

 

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 8E): 8E
Set the bootable flag? (Y/N): N

 

16. Type 'o' to check MBR partition, should look like this now:

 

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0xA76E0A09
MBR partitions:

Number  Boot  Start Sector   End Sector   Status	  Code
  1			 1	   409639   primary	 0xEE
  2	  *		409640	156397567   primary	 0xAF
  3		 156397568	157421567   primary	 0x83
  4		 157421568	325193727   primary	 0x8E

Recovery/transformation command (? for help):

 

17. Type 'v' to verify everything is ok.

 

18. Type 'w' to save and exit.

 

19. Reboot system.

 

You should be able to see Lion, Linux and Windows in the Chameleon.

 

Common problem:

1. If you see something like "Partition 1does not end on cylinder boundary:" when checking the partition, use DiskUtil to repair the disk first. You might need to have freespace in the disk first because after repaired the disk, DiskUtil will create 128MB freespace between partition 2 and partition 3. This problem has caused me not able to boot chameleon in bootable partition 2 but boot GRUB.

Link to comment
Share on other sites

 Share

×
×
  • Create New...