Compiling MythTV for the R5000-HD Recorder - AVS Forum
Forum Jump: 
Thread Tools
post #1 of 10 Old 02-08-2013, 06:39 AM - Thread Starter
 
quantumstate's Avatar
 
Join Date: Apr 2006
Posts: 1,694
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 17
I've been asked in backchannel to give instructions for patching and compiling MythTV for the R5000 recorder. I don't wish to write this over and over, so will post it here.

I don't use Mythbuntu, but this should work on Ubuntu. I run Debian Testing. Never used XBMC, and don't see the use.

These instructions assume you want to use the latest MythTV 0.27 bleeding-edge nightly, which is usually fine for everyday use. If you find a problem, just recompile in a week or so.

You must have the MySQL server installed and get the Myth database installed. I've run Myth so long now that I don't know how you kids do it these days. Maybe install the Debian Myth packages, to get the database set up, then deinstall them to install the compiled version.

$ su
# nano /etc/X11/XvMCConfig
... and add a line with only:
libXvMCNVIDIA_dynamic.so.1
# nano /etc/X11/xorg.conf
... and add at the end of Devices section:
Option "UseEvents" "True"
Option "RenderAccel" "False"
... anyone running Myth should have done these.

-- Install your dependencies:
# apt-get install subversion git patch
# apt-get build-dep mythtv
# apt-get build-dep mythplugins
# apt-get install autoconf automake autopoint autotools-dev cmake curl gdb libsdl1.2-dev debhelper gawk gperf libao-dev libasound2-dev libass-dev libavahi-client-dev libavahi-common-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbluetooth-dev libbluray-dev libboost-dev libboost-thread-dev libiso9660-dev libbz2-dev libcdio-dev libcec-dev libcrystalhd-dev libcurl4-gnutls-dev libcwiid-dev libdbus-1-dev libenca-dev libflac-dev libfontconfig-dev libfreetype6-dev libfribidi-dev libgl1-mesa-dev libgles2-mesa-dev libglew1.6-dev libglu1-mesa-dev libhal-dev libhal-storage-dev libjasper-dev libjpeg-dev libltdl-dev liblzo2-dev libmad0-dev libmicrohttpd-dev libmodplug-dev libmpcdec-dev libmpeg2-4-dev libmysqlclient-dev libnfs-dev libogg-dev libpcre3-dev libplist-dev libpng12-dev libpostproc-dev libpulse-dev librtmp-dev libsamplerate-dev libshairport-dev libsmbclient-dev libsqlite3-dev libssl-dev libswscale-dev libtinyxml-dev libtool libudev-dev libusb-dev libva-dev libvdpau-dev libvorbis-dev libvpx-dev libxinerama-dev libxmu-dev libxrandr-dev libxt-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libyajl-dev lsb-release nasm python-dev python-support unzip yasm zip zlib1g-dev libcap-dev swig fonts-droid ttf-bitstream-vera ttf-dejavu ttf-dejavu-extra ttf-dustin ttf-tiresias git-core checkinstall python-mysqldb python-lxml python-urlgrabber libclass-dbi-perl libdbd-mysql-perl libnet-upnp-perl libio-socket-inet6-perl libavahi-compat-libdnssd-dev xmltv-util ntp uuid-dev libzmq-dev libqt4-opengl-dev libqt4-sql-mysql -y

