Here's my updated guide:
After spending w-a-y more time working on it than I'd like to admit, I
finally have my Apple TV working flawlessly (so far) as a mythTV
frontend, serving up 1080i and 720p MPEG2 from my HDHomeRun equipped
backend. I'm now ready to retire the big and clunky PC that formally
had this duty. But the road was not an easy one. I started out using
Ubuntu Desktop 9.04 and had several problems that left me pulling my
hair out:
- Unacceptable shuttering in both video and audio during playback. I
tried removing this package and that in an attempt to improve this
problem. The results were still disappointing. I heard several people
in this forum discussing their bare bones installations of linux, but
could very find few details on how exactly they accomplished this.
Which packages are needed and which ones are not?
- I was able to get HDMI output to work fairly easily. But sound via
HDMI doesn't appear to be supported by atv-bootloader/linux. There
aren't many HDTV's out there that will accept video via HDMI and audio
via analog or optical. I didn't want to add an external receiver to
the mix either. This rendered HDMI useless to me.
- I became incredibly frustrated trying to get NVIDIA's driver to
output component video that my TV would accept. I kept getting "no
valid modes for 1920x1080 found", etc. I chased many dead ends, like
turning off various types of ModeValidation, etc. Nothing seemed to
work.
- I initially had problems even getting analog sound to work. I
followed others instructions, but it still didn't work (I later
discovered that you have to increase the volume of both aumix AND
Mixer/alsamixer in my Ubuntu desktop install).
But now, I'm happy to report that I have overcome ALL of these
issues.
Very little of this was pioneered by me. I've simply cobbled together
information from other people that are far smarter than me and who
deserve the credit for making this awesome solution work! I don't want
to take any credit for the hard work of others. I simply compiled this
information in this guide for prosperity and with the hope that it
might make it easier for another noob like me :)
Minimum ubuntu install
My first mistake originally starting out was using Ubuntu Desktop.
Ultimately, all I wanted is a mythvfrontend and nothing else. There's
way too much fat in the Desktop install. Instead, use the minimal CD
version of ubuntu 9.04 here:
http://archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/mini.iso
This installer will only install the bare minimum software needed by
Ubuntu and let you add packages after as needed. Create a bootable CD
from the ISO image (alternatively, you could probably just copy the
files to your USB thumb drive - but I didn't do that way, so do so at
your own risk of frustration)
I followed the instructions here to create a bootable USB thumb drive:
http://code.google.com/p/atv-bootloader/wiki/LinuxUSBPenBoot
Using a USB hub, connect your USB thumb drive, CDROM with your Ubuntu
mini CD and keyboard to your Apple TV. Reboot and telnet into your
Apple TV.
Resize the Media partition and create new partitions for Ubuntu on
your Apple TV's internal disk using these instructions:
http://code.google.com/p/atv-bootloader/wiki/AlternatePartitioning2
Start the install from the Ubuntu CD using the following commands:
mkdir /cdrom
mount -o loop /dev/sr0 /cdrom
kexec --load /cdrom/linux --initrd=/cdrom/initrd.gz
kexec -e
Hopefully, at this point, the Ubuntu install will start up. Remove
your USB thumb drive. When you get to the partitioning step, select
Manual. Select the 5th partition from your atv internal drive. For
"use as", select "Ext3 journaling file system". Select "yes" for
Format and "/" as the mount point. Select the 6th partition and set
the "use as" to swap. Towards the end of the install, you'll be given
the option to install additional features. Select openssh server.
When the install finishes, disconnect your CDROM and reboot. During
reboot it may seem to hang (it stop writing output to the screen).
Don't worry. This is because it needs some additional tweaks to get
the video working properly. SSH into your atv from another machine.
ssh <ip of your atv>
Edit "/etc/modprobe.d/blacklist-framebuffer" and comment out
"blacklist vesafb"
#blacklist vesafb
Edit "/etc/initramfs-tools/modules" and add
fbcon
vesafb
8139too
Run "update-initramfs" to commit your changes:
sudo update-initramfs -u
Install some additional needed packages.
sudo apt-get install xorg mythtv-frontend alsa-utils --no-install-
recommends
sudo apt-get install nvidia-common
sudo apt-get install nvidia-glx-180
Note that I originally combined the calls above and installed nvidia-
glx-180 before nvidia-common. I don't think it was the order that was
significant, but it could have been. It might have been the --no-
install-recommends as well. At any rate, x windows would not load. I
got an error "Failed to load module "nvidia"". Doing these as separate
steps fixed the issue. To clean up after screwing up the first time, I
had to apt-get remove --purge nvidia-common nvidia-glx-180 and apt-get
autoremove --purge and retry.
Install the lirc package and select the Apple Mac Mini IR Reciever
from the first prompt (none from the second)
sudo apt-get install lirc
Get the mythtv theme package for the theme that you plan to use (and
its associated OSD package):
sudo apt-get install mythtv-theme-mythcenter-wide mythtv-theme-
blootube-osd
Set a password for the user "mythtv". You'll need this password when
you "su" to the mythtv user.
sudo passwd mythtv
We're going to use the mythtv user to run the frontend, since it will
already be set up with the right groups, etc. Configure Ubuntu to
automatically start up X and the frontend on boot using the mythtv
user:
su mythtv
cd ~
vi .xinitrc
Add the following command to the .xinitrc script:
xset -dpms
xset s off
nvidia-settings -a GPUOverclockingState=1 > nvidia.log
nvidia-settings -a GPU2DClockFreqs=200,760 >> nvidia.log
mythfrontend > mythfrontend.log
This will cause mythfrontend to launch as soon as X windows starts and
underclock the nvidia cards GPU. You can verify that the nvidia-
settings is working properly by looking at the resulting
"nvidia.log" (after bring up x windows). it should contain something
like:
Attribute 'GPUOverclockingState' (appletv:0.0) assigned value 1.
Attribute 'GPU2DClockFreqs' (appletv:0.0) assigned value 200,760.
Un-mute your sound devices and boost the volume using
"alsamixer" (make sure your still running as the mythtv user - if you
get a "snd_ctl_open failed" error then you are not running the
alsamixer under the mythtv user).
alsamixer
Use your arrow keys to move between the sound controls. Use the up
arrow to increase volume on each control and use the "m" key to un-
mute a control (it will have a "00" under it if its not muted). Make
sure you increase the volume of the Master and PCM controls to 100%
and you un-mute the IEC958 IEC958-D, and IEC958 1 controls. Hit the
escape key when done.
Exit from mythtv user:
exit
To store your alsamixer setting:
sudo alsactl store
Add the following to "/etc/rc.local":
su - mythtv -c xinit
This will cause X windows to be started when the system finishing
booting and run under the mythtv user.
Fixing the video
Create and add the following to "/etc/modprobe.d/options.conf"
options nvidia NVreg_RegistryDwords="PerfLevelSrc=0x2222"
options nvidia NVreg_Mobile=0
This makes the graphics card to appear to not have a mobile chipset,
allowing it to be over(under)clocked.
Next, run the following:
sudo sed -i -e 's/^libXvMC.so.1$/libXvMCNVIDIA_dynamic.so.1/' /etc/
X11/XvMCConfig
Edit "/etc/X11/xorg.conf". The following works with my Panasonic HDTV
using the component inputs. It may need some tweaks for your HDTV. The
key things that I discovered were necessary included setting my set
horizontal and vertical frequency ranges and telling X that I'm using
component inputs. I generated a first cut of this config by booting up
with my Apple TV connected to my set via HDMI, launching nvidia-
settings and then selecting the option for it to generate an xorg.conf
file. However, I did this in prior attempt from Ubuntu Desktop (not
this bare bones install), so I can't guarantee it will work for you at
this point, but thought it was worth mentioning. The frequencies below
did NOT match the frequencies in the manual for my set. If you're
trying to output standard 1080i to your set, I'd guess the frequency
values below will work.
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (bui...@palmer) Sun Feb 1 20:21:04
UTC 2009
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
Section "Files"
EndSection
#Section "Module"
# Load "glx"
#EndSection
#Section "ServerFlags"
# Option "Xinerama" "0"
#EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "PANASONIC-TV"
HorizSync 15.0 - 45.0
VertRefresh 59.0 - 61.0
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7300"
Option "RegistryDwords" "RMDisableRenderToSysmem=1"
Option "UseDisplayDevice" "TV"
Option "TVOutFormat" "COMPONENT"
Option "TVStandard" "HD1080i"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "UseEvents" "1"
Option "AddARGBVisuals" "1"
Option "AddARGBGLXVisuals" "1"
Option "NoLogo" "True"
Option "Coolbits" "1"
# Option "TwinView" "0"
SubSection "Display"
Depth 24
Modes "1920x1080" "1280x720" "720x480"
EndSubSection
EndSection
Section "Extensions"
Option "Composite" "Disable"
EndSection
Getting the sound to work
Edit "/etc/modprobe.d/options.conf" and add:
options snd-hda-intel model=imac24
Then run:
sudo update-initramfs -u
IR Controller
Edit "/etc/modprobe.d/options.conf" and add:
options usbhid quirks=0x05ac:0x8241:0x10
Then run:
sudo update-initramfs -u
Edit "/etc/lirc/hardware.conf" and change the top part to look like
this:
# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="Apple Mac mini USB IR Receiver"
REMOTE_MODULES=""
REMOTE_DRIVER="macmini"
REMOTE_DEVICE="/dev/usb/hiddev0"
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS=""
Also make sure START_LIRCD is set to "true"
Use "irrecord" to generate a /etc/lirc/lircd.conf file. Use PLUS,
MINUS, PREV, NEXT, MENU and PLAY for the button names for the Apple
remote. Simply follow the instructions from irrecord:
sudo irrecord -H macmini -d /dev/usb/hiddev0 /etc/lirc/lircd.conf
Actually, I think the command above created a file called
lircd.conf.conf and I had to delete the original lircd.conf and rename
the newly created one.
Edit the lircd.conf file and change the name to "Apple_IR" from "/etc/
lirc/lirc.conf.conf" (this took me a while to figure out!).
name Apple_IR
My lircd.conf ended up like this:
# Please make this file available to others
# by sending it to <[email protected]>
#
# this config file was automatically generated
# using lirc-0.8.4a(macmini) on Tue Aug 24 20:41:11 2010
#
# contributed by
#
# brand: /etc/lirc/lircd.conf.conf
# model no. of remote control:
# devices being controlled by this remote:
#
begin remote
name Apple_IR
bits 8
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 24
pre_data 0x87EEAF
gap 207973
toggle_bit_mask 0x0
ignore_mask 0xFF01
begin codes
PLUS 0x0B
MINUS 0x0D
PREV 0x08
NEXT 0x07
MENU 0x02
PLAY 0x04
end codes
end remote
Superuser to mythtv and create the file "~/.mythtv/lircrc" (I doubt
the Apple_A1156 sections are really needed, but I didn' test it w/o
them):
# LIRCRC Auto Generated by Mythbuntu Lirc Generator
# Author(s): Mario Limonciello, Nick Fox
# Created for use with Mythbuntu
begin
remote = Apple_A1156
prog = mythtv
button = PLAY
config = P
repeat = 0
delay = 0
end
begin
remote = Apple_A1156
prog = mythtv
button = VOLDOWN
config = [
repeat = 0
delay = 0
end
begin
remote = Apple_A1156
prog = mythtv
button = BACKWARD
config = <
repeat = 0
delay = 0
end
begin
remote = Apple_A1156
prog = mythtv
button = VOLUP
config = ]
repeat = 0
delay = 0
end
begin
remote = Apple_A1156
prog = mythtv
button = MENU
config = M
repeat = 0
delay = 0
end
begin
remote = Apple_A1156
prog = mythtv
button = FORWARD
config = >
repeat = 0
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = PLUS
config = Up
repeat = 2
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = MINUS
config = Down
repeat = 2
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = MENU
config = Escape
repeat = 2
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = PLAY
config = Space
repeat = 2
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = NEXT
config = Right
repeat = 2
delay = 0
end
begin
remote = Apple_IR
prog = mythtv
button = PREV
config = Left
repeat = 2
delay = 0
end
If you want to test out your remote, restart lirc:
sudo /etc/init.d/lirc restart
and test your configuration by running the following app and pressing
the IR buttons
irw /dev/lircd
Reboot. The mythtv frontend should launch. Setup your mythtv frontend,
if the backend is not automatically detected. Enter the IP Address or
name of your mythtv backend and enter in the password for that
backend. Hopefully, you can watch TV at this point (including hearing
sound)! If not, make sure your backend is working properly. I had
problems with this initially and later realized that running a
frontend directly on my backend server wasn't working either.
Restarting the backend by going into its setup on the backend server
seemed to fix the issue.
Make sure to set your mythtv theme to the theme that you installed
(Settings -> Appearance). If you can't change channels and don't see
the OSD, this is likely your problem. Check the mythtvfrontend.log
file in ~mythtv. It will likely have an error like this:
2010-08-27 19:41:50.532 Couldn't find OSD theme: blootube-osd
indicating that you have not installed a needed package for your
selected theme or its associated OSD
Good luck! And thanks to everyone for their contributions for
providing a great way to repurpose my Apple TV as a mythTV frontend!
Other errata
Increase the volume in mythtv settings in Settings->General
It looks like there's a bug in mythtv where scaling is being applied
even though the settings indicate otherwise. Go to Settings->TV
Settings->Playback and change the horiz and vert scaling values to -5.
Save the settings and watch TV. Go back to the settings and set the
scaling value back to zeroes. This seems to fix the issue.
The first problem I ran into was the NIC overrun problem. It looks
like in Ubuntu 9.04, this can be
fixed by:
sudo sed -i -e "s/^# kopt=root=UUID=.* ro$/&
processor.max_cstate=2/" /boot/grub/menu.lst
sudo update-grub
Also, I forgot to include setting the frontend's playback settings as
indicated here:
http://code.google.com/p/atv-bootloader/wiki/mythtv
Note that these settings didn't work perfectly for me. The OSD did not
appear and I wasn't able to change channels on live TV. Setting the
OSD Render to Chromakey fixed the problem (even though the log shows
an error that it can't find chromakey, whatever it falls back to works
fine).
To get around playback issues with the recorded programs (the atv
seems to choke on programs recorded from channels with weak signals),
go into Setup->TV Setting->Recording Profiles->Transcoders->Autodetect
from MPEG2 and click the box "Lossless transcoding". Also go into
Setup->Recording Profiles->HDHomeRun Recorders->Default and check
"Enable auto-transcode after recording". Then go into the backend's
General settings and check "Allow Transcoding jobs" and "Run Transcode
Jobs before Auto-Commerical Flagging".
Finally, when adding a recording, make sure that "Trancode new
recordings" is selected in the post-process settings.
I decreased the processor.max_cstate further to 1 using the method
above. I also unchecked "Enable realtime priority threads". I'm not
sure if either of these had an effect (I was still having problems
with shuttering playback and lockups when I made these changes).
I finally broke down and installed x11vnc:
sudo apt-get install x11vnc
Fortunately, this doesn't cause x11vnc to be started by default. You
can do that by ssh'ing in the atv and entering the following:
x11vnc
Now you could use Chicken of the Sea to vnc in. If you quit Mythtv,
you'll have to restart x windows and x11vnc (if you want to do
something in x windows other than Mythtv). Log in as someone other
than mythtv, so that Mythtv will not be autostarted.
sudo xinit &
x11vnc
Misc
To list the installed packages:
dpkg --get-selections
To search the list of all available packages (not just installed)
apt-cache search <search string>
To search for package that contains a file:
apt-file search <file path>
To display NIC stats:
ifconfig
--
To post to this group, send email to [email protected]
For more options, visit this group at
http://groups.google.com/group/atv-bootloader?hl=en