Difference between revisions of "Linux on Apple TV"

From AwkwardTV
Jump to: navigation, search
m (Current Status)
m (Reverted edits by Robots (Talk) to last revision by Anton kg)
 
(41 intermediate revisions by 21 users not shown)
Line 1: Line 1:
 
{{Template:Banner}}
 
{{Template:Banner}}
 
==Current Status==
 
==Current Status==
'''Linux HOWTO may be written as early as Friday night by community member "beyond"'''
+
'''If you would like to contact the moderator of this page, email: kad77 [at] awkwardtv [dot] org'''
  
* Edgar (gimli) Hucek from the [http://www.mactel-linux.org/wiki/AppleTV mactel-linux] project, and AwkwardTV contributor, has gotten the Linux kernel to boot via a custom loader-- which is itself loaded by the AppleTV boot.efi loader. [http://www.mactel-linux.org/wiki/Main_Page gimli first got linux running on EFI-based intel Macs.]
+
Also, let's start using the [http://wiki.awkwardtv.org/wiki/index.php?title=Talk:Linux_on_Apple_TV&action=edit Discussion Page.]
  
Sourceforge SVN access (client needed): https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot
+
* Edgar (gimli) Hucek from the [http://www.mactel-linux.org/wiki/AppleTV mactel-linux] project, and AwkwardTV contributor, has gotten the Linux kernel to boot via a custom loader-- which is itself loaded by the AppleTV boot.efi loader. [http://www.mactel-linux.org/wiki/Main_Page gimli was the first to get Linux running on EFI Intel Macs]
  
"mach_linux_boot" is the only code you need from mactel!
+
[http://mactel-linux.svn.sourceforge.net/viewvc/mactel-linux/trunk/mach_linux_boot/ View the current SVN with your browser.] The Linux side actively requires testing. As you will read below, the results are phenomenal so far.
 +
 
 +
Sourceforge SVN client address: https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot
  
[http://mactel-linux.svn.sourceforge.net/viewvc/mactel-linux/trunk/mach_linux_boot/ View the current SVN with your browser.] The Linux side actively requires testing. As you will read below, the results are phenomenal so far.
+
NOTE: "mach_linux_boot" is the only code you need from mactel!
  
''This page is being slowly reworked (old, and confusing data removed) and may be in flux for a few days. Please add to it, and do see page history for some previous data regarding EFI, and previous Linux on Mac projects.''
+
* A precompiled mach_kernel binary can be obtained from [http://spam.workaround.ch/atv/mach_kernel] (Modules: [http://spam.workaround.ch/atv/2.6.20.6-appletv.modules.tgz]). This linux 2.6.20.6 kernel was compiled on a Slackware 11.0 system and has been running fine on my Apple-Tv without any problems for days. The kernel has built-in ext3 support.
  
 
''DO NOT REMOVE THIS NOTICE UNTIL AN ANSWER WITH LINKS HAS BEEN WIKI'D (kad77):''
 
''DO NOT REMOVE THIS NOTICE UNTIL AN ANSWER WITH LINKS HAS BEEN WIKI'D (kad77):''
We need to establish whether the official NVidia Linux binary supports PureVideo/CUDA for MPEG hardware acceleration. Without hardware MPEG decoding, we are at a severe disadvantage using Linux for video applciation. See these links (please add): [http://www.nvidia.com/object/purevideo_geforcego_comparison.html] [http://www.nvnews.net/vbulletin/showthread.php?t=83594]
+
We need to establish whether the official NVidia Linux binary supports PureVideo/CUDA for MPEG hardware acceleration; further we need a demonstration application that explicitly shows MPEG hardware acceleration is enabled and usable under Linux. Without hardware MPEG decoding through the GeForce 7300 Go, we are at a '''severe''' disadvantage using Linux for video display. Perhaps the video driver could be ported or reverse engineered from the original Apple TV OS (Mac OS X 10.4.7)?  See these links (please add): [http://www.nvidia.com/object/purevideo_geforcego_comparison.html] [http://www.nvnews.net/vbulletin/showthread.php?t=83594] [http://developer.nvidia.com/object/cuda.html]
 +
 
 +
The only known Linux hardware video codec acceleration is by using [http://www.mythtv.org/wiki/index.php/XvMC XvMC] (for MPEG-4, only using Via chipset).  The Linux NVidia binary drivers are not documented to support anything but MPEG2 offloading, so PureVideo is currently unsupported for Linux. [http://www.nvnews.net/vbulletin/showthread.php?t=65739][http://www.nvnews.net/vbulletin/showthread.php?t=77632]
 +
However, Apple TV almost certainly has hardware acceleration enabled, so that would point to the existance of non-Windows PureVideo-like MPEG-4 hardware assistance.
 +
 
 +
''linux kernel 2.6.21 is up and running CentOS4.4/Trixbox on my aTV! Now where to send the patches and config? I also never had the need for the irqpoll kernel option, so that might have to do with my different .config settings. Couldn't get the mb_boot_tv to work, so I'm still using the pseudo mach_kernel boot method. (rcfa)''
 +
 
 +
Could you write your installation procedure for CentOS? Upload your config to a free hosting service and post a link.
  
 
==AwkwardTV Linux Project==
 
==AwkwardTV Linux Project==
Many of us would like to see a minimal source distribution, targeted for AppleTV and utilizing the Linux kernel, emerge with boot and kernel configs. Extras might include scripts for USB or disk image builds. Currently we will be working with gimli's Mach-O wrapper approach to bootstrapping, and this will require a MacOS X setup. Recently Information has been added to the mactel wiki for using a darwin cross-compiler on Linux to compile the mach-binary.<br><br>''
+
Many of us would like to see a minimal source distribution, targeted for AppleTV and utilizing the Linux kernel, emerge with boot and kernel configs. Extras might include scripts for USB or disk image builds. Currently we will be working with gimli's Mach-O wrapper approach to bootstrapping, and this will require a MacOS X setup.  
'''Basic Rundown''' ''Borrowed from the mactel-wiki''<br>
+
 
    * alien must be installed<br>
+
Information has been posted to the mactel wiki regarding a Darwin cross-compiler for Linux to compile the Mach-O binary. gimli reports this to work on Ubuntu Fiesty.''
    * Change to mach_linux_boot and execute the script get_cross.sh<br>
+
 
    * Move darwin-cross to /opt/<br>
+
* 'alien' package must be installed
    * Execute make.sh.<br>
+
* Change to 'mach_linux_boot' and execute the script 'get_cross.sh'
    * Crosscompiler is from this Page http://ranger.befunk.com/fink/darwin-cross/ <br>
+
* Move 'darwin-cross' to /opt/
 +
* Execute 'make.sh'
 +
* Cross-compiler download: [http://ranger.befunk.com/fink/darwin-cross/ Darwin/MacOS X Cross-Compiler for Linux] ''(Sourced from the mactel-wiki)''
 +
 
 +
It bears mentioning that we recommend a '''[[Backup your original Hard Drive | complete backup]]''' of your original AppleTV drive before any experimentation. We have a [[Backup_your_original_Hard_Drive|wiki page]] dedicated to this subject. Remember, if you pipe the dd through gzip or bzip2, the virgin drive image created should only be ~2.5gb!
 +
 
 +
==Linux Installation Guides==
 +
Please add your guides here, they will (hopefully) be maintained by their authors.
 +
 
 +
===beyond's Gentoo Guide===
 +
Status of this work: This is a first draft, expect a lot of changes in the coming days.
 +
 
 +
This work is licensed under a [http://creativecommons.org/licenses/by-nc-sa/2.5/ca/ Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License]
 +
 
 +
Requirements:
 +
* Apple TV; with Hard Drive removed
 +
* A Gentoo Linux computer - any Linux PC should work, but may have some subtle differences
 +
* An Mac OSX computer
 +
* Laptop IDE->USB Adapter
 +
 
 +
''Please note: many commands will require root access to the computers, please become root as needed.''
 +
 
 +
Step 1: Backup your AppleTV
 +
<br>
 +
Under OSX:<br>
 +
First connect your AppleTV HD to your IDE->USB adapter, then open a terminal. Issue the following command in the terminal:<br>
 +
'''dd if=/dev/disk1 of=/path/to/backupfile bs=1024'''<br>
 +
Please note: /dev/disk1 is the device that is associated with the AppleTV HD. This can vary based on your system configuration.<br>
 +
This process takes a while, so be patient, it will finish eventually!<br>
 +
<br>
 +
Under Linux:
 +
First connect your AppleTV HD to your IDE->USB adapter, then open a terminal. Issue the following command in the terminal:<br>
 +
'''dd if=/dev/sdx of=/path/to/backup bs=1024'''<br>
 +
Please note: /dev/sdx is the device that is associated with the AppleTV HD. This can vary based on your system configuration.<br>
 +
This process takes a while, so be patient, it will finish eventually!<br>
  
Please discuss your ideas on the [irc://irc.moofspeak.net/awkwardtv #awkwardtv IRC Channel]!
+
Step 2: Partition and format your AppleTV HD
 +
<br>
 +
Under OSX:<br>
 +
In a terminal make use of the 'gpt' utility to delete and resize your media partition. There is a project providing an ext3 driver for OSX that you can use to create the filesystem. More details will be available soon.
 +
<br>
 +
Under Linux:
 +
First we must include the correct options in the kernel, type:
 +
<pre>
 +
cd /usr/src/linux
 +
make menuconfig
  
It bears mentioning that we recommend a '''[[Backup your original Hard Drive | complete backup]]''' of your original AppleTV drive before any experimentation. [http://wiki.awkwardtv.org/wiki/Backup_your_original_Hard_Drive We have a wiki page dedicated to this subject.] Remember, if you pipe the dd through gzip or bzip2, the virgin drive image created should only be ~2.5gb!
+
Select "File Systems"
 +
Select "Partition Types"
 +
Enable "Advanced partition selection"
 +
Enable "Macintosh partition map support"
 +
Enable "EFI GUID Partition support"
  
==Basic Gentoo Install Guide -arodd-==
+
Exit and save configuration changes, then type:
'''Basic Instructions(Assuming you are on OSX and have Xcode Installed and are installing to the internal atv hd)'''<br>
+
make && make modules_install
''The guide also assumes Gentoo for the Linux OS'' &nbsp;&nbsp;&nbsp; http://www.gentoo.org/doc/en/handbook/handbook-x86.xml <br>You need to use a livecd that supports EFI GPT partition tables. <br>
+
 
 +
Then copy the new kernel into /boot and reboot. Once your system has rebooted you can repartition your AppleTV HD if you wish, using the GNU parted utility. Once you are ready to continue in a terminal run:
 +
 
 +
mkfs.ext3 /dev/sdx4 (sdx4 is the partition you want to install Gentoo on, ie for me it was sdc4)
 +
</pre>
 +
 
 +
Step 3: Install the stage tarball<br>
 +
 
 +
Under Linux:<br>
 +
First we must mount the formatted partition to do so type in a terminal:<br>
 +
<pre>
 +
mkdir /mnt/appletv
 +
mount /dev/sdx4 /mnt/appletv
 +
</pre>
 +
Open a browser and load: http://www.gentoo.org/main/en/mirrors.xml, and download the current stage3 tarball as well as the latest portage snapshot.
 +
 
 +
Once you have a stage3 tarball and portage snapshot, ensure they are saved in /mnt/appletv. Open a terminal and type:
 +
<pre>
 +
cd /mnt/appletv
 +
tar -xjvf stage3-x86-2006.1.tar.bz2
 +
tar -xjvf portage-latest.tar.bz2 -C ./usr/
 +
</pre>
 +
<br>
 +
Step 4: Enter the new Environment<br>
 +
Under Linux:<br>
 +
<pre>
 +
Open a terminal and issue the following commands:
 +
cp -L /etc/resolv /mnt/appletv/etc/resolv.conf
 +
mount -t proc none /mnt/appletv/proc
 +
mount -o bind /dev /mnt/appletv/dev
 +
chroot /mnt/appletv /bin/bash
 +
env-update
 +
source /etc/profile
 +
emerge --sync --quiet
 +
</pre>
 +
Step 5: Build a kernel<br>
 +
<br>
 +
Under Linux:<br>
 +
Download the vanilla 2.6.20.6 kernel from kernel.org. Please ensure it is saved to /mnt/appletv/usr/src/. In our terminal that is in the new environment type:<br>
 +
<pre>
 +
cd /usr/src
 +
tar -xjvf linux-2.6.20.6.tar.bz2 -OR- tar -zxvf linux-2.6.20.6.tar.gz
 +
emerge subversion
 +
svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot/kernel .
 +
patch -p0 < 2.6.20.6-appletv.patch
 +
mv config-2.6.20-appletv linux-2.6.20.6/.config
 +
cd linux-2.6.20.6
 +
make && make modules_install
 +
</pre>
 +
Step 6: Configure the installation<br>
 +
In Linux, while in the environment issue the following commands, or substitute your own setup below.<br>
 +
<pre>
 +
passwd
 +
[follow the on screen instructions to set the root password...]
 +
emerge syslog-ng vixie-cron slocate dhcp
 +
rc-update add syslog-ng default
 +
rc-update add vixie-cron default
 +
dd if=/dev/zero of=/swap bs=1024 count=1000000
 +
</pre>
 +
 
 +
Now we must edit several files, first /etc/fstab:
 +
<pre>
 +
/dev/sda4 / ext3 noatime 0 1
 +
/swap none swap sw 0 0
 +
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
 +
#/dev/fd0 /mnt/floppy auto noauto 0 0
 +
 
 +
# NOTE: The next line is critical for boot!
 +
proc /proc proc defaults 0 0
 +
 
 +
# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
 +
# POSIX shared memory (shm_open, shm_unlink).
 +
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
 +
#  use almost no memory if not populated with files)
 +
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
 +
</pre>
 +
 
 +
Then we must edit /etc/modules.autoload.d/kernel-2.6 to add the following lines:
 +
<pre>
 +
snd-hda-intel
 +
snd-mixer-oss
 +
snd-pcm-oss
 +
</pre>
 +
Edit /etc/conf.d/net to include the following line:
 +
<pre>
 +
modules=("dhclient")
 +
 
 +
Then run:
 +
rc-update add net.eth0 default
 +
exit
 +
umount /mnt/appletv/proc
 +
umount /mnt/appletv/dev
 +
cd
 +
umount /mnt/appletv
 +
</pre>
 +
Disconnect the apple tv drive from the computer at this point.<br>
 +
 
 +
Step 7: The Kernel Wrapper<br>
 +
In OSX: At this point we must build the kernel wrapper provided by Gimli at Mactel-linux. First copy bzImage from /mnt/appletv/usr/src/linux-2.6.20.6/arch/i386/boot/bzImage to your OSX computer.
 +
 
 +
On the mac, first download and install subversion, one implementation is available at metissian.com. You must also have Xcode installed, which is available for free from Apple.
 +
 
 +
Open a terminal and type:
 +
<pre>
 +
svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot mach_linux_boot
 +
cd mach_linux_boot
 +
make
 +
</pre>
 +
At this point copy the bzImage file from above into the mach_linux_boot folder. Then run this command:<br>
 +
'''make'''<br>
 +
<br>
 +
From here we must copy the file mach_kernel to the osboot partition on the apple tv drive. Delete the mach_kernel.preload from this partition while you do this.<br>
 +
In the osboot partition, edit the file com.apple.Boot.plist in folder System/Library/Components or in /System/Library/CoreServices , the contents should look like:
 +
<pre>
 +
<key>Background Color</key>
 +
<integer>0</integer>
 +
<key>Boot Logo</key>
 +
<string>BootLogo.png</string>
 +
<key>Kernel</key>
 +
<string>mach_kernel</string>
 +
<key>Kernel Flags</key>
 +
<string>root=/dev/sda4 irqpoll</string>
 +
</pre>
 +
<br>
 +
At this point you can unmount the AppleTV drive, install it into your AppleTV and boot it up! Congratulations you are running Gentoo on your AppleTV!
 +
<br>
 +
[http://individual.utoronto.ca/justin_hunt/ The original guide comes from beyond's site, used with permission.]
 +
 
 +
===arodd's Basic Gentoo Install Guide===
 +
'''Basic Instructions (Assuming you are on OSX and have Xcode Installed on an Intel Mac, and are installing to the internal AppleTV HD)'''<br>
 +
''The guide also assumes you are using Gentoo Linux OS (for x86)'' &nbsp;&nbsp;&nbsp; http://www.gentoo.org/doc/en/handbook/handbook-x86.xml <br>You need to use a LiveCD that supports EFI GPT partition tables. <br>
 
The Ubuntu InstallCD does. http://www.ubuntu.com/getubuntu/download
 
The Ubuntu InstallCD does. http://www.ubuntu.com/getubuntu/download
 
<br><br>
 
<br><br>
Line 111: Line 297:
 
bless --device=/dev/disk0s4 --setBoot --nextonly
 
bless --device=/dev/disk0s4 --setBoot --nextonly
 
</code><br><br><br>
 
</code><br><br><br>
 +
 +
===Extra Notes===
 +
* If you experience slow wired ethernet speed, try adding the kernel flag no-hlt after irqpoll
  
 
==Hardware Support==
 
==Hardware Support==
Line 138: Line 327:
 
</pre>
 
</pre>
 
* HDMI - WORKING (DVI tested)
 
* HDMI - WORKING (DVI tested)
* Component - not tested
+
* Component working using a single cable (chinch cable at the green video output connected to the yellow video input of my old 4:3 CRT-TV). Colors are fine and so you don't need a video converter box (as suggested in many forums). Tested using the binary nvidia driver and this config:
 +
<pre>
 +
Section "Device"
 +
    Identifier    "Card0"
 +
    Driver        "nvidia"
 +
    VendorName    "nVidia Corporation"
 +
    BoardName      "Quadro NVS 110M / GeForce Go 7300"
 +
#    Option        "MetaModes" "1680x1050"
 +
#    Option        "ConnectedMonitor" "DFP,TV"
 +
    Option        "TVStandard" "PAL-B"
 +
    Option        "UseDisplayDevice" "TV"
 +
EndSection
 +
</pre>
 +
 
  
 
Intel HD Audio
 
Intel HD Audio
 
* HDA-Intel driver recognized by default
 
* HDA-Intel driver recognized by default
* Analogue RCA - not tested
+
* Analog RCA - WORKING (see http://forum.awkwardtv.org/viewtopic.php?f=23&t=167&hilit=&start=70)
 
* Optical SPDIF - WORKING
 
* Optical SPDIF - WORKING
 +
* HDMI - apparently NOT WORKING
 +
 
irDA interface
 
irDA interface
 
* mactel-linux driver recognizes it - untested otherwise
 
* mactel-linux driver recognizes it - untested otherwise
 +
* first signal from apple remote is somewhat recognized. Any following signals are not reported. After reloading usbhid module another signal is reported (using cat with /dev/input/by-id/usb-Apple_Computer,_Inc._IR_Receiver-event-ir)
 +
patch appleir.c to include the AppleTV IR USB id (#define USB_DEVICE_ID_APPLE_TV_IR  0x8241) in the same way as USB_DEVICE_ID_APPLE_IR and it will work.
 +
* [[Apple_TV_Linux_IR_Howto]] details the userspace method.
  
 
Broadcom BCM94321MC wireless
 
Broadcom BCM94321MC wireless
Line 153: Line 360:
 
USB
 
USB
 
* USB booting works when you disable ehci-hcd in kernel
 
* USB booting works when you disable ehci-hcd in kernel
 +
* possible to boot Linux from USB Flash memory?
 +
* USB HID working (keyboard, mouse), but not with ehci-hcd
 +
* USB Storage working (tested with usb memory stick), but not with ehci-hcd
 +
  
 
[http://wiki.awkwardtv.org/wiki/index.php?title=Parts Our components wiki] has further information about the specific chips involved.
 
[http://wiki.awkwardtv.org/wiki/index.php?title=Parts Our components wiki] has further information about the specific chips involved.
Line 173: Line 384:
 
* [http://www.busybox.net/ BusyBox] 1.4.2 (stable)
 
* [http://www.busybox.net/ BusyBox] 1.4.2 (stable)
 
* [http://projects.o-hand.com/matchbox/ MatchBox Window Manager]
 
* [http://projects.o-hand.com/matchbox/ MatchBox Window Manager]
* [http://ftp.x.org/pub/X11R7.2/src/ XOrg X11R7.2]
+
* [http://ftp.x.org/pub/X11R7.2/src/ XOrg X11R7.2] ''We would prefer a lightweight X alternative or optimized/minimal X11 build. KDrive is framebuffer only.''
''We would prefer a lightweight X alternative or optimized/minimal X11 build.''
+
 
''Note: KDrive is framebuffer only.''
+
Other external sources:
 +
* [http://code.google.com/p/atv-bootloader/wiki/InstallingLinux Installing Linux using atv-bootloader] (Ubuntu Gutsy, Gentoo, Mythbuntu, MythDora, KnoppMyth, miniMyth, LiveXBMC)
  
 
==Artwork==
 
==Artwork==
Line 181: Line 393:
  
 
==Geek Notes==
 
==Geek Notes==
April 5, 2007 dmseg output: [http://www.mactel-linux.org/wiki/Dmesg_appletv (source)]
+
April 5, 2007 dmseg output: [http://www.mactel-linux.org/wiki/Dmesg_appletv (from gimli @ mactel)]
<pre>
+
 
[    0.000000] Linux version 2.6.20.4-mactel (root@athlonx2) (gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)) #59 Wed Apr 4 23:02:10 UTC 2007
+
[[Category:Software]][[Category:Potential Capabilities]]
[    0.000000] EFI: EFI v1.10 by Apple
 
[    0.000000]  ACPI=0xfefd000 <6> ACPI 2.0=0xfefd014 <6> SMBIOS=0xfebe000
 
[    0.000000] 0MB HIGHMEM available.
 
[    0.000000] 255MB LOWMEM available.
 
[    0.000000] Entering add_active_range(0, 0, 65280) 0 entries of 256 used
 
[    0.000000] Zone PFN ranges:
 
[    0.000000]  DMA            0 ->    4096
 
[    0.000000]  Normal      4096 ->    65280
 
[    0.000000]  HighMem    65280 ->    65280
 
[    0.000000] early_node_map[1] active PFN ranges
 
[    0.000000]    0:        0 ->    65280
 
[    0.000000] On node 0 totalpages: 65280
 
[    0.000000]  DMA zone: 32 pages used for memmap
 
[    0.000000]  DMA zone: 0 pages reserved
 
[    0.000000]  DMA zone: 4064 pages, LIFO batch:0
 
[    0.000000]  Normal zone: 478 pages used for memmap
 
[    0.000000]  Normal zone: 60706 pages, LIFO batch:15
 
[    0.000000]  HighMem zone: 0 pages used for memmap
 
[    0.000000] DMI 2.4 present.
 
[    0.000000] ACPI: RSDP (v002 APPLE                                ) @ 0x0fefd014
 
[    0.000000] ACPI: XSDT (v001 APPLE  Apple00 0x000000d9      0x01000013) @ 0x0fefd1c0
 
[    0.000000] ACPI: FADT (v003 APPLE  Apple00 0x000000d9 Loki 0x0000005f) @ 0x0fefb000
 
[    0.000000] ACPI: HPET (v001 APPLE  Apple00 0x00000001 Loki 0x0000005f) @ 0x0fefa000
 
[    0.000000] ACPI: MADT (v001 APPLE  Apple00 0x00000001 Loki 0x0000005f) @ 0x0fef9000
 
[    0.000000] ACPI: MCFG (v001 APPLE  Apple00 0x00000001 Loki 0x0000005f) @ 0x0fef8000
 
[    0.000000] ACPI: ASF! (v032 APPLE  Apple00 0x00000001 Loki 0x0000005f) @ 0x0fef7000
 
[    0.000000] ACPI: SSDT (v001 APPLE  Cpu0Ist 0x00003000 INTL 0x20050309) @ 0x0fef2000
 
[    0.000000] ACPI: SSDT (v001 APPLE  Cpu0Cst 0x00003001 INTL 0x20050309) @ 0x0fef3000
 
[    0.000000] ACPI: SSDT (v001 APPLE    CpuPm 0x00003000 INTL 0x20050309) @ 0x0fef1000
 
[    0.000000] ACPI: DSDT (v001 APPLE  AppleTV 0x00010001 INTL 0x20050309) @ 0x00000000
 
[    0.000000] ACPI: PM-Timer IO Port: 0x408
 
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
 
[    0.000000] Allocating PCI resources starting at 10100000 (gap: 10000000:00400000)
 
[    0.000000] Detected 1000.158 MHz processor.
 
[  38.674978] Built 1 zonelists.  Total pages: 64770
 
[  38.674983] Kernel command line: root=/dev/sda3 video=imacfb
 
[  38.675255] Enabling fast FPU save and restore... done.
 
[  38.675259] Enabling unmasked SIMD FPU exception support... done.
 
[  38.675271] Initializing CPU#0
 
[  38.675341] PID hash table entries: 1024 (order: 10, 4096 bytes)
 
[  38.675397] Console: colour dummy device 80x25
 
[  38.675570] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
 
[  38.675741] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
 
[  38.688631] Memory: 253128k/261120k available (1836k kernel code, 5260k reserved, 694k data, 180k init, 0k highmem)
 
[  38.688658] virtual kernel memory layout:
 
[  38.688660]    fixmap  : 0xfffeb000 - 0xfffff000  (  80 kB)
 
[  38.688662]    pkmap  : 0xff800000 - 0xffc00000  (4096 kB)
 
[  38.688665]    vmalloc : 0xd0800000 - 0xff7fe000  ( 751 MB)
 
[  38.688667]    lowmem  : 0xc0000000 - 0xcff00000  ( 255 MB)
 
[  38.688669]      .init : 0xc037c000 - 0xc03a9000  ( 180 kB)
 
[  38.688671]      .data : 0xc02cb0a1 - 0xc037894c  ( 694 kB)
 
[  38.688674]      .text : 0xc0100000 - 0xc02cb0a1  (1836 kB)
 
[  38.688700] Checking if this processor honours the WP bit even in supervisor mode... Ok.
 
[  38.688906] Oops: efitime: can't read time status: 0x80000007
 
[  38.688936] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
 
[  38.688946] hpet0: 3 64-bit timers, 14318180 Hz
 
[  38.689956] Using HPET for base-timer
 
[  38.772185] Calibrating delay using timer specific routine.. 2002.15 BogoMIPS (lpj=3336254)
 
[  38.772213] EFI: ioremap of 0xB178000 failed
 
[  38.772218] EFI: ioremap of 0xB19D000 failed
 
[  38.772224] EFI: ioremap of 0xB1C8000 failed
 
[  38.772262] Mount-cache hash table entries: 512
 
[  38.772403] CPU: After generic identify, caps: afe9fbff 00100000 00000000 00000000 00000180 00000000 00000000
 
[  38.772420] CPU: L1 I cache: 32K, L1 D cache: 32K
 
[  38.772429] CPU: L2 cache: 2048K
 
[  38.772435] CPU: After all inits, caps: afe9fbff 00100000 00000000 00002040 00000180 00000000 00000000
 
[  38.772448] Compat vDSO mapped to ffffe000.
 
[  38.772463] CPU: Intel Genuine Intel(R) processor              1.00GHz stepping 08
 
[  38.772477] Checking 'hlt' instruction... OK.
 
[  38.785576] ACPI: Core revision 20060707
 
[  38.787890] ACPI: setting ELCR to 0200 (from 0000)
 
[  38.788479] NET: Registered protocol family 16
 
[  38.788580] ACPI: bus type pci registered
 
[  38.788595] PCI: BIOS Bug: MCFG area at f0000000 is not E820-reserved
 
[  38.788602] PCI: Not using MMCONFIG.
 
[  38.788877] PCI: Using configuration type 1
 
[  38.788883] Setting up standard PCI resources
 
[  38.788904] EFI: Failed to allocate res Runtime Service Code : 0xb178000-0xb19cfff
 
[  38.788914] EFI: Failed to allocate res Runtime Service Data : 0xb19d000-0xb1c7fff
 
[  38.788923] EFI: Failed to allocate res Runtime Service Data : 0xb1c8000-0xb1c8fff
 
[  38.791825] ACPI: Interpreter enabled
 
[  38.791833] ACPI: Using PIC for interrupt routing
 
[  38.792427] ACPI: PCI Root Bridge [PCI0] (0000:00)
 
[  38.792439] PCI: Probing PCI hardware (bus 00)
 
[  38.793832] PCI quirk: region 0400-047f claimed by ICH6 ACPI/GPIO/TCO
 
[  38.793842] PCI quirk: region 0500-053f claimed by ICH6 GPIO
 
[  38.794523] PCI: Transparent bridge - 0000:00:1e.0
 
[  38.794592] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
 
[  38.798978] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.RP01._PRT]
 
[  38.799918] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCIB._PRT]
 
[  38.801431] ACPI: PCI Interrupt Link [LNKA] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
 
[  38.801755] ACPI: PCI Interrupt Link [LNKB] (IRQs 1 3 4 5 6 7 11 12 14 15) *0, disabled.
 
[  38.802075] ACPI: PCI Interrupt Link [LNKC] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
 
[  38.802424] ACPI: PCI Interrupt Link [LNKD] (IRQs 1 3 4 5 6 7 11 12 14 15) *0, disabled.
 
[  38.802740] ACPI: PCI Interrupt Link [LNKE] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
 
[  38.803056] ACPI: PCI Interrupt Link [LNKF] (IRQs 1 3 4 5 6 7 11 12 14 15) *0, disabled.
 
[  38.803379] ACPI: PCI Interrupt Link [LNKG] (IRQs 1 3 4 5 6 7 10 12 14 15) *0, disabled.
 
[  38.803695] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 11 12 14 15) *0, disabled.
 
[  38.804771] SCSI subsystem initialized
 
[  38.804805] libata version 2.00 loaded.
 
[  38.804872] usbcore: registered new interface driver usbfs
 
[  38.804914] usbcore: registered new interface driver hub
 
[  38.804960] usbcore: registered new device driver usb
 
[  38.804992] PCI: Using ACPI for IRQ routing
 
[  38.804999] PCI: If a device doesn't work, try "pci=routeirq".  If it helps, post a report
 
[  38.805775] PCI: Failed to allocate mem resource #6:20000@20000000 for 0000:01:00.0
 
[  38.805786] PCI: Bridge: 0000:00:01.0
 
[  38.805790]  IO window: disabled.
 
[  38.805798]  MEM window: 20000000-21ffffff
 
[  38.805806]  PREFETCH window: 10000000-1fffffff
 
[  38.805814] PCI: Bridge: 0000:00:1c.0
 
[  38.805818]  IO window: disabled.
 
[  38.805828]  MEM window: 22200000-222fffff
 
[  38.805837]  PREFETCH window: 22000000-220fffff
 
[  38.805848] PCI: Bridge: 0000:00:1e.0
 
[  38.805854]  IO window: 1000-1fff
 
[  38.805864]  MEM window: 22100000-221fffff
 
[  38.805872]  PREFETCH window: disabled.
 
[  38.806132] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
 
[  38.806139] PCI: setting IRQ 10 as level-triggered
 
[  38.806146] ACPI: PCI Interrupt 0000:00:01.0[A] -> Link [LNKA] -> GSI 10 (level, low) -> IRQ 10
 
[  38.806161] PCI: Setting latency timer of device 0000:00:01.0 to 64
 
[  38.806411] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
 
[  38.806418] PCI: setting IRQ 11 as level-triggered
 
[  38.806424] ACPI: PCI Interrupt 0000:00:1c.0[A] -> Link [LNKB] -> GSI 11 (level, low) -> IRQ 11
 
[  38.806439] PCI: Setting latency timer of device 0000:00:1c.0 to 64
 
[  38.806456] PCI: Setting latency timer of device 0000:00:1e.0 to 64
 
[  38.806481] NET: Registered protocol family 2
 
[  38.838832] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
 
[  38.838913] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
 
[  38.838963] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
 
[  38.838993] TCP: Hash tables configured (established 8192 bind 4096)
 
[  38.839000] TCP reno registered
 
[  38.849183] IA-32 Microcode Update Driver: v1.14a <tigran@aivazian.fsnet.co.uk>
 
[  38.849343] Total HugeTLB memory allocated, 0
 
[  38.849407] VFS: Disk quotas dquot_6.5.1
 
[  38.849431] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
 
[  38.849520] io scheduler noop registered
 
[  38.849527] io scheduler anticipatory registered (default)
 
[  38.849535] io scheduler deadline registered
 
[  38.849548] io scheduler cfq registered
 
[  38.849705] PCI: Setting latency timer of device 0000:00:01.0 to 64
 
[  38.849745] assign_interrupt_mode Found MSI capability
 
[  38.849753] Allocate Port Service[0000:00:01.0:pcie00]
 
[  38.849835] PCI: Setting latency timer of device 0000:00:1c.0 to 64
 
[  38.849898] assign_interrupt_mode Found MSI capability
 
[  38.849906] Allocate Port Service[0000:00:1c.0:pcie00]
 
[  38.849944] Allocate Port Service[0000:00:1c.0:pcie02]
 
[  38.850185] imacfb: framebuffer at 0x10030000, mapped to 0xd0880000, using 10800k, total 16384k
 
[  38.850196] imacfb: mode is 1440x900x32, linelength=6144, pages=1
 
[  38.850202] imacfb: scrolling: redraw
 
[  38.850209] imacfb: Truecolor: size=8:8:8:8, shift=24:16:8:0
 
[  38.972031] Console: switching to colour frame buffer device 180x56
 
[  39.083911] fb0: IMAC VGA frame buffer device
 
[  39.087092] Real Time Clock Driver v1.12ac
 
[  39.088295] RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
 
[  39.089517] 8139too Fast Ethernet driver 0.9.28
 
[  39.090166] PCI: Enabling device 0000:03:03.0 (0000 -> 0003)
 
[  39.091228] ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 10
 
[  39.092059] ACPI: PCI Interrupt 0000:03:03.0[A] -> Link [LNKE] -> GSI 10 (level, low) -> IRQ 10
 
[  39.093322] PCI: Setting latency timer of device 0000:03:03.0 to 64
 
[  39.094250] eth0: RealTek RTL8139 at 0x1000, 00:17:f2:f8:9e:18, IRQ 10
 
[  39.095153] eth0:  Identified 8139 chip type 'RTL-8100B/8139D'
 
[  39.095275] input: Macintosh mouse button emulation as /class/input/input0
 
[  39.096377] ata_piix 0000:00:1f.1: version 2.00ac7
 
[  39.096626] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10
 
[  39.097422] ACPI: PCI Interrupt 0000:00:1f.1[A] -> Link [LNKC] -> GSI 10 (level, low) -> IRQ 10
 
[  39.098708] PCI: Setting latency timer of device 0000:00:1f.1 to 64
 
[  39.098753] ata1: PATA max UDMA/133 cmd 0x2058 ctl 0x2066 bmdma 0x2040 irq 10
 
[  39.099766] ata2: PATA max UDMA/133 cmd 0x2050 ctl 0x2062 bmdma 0x2048 irq 10
 
[  39.100761] scsi0 : ata_piix
 
[  39.263784] ATA: abnormal status 0x7F on port 0x205F
 
[  39.268770] ata1.00: ATA-7, max UDMA/33, 78140160 sectors: LBA48
 
[  39.269612] ata1.00: ata1: dev 0 multi count 16
 
[  39.278750] ata1.00: configured for UDMA/33
 
[  39.279333] scsi1 : ata_piix
 
[  39.442719] ATA: abnormal status 0x7F on port 0x2057
 
[  39.443522] scsi 0:0:0:0: Direct-Access    ATA      FUJITSU MHW2040A 0081 PQ: 0 ANSI: 5
 
[  39.444744] SCSI device sda: 78140160 512-byte hdwr sectors (40008 MB)
 
[  39.445668] sda: Write Protect is off
 
[  39.446176] sda: Mode Sense: 00 3a 00 00
 
[  39.446194] SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 
[  39.447473] SCSI device sda: 78140160 512-byte hdwr sectors (40008 MB)
 
[  39.448395] sda: Write Protect is off
 
[  39.482643] sda: Mode Sense: 00 3a 00 00
 
[  39.482662] SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 
[  39.517768]  sda:<7>spurious 8259A interrupt: IRQ7.
 
[  39.596810]  sda1 sda2 sda3
 
[  39.631490] sd 0:0:0:0: Attached scsi disk sda
 
[  39.665895] sd 0:0:0:0: Attached scsi generic sg0 type 0
 
[  39.700063] PCI: Enabling device 0000:00:1d.7 (0000 -> 0002)
 
[  39.734360] ACPI: PCI Interrupt Link [LNKH] enabled at IRQ 11
 
[  39.768360] ACPI: PCI Interrupt 0000:00:1d.7[A] -> Link [LNKH] -> GSI 11 (level, low) -> IRQ 11
 
[  39.802728] PCI: Setting latency timer of device 0000:00:1d.7 to 64
 
[  39.802734] ehci_hcd 0000:00:1d.7: EHCI Host Controller
 
[  39.836716] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1
 
[  39.871041] ehci_hcd 0000:00:1d.7: debug port 1
 
[  39.905030] PCI: cache line size of 32 is not supported by device 0000:00:1d.7
 
[  39.905040] ehci_hcd 0000:00:1d.7: irq 11, io mem 0x22305000
 
[  39.942735] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
 
[  39.976809] usb usb1: configuration #1 chosen from 1 choice
 
[  40.010966] hub 1-0:1.0: USB hub found
 
[  40.045016] hub 1-0:1.0: 8 ports detected
 
[  40.180796] USB Universal Host Controller Interface driver v3.0
 
[  40.215328] ACPI: PCI Interrupt 0000:00:1d.0[A] -> Link [LNKH] -> GSI 11 (level, low) -> IRQ 11
 
[  40.251198] PCI: Setting latency timer of device 0000:00:1d.0 to 64
 
[  40.251204] uhci_hcd 0000:00:1d.0: UHCI Host Controller
 
[  40.286701] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2
 
[  40.322144] uhci_hcd 0000:00:1d.0: irq 11, io base 0x00002020
 
[  40.357284] usb usb2: configuration #1 chosen from 1 choice
 
[  40.392345] hub 2-0:1.0: USB hub found
 
[  40.427216] hub 2-0:1.0: 2 ports detected
 
[  40.563730] Initializing USB Mass Storage driver...
 
[  40.690173] usb 1-1: new high speed USB device using ehci_hcd and address 2
 
[  41.722416] ehci_hcd 0000:00:1d.7: Unlink after no-IRQ?  Controller is probably using the wrong IRQ.
 
[  52.287961] usb 1-1: device not accepting address 2, error -110
 
[  52.427817] usb 1-1: new high speed USB device using ehci_hcd and address 3
 
[  63.992308] usb 1-1: device not accepting address 3, error -110
 
[  64.132164] usb 1-1: new high speed USB device using ehci_hcd and address 4
 
[  74.581162] usb 1-1: device not accepting address 4, error -110
 
[  74.721019] usb 1-1: new high speed USB device using ehci_hcd and address 5
 
[  85.170017] usb 1-1: device not accepting address 5, error -110
 
[  85.722770] usb 2-2: new low speed USB device using uhci_hcd and address 2
 
[  88.842936] usb 2-2: configuration #1 chosen from 1 choice
 
[  89.622232] usbcore: registered new interface driver usb-storage
 
[  89.657373] USB Mass Storage support registered.
 
[  89.692274] usbcore: registered new interface driver libusual
 
[  89.727421] usbcore: registered new interface driver hiddev
 
[  90.997303] input: Apple Computer, Inc. IR Receiver as /class/input/input1
 
[  91.032387] input: USB HID v1.11 Device [Apple Computer, Inc. IR Receiver] on usb-0000:00:1d.0-2
 
[  91.068366] usbcore: registered new interface driver usbhid
 
[  91.104431] drivers/usb/input/hid-core.c: v2.6:USB HID core driver
 
[  91.141641] i8042.c: No controller found.
 
[  91.177552] mice: PS/2 mouse device common for all mice
 
[  91.213411] device-mapper: ioctl: 4.11.0-ioctl (2006-10-12) initialised: dm-devel@redhat.com
 
[  91.279941] ip_tables: (C) 2000-2006 Netfilter Core Team
 
[  91.393468] TCP cubic registered
 
[  91.428955] NET: Registered protocol family 1
 
[  91.464351] NET: Registered protocol family 17
 
[  91.498849] Using IPI Shortcut mode
 
[  91.532685] ACPI: (supports S0 S4)
 
[  91.566452] Time: tsc clocksource has been installed.
 
[  91.973360] kjournald starting.  Commit interval 5 seconds
 
[  92.007750] EXT3-fs: mounted filesystem with ordered data mode.
 
[  92.042316] VFS: Mounted root (ext3 filesystem) readonly.
 
[  92.076968] Freeing unused kernel memory: 180k freed
 
[  98.406036] EXT3 FS on sda3, internal journal
 
[  99.204712] spurious 8259A interrupt: IRQ15.
 
[  99.599013] eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
 
[  106.074809] uhci_hcd 0000:00:1d.0: Unlink after no-IRQ?  Controller is probably using the wrong IRQ.
 
[ 110.383484] usb 1-1: new high speed USB device using ehci_hcd and address 7
 
[ 121.914675] usb 1-1: device not accepting address 7, error -110
 
[  122.061191] usb 1-1: new high speed USB device using ehci_hcd and address 8
 
[  133.592383] usb 1-1: device not accepting address 8, error -110
 
[ 133.738899] usb 1-1: new high speed USB device using ehci_hcd and address 9
 
[ 144.154600] usb 1-1: device not accepting address 9, error -110
 
[  144.301116] usb 1-1: new high speed USB device using ehci_hcd and address 10
 
[  154.716815] usb 1-1: device not accepting address 10, error -110
 
</pre>
 

Latest revision as of 08:21, 30 December 2012

<Google>WIKI</Google>

Current Status

If you would like to contact the moderator of this page, email: kad77 [at] awkwardtv [dot] org

Also, let's start using the Discussion Page.

View the current SVN with your browser. The Linux side actively requires testing. As you will read below, the results are phenomenal so far.

Sourceforge SVN client address: https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot

NOTE: "mach_linux_boot" is the only code you need from mactel!

  • A precompiled mach_kernel binary can be obtained from [1] (Modules: [2]). This linux 2.6.20.6 kernel was compiled on a Slackware 11.0 system and has been running fine on my Apple-Tv without any problems for days. The kernel has built-in ext3 support.

DO NOT REMOVE THIS NOTICE UNTIL AN ANSWER WITH LINKS HAS BEEN WIKI'D (kad77): We need to establish whether the official NVidia Linux binary supports PureVideo/CUDA for MPEG hardware acceleration; further we need a demonstration application that explicitly shows MPEG hardware acceleration is enabled and usable under Linux. Without hardware MPEG decoding through the GeForce 7300 Go, we are at a severe disadvantage using Linux for video display. Perhaps the video driver could be ported or reverse engineered from the original Apple TV OS (Mac OS X 10.4.7)? See these links (please add): [3] [4] [5]

The only known Linux hardware video codec acceleration is by using XvMC (for MPEG-4, only using Via chipset). The Linux NVidia binary drivers are not documented to support anything but MPEG2 offloading, so PureVideo is currently unsupported for Linux. [6][7] However, Apple TV almost certainly has hardware acceleration enabled, so that would point to the existance of non-Windows PureVideo-like MPEG-4 hardware assistance.

linux kernel 2.6.21 is up and running CentOS4.4/Trixbox on my aTV! Now where to send the patches and config? I also never had the need for the irqpoll kernel option, so that might have to do with my different .config settings. Couldn't get the mb_boot_tv to work, so I'm still using the pseudo mach_kernel boot method. (rcfa)

Could you write your installation procedure for CentOS? Upload your config to a free hosting service and post a link.

AwkwardTV Linux Project

Many of us would like to see a minimal source distribution, targeted for AppleTV and utilizing the Linux kernel, emerge with boot and kernel configs. Extras might include scripts for USB or disk image builds. Currently we will be working with gimli's Mach-O wrapper approach to bootstrapping, and this will require a MacOS X setup.

Information has been posted to the mactel wiki regarding a Darwin cross-compiler for Linux to compile the Mach-O binary. gimli reports this to work on Ubuntu Fiesty.

  • 'alien' package must be installed
  • Change to 'mach_linux_boot' and execute the script 'get_cross.sh'
  • Move 'darwin-cross' to /opt/
  • Execute 'make.sh'
  • Cross-compiler download: Darwin/MacOS X Cross-Compiler for Linux (Sourced from the mactel-wiki)

It bears mentioning that we recommend a complete backup of your original AppleTV drive before any experimentation. We have a wiki page dedicated to this subject. Remember, if you pipe the dd through gzip or bzip2, the virgin drive image created should only be ~2.5gb!

Linux Installation Guides

Please add your guides here, they will (hopefully) be maintained by their authors.

beyond's Gentoo Guide

Status of this work: This is a first draft, expect a lot of changes in the coming days.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License

Requirements:

* Apple TV; with Hard Drive removed
* A Gentoo Linux computer - any Linux PC should work, but may have some subtle differences
* An Mac OSX computer
* Laptop IDE->USB Adapter

Please note: many commands will require root access to the computers, please become root as needed.

Step 1: Backup your AppleTV
Under OSX:
First connect your AppleTV HD to your IDE->USB adapter, then open a terminal. Issue the following command in the terminal:
dd if=/dev/disk1 of=/path/to/backupfile bs=1024
Please note: /dev/disk1 is the device that is associated with the AppleTV HD. This can vary based on your system configuration.
This process takes a while, so be patient, it will finish eventually!

Under Linux: First connect your AppleTV HD to your IDE->USB adapter, then open a terminal. Issue the following command in the terminal:
dd if=/dev/sdx of=/path/to/backup bs=1024
Please note: /dev/sdx is the device that is associated with the AppleTV HD. This can vary based on your system configuration.
This process takes a while, so be patient, it will finish eventually!

Step 2: Partition and format your AppleTV HD
Under OSX:
In a terminal make use of the 'gpt' utility to delete and resize your media partition. There is a project providing an ext3 driver for OSX that you can use to create the filesystem. More details will be available soon.
Under Linux: First we must include the correct options in the kernel, type:

cd /usr/src/linux
make menuconfig

Select "File Systems"
Select "Partition Types"
Enable "Advanced partition selection"
Enable "Macintosh partition map support"
Enable "EFI GUID Partition support"

Exit and save configuration changes, then type:
make && make modules_install

Then copy the new kernel into /boot and reboot. Once your system has rebooted you can repartition your AppleTV HD if you wish, using the GNU parted utility. Once you are ready to continue in a terminal run:

mkfs.ext3 /dev/sdx4 (sdx4 is the partition you want to install Gentoo on, ie for me it was sdc4)

Step 3: Install the stage tarball

Under Linux:
First we must mount the formatted partition to do so type in a terminal:

mkdir /mnt/appletv
mount /dev/sdx4 /mnt/appletv

Open a browser and load: http://www.gentoo.org/main/en/mirrors.xml, and download the current stage3 tarball as well as the latest portage snapshot.

Once you have a stage3 tarball and portage snapshot, ensure they are saved in /mnt/appletv. Open a terminal and type:

cd /mnt/appletv
tar -xjvf stage3-x86-2006.1.tar.bz2
tar -xjvf portage-latest.tar.bz2 -C ./usr/


Step 4: Enter the new Environment
Under Linux:

Open a terminal and issue the following commands:
cp -L /etc/resolv /mnt/appletv/etc/resolv.conf
mount -t proc none /mnt/appletv/proc
mount -o bind /dev /mnt/appletv/dev
chroot /mnt/appletv /bin/bash
env-update
source /etc/profile
emerge --sync --quiet

Step 5: Build a kernel

Under Linux:
Download the vanilla 2.6.20.6 kernel from kernel.org. Please ensure it is saved to /mnt/appletv/usr/src/. In our terminal that is in the new environment type:

cd /usr/src
tar -xjvf linux-2.6.20.6.tar.bz2 -OR- tar -zxvf linux-2.6.20.6.tar.gz
emerge subversion
svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot/kernel . 
patch -p0 < 2.6.20.6-appletv.patch
mv config-2.6.20-appletv linux-2.6.20.6/.config
cd linux-2.6.20.6
make && make modules_install

Step 6: Configure the installation
In Linux, while in the environment issue the following commands, or substitute your own setup below.

passwd
[follow the on screen instructions to set the root password...]
emerge syslog-ng vixie-cron slocate dhcp
rc-update add syslog-ng default
rc-update add vixie-cron default
dd if=/dev/zero of=/swap bs=1024 count=1000000

Now we must edit several files, first /etc/fstab:

/dev/sda4		/		ext3		noatime		0 1
/swap			none		swap		sw		0 0
/dev/cdroms/cdrom0	/mnt/cdrom	iso9660		noauto,ro	0 0
#/dev/fd0		/mnt/floppy	auto		noauto		0 0

# NOTE: The next line is critical for boot!
proc			/proc		proc		defaults	0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
shm			/dev/shm	tmpfs		nodev,nosuid,noexec	0 0

Then we must edit /etc/modules.autoload.d/kernel-2.6 to add the following lines:

snd-hda-intel
snd-mixer-oss
snd-pcm-oss

Edit /etc/conf.d/net to include the following line:

modules=("dhclient")

Then run:
rc-update add net.eth0 default
exit
umount /mnt/appletv/proc
umount /mnt/appletv/dev
cd
umount /mnt/appletv

Disconnect the apple tv drive from the computer at this point.

Step 7: The Kernel Wrapper
In OSX: At this point we must build the kernel wrapper provided by Gimli at Mactel-linux. First copy bzImage from /mnt/appletv/usr/src/linux-2.6.20.6/arch/i386/boot/bzImage to your OSX computer.

On the mac, first download and install subversion, one implementation is available at metissian.com. You must also have Xcode installed, which is available for free from Apple.

Open a terminal and type:

svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot mach_linux_boot
cd mach_linux_boot
make

At this point copy the bzImage file from above into the mach_linux_boot folder. Then run this command:
make

From here we must copy the file mach_kernel to the osboot partition on the apple tv drive. Delete the mach_kernel.preload from this partition while you do this.
In the osboot partition, edit the file com.apple.Boot.plist in folder System/Library/Components or in /System/Library/CoreServices , the contents should look like:

<key>Background Color</key>
<integer>0</integer>
<key>Boot Logo</key>
<string>BootLogo.png</string>
<key>Kernel</key>
<string>mach_kernel</string>
<key>Kernel Flags</key>
<string>root=/dev/sda4 irqpoll</string>


At this point you can unmount the AppleTV drive, install it into your AppleTV and boot it up! Congratulations you are running Gentoo on your AppleTV!
The original guide comes from beyond's site, used with permission.

arodd's Basic Gentoo Install Guide

Basic Instructions (Assuming you are on OSX and have Xcode Installed on an Intel Mac, and are installing to the internal AppleTV HD)
The guide also assumes you are using Gentoo Linux OS (for x86)     http://www.gentoo.org/doc/en/handbook/handbook-x86.xml
You need to use a LiveCD that supports EFI GPT partition tables.
The Ubuntu InstallCD does. http://www.ubuntu.com/getubuntu/download

In Linux
The best way to do this step would be to hook up the atv hd to your computer running OSX and create the proper gpt partition for linux and format it as ext3.

More detailed instructions for this will be included later.

The basic rundown would be to make a backup image of the media partition data. Then use gpt to kill the 4th partition on the atv hd. Create a new media partition that doesn't use up the rest of the drive and set as type hfs. Then make a 5th partition as type linux to fill the rest of the drive. Then recover the data to the Media partition

You will need the ext2/3 driver for OSX installed http://sourceforge.net/projects/ext2fsx/ you will then have the tools to format the partition as ext3 and access it from OSX.

newfs_ext2 -j /dev/diskXs5

Boot to the Ubuntu Live CD and then reach the graphical terminal.

sudo su
apt-get install subversion
mkdir /mnt/gentoo
mount /dev/deviceforatvhd /mnt/gentoo
This will probably be hda5/hdb5/sda5/sdb5 or something similar
dd if=/dev/zero of=/mnt/gentoo/swap bs=1024 count=2097152 Creates a 2GB swap file on the root partition
mkswap /mnt/gentoo/swap
cd /mnt/gentoo/usr/src/
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.6.tar.bz2
tar -xjvf linux-2.6.20.6.tar.bz2
svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/mach_linux_boot
patch -p0 < mach_linux_boot/kernel/2.6.20.6-apletv.patch
cp mach_linux_boot/kernel/config-2.6.20-appletv linux-2.6.20.6/.config


Start at 5.b on the Gentoo Handbook and continue to the portion before you emerge gentoo-sources 7.b and then continue on below. Make sure you are in the chrooted environment

cd /usr/src/linux-2.6.20.6
make menuconfig

Add any other features that you may want. Probably not a requirement. Personally I moved some of the things from module to built in. File System support in particular this way you don't need to load a module for hfs/hfs+

make all && make modules_install

Wait for compilation to finish.....and then cleanup

cp arch/i386/boot/bzImage ../mach_linux_boot/ cd /usr/src/
mv mach_linux_boot /
rm linux-2.6.20.6.tar.bz2
ln -s linux-2.6.20.6 linux
cd /lib/modules
ln -s 2.6.20.6-appletv 2.6.20.6
Seem to have missed a patch somewhere so it's looking for both folders when you load a module

Now the bzImage file is located in /usr/src/linux-2.6.20.6/arch/i386/boot/bzImage as well as in the mach_linux_boot folder which we will copy to OSX later. Continue with the Gentoo Handbook from 8.a. all the way up through 9. Make the fstab look similar to below.



/dev/sda5 / ext3 defaults,errors=remount-ro 0 1
proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
/swapfile swap swap defaults 0 0



Skip all of the bootloader stuff in 10. You can follow 10.d to unmount filesystems etc. Reboot back into OSX

In OSX

Open Terminal and begin the OSX portion of the mach_kernel loader compilation.

Since the svn-client in fink doesn't support ssl the easiest way is just to cp it from the ext2 partition.

sudo cp -Rv /Volumes/linuxatvpartition/mach_linux_boot /Users/you/
cd /Users/you/mach_linux_boot
Make sure that your bzImage file is located inside this folder...If not copy it here from your linux partition.
sudo make


Now you have a mach_kernel loader with a linux kernel image enclosed. The ideal method would be to store this on the Media partition alongside boot.efi/com.apple.Boot.plist copied from the OSBoot partition. Modify com.apple.Boot.plist to look similar to below

       <key>Background Color</key>
       <integer>0</integer>
       <key>Boot Logo</key>
       <string>BootLogo.png</string>
       <key>Kernel</key>
       <string>mach_kernel</string>
       <key>Kernel Flags</key>
       <string>root=/dev/sda5 rootdelay=10 irqpoll</string>



Needs Testing/More Documented work

root= may need to be changed to whatever partition number your ext3 partition is at.

The only problem was that I was only able to get it to boot the kernel from the OSBoot partition by removing the atv mach_kernel.prelink from the root directory and customizing the com.apple.Boot.plist in /System/Library/CoreServices/com.apple.Boot.plist. That didn't allow me to dual boot. There is no reason why we shouldn't be able to do the same from the Media partition and swap between atvos/linux and eventually atv/osx/linux, I just haven't got it working yet. In order for it to boot to a specific partition you need to use the bless command either from the ATV via ssh or via an Intel mac. Example...

bless --device=/dev/disk0s4 --setBoot --nextonly


Extra Notes

* If you experience slow wired ethernet speed, try adding the kernel flag no-hlt after irqpoll

Hardware Support

Much of the AppleTV's hardware is supported natively under the Linux kernel. In this section, we will be expanding on the Linux driver details.

Intel CPU Core

  • Speedstep functionality - WORKING

GeForce 7300 Go (NV40) Note: framebuffer fixes in SVN as of April 6, 2007 - please recompile

  • Official NVidia binary driver works without modification. Full 3D and framebuffer acceleration.
  • OSS NVidia driver works without modification (also provides acceleration)
(==) NV(0): Write-combining range (0x10000000,0x4000000)
(II) NV(0): Using XFree86 Acceleration Architecture (XAA)
	Screen to screen bit blits
	Solid filled rectangles
	8x8 mono pattern filled rectangles
	Indirect CPU to Screen color expansion
	Solid Lines
	Scanline Image Writes
	Offscreen Pixmaps
	Setting up tile and stipple cache:
	32 128x128 slots
	32 256x256 slots
	16 512x512 slots
  • HDMI - WORKING (DVI tested)
  • Component working using a single cable (chinch cable at the green video output connected to the yellow video input of my old 4:3 CRT-TV). Colors are fine and so you don't need a video converter box (as suggested in many forums). Tested using the binary nvidia driver and this config:
Section "Device"
    Identifier     "Card0"
    Driver         "nvidia"
    VendorName     "nVidia Corporation"
    BoardName      "Quadro NVS 110M / GeForce Go 7300"
#    Option         "MetaModes" "1680x1050"
#    Option         "ConnectedMonitor" "DFP,TV"
    Option         "TVStandard" "PAL-B"
    Option         "UseDisplayDevice" "TV"
EndSection


Intel HD Audio

irDA interface

  • mactel-linux driver recognizes it - untested otherwise
  • first signal from apple remote is somewhat recognized. Any following signals are not reported. After reloading usbhid module another signal is reported (using cat with /dev/input/by-id/usb-Apple_Computer,_Inc._IR_Receiver-event-ir)

patch appleir.c to include the AppleTV IR USB id (#define USB_DEVICE_ID_APPLE_TV_IR 0x8241) in the same way as USB_DEVICE_ID_APPLE_IR and it will work.

Broadcom BCM94321MC wireless


USB

  • USB booting works when you disable ehci-hcd in kernel
  • possible to boot Linux from USB Flash memory?
  • USB HID working (keyboard, mouse), but not with ehci-hcd
  • USB Storage working (tested with usb memory stick), but not with ehci-hcd


Our components wiki has further information about the specific chips involved.

Barebones Distro Notes

Our preferred base distrubutions:

There are a few Linux distributions specialized for Media Center usage:

Some useful components:

Other external sources:

Artwork

Geek Notes

April 5, 2007 dmseg output: (from gimli @ mactel)