This document will describe how to boot from USB on a "virgin" Apple TV. It assumes that you, for the most part, know what you're doing.
Thanks go to mk500 and Jordan (phoem) for testing.
Creating a disk to boot from USB
Notes: There are 2 key ingredients for booting from USB on the AppleTV:
- Your 'root' partition must be a GPT partition of type 5265636F-7665-11AA-AA11-00306543ECAC
- You must patch the OS X installation to allow it to boot from this special partition type
Some helpful tools to know: dd, hdiutil, gpt, disktool, asr
Partition your disk
Purpose: Set up your disk for booting the AppleTV
Notes: Use Disk Utility to partition your disk using "GUID Partition Table"
Create 1 partition, type HFS+ Journaled
If you're using a 5G iPod, this part is already done, skip to loading your OS
If you're working with a disk image (.dmg) you'll need to use the command line gpt tool to create your partitions
Load your operating system
Purpose: You're not going to get very far without installing an operating system
Notes: Loading of OS X and kernel is beyond the scope of this document. See semthex's howto, or use asr.
Once you change the GUID partition type, you cannot use the Mac OSX Installer to install on that volume.
You will need to use the "boot.efi" from an original AppleTV
You will also need a modified kernel, such as this one from semthex with his awesome SSE3 emulator.
Be sure to delete System/Library/Extensions.mkext and System/Library/Extensions.kextcache if they exist on your new drive.
Patch AppleFileSystemDriver
Purpose: AppleFileSystemDriver.kext must be patched in order for the kernel to recognize the special partition type
Notes: This is obviously already done in the original AppleTV kernel.
If you're using semthex's kernel with stock OS X Extensions, you'll need to patch this.
Add the following section to the file System/Library/Extensions/AppleFileSystemDriver.kext/Contents/Info.plist in the IOPropertyMatch array:
Code: <key>media-match</key>
<dict>
<key>IOPropertyMatch</key>
<array>
<dict>
<key>Content Hint</key>
<string>5265636F-7665-11AA-AA11-00306543ECAC</string>
<key>Leaf</key>
<true/>
</dict>
<dict>
<key>Content Hint</key>
<string>Apple_Recovery</string>
<key>Leaf</key>
<true/>
</dict>
<dict>
<key>Content Hint</key>
<string>48465300-0000-11AA-AA11-00306543ECAC</string>
<key>Leaf</key>
<true/>
</dict>
Change Partition Type
Purpose: Now that everything is configured, change the partition type so the AppleTV will recognise it
Notes: Once you do this, the disk (or iPod) will no longer auto mount on your workstation.
Change it back, or mount it with mount_hfs at the command line
Notes: This is non-destructive only if you do it correctly!
Make sure you record all the information output by "gpt show" for your device.
Load and patch your operating system before changing the partition type.
Code: gpt -r show /dev/diskX
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 8192 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
8232 520155 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
528387 520156 3 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
1048543 32 Sec GPT table
1048575 1 Sec GPT header
disktool -u diskX
gpt remove -i 2 /dev/diskX
disktool -u diskX
gpt add -b 8232 -s 520155 -i 2 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/diskX
Plug it in and boot!
Notes: If you've done the above correctly, simply plug it into your AppleTV and boot! You're done!
Create a disk image instead of using a real disk
Purpose: The AppleTV requires a specially configured GPT (GUID) partition table
Notes: Begin by creating and mounting your disk image. This example is a 2GB disk image
Code: dd if=/dev/zero of=outfile.dmg bs=1024k count=2048
2048+0 records in
2048+0 records out
2147483648 bytes transferred
hdiutil attach -nomount outfile.dmg
/dev/diskX
The image will appear as a regular block device node (/dev/diskX) and you can treat it as a disk
Now use 'gpt' to create your partitions. The first partition is probably unneeded now, but might be useful in the future.
This example will create a GPT partition table with a 4MB EFI system partition, 1 2044MB "Recovery" partition
Adjust your sizes accordingly. Note the partition types here, because if you use the "Recovery" type, your partition will not mount.
Code: gpt create /dev/diskX
gpt add -b 40 -s 8192 -i 1 -t "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" /dev/diskX
gpt add -b 8232 -s 4194304 -i 2 -t "48465300-0000-11AA-AA11-00306543ECAC" /dev/diskX
If you did it correctly, it should look something like this:
Code: gpt -r show /dev/diskX
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 8192 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
8232 4194304 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
Format your partitions
Purpose: Create the filesystems to hold your OS X files
Notes: Obviously, skip this step if you used your iPod or other pre-configured disk
Code: newfs_msdos /dev/rdiskXs1
newfs_hfs -v "Recovery" /dev/diskXs2
Modified 2007-12-14 14:06:35
Contact turbo here