Talk:Patchstick/Testing

From AwkwardTV

Jump to: navigation, search

noerde

Contents

Making the patchstick easier to update

To make it easier to update, how about creating a small base partition (with the scripts, launchd, kexts, boot.efi and kernel), and have a second partition with any additional software to copy over to the aTV's internal disk.

June 30 2007: Another Idea would be to create a fully working patchstick image file. Then zero out the boot.efi that is contained within the image, by Using dd (locating it's offset within the image file and running the command: dd if=/dev/zero of=patchstick.img skip=<offset> bs=<filesize> count=1). The result should be a fully working patchstick without the part that makes it illegal.

People then could use their own boot.efi by writing it back to the patchstick.img ( dd if=boot.efi of=patchstick.img sikp=<offest> bs=<filesize> count=1 ) or a small program could be made to inject their boot.efi in.

  • This could solve a lot of issues for non mac users.
  • great idea, whoever suggested this :) I'll get on it right away! - Mactijn 11:53, 9 April 2007 (CEST)
  • is this what you meant ? :) - Mactijn 15:39, 9 April 2007 (CEST)
  • Exactly what I was thinking :) That makes things far easier. I won't be able to play any more until next week though :( Good work! - dobedobedoh 16:19, 9 April 2007 (CEST)

Our over-enthousiastic Marook unfortunately reverted this, and now it's back to one partition again. The script is using 2 partitions though... I will re-update the page as soon as I have a bit of time. -- Mactijn 22:41, 2 July 2007 (CEST)

Boot Progress Indicator

OK, the instructions have changed since I did this last weekend, but when I was running through this using my first-gen iPod Shuffle, there was no clear indicator when the process had finished and it was safe to reboot. My Apple TV showed the grey Apple logo and then the spinner progress indicator, but it never went away. I had left it for 15 minutes before I had assumed it failed or just wasn't showing something on my end. Luckily, it worked, but I had no confirmation. So, either I did something wrong or this needs to be fixed so others don't get confused.

  • Apparently you didn't use the com.apple.Boot.plist on the wiki page. Also, you added a Bootlogo.png. This is a problem right now, since above is only a concept. We're still working on animated installation, but we need a way to put images on the frame buffer. - Mactijn 11:29, 14 April 2007 (CEST)

Thanks, worked great but needed a larger root partition on the stick

Thanks, i followed the procedure and it worked great. The only deviation: required a larger root partition to copy over all the extensions. I suppose your could be choose about what partitions your copy over, but i was too impatient, and just copied over everything. When copying over sshd/perian it output some errors, but they did not matter. cheers,

  • The root partition size is based on copying only the .kext stuff listed on the bottom of the page. -- Mactijn 11:26, 14 April 2007 (CEST)

Patchstick hangs during boot

I have been trying to get this to work on a clean atv box for a couple of days now, and I've run into a problem. The atv is able to boot off the usb disk, but hangs after a certain point. To make matters worse, the text is half off the screen. From what I can see it doesn't appear to get past mounting the root partition Screenshot. Has anyone run into this before, or have any idea what I need to do to get this working?

  • You can't seem to read any errors due to overscanning problems. These problems can be dealt with by using another video mode on startup. Change com.apple.Boot.plist and add:
<key>Graphics Mode</key>
<string>1024x768x32@60</string>

Fiddle with the resolution a bit until satisfied (width x height x depth @ refresh rate). Untested, so your results may vary.


