Wednesday, September 12, 2012

Multiboot OSX Snow Leopard, Windows XP, Windows 7 and Ubuntu


This guide will show you how I installed OSX Snow Leopard, Windows XP, Windows 7 and Ubuntu using one hard drive, selecting the OS at boot time using GRUB.


Requirements

A hard drive large enough to use all 4 Operating Systems.
Installation discs for
Windows 7
Windows XP


Install Hazard OSX Snow Leopard

Insert and boot from the Hazard Snow Leopard installation disc.

The first thing we need to do is prepare the drive for the installations. Start the disk utility from the Utilities menu.



Select your hard drive, then partition tab.  Set the volume scheme to 6 partitions



Click the options button, then select Master Boot Record for the partition scheme.



Set up the 6 partitions as below.  Feel free to allocate more or less for each operating system. 

Note 1: The partition reserved for the Linux swap space should be roughly the same as the amount of RAM you have in your system.
Note 2:  If you only want to install OSX by itself, you can just allocate all your drive to the 1 partition using the Mac OS Extended (Journaled) filesystem.

Label
Size
Filesystem
OSX
40 GB
Mac OS Extended (Journaled)
XP
15 GB
MS-DOS (FAT)
WIN7
80 GB
MS-DOS (FAT)
SWAP
2 GB
MS-DOS (FAT)
UBUNTU
40 GB
MS-DOS (FAT)
SHARED
123 GB
MS-DOS (FAT)


It’s semi-important that you use FAT32 for the other partitions. The 3 main reasons are..
  1. All the operating system installations can read FAT32, so the disk labels are visible (except in Ubuntu) when you’re selecting the installation partition, which makes things much easier.
  2. Windows installers can reformat the FAT32 partitions directly.  Using HFS+ for example, you need to recreate the partition before formatting to NTFS.
  3. Windows 7 can’t be installed to FAT32, so the installer totally ignores those partitions. Everything is set up on that one partition, without any unexpected dependancies on others.

Click “Apply”, then “Partition” in the confirmation dialog. Close the disk utility to return to the setup.

Click continue and accept the license agreement.

Your newly created partition labelled “OSX” should be selectable as an installation destination.  Select it and click “Continue”.



On the next screen click the “Customize” button and select the options needed for your system. 



The configuration below is for my AMD system with an Nvidia graphics card.

Note: If you have an Intel CPU or ATI card etc. you’ll need to experiment with different options.  If things don’t work correctly after the installation, you’ll need to start over.  I’m afraid there isn’t much information out there on what each of the options are.  Bare in mind that you’ll need to install a boot loader, custom kernel (if required), graphics and sound drivers.

Kernel -> Legacy_Kernel_10.2.0
Graphics_Drivers -> NVEnabler
Audio_Drivers -> VoodooHDA
System_Support -> CMOS_Reset_Fix -> ElliotForceLegacyRTC
System_Support -> SATA_ATA_Fix -> Legacy_AHCI_SATA_Fix
AMD



Click the Done button and then install.



The installer only takes a few minutes.  After the initial user configuration, you should have a fully working OSX Snow Leopard on your PC.




Install Windows 7


The Windows 7 installation is quite straight forward.  Insert and boot from the installation disc.

Select your installation language and when you get to the sceen shown below, select “Custom (advanced)”.



On the partition selection screen, select the partition labelled “WIN7” that you created earlier.  You’ll notice that Windows can’t be installed on this parition because it’s FAT32.  Click “Drive options (advanced)”, then “format”.  Now the partition is ready, so click “Next”.



Once Windows 7 is installed, there’s one final important step before installing Windows XP.

Go to the start orb, right click on Computer and select “Manage”.  In the drive management page, right click on the partition labelled “XP” and set partition as active.  This is needed so that the Windows XP installation leaves the Windows 7 partition untouched.



Note: After this step, neither Windows 7 or OSX will boot, but it’ll all work out in the end.


Install Windows XP


Insert and boot from the XP installation disc.

When you reach the partition selection screen, highlight the partition labelled “XP” and press enter.

Note:  Make sure the XP partition has the drive letter “C:”, otherwise you’ll need to boot back into Windows  7 and follow the instructions to make the XP partition active before continuing.  If you ignore this warning and install Windows XP anyway, then grub won’t be able to boot the Windows 7 partition and you’ll need to start over from the Windows 7 installation again.



It’s up to you how you format the partition, but personally I’d choose the NTFS quick format option.



After the installation, Windows XP should boot OK.



Install Ubuntu


Insert and boot from the Ubuntu disc.

Choose to install Ubuntu.



On the preparation screen, theres a couple of options.  Make your choices and click “Continue”

