Installing MythTV on an Intel Mac Mini using Ubuntu

From MythTV Official Wiki
Revision as of 02:22, 16 October 2008 by Bobodog12 (talk | contribs) (Add a note on how to use the apple remote)

Jump to: navigation, search

Edgy Eft (and probably the final versions of Dapper Drake) have enough support to just install Ubuntu from disk without and particular changes. It is probably better to use one of the other guides to set up your frontend box. There are still a couple of specific changes that need to be done for the macmini hardware, so they will be kept here, but for main setup instructions, the other guides are much better.

This guide assumes you are using edgy eft knot 3.

Install Linux

Before you begin, be aware that you might get stuck with the Mac OS X Install Disc in the drive and nothing on the hard drive if you don't have access to a Mac mouse.

  • Upgrade firmware. Check the Apple site. This worked for me: http://www.apple.com/support/downloads/macminiearly2006smcfirmwareupdate.html
  • Boot from Mac OS Install CD
  • Open Disk Utility
  • Make sure you change the boot type to MBR in the options dialog
  • Format disk to two partitions, both UFS, size doesnt matter
  • The install CD may be removed by restarting the computer while holding the button on a Mac mouse. [I was unable to eject the CD with a Microsoft mouse, or by any other means.]
  • Restart, boot from ubuntu edgy install cd (hold down c). If you are unable to boot from the ubuntu install cd, it may mean that your firmware hasn't been properly upgraded.
  • Choose to install a server. This will give you a minimalist setup and you can go from there.

You can eject the CD on reboot by holding down the F12 button. --High Noonan 00:42, 19 October 2006 (UTC)

In case you wiped the partition table using dd=/dev/zero of=/dev/sda bs=512 count=1 you need to repeat these steps. --Morgennebel 07:32, 4 July 2007 (UTC)

Install MythTv

See Ubuntu_Dapper_Installation#Install_MythTV or Ubuntu_Installation#MythTV

You can also try this for a quick and dirty install:

  • Add the universe and multiverse repositories to /etc/apt/sources.list then:
 apt-get update
 apt-get install openssh-server xserver-xorg xinit xvattr ratpoison xterm
 apt-get install xfonts-base xine-ui libxine-extracodecs 915resolution mythtv-frontend
 apt-get install gsfonts-x11 msttcorefonts xfonts-base
 apt-get install xfonts-base xfonts-75dpi xfonts-100dpi
 apt-get install libgl1-mesa-dri libgl1-mesa-glx
 apt-get install portmap
 apt-get install libdvdnav4
 apt-get install libdvdread3

Specific Configuration

Custom Resolutions

Intel integrated graphics controllers, such as the GMA950 used by the Intel Mac Mini systems, require some trickery to use widescreen or other resolutions not defined in the VGA BIOS. Feisty Fawn users can use the Intel i810 modesetting driver, while users of other versions of Ubuntu can use the standard i810 driver and 915resolution (it may be possible for Dapper and Breezy users to use the modesetting driver, and for Feisty users to use 915resolution).

Intel i810 Modesetting Driver

First, install the i810 modesetting driver. This will remove the existing i810 driver and eliminate the need to use 915resolution to set custom resolutions.

% sudo apt-get install xserver-xorg-video-i810-modesetting

Edit your xorg.conf file to include the resolutions you wish to use. In my specific case, I was able to simply specify the desired resolution (1280x720, for 720p output via DVI->HDMI to my Samsung CRT HDTV), and did not need to use any modelines or tinker with 915resolution at all (I was unable to get anything other than 640x480 with the standard i810 driver and 915resolution).


Script.png /etc/X11/xorg.conf

Section "Screen"
        Identifier      "Default Screen"
        Device          "Onboard"
        Monitor         "Samsung HDTV"
        DefaultDepth    24
        SubSection "Display"
                Depth           24
                Modes           "1280x720"
        EndSubSection
EndSection

915resolution

  • You will need to install 915resolution if it is not already installed:
    % sudo apt-get install 915resolution
  • If you want to run widescreen resolutions, or a resolution not set in the VGA BIOS, you'll need to use 915resolution to alter the modesettings. 915resolution should return something like this:
root@ubuntu:~# 915resolution -l
Intel 800/900 Series VBIOS Hack : version 0.5.2

Chipset: 945GM
BIOS: TYPE 1
Mode Table Offset: $C0000 + $269
Mode Table Entries: 36

