Mythic Beasts

A walk through for installing mb_boot_tv onto an Apple TV.

James McKenzie,

We are planning to start offering dedicated hosting on Apple TVs shortly, check our services soon for prices.

Creating a bootable USB stick for the AppleTV

Prerequisites

sh-2.05b# md5sum boot.efi 
280323d8700e4cfef15116f7e50590e3  boot.efi
sh-2.05b# ls -l boot.efi
-rw-r--r--  1 root root 298800 May  2 15:38 boot.efi
sh-2.05b#

Step 1

get a copy of the source code and untar it someehere.
sh-2.05b# wget http://www.mythic-beasts.com/resources/appletv/mb_boot_tv/mb_boot_tv-1.0.7.tar.gz
[...]
sh-2.05b# tar xfz mb_boot_tv-1.0.7.tar.gz
sh-2.05b# cd mb_boot_tv-1.0.7
sh-2.05b#

Step 2

place the relevant parts in the relevant directories
sh-2.05b# cd usb-stick
sh-2.05b# wget http://www.mythic-beasts.com/resources/appletv/mb_boot_tv/mb_boot_tv.gz
[...]
sh-2.05b# gzip -d mb_boot_tv.gz
sh-2.05b# cp /from/somewhere/boot.efi NODISTRIB/boot.efi
sh-2.05b#

Step 3

insert the usb-key and find it's raw device name (NB: if you get this wrong you may well trash the filesystems on your OS X machine, you might do that anyway so be warned). Then run the install script. (You need to be root for this bit). While the script runs you'll get some dialogue boxes that pop up on the screen, just click ignore. (here it's called /dev/disk2)
sh-2.05b# ./makestick /dev/disk2
+ D=/dev/disk2
+ diskutil unmountDisk /dev/disk2
Disk /dev/disk2 unmounted
+ gpt destroy /dev/disk2
+ gpt create /dev/disk2
+ gpt add -b 34 -s 163840 -i 1 -t 5265636F-7665-11AA-AA11-00306543ECAC /dev/disk2
++ gpt show /dev/disk2
++ tail +6
++ head -1
++ awk '{ print "-b ",$1," -s",$2 }'
+ A=-b  163874  -s 343997
+ gpt add -b 163874 -s 343997 -i 2 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk2
+ sleep 1
+ newfs_hfs -v Patchstick-root /dev/disk2s1
Initialized /dev/rdisk2s1 as a 80 MB HFS Plus volume
+ newfs_hfs -v Patchstick /dev/disk2s2
newfs_hfs: /dev/disk2s2 is mounted on /Volumes/Patchstick
+ diskutil unmountDisk /dev/disk2
Disk /dev/disk2 unmounted
+ gpt show /dev/disk2
   start    size  index  contents
       0       1         PMBR
       1       1         Pri GPT header
       2      32         Pri GPT table
      34  163840      1  GPT part - 5265636F-7665-11AA-AA11-00306543ECAC
  163874  343997      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  507871      32         Sec GPT table
  507903       1         Sec GPT header
+ mkdir -p mnt
+ mount_hfs /dev/disk2s1 /var/root/fish/mnt
+ cd mnt
+ mkdir -p sbin usr/lib/system System/Library/Extensions stuff etc dev OSBoot
+ ln -sf sbin bin
+ cp ../mb_boot_tv mach_kernel
+ cp ../NODISTRIB/boot.efi boot.efi
+ cat
+ cd /System/Library/Extensions/
[...]
+ cd System/Library/Extensions/
+ tar xfpB -
+ cp /bin/bash /bin/chmod /usr/sbin/chown /bin/cp /sbin/mount /sbin/mount_hfs /sbin/mount_devfs /bin/sleep /sbin/umount /bin/sync sbin/
+ cp /usr/lib/dyld /usr/lib/libSystem.B.dylib /usr/lib/libncurses.5.4.dylib /usr/lib/libgcc_s.1.dylib usr/lib/
+ cp /usr/lib/system/libmathCommon.A.dylib system/
+ cd ..
+ umount /var/root/fish/mnt
+ diskutil unmountDisk /dev/disk2
Disk /dev/disk2 unmounted
+ rmdir mnt
+ echo you can now remove the stick
you can now remove the stick
sh-2.05b#

Finish

That's it, stick the stick in a virgin Apple TV, power cycle it and mb_boot_tv should start running, if it doesn't try holding down the Menu and - buttons on the remote control to force a recovery boot

Copyright © 2000-2006 Mythic Beasts Ltd. All Rights Reserved.