I got Xgrid running on my AppleTV for no real reason other than to see if I could do it. I’ve documented what I did on the AwkwardTV wiki and past the jump.
Update: I found a few bugs in the startup/shutdown of the xgridagentd. All relevant changes are now on the AwkwardTV wiki.
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. I am not responsible for any damage you may cause your AppleTV
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.
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/
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.
At this point, you’re done! Your AppleTV will launch the xgridagentd at boot, and accept tasks. Go buy more AppleTVs/Macs and build yourself a supercomputer.