Myth BOX
The home of guides for Myth TV, IPTables, and other linux based phenomena.
 
HD version
Preamble
Home
News
Spec
General guides
Partitioning
Installation
Firewall
Channel setup
Home automation
Product overview
Other
Useful links
SD version
Preamble
Functionality
Hardware
Software
Screenshots
Gallery
General guides
DVB Card
Myth TV
Broadband modem
Wireless network
Firewall
Network shares
Network IDS
Extra security
Streaming
Gensplash
EPIA specific guides
TV-Out cables
Audio/USB cables
Backplate
Wireless network
EPIA Kernel
Openchrome drivers
Surround sound
VPN
Online store
Prebuilt mythbox
Other
Useful links

Getting Gentoo up and running with your hardware

Linux kernel

Assuming you've setup your partition layout using the previous guide, the next step is to install Gentoo. Make sure you install the 64 bit version by downloading the amd64 option. There are plenty of guides on installing Gentoo out there, so we won't bore you by duplicating all the details. However, at the point where you are compiling your kernel there are certain kernel options which must be enabled to utilise your hardware. The following table outlines these options, based on gentoo-sources-3.0.6:

Navigation path Functionality
Device Drivers -->
    Graphics support -->
        /dev/agpgart (AGP Support) -->
            Intel 440 LX/BX/GX, I8xx and E7x05 chipset support
        Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) -->
            Intel 8xx/9xx/G3x/G4x/HD Graphics -->
                Enable modesetting on intel by default
Basic AGP/DRI/HDMI video driver

AGP_INTEL
DRM_I915
DRM_I915_KMS
Device Drivers -->
    Sound card support -->
        Advanced Linux Sound Architecture -->
            PCI sound devices -->
                Intel HD Audio -->
                    Build Realtek HD-audio codec support
                    Build HDMI/DisplayPort HD-audio codec support
        [Ensure Open Sound System is NOT compiled]
ALSA sound driver with HDMI output

SND
SND_HDA_CODEC_REALTEK
SND_HDA_CODEC_HDMI
Device Drivers -->
    Network device support -->
        Ethernet (1000 Mbit) -->
            Realtek 8169 gigabit ethernet support
Ethernet card support

R8169
Device Drivers -->
    Multimedia support -->
        DVB for Linux
        Load and attach frontend and tuner driver modules as needed
        DVB/ATSC adapters -->
            SAA7146 DVB cards (aka Budget, Nova-PCI)
                Budget cards
                Budget cards with onboard CI connector
DVB-T TV card

DVB_CORE
MEDIA_ATTACH
DVB_BUDGET_CORE
DVB_BUDGET
DVB_BUDGET_CI
Device Drivers -->
    Multimedia support -->
        Video For Linux
        DVB for Linux
        Load and attach frontend and tuner driver modules as needed
        Video capture adapters -->
            Autoselect pertinent encoder/decoders and other helper chips
            Conexant 2388x (bt878 successor) support >
                DVB/ATSC Support for cx2388x based TV cards
DVB-S2 TV card

VIDEO_DEV
DVB_CORE
MEDIA_ATTACH
VIDEO_HELPER_CHIPS_AUTO
VIDEO_CX88
VIDEO_CX88_DVB
Device Drivers -->
    Multimedia support -->
        Remote Controller adapters -->
            SoundGraph iMON receiver and Display
iMON remote control and LCD display

IR_IMON

TV Card firmware

To get the two TV cards working, you will need the firmware files which drive the demodulator (also known as the frontend). These firmware files need to be copied to /lib/firmware/. More info on TV card firmware can be found at http://www.linuxtv.org/wiki/index.php/Firmware.

WinTV Nova-T

For the DVB Nova T PCI card, if you see the following from lspci -vvn:
04:02.0 Multimedia controller [0480]: Philips Semiconductors SAA7146 [1131:7146] (rev 01)
then this guide is for your card, which uses the TDA10045 demodulator. The firmware can be acquired from the get_dvb_firmware script bundled in the documentation folder of the Linux kernel source code.

More info on this card can be found on the linuxtv.org site, http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-NOVA-T_PCI and http://www.linuxtv.org/wiki/index.php/NXP_TDA1004x.

WinTV Nova-HD-S2

The WinTV-Nova-HD-S2 is essentially a WinTV-HVR-4000 but without the DVB-T demodulator and analogue functionality. If you see the following output from lspci -vvn:
04:01.0 Multimedia video controller [0400]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [14f1:8800] (rev 05)
04:01.1 Multimedia controller [0480]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] [14f1:8801] (rev 05)
04:01.2 Multimedia controller [0480]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [MPEG Port] [14f1:8802] (rev 05)
04:01.4 Multimedia controller [0480]: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [IR Port] [14f1:8804] (rev 05)
then this guide is for your card, which uses the CX24116 demodulator. You can prepare the firmware by:
  • Running wget http://www.wintvcd.co.uk/drivers/88x_2_126_28225_WHQL.zip
  • Unzip and go into the directory containing bcw88bda.sys
  • Extract the firmware from the file and put it in the firmware directory using sudo dd if=hcw88bda.sys of=/lib/firmware/dvb-fe-cx24116-1.26.90.0.fw bs=1 skip=105768 count=32290; sudo ln -s /lib/firmware/dvb-fe-cx24116-1.26.90.0.fw /lib/firmware/dvb-fe-cx24116.fw
More info on this card can be found on the linuxtv.org site, and http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-4000#Firmware_v1.26.90.0.

Putting the cards in order

Whenever you reboot your Mythbox HD, the TV cards will be allocated in a specific order. Given this could change (from experience it can change if you switch between compiling kernel features as modules and compiling them into the kernel itself), it would be nice to explicitly specifiy the order given that each card will be tied to an ID in the database. There are two options, specify the order as a kernel module option, or utilise a udev rule file.

To specify kernel module options, create a file called /etc/modprobe.d/dvb.conf and put the following in it:
options budget_ci adapter_nr=0
options cx88_dvb adapter_nr=1
Then do a update-modules. Upon reboot the cards should be ordered with the Nova-T first and the Nova-HD-S2 second.

Another method (which we didn't get working at Mythbox.co.uk) is to use udev. First get information about each device:
udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/dvb/adapter0/frontend0)
udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/dvb/adapter1/frontend0)
We will use the discriminating factors to differentiate one card from the other, which in our case is the driver. Now create the following file within /etc/udev/rules.d/10-local.rules to ensure the card order never changes:
# Create a symlink /dev/dvb/vadapter01 pointing to Nova-T
SUBSYSTEM=="dvb", ATTRS{vendor}=="0x1131", ATTRS{device}=="0x7146", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/vadapter01/%%s $${K#*.}'", SYMLINK+="%c"

# Create a symlink /dev/dvb/vadapter02 pointing to Nova-HD-S2
SUBSYSTEM=="dvb", ATTRS{vendor}=="0x14f1", ATTRS{device}=="0x8802", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/vadapter02/%%s $${K#*.}'", SYMLINK+="%c"

iMON LCD and Remote Control

There are various versions of the iMON panel which contains the LCD screen and remote control receiver. To confirm that the instruction here are applicable to your hardware, run lsusb and check that you have the following device information shown:
15c2:0038 SoundGraph Inc. GD01 MX VFD Display/IR Receiver

Packages

At this point you should have a generic Gentoo amd64 install, with specific options set within the kernel for your hardware. The next step is getting the necessary packages installed to make your Mythbox HD useful.
  1. First off, get your system fully up-to-date. emerge --sync; emerge -aDuNv @world
  2. Make sure we have xfsprogs so that we can look after our media partition. emerge xfsprogs
  3. Get our firewall ready for later when we configure it. emerge iptables
  4. We need Xorg to handle the graphics. Add VIDEO_CARDS="intel vga vesa", INPUT_DEVICES="evdev keyboard mouse", USE="X -gtk -gnome -kde -qt3 -qt4 qt3support" to your /etc/make.conf. At the time of writing, the latest version of mesa is broken, so add =media-libs/mesa-7.11 to /etc/portage/packages.mask. Then emerge xorg-x11.
  5. Set your default XvMC and OpenGL implementations with eselect xvmc set 1 and eselect opengl set 1.
  6. Git is an excellent distributed VCS. Even if you aren't going to use it directly, we will need it to retrieve the bleeding edge version of mythtv. emerge git to install. Once installed follow the instructions at https://github.com/MythTV/packaging/tree/master/Gentoo to add the MythTV overlay.
  7. LCDproc will enable our iMON display, and LIRC will allow our remote to function. However, we will need to add keywords to get support for our device, so add =app-misc/lcdproc-0.5.2-r2 ~amd64 and =app-misc/lirc-0.9.0 ~amd64 to /etc/portage/package.keywords. Then add LCD_DEVICES="imonlcd", LIRC_DEVICES="inputlirc userspace", and USE="usb" to /etc/make.conf. These packages will get pulled in by the MythTV package.
  8. Add USE="autostart dvd dvb lcd lirc alsa vaapi python perl ffmpeg" and then emerge mythtv. This will install MythTV from our newly integrated overlay. At the time of writing, you will need to add keywords to get the latest MythTV packages.
  9. MySQL will have been installed as a dependency. You should have seen the notice to configure it, do so. For the lazy it will be something like emerge --config =dev-db/mysql-5.1.56.
  10. Now configure MythTV with emerge --config =media-tv/mythtv-0.25_pre20111102.
  11. Assuming you have setup your /etc/fstab so that /dev/sda3 is mounted to /mnt/store, you need to chown -R mythtv /mnt/store.
  12. Make MythTV autostart by running rc-update add mythbackend default and adding the following to your /etc/inittab file at the end of the TERMINALS section: c8:2345:respawn:/sbin/mingetty --autologin mythtv tty8
  13. Add USE="opengl libvisual sdl cdr fftw mp3 aac jpeg" and then emerge mythmusic mythbrowser mythgallery mythnetvision mythweather mythweb to install the MythTV plugins.
  14. Now if you reboot, you should find mythfrontend shows a language selection screen. But you might find the backend fails to load until you've run mythtv-setup as the mythtv user to setup your tuner cards.
  15. Lets install Xine which is always a good as a fallback if things go bad. Add USE="xvmc dts a52" and then emerge xine-ui.
  16. For similar reasons, emerge mplayer.
  17. We need to configure LCDproc - in your /etc/LCDd.conf specify the Driver=imonlcd at the top, and add the following block:
    [imonlcd]                                                           
      
    # select the device to use                                          
    Device=/dev/lcd0                                                    
    Contrast=90                                                         
    Protocol=1                                                          
    OnExit=2  
    
    Then uncomment ServerScreen=no and Foreground=no. Now make LCDd start on boot rc-update add LCDd default.
  18. Next, to configure LIRC we need to know what event device the LCD is associated with. Run cat /proc/bus/input/devices and look for iMON Remote (15c2:0038). It will specify the event number next to the device, e.g. event5. Specify this in /etc/conf.d/lircd by adding LIRCD_OPTS="-H devinput -d /dev/input/eventX". Then copy the event template config file cp /usr/share/lirc/remotes/devinput/lircd.conf.devinput /etc/lirc/lircd.conf. Make sure that LIRC start on boot using rc-update add lircd default.
  19. Next you need a lircrc file to specify what buttons MythTV and Xine map to what operations. Get this one, and copy it to /home/mythtv/.mythtv/lircrc. Then link it for Xine using: ln -s /home/mythtv/.mythtv/lircrc /home/mythtv/.lircrc.
  20. Depending on your hardware, you may find that ALSA has issues switching between stereo sound and pass-through modes. There are commands you can run to manually set the mode you require, and to do this you'll need to emerge alsa-utils. Here is a stereosound script and a surroundsound script which you can associate with your remote control.
More to come, including the concluding steps to get your remote control working with the Linux in-kernel drivers!