I have the exactly same problem. I found that the launchd script uses the commands sync and echo which are not copied to sbin in the procedure. This doesn't fix the problem. If the launchd file is missing there is a boot error regarding launchd and sbin/mach_int oorosh

  • echo is a built-in in bash, so that shouldn't matter. sync shouldn't be a problem, although I will put it in the procedure. While building patchstick, I had some errors regarding mounting OSBoot as well (unclean journal errors), and what I did was restart my ATV normally, and reboot again with patchstick. I have no previous experience with the fake launchd not starting. please check permissions (chmod 755). -- Mactijn 23:23, 16 April 2007 (CEST)
  • This problem was due to using binaries from OSX 10.4.1, when I used binaries from 10.4.9, launchd worked. --Yogibeer 00:30, 17 April 2007 (CEST)


  • Great job documenting this process so far. I made a patch stick tonight and it worked once, but now when i boot it, it can not mount the OSBoot partition. The error I get is: 'volume on disk0s3 is read-only and journal is dirty. can not mount volume' I've booted back and fourth from ATV OS back to USB patchstick, but the error will not go away. Any ideas? --LiquidIce
  • Mount it read/write (sudo mount -uw /), fsck it (sudo fsck_hfs -f /dev/disk0s3), then reboot cleanly (sudo shutdown -r now).



So I went ahead and followed all the steps laid out here. I plugged the drive into my AppleTV, and did the reboot thing. It restarted, spit out a bunch of text, loaded the kernel, and then spit out more text and froze up. I can't read the last line (text is too fuzzy), but the line before the last is the text output of the /System/Library/Extensions/AppleFileSystemDriver.kext/Contents/Info.plist file (or at least part of it). I can make out <string>IOResources</string><key>IOResourceMatch</key><string>boot-uuid</string><key>media-match</key><dict> then there is a bit more, and then a </dict>. Then it goes to the next line, and has an unreadable text (too small and fuzzy to make out). I have checked, and double checked my info.plist file and it looks ok (compared to what is displayed here, and what is on my machine). After waiting about 3-5 minutes, a new line "waiting for root device" appears. I already have my AppleTV "patched", I just want to put together a thumbdrive easy install for my friends aTV. Thanks for any help here guys - kupan787 (April 20th)


I have the same exact problem - hangs "waiting for root device". Tried unplugging disk and waiting 5 sec - plugging disk back in. I never see the I/O errors. -h3nrch (2007-04-28 20:13 GMT)


No problems whatsoever

This worked beautifully for me, the only thing I could suggest would be to make it disable Watchdog.

ProfessaFresh 17:21, 21 April 2007 (CEST)

Worked but one small issue

At the start of the 'aftermath' section the how-to asks for the patchstick-root partition to be unmounted, (hdiutil unmount diskXs1) but in fact diskXs2 will also need to be unmounted. If any other issues are experienced at this point try unmounting both partitions again and then trying the command which caused the error.


Illegitimate Patchstick Warnings

Its understandable that people working hard to keep this project 100% aboveboard and also stay in good graces with Apple. But these are opportunities to educate and reform the scriptkiddies, not moments to strike out at people who might be less morally upright and congradulate yourself on being both clever and holier-than-thou. Many of these "illegitimate" users are teenagers or pre-teens who will grow up to be outstanding and upright programmers and calling them names now will not reform them or help this project. There is also a legitimate issue in that one cannot (as far as I know) use the software for non-Apple hardware. (as was the case for X86 Tiger install disks) Almost all (perhaps not 100%) users of "pirate" copies of Apple Tv's boot.efi are applying it to Apple hardware and already have a legitimate, purchase of the Apple TV hardware including a copy of the modified, mutant Apple TV boot.efi. There was a similar problem years ago with Apple Boot ROMs and various flavors of Mac 680x0 Linux, and flavors of BSD. At that time Apple had long since abandoned 68k and it seemed outrageous that they would not assist un*x developers- (and in fact slowing MKlinux development and effectively killing A/UX) Right now people seem confident in their ability to work around or find a substitute for boot.efi, but it might not happen, and Apple may stonewall the mod community on this issue forever.


reason of reverting last change

I just reverted an edit by User:Cuvtixo. He removed a remark I put in the wiki, something to do with "morons". This is NOT because I think everyone dealing with these instructions are morons. Really, read again. And also read the AwkwardTV:General_disclaimer while you're at it.

Since Patchstick is my "baby", I tend to take mis/abuse and illegal practices personal. The idea of this page is to get feedback on the method used to construct it, not to actually patch your ATV.

Again, using a patchstick image found on torrent sites is stupid, lazy and most of all, does NOT help the community.

