View Single Post
Posts: 468 | Thanked: 610 times | Joined on Jun 2006
#32
First of all a BIG disclaimer!!!!
These instructions flash the N900 with your own compiled kernel! This can brick your N900 if done incorrectly, requiring a reflash in the worst-case scenario!
PERFORM THESE STEPS AT YOUR OWN RISK!
This sounds really scary, but in reality, if anything goes wrong and the N900 appears bricked, you can almost always just flash the original Nokia kernel (KERNEL ONLY!) and get the N900 working again without any data-loss (but you may need to reinstall kernel-power etc.)


DVB-T modules for Kernel Power v48
I compiled my own kernel-power v48 image and modules in scratchbox and added the v4l dvb modules for DiBcom DiB0700 USB DVB devices (pctv nanoStick uses that chip ) from a more recent version of v4l.

Most instructions are based on this post about compiling kernel-power from source by NiQ, but I updated them for the v48 version from pali.

first I created a fresh target in scratchbox for kernel compilation called "kp48":
Code:
scratchbox sb-conf setup "kp48" -c cs2007q3-glibc2.5-arm7 -d qemu:perl:svn:apt-https -t /scratchbox/devkits/qemu/bin/qemu-arm-sb

scratchbox sb-conf select "kp48"

scratchbox sb-conf rs "kp48" /home/$USER/maemo-sdk-rootstrap_5.0_20.2010.36-2_armel.tgz 

scratchbox sb-conf in "kp48" -edFL
then I updated the target and downloaded and unpacked the source package from extras-devel:
Code:
DEBLINE="deb http://repository.maemo.org/extras-devel/ fremantle free non-free"

echo $DEBLINE | tee -a "/scratchbox/users/$USER/targets/kp48/etc/apt/sources.list"

DEBLINE="deb-src http://repository.maemo.org/extras-devel/ fremantle free"

echo $DEBLINE | tee -a "/scratchbox/users/$USER/targets/kp48/etc/apt/sources.list"

scratchbox fakeroot apt-get -o APT::Architecture=armel update

scratchbox fakeroot apt-get -o APT::Architecture=armel upgrade -y --force-yes

scratchbox fakeroot apt-get -o APT::Architecture=armel -f install -y --force-yes

scratchbox fakeroot apt-get -o APT::Architecture=armel install ncurses-dev -y --force-yes

scratchbox fakeroot apt-get -o APT::Architecture=armel install kernel-power-source -y --force-yes

scratchbox mkdir "/scratchbox/users/$USER/home/$USER/kp48"

scratchbox bzip2 -d < "/scratchbox/users/$USER/targets/kp48/usr/src/kernel-power-source-2.6.28.10-power48.tar.bz2" | tar -x -C "/scratchbox/users/$USER/home/$USER/kp48/"
Later on we will run "menuconfig" to select the correct modules. This ncurses menu only works in scratchbox after a small change:

Code:
fileName="/scratchbox/users/$USER/home/$USER/kp48/kernel-power/scripts/kconfig/lxdialog/check-lxdialog.sh"

lineOld="for ext in so a dylib ; do"

lineNew="echo -lncurses; exit ; for ext in so a dylib ; do"

sed -i "s/$lineOld/$lineNew/g" "$fileName"
Now compile the normal kernel image and modules for power kernel v48. I use "-j 3" to speed up compilation, by using 3 threads in parallel. But if you have an even faster CPU you can use a higher value ( Intel Core i7 with 4 cores for example, you could use "-j 8")

Code:
scratchbox -d /home/$USER/kp48/kernel-power/ make EXTRAVERSION=.10-power48 rx51_defconfig

scratchbox -d /home/$USER/kp48/kernel-power/ make -j 3 EXTRAVERSION=.10-power48 bzImage

scratchbox -d /home/$USER/kp48/kernel-power/ make -j 3 EXTRAVERSION=.10-power48 modules
Normally you could now run menuconfig, select the modules for the dvb adapter and compile the modules again. Sadly the modules produced in this way for the DiBcom 0700 devices do NOT work. The N900 will reset when you attempt to watch a video stream. I don't know why (it is a behavior that also happens when using some other DVB devices, even when I use the updated v4l drivers)

Next step is to copy the zImage and modules to a safe place and strip the debug information:
Code:
scratchbox -d /home/$USER/kp48/kernel-power/ cp arch/arm/boot/zImage ../zImage

