Difference between revisions of "Booting from a USB Thumbdrive"

From AwkwardTV
Jump to: navigation, search
(The image itself)
m (The image itself)
Line 22: Line 22:
 
Note that as is, the recovery partition image won't boot completely from USB, since the kernel basically cuts its own head off when it disables USB.
 
Note that as is, the recovery partition image won't boot completely from USB, since the kernel basically cuts its own head off when it disables USB.
  
== The image itself ==
+
== The image itself (sized for 256MB Flash)==
  
 
I don't have any hosting at the moment, and the complete image is only about 6K compressed, so I've base-64 encoded it and embedded it in the text.  All you need to do is decode and decompress the image, then write it to a storage device of your choice.
 
I don't have any hosting at the moment, and the complete image is only about 6K compressed, so I've base-64 encoded it and embedded it in the text.  All you need to do is decode and decompress the image, then write it to a storage device of your choice.

Revision as of 18:31, 3 April 2007

Booting from a USB Thumbdrive

A bit of info on how the boot process works

Background reading:

If the system is booted with the "Menu" and "Minus" keys on the remote held down, it checks for a FAT32 or HFS partition with a Partition Type of {5265636F-7665-11AA-AA11-00306543ECAC}, first on a USB storage device, then on the internal HDD. If such a partition is found, it's mounted and a file called "boot.efi" is read from the root folder and executed.

A bit of info about the image

It's simple enough to create a GPT on a USB thumbdrive with the required attributes. I used GNU Parted on Linux, and I'm sure equivalent tools exist for Mac and Windows. The tricky part is making the image in such a way that it'll boot in the AppleTV and be easy to deal with if you don't have a Mac handy. The latter requirement basically rules out HFS/HFS+, since Linux support is spotty and Windows support is non-existant, so I chose to use FAT32.

Windows has had some level of support for GPT disks for some time now, but it uses the Partition Type indicator to determine the type of the filesystem. Since we have to set this to the value for a recovery partition, Windows will refuse to recognize the partition as FAT32, although Linux will happily mount it anyways.

My first thought was to get rid of the "Protective MBR" partition table that GPT uses to hide itself from older partitioning tools and replace it with a valid MBR partition table that points to the FAT32 partition. Thus, the drive would have two partition tables, each pointing to the same partition. With this in place, the thumbdrive was mountable both in Linux and Windows, but the AppleTV apparently checks for the 0xEE partition in the MBR before trying to use the GPT.

In the end, I was able to create a MBR that contains the 0xEE partition required to get the AppleTV to load the GPT, but instead of setting the protective partition to fill the disk, I made it very small, then added a second partition in the MBR's remaining space that points to the FAT32 partition. Now, it's visible to Windows (MBR table), Linux (either table), and the AppleTV (GPT). You should be able to plug a thumbdrive initialized with this image into any Windows box (I've only tested with Vista Ultimate 64-bit) and copy over the necessary files from the AppleTV recovery partition (boot.efi, com.apple.Boot.plist, BootLogo.png, and mach_kernel.prelink). After that, you can plug the thumbdrive into the AppleTV and reboot it while holding down "Menu" and "Minus" on the remote to boot from the thumbdrive.

Note that as is, the recovery partition image won't boot completely from USB, since the kernel basically cuts its own head off when it disables USB.

The image itself (sized for 256MB Flash)

I don't have any hosting at the moment, and the complete image is only about 6K compressed, so I've base-64 encoded it and embedded it in the text. All you need to do is decode and decompress the image, then write it to a storage device of your choice.

If you have hosting available, please feel free to host the image elsewhere and remove this big blob of text.

I have hosted the image (assuming I encoded it correctly) here (Right Click Save As), please be gentle on my server! My host may force me to take it down so please mirror it.

Mirrored Here (still have to right click, save as) - MrZarquon

File: Hybrid.img.bz2

QlpoOTFBWSZTWWAattkAABn//////////////////f/////////////v////////////4AneAH1e
3zp4B9EoC74eYFNgyAn3iKiZNTxTEBp6TRgjTCejJqYmJ6RiYmmJppjJpMjQZMnoExMAjNCGmjR6
T0TJ6BPRMNTCBoyemoeoDCYjBNMDQjJiZGDRGQGTTUMkeoA0DQ0NMmmAmg9RoNGjZQaaaZ6QbU/E
UaZpko00AaaPRoR6mTJ6m0IGjTT0RoMQBp6mgaBoMjQDQAAaGjQaNAGqIKP0aSPJPGRtUeqeo8ib
ChpkeoDygGgNNAaMQPUAAzUDQAAAyAAaDTQA0BkyAeUAAAAaNNAaANHqAA1QYhkwgSYE0U9qegGi
mnkagB6jRoaAyNGag0A9TQBoDEPUaAAAAGgAaAAAAGjQAANAANAABkEikEySbSnmlGynknqNGTIA
NDNR6aamQZNNDQAaGgaAaaBpowmnlGmmgDTRoyGg00AAMgaaaGgAABoAaaGgGjEyCVImExNGp4U9
R6EBG1AaNNJkDyjTMUyaNqD1AAb1QaHqPU09QeT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