Anatiferous blog | Move every zig.


Welcome to Anatiferous: Using barnacles to make geese since 1689!

Howdy! This is my (William Reading's) webpage. At the moment, I only have this blog script and my gallery up, but I hope to get more stuff on this page at some point, or so I thought when I created this site years ago. Updates and shiny new copy to eventually go here. If you'd like to contact me to point out that I've done something to break XHTML/CSS standards or heaven forbid--look at my Vita--drop me a line at my e-mail address bill +spam @ [ELEPHANT] Simply remove "+spam", the spaces and the pachyderm along with its brackets and that address will reach me. I'm also available on Jabber/GChat/AIM/MSN with the same address above.


Debian on the AppleTV

Filed under: — bill @ 3:52 pm

This weekend I decided to set up Debian on my AppleTV because the experience for most things relating to video is far better on the XBox 360 (e.g. Netflix versus rental, loading indicators, only low-grade HD performance, etc.), for a lower price ($199 vs. $229)

Getting Debian on there was a little bit tricky, so I’m going to document a few of the things I learned to make this easier on myself, or maybe other people trying to get it to work. I found that I needed several things to get it to work:

  • A 512MB (minimum) usb drive for backing up the partitions on the box
  • A separate usb drive for installing Linux on the box / going in via recovery mode (~$9 for 2GB at Walmart)
  • An existing Linux machine for setting up partitions, etc. on the memory card
  • ATV Bootloader
  • A usb hub / one built into your keyboard
  • USB Keyboard
  • A bit of patience

The first thing that you need to do is back up the device, which requires a specially created USB drive that can be toggled into recovery mode using “menu” and “-” on the apple remote. The ATV-bootloader guys have taken care of making a tool to generate that drive called ATV USB Creator. The only tricky part here is that if a bootloader drive is made on the mac, both partitions are HFS+. The second one can be reformatted to whatever, such as ext3 for backup. The details of backing up the ATV and restoring it are on the ATV Wiki.

The ATV wiki also talks about how to prepare the partitions on the device, which really consists of putting their bootloader on the regular and recovery partitions, set to certain spots on the disk. The bootloader does a variety of things to try to start the device, including looking for menu.lst in different ext3 partitions and then using kexec to pop over to the right kernel and initrd.

The way to install Debian is a variant of Gutsy, with a few notable differences. For one, you don’t need the funky vesafb arguments. In fact, I had problems when these arguments were present. Two, when you’re preparing installation media on a USB drive, such as described in the ATV Wiki, you really only need to the second partition that you get out of the USB creator above for three files: initrd.gz, vmlinuz, and some debian installation iso. Remember that the hd-media finds and installs from iso media, but wont netinstall by itself.

Thus, the commands to kick off kexec look something like this:

mkdir debian
mount /dev/sdb2 debian
kexec –load debian/vmlinuz –initrd="debian/initrd.gz” –command-line="initrd=/initrd.gz”
kexec -e

After that, I just used the keyboard that the USB drive was plugged through to configure and install a minimal standard system, since I was planning on using it as a server anyway. I noticed that GRUB didn’t get installed correctly, so I made my own menu.lst file for the ATV bootloader to find, whose important bits looked like this:

title Debian GNU/Linux, kernel 2.6.26-2-686
root (hd0,3)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda4 ro quiet
initrd /boot/initrd.img-2.6.26-2-686

With all of that, the device finally booted into Debian. However, there was a second problem–flaky network performance. As it turns out, when the CPU moves between certain speedsteps, some network traffic gets lost. The trick is to get cpufreq with the performance governor set to performance to avoid stepping. This can be changed at any time, e.g. via cron to use less power when the system isn’t in use, but the ATV doesn’t really suck much power anyway.

We use cpufreq to modify the speedstep parameters. It doesn’t look like the cpufreq stuff is loaded by default, but that’s easy enough to fix.

modprobe acpi-cpufreq
apt-get install cpufrequtils

We edit /etc/modules to add acpi-cpufreq, and change the governor to “performance” in /etc/init.d/cpufrequtils.

Okay, all done for now. Other side notes: If you’re setting up this machine with AFP to do time machine backups, ala this tutorial: Ubuntu as Mac File Server and Time Machine Volume, you can make the AFP icon an AppleTV with the model string of “AppleTV". Also, for Snow Leopard, you need to create a sparse filesystem on the local mac with “$MACHINENAME_$EN0MAC.sparseimage” for Time Machine to detect it. The same caveats about using defaults to enable unsupported time machine volumes and touching a file called “” on the volume apply. This is discussed on the Mac OS X Hints page for this as well.


No comments yet.

RSS feed for comments on this post.

Leave a comment

Sorry, the comment form is closed at this time.



Powered by WordPress