Building the UT-100 driver on the Raspberry Pi

Building the UT-100 driver module on the Raspberry Pi can be done the same way as on the desktop. The only difference is that instead of “sudo apt-get install”-ing the kernel headers and sources we have to fetch them from the Raspberry Pi git repository and install them manually. Although my instructions are written with the UT-100C DVB-T modulator in mind, the procedure is applicable to other out of tree kernel modules as well.

These instructions are based on the notes posted on Paul’s Raspberry Pi Blog.

First, update all the packages on your Raspberry Pi and upgrade the kernel using rpi-update. Then find the kernel version:

pi@raspberrypi ~ $ uname -r
3.12.20+

The kernel branch we need to find is 3.12.y.

The following commands will fetch the latest 3.12.y kernel sources, install them into /usr/src and configure it for building external kernel modules. Note that we do not need to build the whole kernel which is why it makes sense to build the UT-100 driver directly on the Raspberry Pi.

pi@raspberrypi ~ $ wget https://github.com/raspberrypi/linux/archive/rpi-3.12.y.tar.gz
pi@raspberrypi ~ $ tar xvfz rpi-3.12.y.tar.gz
pi@raspberrypi ~ $ sudo su
root@raspberrypi:/home/pi# mv linux-rpi-3.12.y /usr/src
root@raspberrypi:/home/pi# ln -s /usr/src/linux-rpi-3.12.y /lib/modules/3.12.20+/build
root@raspberrypi:/home/pi# cd /lib/modules/3.12.20+/build
root@raspberrypi:/lib/modules/3.12.20+/build# make mrproper
root@raspberrypi:/lib/modules/3.12.20+/build# gzip -dc /proc/config.gz > .config
root@raspberrypi:/lib/modules/3.12.20+/build# make modules_prepare
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  ...
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/sortextable

root@raspberrypi:/lib/modules/3.12.20+/build# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
root@raspberrypi:/lib/modules/3.12.20+/build# exit

Now we are ready to build the driver. Change to the it950x_driver directory and type make. You may get a few warnings but there should be no errors:

pi@raspberrypi ~/it950x_driver $ make
make -s -C /lib/modules/3.12.20+/build SUBDIRS=/home/pi/it950x_driver modules
/home/pi/it950x_driver/standard.c: In function ‘Standard_getSignalQualityIndication’:
/home/pi/it950x_driver/standard.c:1539:65: warning: array subscript is above array bounds [-Warray-bounds]
/home/pi/it950x_driver/standard.c:1541:65: warning: array subscript is above array bounds [-Warray-bounds]
/home/pi/it950x_driver/modulatorUser.c: In function ‘EagleUser_Initialization’:
/home/pi/it950x_driver/modulatorUser.c:688:32: warning: comparison between ‘TsInterface’ and ‘enum <anonymous>’ [-Wenum-compare]

pi@raspberrypi ~/it950x_driver $

Copy usb-it950x.ko to your working directory, e.g. ~/dvb/. After that you can “make clean” to remove the build files.

Test the driver module with:

pi@raspberrypi ~/dvb $ sudo insmod ./usb-it950x.ko

and check that there are no errors (also check the syslog using dmesg).

Unload the driver using:

pi@raspberrypi ~/dvb $ sudo rmmod ./usb-it950x.ko

That’s all.

In my next post I will explain how to transmit live video from the raspicam using the UT-100 modulator.