Mactijn 13:39, 6 May 2007 (CEST)

why am I a moron? seriously?

I have the utmost respect for everyone in this site; and I expect to start collaborating soon (I am in the process of installing MythTV frontend in my aTV, and I will share my notes/results here), but...

"If this happened to you: GOOD FOR YOU! Moron. Don't count on Apple to help you."

Ok, now, this is not really fair. I don't have a Mac handy. Macs are ultra-pricey here in Brasil, so none of my friends have a Mac handy. The freely-redistributable patchstick is not yeat available. So, either I wait an undeterminated amount of time, or I open my case (and void my warranty, and I can't count on Apple to help me) or I use one of the floating patchsticks and then I'm a moron. Come on, many bittorrent sites have "comments" sections where people give feedback. I think that a good site with some good comments is a safer option than opening my case. And (I tested it already) the "reset everything" thingy kept working OK.

Sure, I would have preferred to use a all-Free-Software solution, but, for the time being, it's the best that can be done for me. Hell, I'm trying to install Linux as soon as I have enough free time. So, I must ask you humbly, please remove the "moron" comment. It's offensive, it will not prevent anyone from downloading the patchsticks, and it serves no constructive purpose at all. Thanks.

Massa 18:24, 23 May 2007 (CEST)

  • Like I said before, I tend to take abuse/misuse of Patchstick a bit personally. Maybe I shouldn't.

The thing is, Patchstick is currently created by (ab)using (some of) OSX's components. On these components Apple has the copyright. Apple uses that copyright to tell us we can't distribute those components legally. Therefor, using Patchstick by means of a pre-made, downloaded image is illegal (actually that depends a bit on the country you are in), since it is distributed over the net.

Next to that, you are encouraging the use of illegally distributed files. That really has to stop. Since Patchstick is an AwkwardTV project, you are giving AwkwardTV and it's community a bad name in the eyes of our Provider (Apple, inc.). Personally, I really want to stay friends with them, so this community will still have something to hack and tweak. Apple made it quite easy for us, let's keep it easy for them.

Oh, and the instructions on this page serve as a guide. The reason I put this online is so I can get feedback over the process of building a Patchstick. Patchstick isn't usable anyway without the boot.efi file, and you can only legally obtain that by opening your AppleTV, and connect it to another machine.

You are not a moron per se. You probably have the technical skills to create and use Patchstick. Hell, you might even be able to add install scripts for it. But that still doesn't give ou the right to break the law. Instead, help us find a 100% legal way to create Patchstick. I have learnt it can be extremely gratifying to do so, even if it takes a while.

Mactijn 22:52, 23 May 2007 (CEST)

Patchstick does not work with Apple TV 1.1

Why did you remove the warning from Patchstick testing instructions? Does it work for you?

AppleTV OS 1.1 ?

Will there be support for AppleTV OS 1.1 soon ? Because I get my AppleTV in maybe 1 ½ month and I really want ATVLoader, SSH, Perian AND YouTube on it then :)

-

It works with ATV 1.1, if you create a Patchstick following the latest instructions (my Patchstick was older). Using boot.efi from 1.1 Update image works too. (mcka)


- Reply -

Thanks for the reply :) As a second thought question, can I download an image that works with aTV 1.1 ? And I have heard news that says that you can no longer boot from a USB drive in 1.1 if you use Apples update service. And what is the difference between OpenSSH and DropBear? Which is the better one ? OGGe 13:01, 28 June 2007 (CEST +1)


I created a Patchstick using the zip file and applied it to a 100% vanilla ATV 1.1. The boot sequence did not complete -- after going through the loader, ssh, and perian sections, the box rebooted endlessly until I yanked the stick ( running on an iPod shuffle ).

Despite this behavior, the AwkwardTV option showed up on the menu. Unfortunately, all plugin installation attempts result in Error -48, and enabling ssh results in a not-so-useful "an error occurred" message. I read somewhere that this issue was well-known in v1.0.7 and was fixed in 1.0.8 ... As for AFP, it can be enabled in the menu ( and shows up as enabled ) but doesn't actually work -- connecting from an MacBook Pro fails ( server not available or something of the sorts).