scratchbox -d /home/$USER/kp48/kernel-power/ mkdir ../modules

cd /scratchbox/users/$USER/home/$USER/kp48/kernel-power/

find . -name "*.ko" -exec cp '{}' ../modules/ \;

cd -

cd /scratchbox/users/$USER/home/$USER/kp48/modules

for f in * 

do

scratchbox strip --strip-debug /home/$USER/kp48/modules/$f

done

cd -
All this is just a slightly updated version of the "compile kernel power from source" post from NiQ
Now it is time to download updated v4l drivers.
You need mercurial to download the sources.

Code:
cd /scratchbox/users/$USER/home/$USER/kp48/

hg clone http://linuxtv.org/hg/v4l-dvb

cd -
By default these updated v4l drivers will NOT work on a 2.6.28 kernel! You need to change 1 line of code as is explained here :

Code:
fileName="$HOME/Desktop/sbhome/kp48/v4l-dvb/v4l/compat.h"

lineOld="p = kmalloc_track_caller(len, GFP_KERNEL);"

lineNew="p = kmalloc(len, GFP_KERNEL);"

sed -i "s/$lineOld/$lineNew/g" "$fileName"
Next is linking them to our compiled kernel power and running menuconfig.

Code:
scratchbox -d "kp48/v4l-dvb" make release DIR="/home/$USER/kp48/kernel-power/" kernel-links

scratchbox -d "kp48/v4l-dvb" make menuconfig
For the PCTV nanoStick modules select ONLY the following items and deselect the rest.
<M> Multimedia support
<M> DVB for Linux[*] Load and attach frontend and tuner driver modules as needed
(8) maximum number of DVB/ATSC adapters
[*] Dynamic DVB minor allocation
[*] DVB/ATSC adapters --->
<M> Support for various USB DVB devices
<M> DiBcom DiB0700 USB DVB devices (see help for supported devices)
If you have a different USB DVB adapter you can try other modules (but they may not work, I haven't tested other ones yet).
If you do NOT deselect stuff like v4l and other items the camera on you N900 may not function anymore. That is why I recommend to only select modules for the DVB device from this updatedv4l source.

Next step is to compile the updated v4l modules and strip the debug code:

Code:
scratchbox -d "kp48/v4l-dvb" make -j 3

mkdir "/scratchbox/users/$USER/home/$USER/kp48/modulesV4l"

cd "/scratchbox/users/$USER/home/$USER/kp48/v4l-dvb"

find . -name "*.ko" -exec cp '{}' ../modulesV4l/ \;

cd -

cd "/scratchbox/users/$USER/home/$USER/kp48/modulesV4l"

for f in * 

do

scratchbox strip --strip-debug "/home/$USER/kp48/modulesV4l/$f"

done

cd -
You now have two folders in your "sbhome/kp48" directory named "modules" and "modulesV4l" and a zImage. Copy these two folders to the N900 and ON THE N900 run the following commands to copy the modules to the correct location and set all the properties in the correct way:

Code:
mkdir /lib/modules/2.6.28.10-power48
cp modules/* /lib/modules/2.6.28.10-power48/
cp modulesV4l/* /lib/modules/2.6.28.10-power48/
chown -R root:root /lib/modules/2.6.28.10-power48
chmod 644 /lib/modules/2.6.28.10-power48/*
depmod 2.6.28.10-power48
rm /lib/modules/current
ln -s /lib/modules/2.6.28.10-power48 /lib/modules/current
Turn off the N900 and flash the kernel image to the N900:
Code:
sudo flasher-3.5 -f -k zImage -R
You now have a kernel-power v48 installed with DVB modules.
The next step is to setup the N900 to actually do something with the DVB device

In the example in my youtube videoI used H-E-N to set the n900 in USB host mode and mplayer to start the DVB device to watch Dutch freeview channels.

I also managed to compile tvheadend for the N900, and am hopeful that that will enable me to view all Digitenne channels on the N900 (even the ones using Conex encryption by using a remote key server using OSCam).
FYI: TVheadend does NOT compile using the default toolchain for Maemo 5 on scratchbox because the gcc compiler is too old, but does compile if you use the newer toolchain intended for Harmattan, and available through the scratchbox repository if you install scratchbox in Ubuntu 11.04 or LinuxMint 11.

But all those other things are for a future post
 

The Following 14 Users Say Thank You to Bernard For This Useful Post: