Installing mini pci express Video capture cards

hi

i wanna install mini pci express capture cards on apalis tk1
i installed ubuntu 14.04 and then ask me about upgrade to 16.04 and i let ubuntu 16.04 installed on apalis tk1 and then install headers and modules on my board according to this link

https://developer.toradex.com/knowledge-base/installing-nvidia-jetpack-with-l4t-on-apalis-tk1#build-linux-kernel-from-source-code

and then my uname -r became this

3.10.40-g063d16e

i have vmx-200 video capture card link text

i used this driver link text

and then add following lines to some v4l files that have errors about __devinitdata ,…

#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 8, 0)
#define __devinitdata
#define __devinit
#define __devexit
#define __devexit_p
#endif

at lost i make and make install v4l successfully
but when i try modprobe i have an error according to this

root@tegra-ubuntu:/home/ubuntu# modprobe cx25858
modprobe: ERROR: could not insert 'cx25858': Invalid argument
root@tegra-ubuntu:/home/ubuntu# dmesg | tail
[ 5505.882646] usb 2-1.3: Product: USB Keyboard
[ 5505.882650] usb 2-1.3: Manufacturer: Chicony
[ 5505.893371] input: Chicony USB Keyboard as /devices/platform/tegra-ehci.0/usb2/2-1/2-1.3/2-1.3:1.0/input/input42
[ 5505.893555] hid-generic 0003:04F2:0408.0029: input,hidraw1: USB HID v1.11 Keyboard [Chicony USB Keyboard] on usb-tegra-ehci.0-1.3/input0
[ 5505.917735] input: Chicony USB Keyboard as /devices/platform/tegra-ehci.0/usb2/2-1/2-1.3/2-1.3:1.1/input/input43
[ 5505.918227] hid-generic 0003:04F2:0408.002A: input,hiddev0,hidraw2: USB HID v1.11 Device [Chicony USB Keyboard] on usb-tegra-ehci.0-1.3/input1
[ 5865.546955] videobuf_dma_sg: disagrees about version of symbol videobuf_queue_core_init
[ 5865.546969] videobuf_dma_sg: Unknown symbol videobuf_queue_core_init (err -22)
[ 5865.546999] videobuf_dma_sg: disagrees about version of symbol videobuf_alloc_vb
[ 5865.547007] videobuf_dma_sg: Unknown symbol videobuf_alloc_vb (err -22)

it seems i have problem with videobuf_dma_sg
would you please help me about modprobe for this capture card?

Cheers,

Toradex please help me thank you

HI @toradexvision

Thanks for writing to the Toradex Community!

Regarding your issue, the Nvidia Jetpack image with custom kernel and also some patches for Ubuntu 14.04 to make the Nvidia features work. We never tried or tested Ubuntu 16.04.

Why you updated to Ubuntu 16.04? Was 14.04 not working well?

Best regards,
Jaski

Thank you for your attention I will change my os to Ubuntu 14.04 and check driver with it

Best regards

You are welcome.

Perfect. Let us know your results.

Best regards,
Jaski

hi Jaski

I reinstalled UBUNTU 14.04 but i still have problem with modprobe cx25858

ubuntu@tegra-ubuntu:~$ sudo su
[sudo] password for ubuntu: 
root@tegra-ubuntu:/home/ubuntu# uname -r
3.10.40-g063d16e-dirty
root@tegra-ubuntu:/home/ubuntu# dmesg | tail
[   12.147491] init: plymouth-stop pre-start process (1165) terminated with status 1
[   14.395510] tegradc tegradc.0: switching framebuffer to 1280x800
[   14.395515] tegradc tegradc.0: Calculated sync href=0 vref=6
[   14.395520] tegradc tegradc.0: using mode 1280x800 pclk=71103000 href=0 vref=6
[   14.397112] tegradc tegradc.0: nominal-pclk:71103000 parent:71000000 div:1.0 pclk:71000000 70391970~77502270
[   14.549679] tegradc tegradc.1: switching framebuffer to 1920x1080
[   14.549685] tegradc tegradc.1: using mode 1920x1080 pclk=148500000 href=1 vref=1
[   14.550624] tegradc tegradc.1: nominal-pclk:148500000 parent:594000000 div:4.0 pclk:148500000 147015000~161865000
[   17.251204] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   17.254843] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
root@tegra-ubuntu:/home/ubuntu# dmesg | grep __video
[    8.826963] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.905920] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.923769] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.940744] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.955838] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.971947] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    8.987717] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    9.003708] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    9.024673] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    9.045042] videodev: exports duplicate symbol __video_register_device (owned by kernel)
[    9.062083] videodev: exports duplicate symbol __video_register_device (owned by kernel)
root@tegra-ubuntu:/home/ubuntu# cd vecow/
root@tegra-ubuntu:/home/ubuntu/vecow# cd VMX200_Linux_3.0Kernel/
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel# ls
AtlasLinuxDist_2.0.111.0.zip  COPYING  cx25858_src_2.0.111.tar.gz  media_build  media_build_source_2012-11-02.tar.gz  Readme.txt  USG-202607-002.docx  VMX-200 Linux SDK Build Gude_A5.pdf
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel# cd media_build
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build# cd v4l
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build/v4l# modprobe cx25858
modprobe: ERROR: could not insert 'cx25858': Exec format error
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build/v4l# dmesg | tail
[   14.395510] tegradc tegradc.0: switching framebuffer to 1280x800
[   14.395515] tegradc tegradc.0: Calculated sync href=0 vref=6
[   14.395520] tegradc tegradc.0: using mode 1280x800 pclk=71103000 href=0 vref=6
[   14.397112] tegradc tegradc.0: nominal-pclk:71103000 parent:71000000 div:1.0 pclk:71000000 70391970~77502270
[   14.549679] tegradc tegradc.1: switching framebuffer to 1920x1080
[   14.549685] tegradc tegradc.1: using mode 1920x1080 pclk=148500000 href=1 vref=1
[   14.550624] tegradc tegradc.1: nominal-pclk:148500000 parent:594000000 div:4.0 pclk:148500000 147015000~161865000
[   17.251204] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   17.254843] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  125.513862] videodev: exports duplicate symbol __video_register_device (owned by kernel)

root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build/v4l# lspci
00:00.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
01:00.0 Multimedia video controller: Conexant Systems, Inc. Device 5851 (rev 01)
02:00.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
03:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)

Thank you

Hi Jaski

These are insmod command results

root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build/v4l# insmod cx25858.ko
insmod: ERROR: could not insert module cx25858.ko: Invalid parameters
root@tegra-ubuntu:/home/ubuntu/vecow/VMX200_Linux_3.0Kernel/media_build/v4l# dmesg | tail
[ 1200.319876] cx25858: Unknown symbol videobuf_queue_cancel (err -22)
[ 1200.319887] cx25858: disagrees about version of symbol v4l2_device_unregister
[ 1200.319891] cx25858: Unknown symbol v4l2_device_unregister (err -22)
[ 1200.319901] cx25858: disagrees about version of symbol video_device_release
[ 1200.319905] cx25858: Unknown symbol video_device_release (err -22)
[ 1200.319917] cx25858: disagrees about version of symbol videobuf_mmap_mapper
[ 1200.319921] cx25858: Unknown symbol videobuf_mmap_mapper (err -22)
[ 1200.319952] cx25858: Unknown symbol videobuf_to_dma (err 0)
[ 1200.319957] cx25858: disagrees about version of symbol videobuf_mmap_free
[ 1200.319961] cx25858: Unknown symbol videobuf_mmap_free (err -22)

i don’t know what should i do to install (cx25858.ko) video capture driver

Cheers,

HI @toradexvision

I don’t know yet. I will try to reproduce this issue and come back till tomorrow to you.

Best regards,
Jaski

Hi jaski

Thank you

Hi Jaski

Is there any hope of installing this capture card on Apalis TK1 with Ubuntu 14.04?

Best Regards

Hi Jaski

During your respectful endeavor to help me
i tried another minipci capture card driver to compare results

i tried this capture
link text

and unfortunately get same results as cx25858

root@tegra-ubuntu:/home/ubuntu/driver-686x-0.1.1_new# modprobe tw686x
modprobe: ERROR: could not insert 'tw686x': Exec format error
root@tegra-ubuntu:/home/ubuntu/driver-686x-0.1.1_new# dmesg | tail
[   76.234322] scsi2 : usb-storage 2-1.4:1.0
[   77.241553] scsi 2:0:0:0: Direct-Access     JetFlash Transcend 8GB    8.07 PQ: 0 ANSI: 4
[   77.245230] sd 2:0:0:0: Attached scsi generic sg0 type 0
[   77.265181] sd 2:0:0:0: [sda] 15679488 512-byte logical blocks: (8.02 GB/7.47 GiB)
[   77.268640] sd 2:0:0:0: [sda] Write Protect is off
[   77.268648] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[   77.271467] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   77.296472]  sda: sda1
[   77.317433] sd 2:0:0:0: [sda] Attached SCSI removable disk
[  154.528135] videodev: exports duplicate symbol __video_register_device (owned by kernel)

it seems all minipci capture cards on apalis tk1 have same problem

Best Regards

link text

Hi @toradexvision

Finally I was able to compile the driver cx25858 for your PCIe Video capturing card. And the result was as following:

[   41.338627] cx25858 driver version 2.0.111 loaded

You need to checkout the kernel sources on your host and do the cross compilation of the kernel and the kernel modules as explained here. The git branch for the kernel sources is toradex_tk1_l4t_r21.7.

Before launching the compilation you will need to modify some files in the git branch and also the sources of the driver. The information about the changes, you can find in the attachment.

Best regards,
Jaski

Hi Jaski

Thank you for your attention

Please let me ask if i have any question during this process

Best Regards

You are welcome. Sure, you can ask questions if you have any.

Hi Jaski

I installed fresh Ubuntu 20.04 on my Desktop Host

and then did following steps:

root@vision-desktop:/home/vision/Toradex# git clone -b toradex_2019.07 https://git.toradex.com/u-boot-toradex.git
root@vision-desktop:/home/vision/Toradex# git clone -b  toradex_tk1_l4t_r21.7 git://git.toradex.com/linux-toradex.git

download gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf for toolchain and then adjust symbolic link and environment variables according to toolchain

root@vision-desktop:/home/vision/Toradex# cd

root@vision-desktop:~# ls 
export_compiler  gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf  gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz  gcc-linaro

root@vision-desktop:~# cat export_compiler 
export ARCH=arm
export PATH=~/gcc-linaro/bin:$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-

root@vision-desktop:~# ls -la gcc-linaro
lrwxrwxrwx 1 root root 46 20:13 17 May  gcc-linaro -> gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf

then add following lines to /linux-toradex/arch/arm/configs/apalis-tk1_defconfig

CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
CONFIG_MEDIA_PCI_SUPPORT=y
CONFIG_MEDIA_RC_SUPPORT=y
CONFIG_RC_CORE=y
CONFIG_VIDEO_CX25858=m
CONFIG_VIDEO_CX25858_ALSA=m

and also add

linux-toradex/drivers/media/pci/Kconfig==>   source "drivers/media/pci/cx25858/Kconfig"
linux-toradex/drivers/media/pci/Makefile  ==> obj-$(CONFIG_VIDEO_CX25858) += cx25858/

from then on, I was a little confused about the next steps

would you please help me?

excuse me for my awkward questions because i never had any experience in cross compiling Linux source

Best Regards

HI @toradexvision

You are almost done. You now need to launch the compilation.

make apalis-tk1_defconfig
make -j3 2>&1 | tee build.log

Best regards,
Jaski

Hi Jaski
i have an error on make apalis-tk1_defconfig that i cant solve it

root@vision-desktop:/home/vision/Toradex# cd linux-toradex/
root@vision-desktop:/home/vision/Toradex/linux-toradex# make apalis-tk1_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:2500:
scripts/kconfig/confdata.c: In function ‘conf_write’:
scripts/kconfig/confdata.c:762:19: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
  762 |  sprintf(newname, "%s%s", dirname, basename);
      |                   ^~~~~~
scripts/kconfig/confdata.c:762:19: note: assuming directive output of 7 bytes
In file included from /usr/include/stdio.h:867,
                 from scripts/kconfig/zconf.tab.c:85:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 1 or more bytes (assuming 4104) into a destination of size 4097
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2500:
scripts/kconfig/confdata.c:765:20: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
  765 |   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
      |                    ^~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
                 from scripts/kconfig/zconf.tab.c:85:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 13 and 4119 bytes into a destination of size 4097
   36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   37 |       __bos (__s), __fmt, __va_arg_pack ());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2503:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:567:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  567 |     jump->offset = r->len - 1;
      |     ~~~~~~~~~~~~~^~~~~~~~~~~~
scripts/kconfig/menu.c:528:19: note: ‘jump’ was declared here
  528 |  struct jump_key *jump;
      |                   ^~~~
  HOSTLD  scripts/kconfig/conf
drivers/media/pci/Kconfig:29: can't open file "drivers/media/pci/cx25858/Kconfig"
make[1]: *** [/home/vision/Toradex/linux-toradex/scripts/kconfig/Makefile:105: apalis-tk1_defconfig] Error 1
make: *** [Makefile:504: apalis-tk1_defconfig] Error 2

do you build cx25858 on host and add it linux image and if yes how?

Best Regards

Yes, I build cx25858 on the host by adding the files to the kernel sources. Once you did this, you need to deploy the kernel and the kernel modules to the SoM or you can also add them to a complete custom Linux image and then Flash this using Toradex Easy Installer.

Hi Jaski
should i execute Linux kernel driver backports process link text to add cx25858 driver to linux kernel?
Thank you

Hi,

Yes, you could do this, but it is easier to just copy the driver into the kernel sources.

Best regards,
Jaski