tommycoolman

tech. blog. repeat.

Menu
Menu

Linux on the 1st Generation Apple TV – Part 2

Posted on October 13, 2018April 5, 2020 by tommy

You have two options for Linux. First is OSMC (https://osmc.tv/download/). Downloading the Apple TV images to a USB drive and booting is the easiest path to get Linux on the Apple TV. It is the method I would recommend.

However if you’re like me and you want a vanilla Linux distro, there is option 2, creating a patchstick. The actual software is located at https://github.com/davilla/atvusb-creator. Getting the original github version of this to work is tricky, because some of the creation scripts (Windows batch files) contain dead hyperlinks. If you choose this method, you will have to fix the broken links like I did.

The “Apple TV USB Creator” is used to create a “patchstick”, or a bootable USB drive that has a “boot.efi” file that the Apple TV can boot from. Contained within the boot.efi file is a Linux kernel and initrd.

  • Download the complete image file here
  • Download the software to write the image to USB here

After booting from the USB drive, login with the username and password root/root. From this Linux environment, you can do as you please.

I opted to copy the USB drive to the internal hard drive using dd. Something like…

dd if=/dev/sdb of=/dev/sda bs=1M

Where /dev/sdb is the USB drive and /dev/sda is the internal hard drive. After dd is finished copying run parted /dev/sda. Parted will fix any partition problems. Afterwards, you can repartition your hard drive before installing Linux proper. Do not delete the “Number 1” HFS+ partition as it is required to boot the AppleTV.

The patchstick is designed to load a simple Linux environment to bootstrap a proper Linux kernel with “kexec.” In my case, I loaded the Debian Net Installer, but you can probably load any kernel and ram image.

After installing Debian, my partition table had the Apple HFS+ boot partition, the main Linux ext3 root, and a swap.

Booting Debian from the SSD without a USB drive.

Important notes — GRUB is not actually required to boot your new Linux installation. The boot partition from the USB patchstick contains a boot.efi that is designed to scan your hard drive, looking for “/boot/grub/menu.lst.” If found, the machine will automatically boot your Linux entry. You won’t hurt anything by installing GRUB, but I opted not to install GRUB and simply create the “menu.lst” file manually, as this is the only thing boot.efi needs. If done successfully, the patchstick USB can be removed and the Apple TV will boot to your Linux partition.

Failing any of this, you can use your patchstick to manually boot your Linux partition.

Final shots before removing the USB drive

Final thoughts.

This box will mainly be my SSH tunneling machine, though I installed the larger storage for torrenting and SABnzbd. My main server could do these things, but it’s not on 24/7.

It was neat to get this up and running. Debian runs as it normally would with HDMI output and WiFi working (I won’t need either). Again, OSMC is the easiest way to get Linux onto this machine.

The biggest drawback is a lack of gigabit ethernet. I will have to buy a USB2.0 ethernet adapter. The noise is minimal. There is a small fan, but you only hear it in a dead quiet room.


  • Part 1 – The Hardware
  • Part 2 – The Software

Recent Posts

  • Public Key Authentication with PuTTY

    Public Key Authentication with PuTTY

    April 4, 2021
  • Connecting UPS WorldShip to  MySQL

    Connecting UPS WorldShip to MySQL

    December 24, 2019
  • Integrating PayPal with Perl

    Integrating PayPal with Perl

    November 3, 2019
  • Creating PDF’s with Perl

    Creating PDF’s with Perl

    April 14, 2019

Archives

  • April 2021
  • December 2019
  • November 2019
  • April 2019
  • March 2019
  • October 2018

Categories

  • Computers
  • Programming
  • Uncategorized
©2021 tommycoolman