User:Outragedtony/Creating Chameleon Boot Media
This guide explains how to create CD's and USB drives booting Chameleon 2 with different operating systems. Basic understanding about how Chameleon works is expected. Before creating the boot media, collect the configuration files, kext's and other customizations you will need and organize these files as Chameleon expects them. In short, you should have one Chameleon root folder containing the stage2 bootloader file and the Extra/... folder with all the other stuff inside. Download Chameleon 2 from here. Also, check out the utilities to create BootCDs made by Chameleon Users (under #References).
The Chameleon Boot CD allows you to install Mac OS X from a retail DVD. After Chameleon is booted, eject the CD and insert the retail OS X DVD and press F5 to rescan the optical drive. Make sure to have Chameleon's "cdboot" stage2 in Chameleon's root folder (instead of "boot" which is used for HD-installation), and set "Rescan" and "Instant Menu" to yes in com.apple.Boot.plist. The CD can also boot operating systems on the hard drive, essential to get access if you somehow screwed up your installation
Mac OS X
1. Open Terminal.app and create the preboot image (in this example, Chameleon's root folder is ~/Desktop/newiso/):
# hdiutil create -size 15m -fs HFS+ -volname Preboot -layout MBRSPUD -attach ~/Desktop/newiso/Extra/Preboot.dmg
2. Create a bootable iso:
# hdiutil makehybrid -o ~/Desktop/Chameleon.iso ~/Desktop/newiso/ -iso -hfs -eltorito-boot ~/Desktop/newiso/cdboot -no-emul-boot -hfs-volume-name "BootCD"
3. Burn Chameleon.iso
1. Get the open-source burning tool InfraRecorder
2. Select Data CD and add the Chameleon files (cdboot & Extra folder)
3. Go to File -> Project Properties -> Boot
4. Add Chameleon's "cdboot" stage2 and set Emulation Type to "None"
5. Burn the CD
1. Use mkisofs to create a bootable iso. Run the following command from the level containing Chameleon's root folder (newiso):
# mkisofs -R -b cdboot -no-emul-boot -boot-load-size 4 -boot-info-table -o chameleon.iso newiso
2. Burn chameleon.iso
Bootable USB Drives
Chameleon USB keys can not boot the retail OS X DVD, but they come in handy as rescue tool to boot into a borked installation. Similarly, if you want to play safe, use them to test new kexts and other customizations for compatibility before applying them to your main chameleon installation. In this case, the stage2 loaders for HD's must be present ("boot" instead of "cdboot") in the Chameleon root directory.
For simplicity, this example uses a single Fat32 formatted partition and MBR. If you experience problems, try with HFS+ partition and/or GPT layout (remember to use boot1h stage1 loader for HFS+ partitions). A great tool for creating GPT partition tables under linux is gdisk.
1. Format the Usb stick to F32:
# mkfs.vfat -F32 /dev/sdx1
2. Copy the contents of Chameleon's root folder:
# cp -r Chameleon/newimg/* /mnt/usb/
3. Unmount the Usb stick:
# sudo umount /dev/sdx
4. Install Chameleon's stage0 boot loader to the usb device:
# dd if=Chameleon/i386/boot0 of=/dev/sdx bs=440 count=1
5. Install Chameleon's stage1 f32 boot loader to the usb partition:
# dd if=/Chameleon/i386/boot1f32 of=/dev/sdx1
Edit .plist files with Windows
UNIX and Mac OS X use the line feed (LF) character to mark the end of a line of text, Windows uses the carriage return (CR) character. Because .plist files must have linefeed characters at the end of every line to be readable by Mac OS X, editing these files with Windows tools can result in headaches. Use Wordpad instead of Notepad, and to be extra sure convert them with dos2unix after editing.
<?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></string> <key>Rescan<key> <string>Yes|No<string> <key>Instant Menu<key> <string>Yes|No<string> </dict> </plist>
USB key as kext testing ground
Using Chameleon-USB keys to test new kexts is a great way to save yourself trouble. Start with the most minimal set of modifications that will let you install OSx, and then work your way up: Always keep your last working "main" configuration in sync with the Chameleon USB key, add one kext at a time onto it, and use it to boot into the installed system. If all goes well, add the kext to the main Chameleon install on the HD and move to the next one. That way, you should minimize major lockups.