Mode 30 : 640x480, 8 bits/pixel
Mode 32 : 800x600, 8 bits/pixel
Mode 34 : 1024x768, 8 bits/pixel
Mode 38 : 1280x1024, 8 bits/pixel
Mode 3a : 1600x1200, 8 bits/pixel
Mode 3c : 1920x1440, 8 bits/pixel
Mode 41 : 640x480, 16 bits/pixel
Mode 43 : 800x600, 16 bits/pixel
Mode 45 : 1024x768, 16 bits/pixel
Mode 49 : 1280x1024, 16 bits/pixel
Mode 4b : 1600x1200, 16 bits/pixel
Mode 4d : 1920x1440, 16 bits/pixel
Mode 50 : 640x480, 32 bits/pixel
Mode 52 : 800x600, 32 bits/pixel
Mode 54 : 1024x768, 32 bits/pixel
Mode 58 : 1280x1024, 32 bits/pixel
Mode 5a : 1600x1200, 32 bits/pixel
Mode 5c : 1920x1440, 32 bits/pixel

Choose a mode you arent using, such as 5c, then run it again, specifying the new resolution. Here im using 1280x768:

root@ubuntu:~# 915resolution 5c 1280 768

The modesetting list should then update so that 1280x768 is available. Use 915resolution -l to check. You can then use the mode in your xorg.conf:

Script.png /etc/X11/xorg.conf

 SubSection "Display"
       Depth           24
       Modes           "1280x768" "1024x768" "800x600" "640x480"
 EndSubSection
  • 915resolution seems to sometime require a full reboot to take effect.
  • You can find the custom timings required by your LCD by following the instruction in post #7 of the following thread [Solved i915 1440x900 ext. VGA monitor problems


Intel Video in Gutsy Gibbon (7.10)

Both the Intel and i810 Xorg drivers in Ubuntu 7.04 seem problematic when used with widescreen resolutions not found in the video BIOS. I originally tried to follow the original instructions for configuration of the i945 video listed above. However, I could not reliably drive the mini to 1280x720 with my video hardware (a 720p TV set). The Intel driver didn't work at all and the i810 sometimes would only work in normal 4:3 resolutions like 1024x768.

In Ubuntu 7.04, xserver-xorg-video-i810-modesetting is obsoleted by xserver-xorg-video-intel. However, this Xorg driver generated nothing but a blank screen when I used it on an HDTV. This driver is version 1.9.94.

The most recent version of the Xorg Intel driver is 2.1.0. This is a proper modesetting driver and is a part of Ubuntu 7.10. Once I installed this version of Ubuntu, and used the newest Intel driver I was able to reliably drive my TV to it's full 1280x720.

I run this configuration without an xorg.conf file.

My configuration includes a 720p Sharp DLP projection TV which runs at a native resolution of 1280x720 when you use the RGB connector.


Using the DVI -> SVideo Adaptor

Here are some suggested xorg.conf options for using the SVideo Adaptor:

Section "Device"
        Identifier      "Intel i915"
        Driver          "i810"
        BusID           "PCI:0:2:0"
        Option          "UseFBDev"              "true"
        Option      "TVStandard" "NTSC"
        Option      "TVOutFormat" "COMPOSITE"
        Option      "TVOverScan" "0.6"
        Option      "ConnectedMonitor" "TV" # Add this if you're having problems
        Option "XAANoOffscreenPixmaps" "true"
EndSection

Section "Extensions"
        Option "Composite" "Enable"
EndSection

Viewing HD Material

  • Add a LinearAlloc option line to your xorg.conf. E.g. :

Script.png /etc/X11/xorg.conf

 Section "Device"
       Identifier      "IntelIntegrated"
       Driver          "i810"
       BusID           "PCI:0:2:0"
       Option          "LinearAlloc"   "16384"
 EndSection

16mb of memory seems to be enough for my setup, yours may vary.

  • A LinearAlloc value of "6144" was working with 1080i. After upgrading the i810 driver I encountered blue screens on HD material 720 and 1080 until increasing the value to "8160". This required a reboot to take effect. Just restarting gdm gave the same blue screen error. These values were pulled from the i810 driver support list.
  • If encountering a blue screen when viewing HD the following patch to libmyth may be required.

The latest freedesktop i810 driver does not require this patch. I compiled the (non-modesetting) driver by pulling the xf86-video-intel sources with git and compiling the latest driver by hand. Instructions here Ubuntu git i810 driver but I did not use the modestting option during the "git checkout".