On the installation type screen, select “Something else” and continue.



Now it’s time to set up the Linux partitions. 

Select the 2GB swap partition you created earlier (as FAT32). Click “change” and use as “Swap area”.  Click OK.



Select the 40 GB Fat32 partition directly after the swap area.  Use as “Ext4 journaling file system”, tick “Format the partition” and set the mount point to “/” (root).  Click OK.



Make sure the “Device for boot loader installation” is set to the whole drive. eg. “/dev/sda”, not “/dev/sda1” or similar.

Click “Install now”, follow the user setup instructions and wait for the installation to complete.

Note: After the reboot, don’t try to load any other OS from grub just yet.  Especially OSX, because it totally messed up my CMOS bad enough that Windows won’t install on the drive afterwards.  I had to hard reset the CMOS on my motherboard to get things back to normal.


Set up GRUB


At this point, your GRUB menu should look something like this.



Everything should work as expected, except the Mac OS X entries.  These entries might work fine on a mac, but they don’t work on a PC.  So lets fix it..

Boot into Ubuntu, if it’s not already loaded.

Start a terminal and enter “sudo gedit /boot/grub/grub.cfg”

Note 1: You start the terminal quickly by pressing CTRL+T.
Note 2:  This isn’t the “proper” way to do this because the grub.cfg file is regenerated when you run update-grub.  Since it’s so quick and easy to apply the changes to the file after the update, I didn’t look into how to do it the proper way..



Make the  following changes..

On line 13
set default="0"
Change to
set default="${saved_entry}"

This sets the last selected OS as default after reboot.  For each OS you want to include in this, insert a line after the menuentry command “savedefault”.

menuentry 'Ubuntu, with Linux 3.2.0-29-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
      savedefault # insert this line
      recordfail
      ..
      ..
      ..
}

Find the first menu entry for Mac OS X.  Delete everything from “load_video” down to the closing brace. And enter the line “multiboot /boot”.  The whole menu entry should look something like this.

menuentry "Mac OS X (on /dev/sda1)" --class osx --class darwin --class os {
      insmod part_msdos
      insmod hfsplus
      set root='(hd0,msdos1)'
      search --no-floppy --fs-uuid --set=root 17c2176a44ee833a
     multiboot /boot
}

Delete the other Max OS X menu entry because it’s not needed and save the file.

You should now be able to boot into OSX, Windows XP, Window 7 or Ubuntu from the GRUB menu.

This is how my final menu looks.




menuentry 'Ubuntu, with Linux 3.2.0-29-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
      savedefault
      recordfail
      gfxmode $linux_gfx_mode
      insmod gzio
      insmod part_msdos
      insmod ext2
      set root='(hd0,msdos6)'
      search --no-floppy --fs-uuid --set=root 5ffb7144-7086-4352-8a28-ad9936c68303
      linux /boot/vmlinuz-3.2.0-29-generic-pae root=UUID=5ffb7144-7086-4352-8a28-ad9936c68303 ro   quiet splash $vt_handoff
      initrd      /boot/initrd.img-3.2.0-29-generic-pae
}

menuentry 'Ubuntu, with Linux 3.2.0-29-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
      recordfail
      insmod gzio
      insmod part_msdos
      insmod ext2
      set root='(hd0,msdos6)'
      search --no-floppy --fs-uuid --set=root 5ffb7144-7086-4352-8a28-ad9936c68303
      echo  'Loading Linux 3.2.0-29-generic-pae ...'
      linux /boot/vmlinuz-3.2.0-29-generic-pae root=UUID=5ffb7144-7086-4352-8a28-ad9936c68303 ro recovery nomodeset
      echo  'Loading initial ramdisk ...'
      initrd      /boot/initrd.img-3.2.0-29-generic-pae
}

menuentry "Mac OSX – Snow Leopard (on /dev/sda1)" --class osx --class darwin --class os {
      savedefault
      insmod part_msdos
      insmod hfsplus
      set root='(hd0,msdos1)'
      search --no-floppy --fs-uuid --set=root 17c2176a44ee833a
     multiboot /boot
}

menuentry "Windows XP 32-bit (on /dev/sda2)" --class windows --class os {
      savedefault
      insmod part_msdos
      insmod ntfs
      set root='(hd0,msdos2)'
      search --no-floppy --fs-uuid --set=root DCD882AFD882878A
      drivemap -s (hd0) ${root}
      chainloader +1
}

menuentry "Windows 7 64-bit (on /dev/sda3)" --class windows --class os {
      savedefault
      insmod part_msdos
      insmod ntfs
      set root='(hd0,msdos3)'
      search --no-floppy --fs-uuid --set=root 5AE6D283E6D25EB7
      chainloader +1
}