Building MythTV for DVB from source

January 15th, 2009

Based on "Roo's quick guide on how-to build Mythtv on Ubuntu Edgy (6.10) for either a Nexus (FF) or a softcard (non FF)." Please note that some users have reported that sasc-ng will work without compiling, patching, and re-installing Mythtv. I have not tried this myself, and YMMV.

Link to page is here

# Instructions for downloading, and compiling the source for the kernel and sasc-ng for Knoppmyth R5E50
# Knoppmyth should be installed and running

# get the knoppmyth kernel source
wget ftp://knoppmyth.net/R5/linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb
su
dpkg -i linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb
cd /usr/src
tar xjvf linux-source-2.6.18-chw-13.tar.bz2
cd /usr/src/linux-source-2.6.18-chw-13
cp /boot/config-2.6.18-chw-13 .config
echo Compiling the kernel
make
#Wait a while for compile
make modules
# backup the modules directory just in case. You can delete it if everything goes OK.
mkdir /lib/modules/2.6.18-chw-13.backup
cp -av /lib/modules/2.6.18-chw-13 /lib/modules/2.6.18-chw-13.backup
make modules_install

# change the main source symlink to point at the sources
cd /usr/src
rm linux
ln -sf linux-source-2.6.18-chw-13 linux
# ln -s linux-headers-2.6.18-chw-13 linux # this is what the original linux link points to

ln -sf linux-source-2.6.18-chw-13 /lib/modules/2.6.18-chw-13/source

dmesg | grep dvb #at this point the dvb card should have already been loaded and you can see it in the output of a dmesg

ls -al /dev/dvb #and you can see adapter0 in the dev dvb folder.
# if not, check http://www.linuxtv.org/wiki/index.php/PCI_devices_DVB-S or around there depending on your card to ensure that the correct modules are loaded.

# ***NEXUS ONLY***
# We need to copy Patched firmward for a nexus card to the firmware directory and unload/reload the dvb module after the copy.
#cd /usr/src
#wget http://207.44.152.197/dvb-ttpci-01-f22623-patched.fw.bz2
#bunzip2 dvb-ttpci-01-f22623-patched.fw.bz2
#mkdir /lib/firmware/`uname -r`
#cp dvb-ttpci-01-f22623-patched.fw /lib/firmware/`uname -r`
#mv /lib/firmware/dvb-ttpci-01.fw /lib/firmware/`uname -r`/dvb-ttpci-01.bu
#ln -s /lib/firmware/`uname -r`/dvb-ttpci-01-f22623-patched.fw /lib/firmware/dvb-ttpci-01.fw
#modprobe -r dvb_ttpci
#sleep 10 #or just wait 10 seconds
#modprobe dvb_ttpci

#get sasc-ng
cd /usr/src
svn co http://OpenSVN.csie.org/sascng sasc-ng

cd /usr/src/sasc-ng/trunk
#sasc-ng
./configure
make
#dvbloopback module
make module
insmod dvbloopback.ko
cd sc_files
#Setup your sc_files folder to look like this:
# -rw-r--r-- 1 root src 1381 2006-12-31 09:24 ca.cache
# drwxr-sr-x 2 root src 4096 2006-12-31 15:43 nagra
# -rw-r--r-- 1 root src 1642 2006-12-27 11:36 SoftCam.Key
#
# ./nagra:
# -rw-r--r-- 1 root src 18432 2006-12-27 11:36 EEP01_102.bin
# -rw-r--r-- 1 root src 18432 2006-12-27 11:36 EEP08_102.bin
# -rw-r--r-- 1 root src 98304 2006-12-27 11:36 ROM102.bin
# to do so:
touch ca.cache #creates blank one
wget http://www.geocities_com/vlivecd/vdr-live/SoftCam.Key (change _ to .)
wget http://www.geocities_com/vlivecd/vdr-live/au-bins2.tar.zip (change _ to .)
unzip au-bins2.tar.zip
tar jxvf au-bins2.tar.bz2
mv au-bins2 nagra
#start sasc-ng
cd ..
./sasc-ng -j 0:1

#Open a new terminal

su
cd /usr/src
/etc/init.d/mythtv-backend stop

#Get Mythtv SVN or Mythtv 20-fixes. Pick one set of the three checkouts
#svn co -r 12354 http://svn.mythtv.org/svn/trunk/mythtv
#svn co -r 12354 http://svn.mythtv.org/svn/trunk/mythplugins
#svn co -r 12354 http://svn.mythtv.org/svn/trunk/myththemes

# I used the fixes branch and it worked