BootUp Menu?

Can Bootup menu still be activated with the remote ? --OGGe 13:04, 4 July 2007 (CEST)

patchstick-1.0.zip does not install SSH

If you download and execute the patchstick installer, it does not install sshd.

- Reply - If you want to have sshd activated with the createPatchstick script, just open it in an editor (TextEdit should work) and uncomment (remove the # in front of) line 91 (# cp /usr/sbin/sshd /Volumes/Patchstick/ssh/).

- Re: Reply - I've done this and it works, but it does not install the Kerberos Framework, and it does not patch the sshd-keygen-wrapper file, so using the default SSH2 does not work. I tried to figure out why this does not work, and I found some problems (e.g. the /usr/bin/sed binary used in the ssh installer script is not copied to the patchstick), but I could not make it work.

Another Problem is perian, which is installed to $HOME/Library/QuickTime starting from version 1.0.

Creating Patchstick on ppc Mac or Windows

Note: People from ATVCreator seem to have managed to create a Patchstick for Windows: http://code.google.com/p/atvusb-creator/downloads/detail?name=atv-win-1.0.b8.zip&can=2&q=

Extracting .dmg files on Windows works fine (on a ppc mac anyway). By using files from images like the 10.4.9 Combo Update and Apple TV 1.1 Update, isn't it possible to create a Patchstick without the need of an (Intel-)Mac? Are there any files missing in the images from Apple? Could they be extracted from other images or compiled from MacPorts?

The following binaries are missing in the combo update (chmod, sleep and mkdir can be found in the Apple TV update):

/usr/bin/sed

But as far as I can tell, sed is not really necessary for the patchstick (only to enable SSH version 2)!

The following .kexts and .dylib are missing too (libncurses.5.4.dylib and AudioIPCDriver.kext can be found in the Apple TV update, but not sure if they are compatible):

/System/Library/Extensions/OSvKernDSPLib.kext
/System/Library/Extensions/IOACPIFamily.kext
/System/Library/Extensions/AppleFlashNVRAM.kext

Does someone know if they are really necessary, or where to get them from? 10.4.8 combo update does not contain any missing file. Building a patchstick using these files and leave the 3 kexts out, leads to a kernel panic because of ACPI problems ("unable to find driver for this platform: ACPI"). Adding the 3 kexts from an Intel Mac does not solve the problem. But probably I'm doing something wrong... Replacing the kexts with kexts from my Intel Mac solves the kernel panic.

That is not correct, I _did_ something wrong. When using all available files from the combo update, and use the missing files from Intel Mac it works! Perhaps combining with files from ATV Update is not good. (mcka, 2007-08-24)

For creating a Patchstick on Windows you can simply boot from an FreeBSD live CD (x86) like FreeSBIE or frenzy, which should contain all the necessary tools!

With files only from Intel-mac: http://www.bilder-hochladen.net/files/3kjn-1-jpg.html

  • make sure that launchd is in /sbin and executable? (mcka, 2007-08-24)

and with files from Combo-Update and from OSBoot: http://www.bilder-hochladen.net/files/3rls-1-jpg.html

I used the following scripts to mount/unmount the Patchstick:

unmount:

diskutil unmountDisk /dev/disk2
gpt remove -i 1 /dev/disk2
diskutil unmountDisk /dev/disk2
gpt add -b 40 -s 503728 -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" /dev/disk2
diskutil unmountDisk /dev/disk2

mount:

diskutil unmountDisk /dev/disk2
gpt remove -i 1 /dev/disk2
diskutil unmountDisk /dev/disk2
gpt add -b 40 -s 503728 -i 1 -t "48465300-0000-11AA-AA11-00306543ECAC" /dev/disk2

See the manual instructions for creating a Testing Patchstick how to find your values for the marked -b and -s switches

And you have to change /dev/disk2 to your corresponding value.

Here you can find more OS X Combo updates: http://www.apple.com/support/downloads/ with more files (up to 10.4.11)

Suggestion: Make backup image before making any changes.

What about a scripted backup of the partitions on the appletv before any changes are made? Backup could be stored on the usb drive if the free space on the partition was zeroed out first and if the drive was >= 1GB. --Mikemars 03:57, 30 September 2007 (CEST)

Disk size

Patchstick/Testing says "for PatchStick.1.0.zip, a 512Meg stick is sufficient -- has anyone succeeded with a smaller stick?". And yes, I have - a 128 MB USB stick has sufficent space for installing at least the ATV Loader plug-in and SSH.

Some problems with partitioning disk in OS X 10.4.11

I created my patchstick with OS X version 10.4.11; either the diskutil utility in this version has slightly different behavior, or something else changed. At any rate, when asked to create two HFS+ partitions, diskutil in fact creates 3, prepending a 200M EFI partition. This doesn't hurt anything, but it does throw off the numbering of the partitions; the patchstick script relies on the root partition being index 1 and the 'stuff' partition being index 2. With the extra EFI partition it fails to alter the UUID of the root partition and the launchd script fails to mount the 'stuff' partition correctly, meaning none of the install scripts run.

This is easily solved by changing the createPatchstick and launchd scripts to account for the EFI partition (by upping the respective index numbers), but a more general solution would probably be better. I'm not sure if this is an issue for Leopard as well, since I'm not really sure what caused diskutil to make the extra EFI partition. Graft 16:20, 24 February 2008 (CET)

Using atv-bootloader to create patchstick on any platform (OSX PPC, Linux, etc)

After all sorts of trouble trying to get the OSX patchstick working, I stumbled across the atv-bootloader project at http://code.google.com/p/atv-bootloader/ and the process became much simpler. The OSX-based patchstick requires you to find kernel extensions (IOACPIFamily.kext and AudioIPCDriver.kext) that are only available on Intel-based Tiger systems (the newer Leopard versions don't work). Needless to say, if you don't have an Intel-based Mac running Tiger handy or the Intel-specific Tiger install media, you're out of luck.

The directions are mostly here http://code.google.com/p/atv-bootloader/wiki/BuildingPatchstick and will work for most platforms. I used the partitioning commands from the Patchstick2.0.zip file to make life easier on a Mac. I extracted all ssh files from the 10.4.9 Combo Update (including the Kerberos Framework) and set them up as described on http://wiki.awkwardtv.org/wiki/Install_SSH#Notes_for_Take_2

Basically what happens below is you create the Recovery partition, which contains all the necessary boot files, and the Patchstick partition, which lets you do all your work. The Recovery partition boots up and then runs patchstick.sh on the Patchstick partition, so once that's in place, you can just modify that anytime to do anything you want. Note that once this is done, you can't easily modify the Recovery partition because the last step we do is change the UUID on it so that it is an AppleTV Recovery partition. It can be changed back, but it's annoying and I got tired of doing it while testing the patchstick, so I just moved functionality off to the Patchstick partition.  :)

Steps on my PPC G4 running Leopard:

  • Determine the disk device name of your USB thumb drive
diskutil list

It will be something like /dev/disk2 or /dev/disk5. Use the size and partition names to determine the actual path. If you aren't sure, then don't attempt this, as you could lose your entire drive. For example, in the below output, mine is at /dev/disk5:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *93.2 Gi    disk0
   1:        Apple_partition_map                         31.5 Ki    disk0s1
   2:                  Apple_HFS Speedy Gonzales         93.0 Gi    disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:        CD_partition_scheme                        *238.8 Mi   disk1
   1:              CD_ROM_Mode_1 000925                  207.6 Mi   disk1s0
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *232.9 Gi   disk2
   1:        Apple_partition_map                         31.5 Ki    disk2s1
   2:                  Apple_HFS Seagate                 232.8 Gi   disk2s3
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *931.5 Gi   disk3
   1:        Apple_partition_map                         31.5 Ki    disk3s1
   2:                  Apple_HFS TimeMachine             931.4 Gi   disk3s3
/dev/disk4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *931.5 Gi   disk4
   1:        Apple_partition_map                         31.5 Ki    disk4s1
   2:                  Apple_HFS Terabyte                931.4 Gi   disk4s3
/dev/disk5
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.9 Gi     disk5
   1:                  Apple_HFS Recovery                80.0 Mi    disk5s1
   2:                  Apple_HFS Patchstick              1.7 Gi     disk5s2
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *407.1 Mi   disk6
   1:        Apple_partition_map                         31.5 Ki    disk6s1
   2:         Apple_Driver_ATAPI                         4.0 Ki     disk6s2
   3:                  Apple_HFS Mac OS X 10.4.9 Combined Update (Intel)407.0 Mi   disk6s3
/dev/disk7
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *1.3 Gi     disk7
   1:        Apple_partition_map                         30.0 Ki    disk7s1
   2:         Apple_Driver_ATAPI                         2.0 Ki     disk7s2
   3:                  Apple_HFS iPhone SDK              1.3 Gi     disk7s3
/dev/disk8
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *685.7 Mi   disk8
   1:        Apple_partition_map                         31.5 Ki    disk8s1
   2:                  Apple_HFS OSBoot                  685.7 Mi   disk8s2
  • Extract boot.efi from the AppleTV 2.0.2 firmware
wget http://mesu.apple.com/data/OS/061-4632.2080414.gt5rW/2Z694-5428-3.dmg
hdiutil attach 2Z694-5428-3.dmg
cp -p /Volumes/OSBoot/System/Library/CoreServices/boot.efi .
hdiutil detach /Volumes/OSBoot
  • Verify boot.efi md5sum
    md5 ./boot.efi
    (should be 280323d8700e4cfef15116f7e50590e3)
  • Partition USB stick
    diskutil partitionDisk [disk device here] 2 GPTFormat HFS+ Recovery 80M HFS+ Patchstick 40M
    Replace [disk device here] with the actual path to the disk, i.e. /dev/disk5, which you got from diskutil list.

    WARNING: The above command WILL wipe the disk at whatever device path you give it, so USE CAUTION to not repartition something important!!!
  • Download recovery files
wget http://atv-bootloader.googlecode.com/files/recovery-0.6.tar.gz
sudo tar -xzfp recovery-0.6.tar.gz
sudo cp -rp recovery/* /Volumes/Recovery/
  • Copy boot.efi to boot partition of USB stick
sudo cp -p boot.efi /Volumes/Recovery
  • create /Volumes/Recovery/patchstick.sh of USB stick containing the following:
#!/bin/bash
exec 2>/dev/console
exec 1>/dev/console

echo "Executing patchstick.sh on Patchstick partition /dev/disk2s2 aka /dev/sdb2..."

echo "        * mounting partition r/o"
mkdir /mnt/stuff
fsck.hfsplus /dev/sdb2
mount -t hfsplus -r /dev/sdb2 /mnt/stuff

sh /mnt/stuff/patchstick.sh
  • Make the script executable
    sudo chmod 755 /Volumes/Recovery/Patchstick.sh
  • Edit /Volumes/Recovery/com.apple.Boot.plist and change
    <string>atv-boot=auto video=vesafb</string>
    to
    <string>atv-boot=patchstick video=vesafb</string>
  • Now the Recovery partition is complete, so we change the UUID so AppleTV will boot it.
    WARNING: Replace /dev/disk5 in the below example with the disk device path you got from diskutil list above, or you will make one of your disks un-mountable!
THEDISK=/dev/disk5
START=$(gpt -r show $THEDISK | grep '1  GPT part' | awk '{print $1}')
SIZE=$(gpt -r show $THEDISK | grep '1  GPT part' | awk '{print $2}')
diskutil unmountDisk $THEDISK
gpt remove -i 1 $THEDISK
diskutil unmountDisk $THEDISK
gpt add -b $START -s $SIZE -i 1 -t "5265636F-7665-11AA-AA11-00306543ECAC" $THEDISK
  • Now the Recovery partition is complete, so we build the ssh installer on the Patchstick partition.
    First, create /Volumes/Patchstick/patchstick.sh containing the following:
#!/bin/bash

exec 2>/dev/console
exec 1>/dev/console

echo
echo "        --- aTV Flash 2.0.1 Upgrade ---"
echo "  -w00t"

echo "        * mounting OSBoot partition"
mkdir /mnt/OSBoot
fsck.hfsplus -f /dev/sda3
mount -t hfsplus -o rw,force /dev/sda3 /mnt/OSBoot

echo "        * keeping the OSBoot partition r/w for plugins"
touch /mnt/OSBoot/.readwrite

cd /mnt/stuff

if [ -f ./ssh/sshd ] && [ -f ./ssh/ssh.plist ]; then
 echo -n "        * Installing SSH daemon... "
 cp ./ssh/sshd /mnt/OSBoot/usr/sbin/sshd
 cp ./ssh/ssh /mnt/OSBoot/usr/bin/ssh
 cp ./ssh/ssh-add /mnt/OSBoot/usr/bin/ssh-add
 cp ./ssh/ssh-agent /mnt/OSBoot/usr/bin/ssh-agent
 cp ./ssh/ssh-keygen /mnt/OSBoot/usr/bin/ssh-keygen
 cp ./ssh/ssh-keyscan /mnt/OSBoot/usr/bin/ssh-keyscan
 cp ./ssh/scp /mnt/OSBoot/usr/bin/scp
 cp ./ssh/sftp-server /mnt/OSBoot/usr/libexec/sftp-server
 cp ./ssh/ssh-keysign /mnt/OSBoot/usr/libexec/ssh-keysign
 cp ./ssh/sshd-keygen-wrapper /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper
 cp ./ssh/ssh.plist /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist

 chown 0:0 /mnt/OSBoot/usr/sbin/sshd
 chown 0:0 /mnt/OSBoot/usr/bin/ssh
 chown 0:0 /mnt/OSBoot/usr/bin/ssh-add
 chown 0:0 /mnt/OSBoot/usr/bin/ssh-agent
 chown 0:0 /mnt/OSBoot/usr/bin/ssh-keygen
 chown 0:0 /mnt/OSBoot/usr/bin/ssh-keyscan
 chown 0:0 /mnt/OSBoot/usr/bin/scp
 chown 0:0 /mnt/OSBoot/usr/libexec/sftp-server
 chown 0:0 /mnt/OSBoot/usr/libexec/ssh-keysign
 chown 0:0 /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper
 chown 0:0 /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist
  
 chmod 755 /mnt/OSBoot/usr/sbin/sshd
 chmod 755 /mnt/OSBoot/usr/bin/ssh
 chmod 755 /mnt/OSBoot/usr/bin/ssh-add
 chmod 755 /mnt/OSBoot/usr/bin/ssh-agent
 chmod 755 /mnt/OSBoot/usr/bin/ssh-keygen
 chmod 755 /mnt/OSBoot/usr/bin/ssh-keyscan
 chmod 755 /mnt/OSBoot/usr/bin/scp
 chmod 755 /mnt/OSBoot/usr/libexec/sftp-server
 chmod 4755 /mnt/OSBoot/usr/libexec/ssh-keysign
 chmod 755 /mnt/OSBoot/usr/libexec/sshd-keygen-wrapper
 chmod 755 /mnt/OSBoot/System/Library/LaunchDaemons/ssh.plist

 echo "        Adding Kerberos..."
 mkdir /mnt/OSBoot/System/Library/Frameworks/OSXFrames
 cp -pr ./ssh/Kerberos.framework /mnt/OSBoot/System/Library/Frameworks/OSXFrames/
 echo "        done."
else
 echo "        SSH files not found."
fi

echo ""

 sync &>/dev/null
 sync &>/dev/null
 echo "        Unmounting OSBoot partition..."
 umount /mnt/OSBoot
 echo "        all done!"
 
echo
echo "        The aTV Flash software has been successfully installed.  You may now remove the flash drive and restart your Apple TV."
sleep 100000
  • Now get the ssh files from the 10.4.9 Combo installer
mkdir ssh
wget http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=13207&cat=60&platform=osx&method=sa/MacOSXUpdCombo10.4.9Intel.dmg
hdiutil attach MacOSXUpdCombo10.4.9Intel.dmg
cd ssh
sudo pax -r -p e -z -f /Volumes/Mac\ OS\ X\ 10.4.9\ Combined\ Update\ \(Intel\)/MacOSXUpdCombo10.4.9Intel.pkg/Contents/Archive.pax.gz \
'./usr/sbin/sshd' \
'./System/Library/LaunchDaemons/ssh.plist' \
'./usr/bin/ssh' \
'./usr/bin/ssh-add' \
'./usr/bin/ssh-agent' \
'./usr/bin/ssh-keygen' \
'./usr/bin/ssh-keyscan' \
'./usr/bin/scp' \
'./usr/bin/sftp' \
'./usr/libexec/sftp-server' \
'./usr/libexec/ssh-keysign' \
'./usr/libexec/sshd-keygen-wrapper' \
'./System/Library/Frameworks/Kerberos.framework' ;

mv ./usr/sbin/sshd .
mv ./System/Library/LaunchDaemons/ssh.plist .
mv ./usr/bin/ssh .
mv ./usr/bin/ssh-add .
mv ./usr/bin/ssh-agent .
mv ./usr/bin/ssh-keygen .
mv ./usr/bin/ssh-keyscan .
mv ./usr/bin/scp .
mv ./usr/bin/sftp .
mv ./usr/libexec/sftp-server .
mv ./usr/libexec/ssh-keysign .
mv ./usr/libexec/sshd-keygen-wrapper .
mv ./System/Library/Frameworks/Kerberos.framework .

rmdir ./usr/sbin ./usr/bin ./usr/libexec ./usr ./System/Library/LaunchDaemons ./System/Library/Frameworks ./System/Library ./System
  • Modify the ssh.plist file so that it actually starts ssh (default is to not)
defaults delete /Volumes/Patchstick/ssh/ssh Disabled
  • And finally, edit /Volumes/Patchstick/ssh/sshd-keygen-wrapper and change the last line from
    exec /usr/sbin/sshd $@
    to
    DYLD_FRAMEWORK_PATH="/System/Library/Frameworks/OSXFrames" exec /usr/sbin/sshd $@
  • Unmount your USB Patchstick... (again, replacing /dev/disk5 with the disk device you got from diskutil list earlier)
diskutil unmountDisk /dev/disk5
  • Pop the USB drive into your AppleTV, then press and hold the 'Menu' and '-' buttons at the same time until your AppleTV reboots. You should see an image of Tux, the Linux penguin, sitting on top of an AppleTV. If you see the Apple logo, something went wrong and the system couldn't boot off your USB drive.
  • Once the process completes, remove the thumb drive and power cycle the AppleTV. It should boot as normal, and then you should be able to ssh into it (V2 should work) using the following command:
ssh frontrow@appletv.local
Note that the first time you attempt to connect, it may take as long as a few minutes while the SSH host keys are generated. After that it should be quick. The default password is 'frontrow' and you can become root by typing
sudo -s

Now use SSH to mod your AppleTV to your heart's content.  :) Enjoy!

Note that this can be done on Linux as well, but some of the commands are different (partitioning and extracting boot.efi, namely). Follow the directions at the atv-bootloader project to do these things http://code.google.com/p/atv-bootloader/wiki/BuildingPatchstick

I apologize if there are any omissions, as I'm writing this from memory after the fact, but this should work for you. I did this on a PPC Leopard Mac to a 2.1 (aka 2.0.1) Apple TV without issue and now have full control over the box.

Also note that I make no warranty about this. It might break your stuff and summon demons and all types of bad things. So be careful.

Personal tools