USB Flash Drive-Based Chameleon 2.0RC2 / Retail Install
This tutorial is for installing OS X Leopard 10.5.6 on a PC using a USB flash drive.
It was penned by dougaa in its entirety and can be found on the insanely mac.com forum Â
Add Customizations for Chameleon to Load
These steps install the kernel extensions and com.apple.Boot.plist files needed for your hardware. If you added a replacement kernel in step 11, you should have a com.apple.Boot.plist file which specifies the name of the replacement kernel. For my P4 install, com.apple.Boot.plist contains:
The end result is a flash drive which can be used to boot your PC using Chameleon and do maintenance on OS X (eliminating the need for an extra OS X partition), and Chameleon and OS X installed on your hard drive. The flash drive offers several advantages over a DVD. It is easier to set up, boots much faster than a DVD, and makes it easy to try different kexts or other changes. At the time of this writing, the required 8GB USB flash drive costs less than $20.Â
For Snow Leopard, dougaa has written a similar tutorial http://www.insanelymac.com/forum/index.php?showtopic=199832.
These steps are based on my experience doing installs using an Intel D915GUX motherboard with a Pentium 530J processor, and also an Intel D975XBX2 motherboard (Bad Axe 2) with a Core 2 Quad Q6600 processor. dougaa has tried to generalize what worked well into a tutorial. The information here comes from a variety of sources, but munky's tutorial at http://www.insanelymac.com/forum/index.php?showtopic=127330 was particularly helpful. dougaa concentrated on the steps to get an initial install of OS X running, even if some hardware, such as sound, may not work initially. These steps and Chameleon are compatible with using EFI, but setting up EFI is not covered.
While the retail DVD installs 10.5.6, this method works for 10.5.8. After installing 10.5.6, Software Update can be used to update to 10.5.8 without taking any special precautions (thanks to Chameleon).
Please let me know about any problems with this tutorial and I'll make updates as needed.
Change Log
2009-05-15: Minor updates for 10.5.8 and Chameleon RC2
2009-05-15: Added a note that this works for 10.5.7
2009-05-15: Added a note about hard drive installation with RAID
2009-05-09: Initial version
Requirements
* The BIOS in your motherboard must support booting from a USB drive
* Leopard 10.5.6 retail DVD
This may also work with the original 10.5.0 DVD, but dougaa hasn't tested that.
* An 8GB or larger USB drive which can be completely erased, I assume most people will use a flash drive, but any drive separate from the one you are installing on will work.
* Access to an existing installation of 10.5.6
Access is only needed long enough to get the USB drive set up.Â
Before starting you need to know what modifications are needed for OS X to run on your system. At a minimum, some number of kernel extensions (kexts) need to be replaced. You may also need a replacement kernel such as the excellent Voodoo kernel. Also, you may need to add device strings to com.apple.Boot.plist. If you already know what changes need to be made for your hardware this should go very smoothly. If not, do an initial install using one of the Leopard distributions. The distributions are a source of kexts and kernels, and by changing installer options you can determine what works best on your hardware. Also, the Leopard system you install using the distribution can be used to perform these steps. Once the flash drive is set up the distribution install can be replaced by the retail install.
Partition the USB Drive
These steps create a 512MB partition on the USB drive for Chameleon and any files needed to customize your OS X installation. They also create a 6.66 GB or larger partition for a copy of the OS X retail install DVD.
Connect the USB drive to the OS X machine. If a window comes up that says the disk is not readable, click on Ignore.
Open Disk Utility (under Utilities in the Finder's Go menu.) Locate the USB drive in the left section of the Disk Utility window and click (once) on the drive itself. Info about the drive should appear at the bottom of the window, and you can verify it's the correct drive. BE CAREFUL to select the correct drive, because the next steps will delete all the data on the drive you select.
Click on Partition to the top right and under Volume Scheme select 2 Partitions. Click on Options... at the bottom and select GUID Partition Table, then click on OK.
Click on the Untitled 1 partition, then set its name to usbboot, the Format to Mac OS Extended (Journaled), and the size to .5 GB.
Click on the Untitled 2 partition and set its name to "OS X Install Image" and the Format to Mac OS Extended (Journaled). Its size should be the remaining space available on the drive. For my 8GB flash drive its size is 6.98 GB. Click on the usbboot partition again and verify its size is 512MB.
Click on Apply. A window will appear asking you to confirm partitioning the disk. Verify that it names the correct disk. Once again, BE CAREFUL. Then click on Partition. When the partitioning is complete, the new partitions, "usbboot" and "OS X Install Image", will appear on the desktop. Quit from Disk Utility.
For each partition on the USB drive, "usbboot" and "OS X Install Image", right click or control click on it and select Get Info. In the info window, if necessary expand Sharing & Permissions by clicking on the arrow on the left. Click on the lock at the bottom and enter your password to unlock it. Then uncheck the box that says "Ignore ownership on this volume" and close the info window.Â
Copy the Retail Image to the USB Drive
These steps copy the contents of the retail DVD to the USB drive partition. To save space, the Xcode Tools optional install is not copied. After OS X is installed, the original retail DVD can be used to install Xcode Tools. Also, the latest version of Xcode Tools can be downloaded from Apple after getting a free ADC membership.
At this point we need to switch to the command line using the Terminal application. Open Terminal (under Utilities in the Finder's Go menu.) Then enter:
and enter your password. This provides root privileges for commands.
Execute these commands to prepare for copying the retail DVD. They create a file where the "Xcode Tools" directory would be copied. The copy command we'll use won't replace a file with a directory, thus the file prevents the "Xcode Tools" directory from being copied, saving almost 1GB. Enter:
CODE
sudo -s
install -d "/Volumes/OS X Install Image/Optional Installs.localized"
touch "/Volumes/OS X Install Image/Optional Installs.localized/Xcode Tools"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kernel</key>
<string>mach_kernel.voodoo</string>
<key>Kernel Flags</key>
<string></string>
</dict>
</plist>
Setup the Extra and Extensions folders. Enter:
install -d /Volumes/usbboot/Extra/Extensions
to create the folders. Using the Finder, copy the kernel extensions your hardware needs into the Extensions folder in usbboot/Extra. Copy com.apple.Boot.plist into usbboot/Extra. Authenticate to the Finder when asked to.
For people installing with one of my motherboards, for my D915GUX P4 install I used dsmos.kext, IOATAFamily.kext, IONetworkingFamily.kext, and System.kext from Voodoo.
For the D975XBX2 Core 2 install I used dsmos.kext, IntelCPUPMDisabler.kext, and three kexts from the Chameleon Optional Extras folder: AHCIPortInjector.kext, ATAPortInjector.kext, and IOAHCIBlockStorageInjector.kext.
Set permissions. Enter:
chown -R root:wheel /Volumes/usbboot/Extra
chmod -R 755 /Volumes/usbboot/Extra
Create the kernel extension cache. Enter:
kextcache -a i386 -m /Volumes/usbboot/Extra/Extensions.mkext /Volumes/usbboot/Extra/Extensions
chown root:wheel /Volumes/usbboot/Extra/Extensions.mkext
chmod 644 /Volumes/usbboot/Extra/Extensions.mkext
Warning messages are normal for the kextcache command.
Disconnect the USB Drive
Disconnect the USB drive from the machine used to set it up. Enter:
sync
and if the activity light on the USB drive indicates any activity, wait for it to stop. Then enter:
exit
and quit from Terminal. Drag the two partitions for the USB drive to the trash to eject them. When both no longer appear on the deskop, disconnect the USB drive. If the Finder says the volumes cannot be ejected because they are in use, provided you entered the sync command and waited for disk activity to stop, it's safe to remove the drive. The device removal error that is displayed can be ignored.
Boot the USB Drive and Install OS X
We're ready to boot the USB drive. With the USB drive connected to the PC, boot or reboot it and go into the BIOS settings. Make sure the BIOS is set to allow booting from USB drives, and that the USB drive comes before any hard drives in the boot order. Don't forget to save any changes. If you've carefully followed the above steps, the most likely reason the USB drive won't boot is the BIOS settings. Just getting the USB drive to boot should work even if it turns out there is a problem getting OS X to run.
Boot from the USB drive. The Chameleon boot screen should appear. It should have Apple icons for usbboot and OS X Install Image, and may have icons for partitions on hard drives in the machine. Use the left and right arrow keys to select OS X Install Image. To enable verbose boot messages, type -v, which should appear at the bottom left. Then press return. The install image should then boot. If this hangs or fails in some way, it's likely due to not having the correct kernel or kexts for your hardware.
Continue to the screen which says "Select a Destination", and select the hard drive or partition you want to use for OS X. Notice that there is an Options button which provides options you may want to use. Also, you can run Disk Utility at this time to partition the drive. To do that, select Disk Utility from the Utilities menu. If you partition a drive for OS X, be sure to select a GUID partition table as in step 3 above. When you quit from Disk Utility you will be back at Select a Destination, and any new partitions you created should be displayed.
The installation should proceed and take a while. At the end, you may get an "Install Failed" warning message due to not being able to set the startup disk. That can be ignored provided the reason given is setting the startup disk.
Finish the Installation
If you didn't need to make any changes to the retail disk image (step 11), and you always want to boot OS X using the USB drive, you're done! When booting just select the version of OS X you just installed on the Chameleon boot screen. After booting, the usbboot and OS X Install Image partitions can be ejected by dragging them to the trash.
If you did make changes to the retail disk image, continue with the next step. Otherwise, skip to step 26.
When the computer restarts after the install, once again boot from OS X Install Image. At the Welcome screen, select Terminal from Utilities. In Terminal you already have root privileges.
Make the same changes to the newly-installed OS X as were made in step 11. To install the Voodoo kernel enter:
cp -p /mach_kernel.voodoo /Volumes/"xxx"
where xxx is the name of the partition you installed OS X on. Any files on the usbboot partition are available at /Volumes/usbboot. When you're finished making changes enter:
reboot
Now you can verify the new installation of OS X boots. After rebooting, on the Chameleon boot menu select the partition you installed OS X on. The newly-installed OS X should boot and run the interactive setup.
Install Chameleon on the Hard Drive
WARNING: The directions that follow assume a dedicated hard drive for OS X without any other operating systems. Also, BE VERY CAREFUL if there are any hard drives in the PC with data which needs to be preserved. You should have backups, and not follow these directions unless you are sure you understand the significance of each step.
Also, these directions are not for RAID installs. However, Chameleon will work with RAID. That's documented under "RAID Install" in the README file found in the Chameleon doc folder.
Restart and select OS X Install Image in the Chameleon boot menu. At the Welcome screen, select Terminal from the Utilities menu.
Chameleon will be installed in the EFI partition that Disk Utility creates when there is a GUID partition table. Similarly to step 14, determine the device number for the hard drive which Chameleon will be installed on. Use "diskutil list" and find the drive number for the drive which contains the partition you installed OS X on.
The EFI partition must be changed from FAT32 to HFS+ format. Reformat the EFI partition: be CERTAIN you determined the correct device number, then enter:
diskutil eraseVolume "HFS+" "EFI" /dev/diskXs1
where X is the device number. Mount the partition. Enter:
mkdir /Volumes/EFI
mount_hfs /dev/diskXs1 /Volumes/EFI
Issue these command to install Chameleon in the MBR and the EFI partition. Replace X by the number you determined:
cd /Volumes/usbboot
fdisk -f boot0 -u /dev/rdiskX
dd if=boot1h of=/dev/rdiskXs1
ditto -V /Volumes/usbboot /Volumes/EFI
Fdisk will ask you to confirm that you want to write the MBR. Enter "y" after verifying X is correct.
As in step 16 flag the first MBR partition on the hard drive as active. Type the fdisk command and then each line as shown:
fdisk -e /dev/rdiskX (NB: Ignore any fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory error)
f 1
w
q
(Thanks to munky.) Enter this command to prevent the File System Events Daemon (fseventsd) from logging on the EFI partition, which can cause it to become unmountable:
touch /Volumes/EFI/.fseventsd/no_log
Unmount the EFI partition and delete the directory. Enter:
sync
umount -f /Volumes/EFI
rmdir /Volumes/EFI
Done! Enter:
reboot
then once the system is rebooting remove the USB drive. If necessary, change the BIOS settings so the hard drive with Chameleon will boot first. Booting from the hard drive should result in the Chameleon boot menu, and you can select the partition containing OS X.
Set Chameleon Options
If desired, you can edit com.apple.Boot.plist to set various Chameleon options. The available options are listed in BootHelp.txt, which is in the Chameleon doc folder. I used the options to set the default partition in the boot menu, and also the graphics enabler and built-in Ethernet enabler. The enabler options are new in Chameleon RC2, and with those I no longer needed a device-string in com.apple.Boot.plist. Read Chameleon 2.0-RC2 is available with new features and less bugs on the Chameleon web site for more information about that.
In the newly-installed OS X, run Terminal and mount the EFI partition. Enter:
sudo -s
mkdir /Volumes/EFI
mount_hfs /dev/diskXs1 /Volumes/EFI
For the default boot partition, edit com.apple.Boot.plist. Enter:
diskutil list
In the output from "diskutil list", find the identifier for the partition you want to be the default for booting. Edit /Volumes/EFI/Extra/com.apple.Boot.plist (I used vi), and add the following key/string pair:
<key>Default Partition</key
<string>hd(x,y)</string>
where x and y are the first and second digits from the partition identifier. Add it making sure not to split up an existing key/string pair.
For the graphics and Ethernet enabler options, also in com.apple.Boot.plist. add:
<key>GraphicsEnabler</key>
<string>Yes</string>
<key>EthernetBuiltIn</key>
<string>Yes</string>
Unmount and remove the EFI volume. Enter:
umount /Volumes/EFI
rmdir /Volumes/EFI
When you reboot, the partition you chose should be the one initially selected in the Chameleon boot menu.
Good luck!
This can be skipped if the USB drive is 9GB or larger.
Insert the retail DVD into your DVD drive. "Mac OS X Install DVD" should appear on the desktop. Then copy the contents of the DVD to the USB drive partition. Enter:
-V is just to show detailed progress information. That's useful, because this takes a long time.
Customize the Retail Image
Because Chameleon is being used, little or no customization of the retail image is normally needed. If you can't use the vanilla kernel, you'll need to add a replacement kernel to the retail image. For my P4 install I need to use the Voodoo kernel. For my Core 2 install the vanilla kernel works.
(If you need it.) Get the replacement kernel on the OS X machine, so you can access it in the Finder. It should be named something other than mach_kernel. For Voodoo, it's provided as the file mach_kernel.voodoo. In the Finder, drag the kernel file to "OS X Install Image", so that it's copied to the root of the image partition. Experienced people may want to make additional changes to the retail image at this point.
Add Additional Terminal Commands to the Retail Image
The OS X installation disk contains only a subset of all the Terminal commands included in a full install of OS X. This step makes all the commands available when Terminal is run from the installation disk, so it can more easily be used to setup or repair a hard disk installation. For example, this makes the "more", "emacs", and "vi" commands available. While the rest of these commands can be done from either an Intel or PowerPC machine running Leopard, these additional commands must be copied using an Intel OS X machine. While the additional commands can be very useful, they are not required for the other steps listed here.
Issue this command:
cp -npv /usr/bin/* /Volumes/"OS X Install Image"/usr/bin
This copies only the commands not already present.
Install Chameleon on the USB Drive
Download the current version of Chameleon from the Chameleon Boot Loader web site. Download the bin.tar.gz version. As I write this, the current file is Chameleon-2.0-RC2-r640-bin.tar.gz. Double-click on the file to expand it and create a Chameleon folder. Back now in Terminal, make the Chameleon folder the current directory. Enter "cd" followed by a space, then drag the Chameleon folder to the Terminal window to paste the path, and press return. If this worked correctly, the "ls" command output will include "i386". Enter:
cd i386
to switch to the directory with the files to install.
Determine the device number for the USB drive. Issue the command "diskutil list". The output will show sections beginning with "/dev/diskX", and then the disk partitions. Determine what X is for the USB drive with the usbboot partition. The usbboot partition should be displayed with IDENTIFIER diskXs2, and diskXs3 should be "OS X Install Image". BE CAREFUL to identify the correct disk, because we will be writing to the disk MBR and the boot area of a partition.
Issue these command to install Chameleon in the MBR and the usbboot partition. Replace X by the number you determined. Enter:
fdisk -f boot0 -u /dev/rdiskX
dd if=boot1h of=/dev/rdiskXs2
cp -p boot boot0 boot1h /Volumes/usbboot
Fdisk will ask you to confirm that you want to write the MBR. Enter "y" after verifying X is correct. The boot0 and boot1h files are copied to /Volumes/usbboot not because they are needed now, but so it will be easy to set up a hard drive with Chameleon later.
(Thanks to munky.) Flag the first MBR partition on the USB drive as active This stage may not be necessary for some motherboards, but it's harmless in any case. Enter the fdisk command and then each line as shown:
fdisk -e /dev/rdiskX (NB: Ignore any fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory error)
f 1
w
q
At this point the USB drive is bootable and will run Chameleon, but customization is needed before it can boot OS X successfully.
ditto -V "/Volumes/Mac OS X Install DVD" "/Volumes/OS X Install Image"