(What, you couldn't -guess- that?!)

Do NOT use OpenGL ES if Qt doesn't support it. Remove all libgles packages. libgles will cause a black screen after mythfrontend starts.

-- Always compile software in the proper place on Linux machines:
# cd /usr/local/src
-- This will put the Myth source into mythtv subdir:
# git clone https://github.com/MythTV/mythtv.git
# mv mythtv mythtv-Feb2013
... Now, we will always be patching MythTV and so can never use git checkout. You will always have to use git clone, starting fresh.

-- Get Alan Nisota's old Myth r5000 stuff:
# svn checkout http://r5000-for-linux.googlecode.com/svn/trunk/ r5000-for-linux-R18
# cp r5000-for-linux-R18/firmware/r5000.hex /lib/firmware/
# cp -R r5000-for-linux-R18/src/r5000 mythtv-Feb2013/mythtv/mythtv/libs/libmythtv


-- Set up my patch:
# touch r5000-0.27.patch
-- As this board will not allow me to attach files, I am forced to put it on pastebin for you to select and put in your patch file. (with nano) Get the patch at:
https://paste.debian.net/232679/
Revised 16 Feb 2013 - applies perfectly, compiles cleanly
http://pastebin.com/x8P6NB30

# cd mythtv-Feb2013/mythtv
# cp ../../r5000-0.27.patch .
... (notice the last dot)
# patch -p0 < r5000-0.27.patch
... It should apply fairly cleanly and there should be no .rej files.
As time goes on, it is likely that this patch will fail due to changes in Myth, but the failures will be minor. You can usually edit the failed files and add the modifications by hand which are in the .rej file.

-- Prepare to compile:
# ./configure --compile-type=profile --enable-crystalhd --enable-lirc --enable-audio-alsa --enable-audio-pulse --enable-audio-jack --enable-dvb --enable-ivtv --enable-joystick-menu --enable-ffmpeg-pthreads --enable-pic --enable-vaapi --perl-config-opts="INSTALLDIRS=vendor" --enable-libvpx --enable-libx264 --enable-libmp3lame --enable-libfaac --enable-libxvid --enable-nonfree --enable-opengl-video --enable-runtime-cpudetect --enable-mmx --enable-vdpau --enable-libfftw3 --enable-sdl --with-bindings=perl,python,php
# make -j 6

(I have to go to work now)
quantumstate is offline  
Sponsored Links
Advertisement
 
post #2 of 10 Old 02-09-2013, 10:42 AM - Thread Starter
 
quantumstate's Avatar
 
Join Date: Apr 2006
Posts: 1,694
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 17
Right then, we've now (hopefully) compiled Myth.

-- If you see the word "Error" anywhere in the last several lines, something went wrong. As you've compiled multithreaded (with multiple cores, -j 6), it will not give you the true cause. To find that you must recompile single-threaded.
# make clean
# make
(Do NOT use -j 6... it can't get precedence right)
... this will hopefully yield a concrete reason why the compile failed. Maybe it will complain about some nebulous library, which is likely missing. Don't ask me.

-- Once you get a clean compile, uninstall any cruft that may be laying around your system:
# make uninstall
... also delete any old myth* files in /usr/local/bin, include, and share.
# make install

In /usr/local/bin you should now see lots of myth* files. This is good news. Make sure /usr/local/bin is in your path for executables with:
# env |grep local/bin
... If it's there, next step.

# cd ../mythplugins
# ./configure --enable-all --enable-opengl
# qmake-qt4 mythplugins.pro
# make
(Do NOT use -j 6... it can't get precedence right)
# make uninstall
# make install

Well done, if you've gotten to this point.

Now, Linux doesn't know a rectum from your r5000, so it would be very nice to make it recognize it automatically when you plug it. Alan Nisota made a shot at a config script, but it's never worked for me. His is in r5000-for-linux-18/udev. If you like, try his (using his instructions).

-- If it doesn't work, try mine:
# cd /etc/udev/rules.d
# touch 85-{yourname}-r5000.rules
# nano 85-{yourname}-r5000.rules
... and paste the following in it:
Code:
SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b4/8613/*", RUN+="/sbin/fxload -D %N -I /lib/firmware/r5000.hex -t fx2 -m 0666"
SUBSYSTEM=="usb", ENV{PRODUCT}=="547/1002/*", GROUP="disk", MODE="666"
# apt-get install fxload

-- We want mythbackend to start automatically on boot every time, don't we. If you already have /etc/init.d/mythtv-backend from your package install, cool. If not here's my (old-fashioned way of doing that:
# cd /etc/init.d
# touch mythtv-backend
# nano mythtv-backend
... and paste in my rc script from https://paste.debian.net/232946/
# chmod +x mythtv-backend
# ln -s /etc/init.d/mythtv-backend /etc/rc2.d/S03mythtv-backend
# ln -s /etc/init.d/mythtv-backend /etc/rc3.d/S03mythtv-backend
# ln -s /etc/init.d/mythtv-backend /etc/rc4.d/S03mythtv-backend
# ln -s /etc/init.d/mythtv-backend /etc/rc5.d/S03mythtv-backend

... If you get the new /etc/init method working, by all means share.

... Now, reboot your machine. Make sure the r5000 is unplugged.

So; the way this works is your ViP211 does not provide power to the R5000 -- the USB connexion does. But for good measure, power-cycle your ViP211 for ten seconds.

Your HTPC is now running and the ViP is up, so time to test this thing.

-- Plug the ViP USB. Wait a couple seconds and:
# lsusb
... And you should see something like:
Bus 002 Device 002: ID 0547:1002 Anchor Chips, Inc. Python2 WDM Encoder
-- If you see the other device, your udev script did not work for some reason. Try manually loading the firmware with Alan's instructions.

OK so now you see your device. Check to make sure the backend is running:
# lsof -i -n -P |grep myth
... You should see at least something like:
mythbacke 4593 {user} 48u IPv4 11696 0t0 TCP 127.0.0.1:6544 (LISTEN)
mythbacke 4593 {user} 50u IPv4 11697 0t0 TCP 127.0.0.1:6543 (LISTEN)
# lsof -i -n -P |grep mysql
mysqld 3874 mysql 10u IPv4 7500 0t0 TCP 127.0.0.1:3306 (LISTEN)


You are ready to GO! Time to Stop the backend...
$ sudo /etc/init.d/mythtv-backend stop
$ mythtv-setup
... NOTE run this as your user!

-- There is nothing you want to change right off in General, so move on to
Capture Cards|New capture card
... Pull down Card Type and you should find R5000 capable STB
R5000 tuning delay: 900
Serial#: {write it down}
R5000 STB type: VIP211
Finish

Set up Recording Profiles and everything else as per normal.

I always connect the projector to the ViP211 and page through the Program Guide writing down each channel I am subscribed to. Then use the Channel Editor to customize my channel list. And I set up SchedulesDirect with my channel list so I'm not downloading unnecessary stuffs.

$ mythfilldatabase
$ sudo /etc/init.d/mythtv-backend restart

-- Also, I have a menu entry in /home/{user}/.local/share/applications/mythfrontend.desktop which contains:
Code:
[Desktop Entry]
Name=MythTV Frontend
Comment=A frontend for all content on a mythtv-backend
GenericName=MythTV Viewer
Exec=/usr/local/bin/mythfrontend --logpath /var/log/mythtv/mythfrontend.log
Type=Application
Icon=/home/{user}/Utilities/updates/linux/applications/mythtvlogo.png
Categories=GNOME;AudioVideo
... (Caution: I run XBMC) So Myth now shows up in my menuing system under Multimedia.

... And to start the frontend automatically on boot I've symlinked this .desktop file into /home/{user}/.config/autostart


Why? I hear a chorus of WHY go to all this trouble?

The R5000-HD is the only method of recording which allows you to directly record the digital-perfect data straight from your satellite provider. There is no conversion from digital to analog, decompression, recompression, and back as is the case with the HD-PVR and others. You are tapping straight into the guts of the ViP and sucking out the pure decrypted digital signal direct from Dish's $50,000 compression engines, just as God intended. You can not get better signal quality.
quantumstate is offline  
post #3 of 10 Old 02-11-2013, 12:38 PM - Thread Starter
 
quantumstate's Avatar
 
Join Date: Apr 2006
Posts: 1,694
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 17
...
quantumstate is offline  
post #4 of 10 Old 05-11-2013, 08:00 PM
Member
 
waldo22's Avatar
 
Join Date: Sep 2008
Posts: 34
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Bill's instructions above are for MythTV 0.27, which is in development.

If you want to run the current stable branch, MythTV 0.26, here are some simple instructions.

First, make sure you have the build dependencies installed. On Ubuntu, this should be as easy as installing the build-depends for MythTV, but here is a list:
http://www.mythtv.org/wiki/User_Manual:Initial_Installation

For Debian, these are the dependencies that I needed for a fresh install of Wheezy 64-bit:
Code:
libusb-dev libgdb-dev qt4-qmake yasm uuid-dev libfreetype6-dev zlib1g-dev libmp3lame-dev libqtwebkit-dev libxxf86vm-dev x11proto-xf86vidmode-dev libxinerama-dev libxinerama1 x11proto-xinerama-dev mysql-server pkg-config python-mysqldb libxslt1.1 python-lxml python-pycurl python-urlgrabber libsocket6-perl libio-socket-inet6-perl libnet-upnp-perl fxload

You will need to clone my git, checkout the 0.26 branch, configure, compile and install. This means you'll need to install git if you haven't already.
Code:
git clone https://github.com/waldo22/mythtv.git
cd mythtv
git checkout fixes/0.26
cd mythtv
./configure --enable-proc-opt
make -j2
sudo make install

That's it. Due to the way the R5000 patch accesses USB (I think), MythBackend must be run as root! I couldn't get it to work otherwise.

Hope this helps someone.

-Wes

PS if you're interested, here is a live view on GitHub of all the changes that I made in order to make this work: https://github.com/waldo22/mythtv/compare/MythTV:fixes/0.26%E2%80%A6waldo22:fixes/0.26

Adding ".diff" at the end will give you a download-able diff: https://github.com/waldo22/mythtv/compare/MythTV:fixes/0.26%E2%80%A6waldo22:fixes/0.26.diff

The more I learn about GitHub, the more I like it smile.gif
waldo22 is offline  
post #5 of 10 Old 05-11-2013, 10:16 PM - Thread Starter
 
quantumstate's Avatar
 
Join Date: Apr 2006
Posts: 1,694
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 17
Thanks Wes.

The reason the backend must be run as root is so it can read and write to the USB device (which moves around with each boot, cunningly). I set mine to be writable by the video group, dynamically, using this in /etc/udev/rules.d/85-bills-r5000.rules:
Code:
SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b4/8613/*", RUN+="/sbin/fxload -D %N -I /lib/firmware/r5000.hex -t fx2 -m 0666"
SUBSYSTEM=="usb", ENV{PRODUCT}=="547/1002/*", GROUP="video", MODE="666"

# lsusb |grep Anc
Bus 002 Device 002: ID 0547:1002 Anchor Chips, Inc. Python2 WDM Encoder
# ls -al /dev/bus/usb/002/002
crw-rw-r-T 1 root video 189, 129 May 11 20:00 /dev/bus/usb/002/002

I still start the daemon as root as, I hadn't actually thought of otherwise.
quantumstate is offline  
post #6 of 10 Old 08-24-2013, 02:13 PM
Newbie
 
medman25's Avatar
 
Join Date: May 2013
Posts: 2
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Does this work with .25 as well???
medman25 is offline  
post #7 of 10 Old 10-08-2013, 09:05 PM
Member
 
waldo22's Avatar
 
Join Date: Sep 2008
Posts: 34
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
@medman25,

No, the original patch here works for 0.22 - 0.24.

My patch (in my git above) is just for 0.26, since that was the current stable release at the time I tried it.

I think quantumstate's patch works with 0.27, or it did when he posted it several months ago.

At some point I'll probably update mine for 0.27 since that's stable now, but for right now it's working well with 0.26.

-Wes
waldo22 is offline  
post #8 of 10 Old 11-27-2013, 10:23 PM - Thread Starter
 
quantumstate's Avatar
 
Join Date: Apr 2006
Posts: 1,694
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 17
Saved you the trouble Wes. I have now adapted the r5000 code to v0.28-pre-560-gb77e1a8-dirty, which is a recent nightly. Should work with any recent nightly. No friggin' way to attach a file here though. A few new libs are needed.
quantumstate is offline  
post #9 of 10 Unread 09-05-2014, 02:47 PM
Advanced Member
 
pdermody's Avatar
 
Join Date: May 2002
Location: Houston, TX
Posts: 788
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 1 Post(s)
Liked: 10
Curious how stable MythTV is with the r5000-hd recorder? I though I saw mention somewhere about livetv being an issue? Also is there a patch for the latest stable 0.27.3 ? and I see the firmware file is struck out above, is this no longer needed?

I had this MythTV "working" long ago against the r5000-hd as a test, but I wasnt too keen on the interface compared to SageTV at the time. So I went back to SageTV. That being said I am looking/exploring what my options are and I am leaning towards perhaps a MythTV backend and a XBMC/Kody front end so I thought I would perhaps give this a go again

-pd
pdermody is offline  
post #10 of 10 Unread 09-05-2014, 06:55 PM
Senior Member
 
sysadmin's Avatar
 
Join Date: Oct 2011
Posts: 225
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 14 Post(s)
Liked: 17
Quote:
Originally Posted by pdermody View Post
Curious how stable MythTV is with the r5000-hd recorder? I though I saw mention somewhere about livetv being an issue? Also is there a patch for the latest stable 0.27.3 ? and I see the firmware file is struck out above, is this no longer needed?

I had this MythTV "working" long ago against the r5000-hd as a test, but I wasnt too keen on the interface compared to SageTV at the time. So I went back to SageTV. That being said I am looking/exploring what my options are and I am leaning towards perhaps a MythTV backend and a XBMC/Kody front end so I thought I would perhaps give this a go again

-pd
I'm curious about the current state of this, as well, since my cableco locks everything "copy-once".
sysadmin is offline  
Reply HTPC - Linux Chat

User Tag List



Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off