How-To: DVB-T (rtl2832) with TVHeadend (Linaro 12.04)

Discussion in 'Application & Utilities' started by flipsa, Jan 16, 2014.

  1. flipsa

    flipsa New Member

    Joined:
    Jan 14, 2014
    Messages:
    17
    Likes Received:
    0
    Hey,

    not a question, just sharing my success, in case other people are trying / struggling with the same...

    Got my DVB-T adapter (rtl2832 chipset) and also tvheadend working. So my udoo is now streaming live tv to all my other devices (vlc as a client on Linux, Windows and Mac; TVHGuide on Android), which is awesome :)

    I don't have time for a detailed step by step how-to right now (but will add one later if anybody is interested). In the meantime: if anybody wants to compile the module for rtl2832 based adapters or tvheadend, feel free to ask in this thread, i'll try to help.
     
  2. bhakta

    bhakta New Member

    Joined:
    Nov 22, 2013
    Messages:
    16
    Likes Received:
    0
    Re: Success: DVB-T (rtl2832) with TVHeadend on Linaro 12.04

    I would be interested in this project if you would like to share the details.

    TIA
     
  3. flipsa

    flipsa New Member

    Joined:
    Jan 14, 2014
    Messages:
    17
    Likes Received:
    0
    Re: Success: DVB-T (rtl2832) with TVHeadend on Linaro 12.04

    Sure, i'll try to help. There was also a bit of trial and error and i did not take notes when I did this unfortunately, so all this is from memory. Hope I don't forget any critical step. If you need help just ask again...

    All the following happens directly on the udoo, no cross-compiling or anything, while logged in as root (since this is potentially dangerous, please don't just copy and paste the commands from below if you're not sure what you are doing!). If you cross-compile, make sure you have the toolchain and use cross-compiler instructions whenever you compile or "make" (follow the udoo manual, it has all the info you need) .

    Install needed dependencies:
    Code:
    apt-get install build-essential git libncurses5-dev 
    
    Since there is only an outdated version for uboot-mkimage in the apt repos, get the source and build it yourself:
    Code:
    wget ftp://ftp.denx.de/pub/u-boot/u-boot-2013.10.tar.bz2
    tar -xzf u-boot-2013.10.tar.bz2
    cd u-boot-2013.10
    make -j5 tools
    cp tools/mkimage /usr/local/bin/
    Download and configure the Unico kernel sources:
    Code:
    cd /usr/src
    git clone https://github.com/UDOOboard/Kernel_Unico
    cd Kernel_Unico
    make UDOO_defconfig
    make menuconfig
    Now activate DVB-T support and any other modules you need, which is at the least: DVB_CORE and DVB_USB
    Code:
    Device Drivers  ---> <*> Multimedia support  ---> <M>   DVB for Linux 
    Device Drivers  ---> <*> Multimedia support  ---> [*]   DVB/ATSC adapters  ---> <M>   Support for various USB DVB devices. 
    If you are lucky and kernel 3.0.35 already has a module that matches your adapter you should include it. If, like me, you have a rtl2832, which is not supported yet in this kernel, then there's a bit more work involved - see below). When you are done selecting everything you need, save and exit menuconfig and build your kernel and modules:
    Code:
    make -j5 uImage && make modules_install
    cp arch/arm/boot/uImage /boot/
    
    As you'll notice when trying to build modules against the running kernel, and for reasons beyond comprehension (at least for me), the download Unico sources will give you a slightly different kernel version string than the running kernel. So, after building it you will have to boot from the new kernel before you can finally build the rtl3832 module. So, after a hopefully successful reboot, verify the changed kernel version:
    Code:
    root@udoo:/root# uname -r
    3.0.35-g76d54f2
    Building the module for rtl2832 based adapter
    Code:
    cd /root
    git clone https://github.com/ambrosa/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0.git
    cd DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0/RTL2832-2.2.2_kernel-3.0.0
    Now, edit the Makefile and find the line starting with KDIR. Comment it out and add a new line, so it looks like below (even though this does not make sense, as it asks for the header files, but we supply instead the path to the sources, this mysteriously works):
    Code:
    #KDIR = /usr/src/linux-headers-`uname -r`
    KDIR = /usr/src/Kernel_Unico
    Then build the modules. If make complains about missing kernel headers (which i *think* it won't) see my other thread here: viewtopic.php?f=24&t=800
    Code:
    make clean
    make  -j5
    make install
    If all goes well you should now have a module called dvb-usb-rtl2832u.ko in /lib/modules/3.0.35-g76d54f2/kernel/drivers/media/dvb/dvb-usb/
    Load it with:
    Code:
    insmod /lib/modules/3.0.35-g76d54f2/kernel/drivers/media/dvb/dvb-usb/dvb-usb-rtl2832u.ko
    
    NOTE: modprobe fails for me, while insmod works. No clue why that is, but that means that automatic loading of modules (when plugging in your USB adapter or during boot) will fail. But you can insmod it by hand or write yourself a script that get's executed at boot time. I load the module in the tvheadend init script (see below).

    Building tvheadend.
    First get all the dependecies:
    Code:
    apt-get install libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
    First clone the github repo. If you want to you can configure build options, but the default should work. Then build the module:
    Code:
    cd /root
    git clone https://github.com/tvheadend/tvheadend.git
    cd tvheadend-master
    ./configure 
    make -j5 
    Test the binary
    Code:
    ./build.linux/tvheadend -C 
    If it runs fine and detects your adapter, use ctrl+c to stop it and
    Code:
    make install
    I used the init-script and config file from my regular debian installation and just copied it to /etc/init.d and /etc/default and added the insmod line from above to the init-script (you might also have to change the path to /usr/local/bin since most distros will install it to /usr/bin). Then just add it to the default runlevel if you want it to start at boot.

    You should now read up on the tvheadend website on how to properly configure und run tvheadend (e.g. running as user hts and group video, permissions, how to access the web-frontend and setting everything up, etc.). See here: https://tvheadend.org/projects/tvheadend/wiki

    If you made it this far, you should now be able to watch live tv streamed from your udoo to any device in your network or you can watch on the udoo itself, of course. If you also install openvpn (and if your upstream is fast enough; you'll need around ~400 to 800kB/s), you can also watch tv from anywhere, even on most 3G networks. Not that i'd recommend watching too much tv, but that's another story...
     

Share This Page