Compile Linux

From Dolot

Jump to:navigation, search

To get SASC-NG to work on a kernel higher than 2.6.38 you need to patch it.

Contents

1 Dependencies

You will need these packages to compile the linux kernel

apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential
apt-get build-dep asciidoc binutils-dev docbook-dsssl docbook-utils docbook-xsl gawk jadetex kernel-wedge libdw-dev libdw1 libelf-dev libosp5 libostyle1c2 libsgmls-perl libsigsegv2 libsp1c2 libxml2-utils luatex lynx lynx-cur makedumpfile openjade sgmlspl sharutils sp tex-common texlive-base texlive-binaries texlive-common texlive-doc-base texlive-fonts-recommended texlive-latex-base texlive-latex-recommended tipa transfig xmlto xsltproc

You will also need these packages to pass the nvidia-module building: (I use version 173, yours may be different)

Note: It seems that compiling nvidia drivers fails. Solution might be to download the driver from nvidia website and compile driver from that file.

apt-get install nvidia-current-dev nvidia-current-updates-dev
apt-get install nvidia-173-updates-dev nvidia-173-dev

2 Get Linux 3.0.4 source

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.4.tar.bz2
tar xjf linux-3.0.4.tar.bz2
cd linux-3.0.4

3 Patch the source

cd /usr/src/linux-3.0.4
wget http://kipdola.be/subdomain/linux-2.6.38-dvb-mutex.patch
patch -p1 linux-2.6.38-dvb-mutex.patch

4 Compile

It is normally a good idea to take the configuration of your current kernel as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-3.0.0-13-generic

cd /usr/src/linux-3.0.4/
cp /boot/config-3.0.0-13-generic .config
make

After everything has been compiled you can install it with this. You'll see lots of files installing. The last line seems to be stuck, but it's actually doing lots of stuff in the background. If you're really unsure if it actually is working, use htop to see what it's doing.

sudo make modules_install install

5 Check

Everything should be ok. Check for these files in /boot/

If you can't find the initrd.img, run this:

sudo update-initramfs -u -k 3.0.4

If it's still not there, try this:

sudo update-initramfs -c -k 3.0.4

6 Ubuntu 11.10

Alternative way of doing things on Ubuntu 11.10. In this example kernel 3.0.0-12-generic is used, but it works also with newer version 3.0.0-14-generic (just substitute the version number). No reboot required, even if in some cases it may be needed to make things work.

mkdir ~/kernel
cd ~/kernel
apt-get source linux-source-3.0.0

Unpack /usr/src/linux-source-3.0.0/linux-source-3.0.0.tar.bz2 to ~/kernel, then:

wget http://kipdola.be/subdomain/linux-2.6.38-dvb-mutex.patch
patch -p1 linux-source-3.0.0/drivers/media/dvb/dvb-core/dvbdev.c linux-2.6.38-dvb-mutex.patch 

"Configure" and build the kernel tree. There is a way to build just the modules. Didn't find the exact command. Here's a hint though.

make mrproper
cp /boot/config-3.0.0-12-generic .config
cp /usr/src/linux-headers-3.0.0.0-12-generic/Module.symvers .
make oldconfig
make prepare
make scripts
make modules SUBDIRS=drivers/media/dvb/

Make sure you stopped mythbackend and any other program that may be using the DVB hardware. Note, the modules budget_core and budget_ci are hardware dependent. In this case, it's a TechnoTrend S2-3200 DVB card.

sudo cp drivers/media/dvb/dvb-core/dvb-core.ko /lib/modules/3.0.0-12-generic/kernel/drivers/media/dvb/dvb-core/
sudo modprobe -r budget_ci budget_core dvb_core dvbloopback
find drivers/media/dvb/ -name '*.ko' -exec sudo cp -v '{}' '/lib/modules/3.0.0-12-generic/kernel/{}' \;
sudo depmod -a

Then follow the instructions to compile sasc-ng and the dvbloopback module here http://dolot.kipdola.com/wiki/Install_SASC-NG#Installing_dependencies

Load the new modules.

sudo modprobe dvb_core
sudo modprobe budget_core
sudo modprobe budget_ci
sudo modprobe dvbloopback

lsmod | grep dvb
dvbloopback            23934  4 
dvb_core              109664  3 dvbloopback,budget_ci,budget_core

Start mythtv-backend and check if the backend listens on port 6543.

sudo service mythtv-backend start
sudo netstat -tanp | grep myth
tcp        0      0 0.0.0.0:6543            0.0.0.0:*               LISTEN      19766/mythbackend
tcp        0      0 0.0.0.0:6544            0.0.0.0:*               LISTEN      19766/mythbackend
tcp        0      0 0.0.0.0:6545            0.0.0.0:*               LISTEN      30349/mythlcdserver

7 Disclaimer

Influenced by www.howopensource.com's [1] guide.

Navigation
Toolbox