Ubuntu on Beagleboard xM with Easycap Video Capture (Compiling Driver)
Attempt to run Ubuntu in BeagleBoard xM rev C board has taken me to try various options of kernel and release. The goal was to have both Ubuntu and widely-available Easycap as video input via the USB of this compact TI OMAP board. Porting Ubuntu would spare us some flexibility to try different alternatives of video processing and networking options for the stream. The easiest way initially was to run Ubuntu preinstalled image. I had two popular options immediately: 1) Ubuntu Port CD Image release 2) Robert C. Nelson custom image (rootfs). I started with the later first to see the board running at once. The latest found in http://rcn-ee.net/deb/rootfs/ was ubuntu-11.10-r0-minimal-armel.tar.xz which gave me Ubuntu 11.10 Oneiric with custom linux 3.0.3-x2 kernel.
It turned out that this custom kernel hadn’t been compiled without Easycap. We can compare that to my laptop running linux 2.6.38-10 where it was part of its kernel compilation:
[ubuntu-laptop]$ cat /usr/src/linux-headers-2.6.38-10/.config | grep -i easy CONFIG_EASYCAP=m
Compiling the whole thing using make menuconfig
to change .config
file and so on seemed too much. A more partial approach was to touch only relevant Makefile
involved in building the driver. First we needed the kernel header files provided as linux-headers-3.0.6-x3_1.0oneiric_armel.deb and then source files for Easycap. As this was custom kernel, by guessing I found that it was closest to official linux 3.0.0-12.20 at launchpad, hence easycap source files were copied from it (the custom kernel might’ve been forked from this release as some random header files comparison to linux-headers-3.0.0-12-omap_3.0.0-12.20_armel
returned no difference).
FYI Easycap linux driver is no longer developed separately as a SourceForge project, it has been part of drivers/staging
in recent kernel releases (where you get dmesg
like “module is from the staging directory, the quality is unknown, you have been warned” when inserting it). In the source we’ll find /linux-3.0/drivers/staging/easycap/
to be copied into /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/
on the board.
After removing the old one (pointed to build -> /build/buildd/linux-3.0
), I created a link inside /lib/modules/3.0.6-x3
named build
pointing to:
build -> /usr/src/linux-headers-3.0.6-x3
then copied the Makefile
from my laptop to replace original Easycap source with this content of rules:
obj-m += easycap.o easycap-y := easycap_main.o easycap_low.o easycap_sound.o easycap-y += easycap_ioctl.o easycap_settings.o easycap-y += easycap_testcard.o ccflags-y := -Wall # Impose all or none of the following: ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT ccflags-y += -DEASYCAP_NEEDS_V4L2_DEVICE_H ccflags-y += -DEASYCAP_NEEDS_V4L2_FOPS ccflags-y += -DEASYCAP_NEEDS_UNLOCKED_IOCTL
Compiling should work afterward:
$ make -C /lib/modules/3.0.6-x3/build/ M=/usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/ LD /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/built-in.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_main.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_low.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_sound.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_ioctl.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_settings.o CC [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap_testcard.o LD [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap.o Building modules, stage 2. MODPOST 1 modules CC /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap.mod.o LD [M] /usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/easycap.ko make: Leaving directory `/usr/src/linux-headers-3.0.6-x3'
I tried to insmod
the easycap.ko
built, but dmesg showed some error and no /dev/video0
created. There must be some other drivers that must be loaded first which I didn’t know in what sequence (i.e. v4l2-common
etc.), hence I decided to just copy that under the /lib/modules/3.0.6-x3/kernel/drivers/staging/easycap
, depmod -a
, and reboot.
If you plug the Easycap while inspecting the syslog
tail, there won’t be similar message as found in kernel 2.6.38-10. Instead, you’ll see:
kernel: [ 1377.696838] usb 1-2.3: new high speed USB device number 6 using ehci-omap mtp-probe: checking bus 1, device 6: "/sys/devices/platform/usbhs-omap.0/ehci-omap.0/usb1/1-2/1-2.3" mtp-probe: bus: 1, device: 6 was not an MTP device kernel: [ 1378.052459] Linux video capture interface: v2.00 kernel: [ 1378.169006] Easycap version: 0.9.01 kernel: [ 1378.198944] usbcore: registered new interface driver snd-usb-audio kernel: [ 1381.043853] easycap::0adjust_standard: selected standard: PAL_BGHIN kernel: [ 1381.151245] easycap::0adjust_format: sought: 640x480,UYVY(0x59565955),1=field,0x00=std mask kernel: [ 1381.151306] easycap::0adjust_format: sought: V4L2_FIELD_NONE kernel: [ 1381.151336] easycap::0adjust_format: actioning: 640x480 PAL_BGHIN_AT_640x480_FMT_UYVY-n kernel: [ 1381.181488] easycap::0adjust_brightness: adjusting brightness to 0x7F kernel: [ 1381.184478] easycap::0adjust_contrast: adjusting contrast to 0x3F kernel: [ 1381.212768] easycap::0adjust_saturation: adjusting saturation to 0x2F kernel: [ 1381.214599] easycap::0adjust_hue: adjusting hue to 0x00 kernel: [ 1381.219207] easycap::0easycap_usb_probe: registered with videodev: 0=minor kernel: [ 1381.219238] easycap::0easycap_usb_probe: ends successfully for interface 0 kernel: [ 1381.219543] usbcore: registered new interface driver easycap kernel: [ 1381.314453] easycap:: easycap_open: ==========OPEN========= kernel: [ 1384.031188] easycap::0adjust_standard: selected standard: PAL_BGHIN kernel: [ 1384.228759] easycap::0adjust_format: sought: 640x480,UYVY(0x59565955),1=field,0x00=std mask kernel: [ 1384.228790] easycap::0adjust_format: sought: V4L2_FIELD_NONE kernel: [ 1384.228851] easycap::0adjust_format: actioning: 640x480 PAL_BGHIN_AT_640x480_FMT_UYVY-n kernel: [ 1384.233489] easycap::0adjust_brightness: adjusting brightness to 0x7F kernel: [ 1384.235198] easycap::0adjust_contrast: adjusting contrast to 0x3F kernel: [ 1384.237884] easycap::0adjust_saturation: adjusting saturation to 0x2F kernel: [ 1384.239501] easycap::0adjust_hue: adjusting hue to 0x00
Later I find out that newer image is available on the Robert’s site, but not sure which linux source I should use for the Easycap if I were to to use it. Anyway, before deciding to just go with this one I’ve tried various kernels. Here are list of images and their kernel versions (I wasn’t quite sure which one was running smoothly and which wasn’t):
- linux-2.6.35.9-l9 Ubuntu 10.04 Lucid: ubuntu-10.04.1-r4-minimal-armel.tar
- linux-3.1.4-x6 Ubuntu 11.10 Oneiric: ubuntu-11.10-r2-minimal-armel.tar.xz
- linux-3.1.4-x6 Ubuntu 11.04 Natty: ubuntu-11.04-r7-minimal-armel.tar.xz
- linux-2.6.38.2-d9 Ubuntu 10.10 Maverick: ubuntu-10.10-r6-minimal-armel.tar.xz
About
+Arif Kusbandono
Recently
Et Cetera
© logIt. Powered by WordPress using the DePo Skinny Tweaked Theme.