svn co -r 12354 http://svn.mythtv.org/svn/branches/release-0-20-fixes/mythtv
svn co -r 12354 http://svn.mythtv.org/svn/branches/release-0-20-fixes/mythplugins
svn co -r 12354 http://svn.mythtv.org/svn/branches/release-0-20-fixes/myththemes

#get patches
svn co http://opensvn.csie.org/myth_dvb_ng

cd /usr/src/mythtv
#apply patches to mythtv SVN or mythtv 20-fixes. Note nexus patches are for Nexus FF boards only.
#patch -p0 -F99 < ../myth_dvb_ng/TRUNK/1_SDT/myth_sdt_r?????.diff
#patch -p0 -F99 < ../myth_dvb_ng/TRUNK/2_EIT/myth_eit-bev-dn3_r?????.diff
##uncomment the next two lines only if you have a Nexus card
##patch -p0 -F99 < ../myth_dvb_ng/TRUNK/3_NEXUS/myth_nexus_pmt_r?????.diff # ***NEXUS ONLY***
##patch -p0 -F99 < ../myth_dvb_ng/TRUNK/3_NEXUS/myth_nexus_tune_pes_r?????.diff # ***NEXUS ONLY***
#patch -p0 -F99 < ../myth_dvb_ng/TRUNK/4_SISCAN/myth_siscan_r?????.diff
#patch -p0 -F99 < ../myth_dvb_ng/TRUNK/5_RADIO/myth_radiots_r?????.diff # *** Radio Transport Stream Pid 200 (Required for audio channels only)
#patch -p0 -F99 < ../myth_dvb_ng/TRUNK/5_RADIO/myth_killerradio_r?????.diff # *** Radio song display (not required)

#OR

patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/1_SDT/myth_sdt_r?????.diff
patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/2_EIT/myth_eit-bev-dn3_r?????.diff
#uncomment the next two lines only if you have a Nexus card
#patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/3_NEXUS/myth_nexus_pmt_r?????.diff # ***NEXUS ONLY***
#patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/3_NEXUS/myth_nexus_tune_pes_r?????.diff # ***NEXUS ONLY***
patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/4_SISCAN/myth_siscan_r?????.diff
patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/5_RADIO/myth_radiots_r?????.diff # *** Radio Transport Stream Pid 200 (Required for audio channels only)
patch -p0 -F99 < ../myth_dvb_ng/20-FIXES/5_RADIO/myth_killerradio_r?????.diff # *** Radio song display (not required)

# The following will configure mythtv to the Knoppmyth defaults
./configure --enable-dvb --enable-xvmc --enable-opengl-vsync --enable-xvmc-pro --enable-proc-opt --prefix=/usr

make #Wait a while for compile... hopefully error free Smile

# Backup the custom Knoppmyth menus
# Thanks to WattoToydarian, HTTP://Watto.HomeIP_net/mythsvn.sh (replace _ with . in URL)

/bin/cp -f --reply=yes /usr/share/mythtv/mainmenu.xml ../
/bin/cp -f --reply=yes /usr/share/mythtv/optical_menu.xml ../

make install #Copy's files to /usr/local/bin

# Restore the custom menus
/bin/cp -f --reply=yes ../mainmenu.xml /usr/share/mythtv/
/bin/cp -f --reply=yes ../optical_menu.xml /usr/share/mythtv/

cd ../myth_dvb_ng/20-FIXES/5_RADIO/
# thanks to testingguy for the following fix
echo "cp dummy1280x720p25.00.ts /usr/share/mythtv/themes/default" >> /usr/src/myth_dvb_ng/20-FIXES/5_RADIO/copyts.sh
sh copyts.sh # *** Radio Transport stream copy to your backend themes folder, 20-FIXES and TRUNK use the same file. (Required for audio channels only)
# Don't worry about an error message that says:
# cp: cannot create regular file `/usr/local/share/mythtv/themes/default': No such file or directory

echo /usr/local/lib >> /etc/ld.so.conf # fixes where to look for library files.
ldconfig #updates the LD cache.

# the next 5 "echo" lines will be added to/etc/init.d/bootmisc.sh to automatically start sasc-ng on boot
echo "## start loopback adapter and sasc-ng ##" >> /etc/init.d/bootmisc.sh
# You may need to modify the next line depending on the
# Number of DVB Cards you have in your system dedicated to SASC-NG
echo "modprobe dvbloopback" >> /etc/init.d/bootmisc.sh
echo "sleep 3" >> /etc/init.d/bootmisc.sh
echo "cd /usr/src/sasc-ng" >> /etc/init.d/bootmisc.sh
# Adjust the next line to start sasc-ng according to your devices.
echo "./sasc-ng -j 0:1 > /var/log/sasc-ng.log &" >> /etc/init.d/bootmisc.sh
echo "sleep 5" >> /etc/init.d/bootmisc.sh

