Installing MythFrontend on an AppleTV

From MythTV Official Wiki
Revision as of 20:05, 20 May 2007 by Yod9999 (talk | contribs)

Jump to: navigation, search

This guide is work in progress

Warning/Disclaimer

This HOWTO describes the process of installing MythFrontend on an AppleTV. As this procedure requires opening up the AppleTV and removing the hard drive it will almost certainly void your warranty. Do not attempt this procedure unless you are comfortable with this. You do this at your own risk, and I take no responsibility if you kill your AppleTV etc etc.

Requirements

  • An AppleTV
  • An OSX build of MythFrontend. I used 0.20-fixes from http://padilla.net/mythtv-osx, or you can build your own
  • An Intel Mac to connect the harddrive to
  • A 2.5" IDE drive to firewire converter
  • Torx T8 and T10 screwdrivers

Backup your AppleTV and install SSH

Backing up

I followed the instructions here http://www.engadget.com/2007/03/23/how-to-upgrade-the-drive-in-your-apple-tv/

Basically, you need to open the AppleTV and remove the hard drive. Connect it to your Intel Mac (do not use a PPC Mac or you'll risk damaging the GUID partition) using the 2.5" IDE to firewire adaptor.

Use the diskutil command to determine which is the AppleTV disk. You'll see something like this:

y@mac# diskutil list
/dev/disk0
  #:                   type name               size      identifier
  0:  GUID_partition_scheme                    *149.1 GB disk0
  1:                    EFI                    200.0 MB  disk0s1
  2:              Apple_HFS Macintosh HD       148.7 GB  disk0s2
/dev/disk1
  0:  GUID_partition_scheme                    *37.3 GB  disk1
  1:                    EFI                    34.0 MB   disk1s1
  2:         Apple_Recovery                    400.0 MB  disk1s2
  3:              Apple_HFS OSBoot             900.0 MB  disk1s3
  4:              Apple_HFS Media              35.8 GB   disk1s4

In this case the AppleTV drive is /dev/disk1. Make a backup of the drive using the following command:

y@mac# dd if=/dev/disk1 of=AppleTV.img bs=1024k

Install SSH

I followed the instructions here http://wiki.awkwardtv.org/wiki/Install_SSH

Copy ssh from /usr/sbin to the AppleTV drive and make sure it's executable:

y@mac# cp /usr/sbin/sshd /Volumes/OSBoot/usr/sbin/
y@mac# chmod +x /Volumes/OSBoot/usr/sbin/sshd

Ensure /Volumes/OSBoot/System/Library/LaunchDaemons/ssh.plist contains the following:

<?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>Disabled</key>
        <false/>
        <key>Label</key>
        <string>com.openssh.sshd</string>
        <key>Program</key>
        <string>/usr/libexec/sshd-keygen-wrapper</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/sbin/sshd</string>
                <string>-i</string>
        </array>
        <key>SessionCreate</key>
        <true/>
        <key>Sockets</key>
        <dict>
              <key>Listeners</key>
                <dict>
                        <key>Bonjour</key>
                        <array>
                                <string>ssh</string>
                                <string>sftp-ssh</string>
                        </array>
                        <key>SockServiceName</key>
                        <string>ssh</string>
                </dict>
        </dict>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>inetdCompatibility</key>
        <dict>
                <key>Wait</key>
                <false/>
        </dict>
</dict>
</plist>

Test SSH access

Return the drive to the AppleTV and start it up. Rather than start up normally it may bring up a menu asking if you want to do a restore. If this happens, run the diagnostics, this should be fine, and then select restart. Choosing restore will wie out the work done in the previous steps.

Once it's started up, try and connect using ssh:

y@mac# ssh -1 frontrow@<appletv ip address>

the password is also frontrow

Mount drive as read/write

By default the OSBoot partition is read only. To mount it as read/write run the following:

root@appletv# mount -o remount,rw /dev/disk0s3 /

To make it mount read/write on boot in future:

root@appletv# touch /.readwrite

Install vi and su

Copy vim and su to the AppleTV:

y@mac# scp -1 /usr/bin/vim frontrow@<appletv ip address>:~
y@mac# scp -1 /usr/bin/su frontrow@<appletv ip address>:~

Then on the AppleTV:

root@appletv# mv ~/vim /usr/bin/
root@appletv# mv ~/su /usr/bin/
root@appletv# ln -s /usr/bin/vim /usr/bin/vi

Disable watchdog

Instructions are from http://wiki.awkwardtv.org/wiki/Watchdog

Disable ripstop (as root):

root@appletv# mkdir /etc/mach_init.disabled
root@appletv# mv /etc/mach_init.d/ripstop.plist /etc/mach_init.disabled

Add the following to /etc/rc.local (create this file if it doesn't already exist):

/sbin/kextunload -b com.apple.driver.AppleTCOWatchdog

This will unload the watchdog on startup.

Reboot:

root@appletv# shutdown -r now

Fix the timezone

My AppleTV thought it was in Rome. If the timezone is wrong problems occur when scheduling recordings. To fix this add the following to /etc/rc.local (adjust as necessary for you location):

/bin/ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

Either run the file or reboot for this to take effect.

Copy MythFrontend

Tar up MythFrontend. This assumes that MythFrontend is installed in /Applications on your Mac:

y@mac# tar cf ~/MythFE.tar -C /Applications/ MythFrontend.app
y@mac# scp -1 ~/MythFE.tar frontrow@<appletv ip address>:~

Untar MythFrontend on the AppleTV:

root@appletv# tar xf MythFE.tar -C /Applications/