Script.png xv-mini.diff

Index: libs/libmythtv/videoout_xv.cpp
===================================================================
--- libs/libmythtv/videoout_xv.cpp      (revision 11313)
+++ libs/libmythtv/videoout_xv.cpp      (working copy)
@@ -549,7 +549,7 @@
         VERBOSE(VB_PLAYBACK, LOC + QString("@ j=%1 Looking for flag[s]: %2")
                 .arg(j).arg(xvflags2str(neededFlags[j])));

-        for (uint i = 0; i < p_num_adaptors && (port == -1); ++i)
+        for (int i = p_num_adaptors - 1; i >= 0 && (port == -1); --i)
         {
             lastAdaptorName = ai[i].name;
             VERBOSE(VB_PLAYBACK, LOC +

Source: http://www.gossamer-threads.com/lists/mythtv/users/233302?#233302


Mythtv Internal player Sound

To use the optical output with AC3 passthrough you must have an external tuner capable of AC3 input. The following settings output AC3 and regualr audio out the optical cable. The optical jack is the same as the stereo headphone jack on the back of the mini.

These settings worked with no other configuration in Ubuntu 7.04.

 Default Sound device:  ALSA:plug:iec958
 Passthrough output device: ALSA:iec958

[1]

xine setup

  • Unmute IEC958 in alsamixer
  • Create /etc/asound.conf (or .asoundrc) (see below)
  • Setup xine to use 'default' device for passthrough. In ~/.xine/config change the line:
 #audio.device.alsa_passthrough_device:iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2

to:

 audio.device.alsa_passthrough_device:default

and change:

 audio.output.speaker_arrangement:Stereo 2.0

to:

 audio.output.speaker_arrangement:Pass Through

im not sure how to setup other players to work like this. I never tried with mplayer, and I couldnt get VLC to work at all.

  • To play encrypted DVDs install libdvdread3
 sudo apt-get install libdvdread3

Then run the installation script:

 sudo /usr/share/doc/libdvdread3/install-css.sh
  • As I never played DVDs in MacOs before formatting (and purchased the mac-mini outside of my home country) I needed to install "regionset":
 sudo apt-get install regionset

type regionset to set the drive to your region. Note only 5 sets max!

Other Setup

  • I add the following to /etc/rc.local to make myth startup at boot:
 su -c startx mythtv

and in /home/mythtv/.xinitrc i add:

 ratpoison &
 mythfrontend &> /tmp/frontend.log
  • Add mythtv user to /etc/sudoers so it can shutdown. I use the following line:
 mythtv  ALL=NOPASSWD:/sbin/halt,/sbin/reboot,/bin/mount,/bin/umount

You then need to change the shutdown command in mythtv to be:

 sudo /sbin/halt
  • During my setup ubuntu didn't recognise the gigabit potential of the switch/cabling connected to the mac-mini & defaulted to 100baseT, it needed manually tweaking to use the full 1000baseT potential. This actually seemed to make a performance difference when using mythDVD & mythVideo so is definitely worth checking. This line will turn off auto negotiate and up the speed to gigabit:
 sudo ethtool -s eth0 speed 1000 duplex full autoneg off

You can check what speed it's currently using from the output of:

   sudo ethtool eth0

I did NOT need to edit /etc/network/interfaces, it seems to remain stable at gigabit speeds after a full reboot etc.

[2]


/etc/asound.conf

  • Make sure you create this file to get digital audio out.

Script.png /etc/asound.conf

pcm.nforce-hw {
    type hw
    card 0
}
pcm.!default {
    type plug
    slave.pcm "nforce"
}
pcm.nforce {
    type dmix
    ipc_key 1234
    slave {
        pcm "hw:0,1"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 48000
        channels 6
    }
}
ctl.nforce-hw {
    type hw
    card 0
}

LIRC

  • Ubuntu 7.04 vs 7.10

When using Ubuntu 7.04 I had some difficultly building the kernel modules for LIRC. This is consistent with the problems I have had with it in the past. When I did a dist-upgrade from 7.04 to 7.10, the package configuration step successfully built my lirc_streamzap module for me.

This was a very nice surprise.


  • Use the Apple Remote

You Need to Edit: /etc/sysconfig/lirc

LIRCD_OPTIONS="-H macmini -d /dev/hiddev0"

Restart the lirc service and test with irw