How to enable your AppleTV as an Xgrid node
This procedure will show you how to setup you AppleTV as an Xgrid node. I'm not really sure why you'd want to do this, but this is proof-of-concept. There's not a whole lot of Xgrid-aware apps out there, but Techspansion's excellent video converter VisualHub is aware.
Tested and confirmed working on a 1.0 AppleTV. Untested with 1.1 software.
This all assumes you have an Intel Mac with Tiger. This also falls into the "this hack uses OSX/Intel binaries, and therefore is not legally distributable. No support whatsoever is given to anyone. Do this at your own risk" category.
- XgridLite - A prefpane to make your Mac into an Xgrid Controller for your local network
- MacFUSE - MacFUSE core
- SSHFS for MacFUSE - lets you mount SSH volumes on your desktop, used heavily in this how-to
- Xgrid Mandelbrot from the the Developer tools from your OS X install DVD. Open /Developer/Examples/Xgrid/GridMandelbrot/GridMandelbrot.xcodeproj in Xcode and hit the Build and Go button.
- Uninstall MacFUSE - lets you efficiently uninstall MacFUSE and other apps
In a terminal window on your Mac, turn on the Xgrid controller daemon
sudo xgridctl controller start
We're going to make your Mac a client node in our grid too, so open your Sharing Prefpane, check the box for Xgrid under the Services tab, and click the Configure button. Set it to use a specific controller, and your machine's hostname should show up in the dropdown.
Open the Xgrid Admin app that installed with the admin tools pack from /Applications/Server/Xgrid Admin.app. Click the Agents tab, and your Mac should show up.
Copying the necessary Frameworks to the AppleTV
- Make sure you've upgraded your SSHd
- Give root on the AppleTV a password. SSH into it, and do
sudo passwd root
- Remount your AppleTV's root as read/write
sudo mount -uw /
- If you haven't already, mount your ATV with SSHFS/MacFuse. Make sure you've mounted the root (/) while logged in as root. In the following examples, my AppleTV is mounted on my Mac at /Volumes/appletv.local
- Bang out the following commands in a terminal window
cp /Library/Preferences/com.apple.xgrid.agent.plist /Volumes/appletv.local/Library/Preferences
mkdir -p /Volumes/appletv.local/private/etc/xgrid/agent
cp /private/etc/xgrid/agent/com.apple.xgrid.agent.plist.default /Volumes/appletv.local/private/etc/xgrid/agent/
cp -Rf /System/Library/Frameworks/XgridFoundation.framework /Volumes/appletv.local/System/Library/Frameworks
cp -Rf /System/Library/LaunchDaemons/com.apple.xgridagentd.plist /Volumes/appletv.local/System/Library/LaunchDaemons
cp -Rf /System/Library/PrivateFrameworks/XgridInterface.framework /Volumes/appletv.local/System/Library/PrivateFrameworks
cp /usr/bin/xgrid /Volumes/appletv.local/usr/bin/xgrid
cp -Rf /usr/libexec/xgrid /Volumes/appletv.local/usr/libexec
cp -Rf /usr/sbin/xgridctl /Volumes/appletv.local/usr/sbin/xgridctl
cp -Rf /System/Library/PrivateFrameworks/BEEP.framework /Volumes/appletv.local/System/Library/PrivateFrameworks/
cp -f /usr/bin/basename /Volumes/appletv.local/usr/bin/basename
Start up the Agent
/usr/sbin/xgridctl agent on /usr/sbin/xgridctl agent start
Then check the status
Should come back with something like
610 ?? Ss 0:00.56 xgridagentd
If nothing comes back and you get a prompt, the agentd isn't running.
At this point, you should see another processor and another agent in your Xgrid Admin tool. For example, my MacBook shows up as two processors/one agent, and my AppleTV shows up as an additional processor/agent.
Test the Grid
Build and run the Xgrid Mandelbrot app from the Developer Tools examples. If you watch the Agents and tab in the Xgrid Admin app, you should see your Mac and AppleTV go back and forth from Available to Working.
Set the AppleTV's hard drive to mount your root partition read/write on boot
(Things won't work right unless you do this, xgridagentd will need to write to /var/run/xgridagentd.pid on your root partition)
sudo touch /.readwrite
At this point, you're done! Your AppleTV mount your root partition read/write on boot. You will still need to restart the agent (see below). Go buy more AppleTVs/Macs and build yourself a supercomputer of video transcoding/Mandelbrot set-drawing/pure neatness.
I have noticed that if you reboot the AppleTV and/or restart the xgridagentd process, you will need to delete it from your xgridcontroller (Xgrid Admin, Agents tab, delete the entry). If you sleep|restart/reboot the controller, you will also need to restart the agent on the AppleTV. Working on somehow automating this...
sudo xgridctl a stop
(On the Mac, delete the node entry)
sudo xgridctl a start