This tutorial is for installing OS X Snow Leopard on a PC using a USB flash drive. It's an update of my similar tutorial for Leopard at http://www.insanelym...howtopic=165676 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), as well as 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 is available for less than $20.
These steps are based on my experience doing installs using an Intel D975XBX2 motherboard (Bad Axe 2) with a Core 2 Quad Q6600 processor. I've tried to generalize what worked well for me into a tutorial. The information here comes from a variety of sources, but munky's tutorial at http://www.insanelym...howtopic=127330 was particularly helpful. I've 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.
Please let me know about any problems with this tutorial and I'll make updates as needed.
Change Log
2009-11-27: Initial version
Requirements
* The BIOS in your motherboard must support booting from a USB drive
* Snow Leopard 10.6 retail DVD
* 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 drive for the final installation will work.
* Access to an existing installation of Snow Leopard. Most of these steps don't require Snow Leopard. However one step, building the initial kernel extensions cache, must be done using Snow Leopard.
Before starting you need to know what modifications are needed for OS X to run on your hardware. At a minimum, some number of kernel extensions (kexts) need to be replaced. You may need to add device strings to com.apple.Boot.plist, or add files to the OS X root directory. If you already know what changes need to be made for your hardware this should go very smoothly. If not, check this forum to find out what has worked for others with similar hardware. I'll include what was required for my machine.
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.
1. Connect the USB drive to the OS X machine. If a window comes up that says the disk is not readable, click on Ignore.
2. 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. The drive is listed immediately above any partitions on it (there may be none.) 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.
3. Click on Partition to the top right, then under Volume Scheme select 2 Partitions. Click on Options... at the bottom and select GUID Partition Table, then click on OK.
4. 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.
5. 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 in Leopard and 7.57 GB in Snow Leopard. Click on the usbboot partition again and verify its size is 512MB (Leopard) or 500MB (Snow Leopard.)
6. 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.
7. For each partition on the USB drive, "usbboot" and "OS X Install Image", right click or control click on it on the desktop and select Get Info. In the info window, if necessary expand Sharing & Permissions by clicking on the arrow at 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. Be sure to do this for both partitions.
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 Optional Installs folder is not copied. After OS X is installed, the retail DVD can be used for the optional installs. Also, the latest version of Xcode Tools (one of the optional installs) can be downloaded from Apple after getting a free ADC membership.
8. 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:
sudo -s
and enter your password. This provides root privileges for commands.
9. Use this command to prevent "Optional Installs" from being copied. It creates a file where the "Optional Installs" folder would be copied, and results in saving 760MB. This can be skipped if the USB drive is 9GB or larger, or if you won't be copying large files to the USB drive. Enter:
touch "/Volumes/OS X Install Image/Optional Installs.localized"
10. 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:
ditto -V "/Volumes/Mac OS X Install DVD" "/Volumes/OS X Install Image"
-V is just to show detailed progress information. That's useful, because this takes a long time.
Initial Customization of the Retail Image
This step is to make any changes to the retail image which are required to get Snow Leopard to boot on your machine. Because Chameleon is being used, normally little or no customization is needed to get Snow Leopard to boot. We'll assume that no kernel extensions must be added or removed in order to get Snow Leopard to boot (because Chameleon will handle that.) For my machine, Chameleon does not handle the kernel extension changes needed to get sound to work, but that's not necessary for booting.
For my machine I add dsdt.aml to the OS X root directory. DSDT Patcher was used to create dsdt.aml. To copy dsdt.aml or other files to the USB image root, in the Finder just drag them to OS X Install Image.
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. These additional commands must be copied from a Snow Leopard installation. While the additional commands can be very useful, they are not required for the other steps listed here.
11. Issue this command (optional, requires using Snow Leopard):
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
12. 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-RC3-r658-bin.tar.gz. Double-click on the file to expand it and create a Chameleon folder (if that didn't happen automatically.) 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.
13. 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.
14. 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.
15. For Snow Leopard, the PC EFI 10.5 boot file from Netkas (netkas.org) replaces the boot file from Chameleon. Rename the boot file from Chameleon in the Finder or in Terminal:
mv /Volumes/usbboot/boot "/Volumes/usbboot/Chameleon boot"
Then download the PC EFI 10.5 boot file and use the Finder to drag it to usbboot.
16. (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
After the "w" command, respond "y" if you're asked if it's ok that a reboot will be needed. At this point the USB drive is bootable and will run Chameleon, but customization is needed before it can boot OS X successfully.
Add Customizations for Chameleon to Load
These steps install the kernel extensions and com.apple.Boot.plist needed for your hardware.
17. 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. If you use smbios.plist, copy it into the Extra folder. The Chameleon Themes folder can also be copied to Extra to allow using different themes. Authenticate to the Finder when asked to.
For my machine I used these kernel extensions from Chameleon's Optional Extras:
AHCIPortInjector.kext
Disabler.kext (the 10.6 version)
IOAHCIBlockStorageInjector.kext
Also these from the forum or other web sites:
a patched copy of IOATAFamily.kext with AppleIntelPIIXATA removed
OpenHaltRestart.kext
fakesmc.kext
My smbios.plist specifies the memory speed is 800:
<?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>SMmemspeed</key> <string>800</string> </dict> </plist>
com.apple.Boot.plist specifies booting in 32-bit mode and also includes an EFI string generated by OSX86Tools:
<?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</string> <key>Kernel Flags</key> <string>-x32</string> <key>device-properties</key> <string>insert your EFI string here</string> </dict> </plist>
18. Set permissions. Enter:
chown -R root:wheel /Volumes/usbboot/Extra
chmod -R 755 /Volumes/usbboot/Extra
19. Chameleon requires that a kernel extension cache be built for the kernel extensions. The cache must be built in Snow Leopard. USING SNOW LEOPARD enter:
kextcache -m /Volumes/usbboot/Extra/Extensions.mkext /Volumes/usbboot/Extra/Extensions
Warning messages are normal for the kextcache command.
20. Set permissions for the cache:
chown root:wheel /Volumes/usbboot/Extra/Extensions.mkext
chmod 644 /Volumes/usbboot/Extra/Extensions.mkext
Disconnect the USB Drive
21. 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 desktop, 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 finally 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 and run Chameleon should work even if it turns out there is a problem getting OS X to run.
22. Boot from the USB drive. The Chameleon boot screen should appear. It should have an icon for OS X Install Image, and may have icons for other partitions on hard drive. If necessary, use the left and right arrow keys to select OS X Install Image. To enable verbose boot messages (useful for debugging), 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 kexts or other customization for your hardware.
23. Continue to the screen which says "Install Mac OS X", and select the hard drive or partition you want to use for OS X. Notice that there is a Customize button which provides options you may want to use. The Rosetta option is necessary for running PowerPC applications. 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 "Install Mac OS X", and any new partitions you created should be displayed.
24. 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.
25. After the installer copies files it will reboot your machine. When the machine reboots, select the icon for the new installation in Chameleon. The installation should complete and run the interactive setup.
26. Once the installation is complete, use System Preferences to run Software Update. Install all the updates, rebooting as often as needed. For some system updates and security updates, it's normal for the update to reboot your machine before returning to the desktop again.
Finish the Installation
If your machine requires kernel extension changes not handled by Chameleon, make then now. Besides making changes to the boot volume, you may also want to make the same changes to "OS X Install Image" for when you boot from the USB drive. The kernel extensions are in /System/Library/Extensions. If you have no kernel extension changes, skip to step 31.
While you're making changes to extensions, OS X may warn you that new extensions are unusable. Those warning can be ignored because these commands will fix the extensions.
27. Set permissions for any extensions you added to the install image. Enter these commands in terminal:
sudo -s
chown -R root:wheel /Volumes/"OS X Install Image"/System/Library/Extensions/xxxxxx
chmod -R 755 /Volumes/"OS X Install Image"/System/Library/Extensions/xxxxxx
Do these commands for each extension added, with "xxxxxx" replaced by the name of the extension.
28. Rebuild the extensions cache for the install image. In Terminal enter:
sudo -s
kextcache -m /Volumes/"OS X Install Image"/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /Volumes/"OS X Install Image"/System/Library/Extensions
29. Set permissions for any extensions you added to the OS X installation. Enter these commands in terminal:
sudo -s
chown -R root:wheel /System/Library/Extensions/xxxxxx
chmod -R 755 /System/Library/Extensions/xxxxxx
Do these commands for each extension added, with "xxxxxx" replaced by the name of the extension.
30. Rebuild the extensions cache for the OS X installation. In Terminal enter:
sudo -s
touch /System/Library/Extensions
In this case the kextcache command is not needed because OS X will automatically rebuild the cache of the boot volume when it sees the Extensions folder has been updated.
For my machine, I had to make kernel extension changes to get sound to work. I removed AppleHDA.kext, and added the 64-bit version of VoodooHDA.kext.
31. If you always want to boot OS X using the USB drive, you're done! When booting just select the OS X you 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.
Install Chameleon on the Hard Drive
These steps set up the hard drive so you don't need to boot from the USB 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.
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.
32. Run Terminal with root privileges. In Terminal enter:
sudo -s
33. 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.
34. 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
35. 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.
36. 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
37. (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
38. Unmount the EFI partition and delete the directory. Enter:
sync
umount -f /Volumes/EFI
rmdir /Volumes/EFI
39. Done! Reboot OS X, and 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 option to set the default partition in the boot menu.
40. 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
41. To set 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. Other Chameleon options can be added in the same way.
42. 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!



Sign In
Create Account