cp /usr/src/sasc-ng/dvbloopback.ko /lib/modules/2.6.18-chw-13/misc/
depmod -a

#setup your card, ensure you use card 1 (or whatever virtual adapter number, not card 0. For NA providers, use Circular Dish setup
#setup your Video Sources
#setup your Input connections
#Scan channels etc. For initial transponders, use one frequency that locks from the list:
#D**hnet 119 -> http://www.lyngsat.com/packages/dish119.html
#D**hnet 110 -> http://www.lyngsat.com/packages/dish110.html
#B*v 91 -> http://www.lyngsat.com/nimiq1.html
#B*v 82 -> http://www.lyngsat.com/nimiq2.html
#Add 3 zeros to the end of each freq (ie 12224 R should be 12224000, Right Circular, 20000000)
#setup a storage directory

mythtv-setup

mythbackend

#Open a new terminal
mythfrontend

#Watch tv a few times (once maybe twice will do)
#to roll the first key (or seed ca.cache). You should see things happening in the sasc-ng terminal window

#The following will add the ivtv drivers for PVR cards. Credit for this goes to testingguy
cd /usr/src
wget http://dl.ivtvdriver.org/ivtv/stable/ivtv-0.10.1.tar.gz
tar zxvf ivtv-0.10.1.tar.gz
cd ivtv-0.10.1
make
make install
reboot

HP HDX 20"

January 15th, 2009

This laptop (if it can really be called that) is my favorite laptop ever.

Forum Links
HDX Owners Lounge
Black Knight's 'page 100' post - most important info in thread

Video Driver
Here is a link to all of the nvidia 179.28 mobile video drivers

Audio Driver
Here is a link to the 5607 audio driver - recommended since other versions often result in a loss of bass

Driver Cleaner (not specific to HDX)
Homepage
1) Uninstall Driver
2) Restart to safe-mode
3) Run Driver Cleaner

ddrescue - Data recovery tool

January 14th, 2009

GNU ddrescue is a data recovery tool. It copies data from one file or block device (hard disc, cdrom, etc) to another, trying hard to rescue data in case of read errors.

Ddrescue does not truncate the output file if not asked to. So, every time you run it on the same output file, it tries to fill in the gaps.

The basic operation of ddrescue is fully automatic. That is, you don't have to wait for an error, stop the program, read the log, run it in reverse mode, etc.

If you use the logfile feature of ddrescue, the data is rescued very efficiently (only the needed blocks are read). Also you can interrupt the rescue at any time and resume it later at the same point.

Automatic merging of backups: If you have two or more damaged copies of a file, cdrom, etc, and run ddrescue on all of them, one at a time, with the same output file, you will probably obtain a complete and error-free file. This is so because the probability of having damaged areas at the same places on different input files is very low. Using the logfile, only the needed blocks are read from the second and successive copies.

The logfile is periodically saved to disc. So in case of a crash you can resume the rescue with little recopying.

Also, the same logfile can be used for multiple commands that copy different areas of the file, and for multiple recovery attempts over different subsets.

Ddrescue aligns its I/O buffer to the sector size so that it can be used to read from raw devices. For efficiency reasons, also aligns it to the memory page size if page size is a multiple of sector size.

More information at homepage here

Note: For floppy, I used the following command:
ddrescue --direct -v -r99 -c1 -b512 /dev/sdb disk1.img disk1.log

SSH Tunneling

January 14th, 2009

Putty command line to set up a tunnel (page is here):

Make a ssh connection to the remote machine using dynamic port forwarding. (If the standard ssh port [22] is blocked then some accounts, such as Panix, will allow a ssh connection on another port, such as 80 or 443). For example, on a Windows machine I could connect to Panix by entering the following on the command line:

putty -ssh -D 4096 -P 80 shell.panix.com

In case you are not familiar with Putty* and its command line options I will break that down for you:

-ssh
Use the ssh protocol
-D 4096
Use dynamic port forwarding with 4096 as that port. (You could use any port number you like that is not already in use on your machine).
-P 80
Connect to the server on port 80 (this part may not be needed or your remote machine may not support it)
shell.panix.com
The server you are connecting to. In this example the panix shell server.

Note 1: You can also use the Putty graphical user interface. You do not need to use the command line! Once you have started Putty you can get to the port forwarding section via Connection -> SSH -> Tunnels. Then type 4096 (or any other suitable port number) in the Source Port box, click the Dynamic radio box and click the Add button.

Note 2: If you are using Linux or MacOS/X you could use OpenSSH as follows: ssh -D 4096 -p 80 shell.panix.com

DD-WRT

January 14th, 2009

Awesome firmware replacement for wireless routers.

WRT600N
Thread regarding WRT600N