Building Toradex Linux 2.4 for Apalis iMX6

I was trying to build Linux 2.4 for Apalis iMX6 using the steps provided at:

I have setup my cross compiler tool-chain (Linaro 4.9) and it is on the $PATH

adwait@adwait-Lenovo-ideapad-100-15IBD:~$ echo $PATH
/home/adwait/gcc-linaro/bin/:/usr/local/cuda-6.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Then I have performed the following steps for getting the source:
adwait@adwait-Lenovo-ideapad-100-15IBD:~$ cd Desktop/Workstation/
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation$ git clone -b toradex_imx_3.10.17_1.0.0_ga git://git.toradex.com/linux-toradex.git
Cloning into 'linux-toradex'...
remote: Counting objects: 5574315, done.
remote: Compressing objects: 100% (837818/837818), done.
remote: Total 5574315 (delta 4699343), reused 5572559 (delta 4697690)
Receiving objects: 100% (5574315/5574315), 1.15 GiB | 1.17 MiB/s, done.
Resolving deltas: 100% (4699343/4699343), done.
Checking connectivity... done.
Checking out files: 100% (43376/43376), done.
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation$

After that I attempt to build with the default config, but it fails:
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation$ cd linux-toradex/
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ make apalis_imx6_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
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ make clean 
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ make -j3 uImage LOADADDR=10008000 
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
  WRAP    arch/arm/include/generated/asm/auxvec.h
  WRAP    arch/arm/include/generated/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/asm/cputime.h
  WRAP    arch/arm/include/generated/asm/current.h
  WRAP    arch/arm/include/generated/asm/emergency-restart.h
  WRAP    arch/arm/include/generated/asm/errno.h
  WRAP    arch/arm/include/generated/asm/exec.h
  WRAP    arch/arm/include/generated/asm/ioctl.h
  WRAP    arch/arm/include/generated/asm/ipcbuf.h
  WRAP    arch/arm/include/generated/asm/irq_regs.h
  WRAP    arch/arm/include/generated/asm/kdebug.h
  WRAP    arch/arm/include/generated/asm/local.h
  WRAP    arch/arm/include/generated/asm/local64.h
  WRAP    arch/arm/include/generated/asm/msgbuf.h
  WRAP    arch/arm/include/generated/asm/param.h
  WRAP    arch/arm/include/generated/asm/parport.h
  WRAP    arch/arm/include/generated/asm/poll.h
  WRAP    arch/arm/include/generated/asm/resource.h
  WRAP    arch/arm/include/generated/asm/sections.h
  WRAP    arch/arm/include/generated/asm/segment.h
  WRAP    arch/arm/include/generated/asm/sembuf.h
  WRAP    arch/arm/include/generated/asm/serial.h
  WRAP    arch/arm/include/generated/asm/shmbuf.h
  WRAP    arch/arm/include/generated/asm/siginfo.h
  WRAP    arch/arm/include/generated/asm/sizes.h
  WRAP    arch/arm/include/generated/asm/socket.h
  WRAP    arch/arm/include/generated/asm/sockios.h
  WRAP    arch/arm/include/generated/asm/termbits.h
  WRAP    arch/arm/include/generated/asm/termios.h
  WRAP    arch/arm/include/generated/asm/timex.h
  WRAP    arch/arm/include/generated/asm/trace_clock.h
  WRAP    arch/arm/include/generated/asm/types.h
  WRAP    arch/arm/include/generated/asm/unaligned.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/genksyms/genksyms.o
  HOSTCC  scripts/dtc/data.o
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc.o
  SHIPPED scripts/genksyms/lex.lex.c
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  SHIPPED scripts/genksyms/parse.tab.c
  Generating include/generated/mach-types.h
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTCC  scripts/genksyms/parse.tab.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTLD  scripts/genksyms/genksyms
  CC      kernel/bounds.s
  HOSTCC  scripts/dtc/livetree.o
In file included from include/linux/compiler.h:54:0,
                 from include/uapi/linux/stddef.h:1,
                 from include/linux/stddef.h:4,
                 from /home/adwait/Desktop/Workstation/linux-toradex/include/uapi/linux/posix_types.h:4,
                 from include/uapi/linux/types.h:13,
                 from include/linux/types.h:5,
                 from include/linux/page-flags.h:8,
                 from kernel/bounds.c:9:
include/linux/compiler-gcc.h:103:30: fatal error: linux/compiler-gcc5.h: No such file or directory
compilation terminated.
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
make: *** Waiting for unfinished jobs....
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/util.o
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/devicetable-offsets.s
In file included from include/linux/compiler.h:54:0,
                 from include/uapi/linux/stddef.h:1,
                 from include/linux/stddef.h:4,
                 from /home/adwait/Desktop/Workstation/linux-toradex/include/uapi/linux/posix_types.h:4,
                 from include/uapi/linux/types.h:13,
                 from include/linux/types.h:5,
                 from include/linux/mod_devicetable.h:11,
                 from scripts/mod/devicetable-offsets.c:2:
include/linux/compiler-gcc.h:103:30: fatal error: linux/compiler-gcc5.h: No such file or directory
compilation terminated.
make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/kallsyms
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
make: *** [scripts] Error 2
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$

The steps are failing because of this line in the script:
include/linux/compiler-gcc.h:103:30: fatal error: linux/compiler-gcc5.h: No such file or directory

I checked the directory listing for include/linux/
adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ ls include/linux/compiler*
include/linux/compiler-gcc3.h  include/linux/compiler-gcc4.h  include/linux/compiler-gcc.h  include/linux/compiler.h  include/linux/compiler-intel.h

As you can see the compiler-gcc5.h file does not exist.




Can someone please provide a solution for this, I am sure it is a minor issue.
Thanks.

Please note that our Embedded Linux BSP V2.4 was only ever released as a preliminary beta 1 for sample hardware and long since got superseded by V2.5 beta releases which in turn got superseeded by V2.6 beta and later V2.6 stable and V2.7 beta 1 resp. now 2.7b2. Only stable releases as well as the latest beta release are officially supported by Toradex.

We therefore suggest you updating to any of the officially supported BSPs at your earliest convenience.

Ok.


I got hold of compiler-gcc5.h from the internet and copied it into include/linux/



Steps:

adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ wget https://raw.githubusercontent.com/antmicro/u-boot/master/include/linux/compiler-gcc5.h
--2017-06-14 16:40:43--  https://raw.githubusercontent.com/antmicro/u-boot/master/include/linux/compiler-gcc5.h
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.8.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.8.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2455 (2.4K) [text/plain]
Saving to: ‘compiler-gcc5.h’

100%[========================================================================================================================================================>] 2,455       --.-K/s   in 0s      

2017-06-14 16:40:43 (55.1 MB/s) - ‘compiler-gcc5.h’ saved [2455/2455]

adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ cp compiler-gcc5.h include/linux/




Then I compiled again using:

adwait@adwait-Lenovo-ideapad-100-15IBD:~/Desktop/Workstation/linux-toradex$ make -j3 uImage LOADADDR=10008000 | tee build.log



The compilation was successful, i have attached the build log for reference:

build.log

I hope the good folks at Toradex will add compiler-gcc.h to their repository or remove the dependency on compiler-gcc.h from the script.


Thank you.

I was actually trying to compile with some additional drivers that are not part of the default config.
I am trying to enable drivers for Model 1012 from Sensoray and was following their article at:
http://www.sensoray.com/wiki/index.php?title=1012_TORADEX
They have used v2.4BSP, so I am using v2.4 to evaluate their product.

On this same point, I have an additional question.
The drivers for Sensoray seem to be part of the toradex_imx_3.10.17_1.0.0_ga git branch.
Have these been added to the newer BSPs as well?

Please use the toradex_4.1-2.0.x-imx-next branch for iMX6 and latest image. The Linux drivers from Sensoray available in their Linux SDK have been tested with the same at our end using Sensoray 1012 and Apalis iMX6.

I am having trouble loading the modules when using Toradex Linux BSP 2.7

Here are the steps I followed:
link text

First of all, the 8 /dev/video? are not present.

This maybe because the drivers were selected to be loaded as modules.

The tw6869 driver loads fine:

modprobe tw68

When I try to load Sensoray driver, it gives this error

root@apalis-imx6# modprobe s2255

modprobe: FATAL: Module s2255 not found in directory /lib/modules/4.1.39-00033-g50e26af

Any help would be appreciated.

Are you trying the Sensoray 1012 or 2255? Both are different devices. The former is PCIe based one while the latter is USB based. I did not try as per the steps you mention in the document as far as the driver is concerned. I downloaded the Linux Software Development Kit and cross compiled the driver from the kit against our kernel source tree using the below changes.

diff --git a/arch/arm/configs/apalis_imx6_defconfig b/arch/arm/configs/apalis_imx6_defconfig
index a63dbf750d88..be291ac7c105 100644
--- a/arch/arm/configs/apalis_imx6_defconfig
+++ b/arch/arm/configs/apalis_imx6_defconfig
@@ -384,3 +384,8 @@ CONFIG_LIBCRC32C=m
 CONFIG_FONTS=y
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
+CONFIG_VIDEOBUF_GEN=y
+CONFIG_VIDEOBUF_DMA_SG=y
+CONFIG_VIDEOBUF_VMALLOC=y
+CONFIG_VIDEOBUF_DMA_CONTIG=y
+CONFIG_VIDEOBUF_DVB=y
diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a73023..16b2ab1222f7 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -61,6 +61,7 @@ config VIDEOBUF_DMA_CONTIG
        tristate
        depends on HAS_DMA
        select VIDEOBUF_GEN
+       select VIDEOBUF_VMALLOC
 
 config VIDEOBUF_DVB
        tristate

Also the options “pci=nomsi” and “coherent_pool=256M” have to be added to the kernel command line without which the Sensoray driver will crash the kernel when a gstreamer pipeline is run.

I followed your steps and installed the driver provided in the Sensoray SDK

I have named the driver tw686x in the Kconfig and Makefiles.
I compiled using the usual steps as below

make -j3 uImage LOADADDR=10008000 | tee build.log

build.log

make -j3 modules | tee module_build.log

module_build.log

Then followed the rest of the steps, i.e.installing modules to rootfs of BSP, copying uImage to BSP, running update.sh, run setupdate, run update.

The system boots up as expected.


If i do a modinfo, I get this:

root@apalis-imx6:~# modinfo tw686x
filename:       /lib/modules/4.1.39-00033-g50e26af-dirty/kernel/drivers/media/pci/tw686x/tw686x.ko
license:        GPL v2
author:         Krzysztof Ha?asa <khalasa@piap.pl>
author:         Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
description:    Driver for video frame grabber cards based on Intersil/Techwell TW686[4589]. S812 updates for 4.2, 4.4
srcversion:     EA8567ABEC83468424C8939
alias:          pci:v00001797d00006869sv*sd*bc*sc*i*
alias:          pci:v00001797d00006868sv*sd*bc*sc*i*
alias:          pci:v00001797d00006865sv*sd*bc*sc*i*
alias:          pci:v00001797d00006864sv*sd*bc*sc*i*
depends:        videobuf2-vmalloc,videobuf2-dma-contig
intree:         Y
vermagic:       4.1.39-00033-g50e26af-dirty SMP mod_unload modversions ARMv7 p2v8 
parm:           dma_interval:Minimum time span for DMA interrupting host (int)
parm:           dma_mode:DMA operation mode (memcpy/contig/sg, default=memcpy)
root@apalis-imx6:~# 

It seems everything is Ok.

But I can’t find the associated device at /dev/video*

root@apalis-imx6:~# ls -l /dev/video*
crw-rw----    1 root     video      81,   2 Apr 10 00:14 /dev/video0
crw-rw----    1 root     video      81,   3 Apr 10 00:14 /dev/video1
crw-rw----    1 root     video      81,   0 Apr  4 15:16 /dev/video16
crw-rw----    1 root     video      81,   1 Apr  4 15:16 /dev/video17
crw-rw----    1 root     video      81,   4 Apr 10 00:14 /dev/video2
root@apalis-imx6:~# 

I was expecting 8 video devices, instead there are 5, and they don’t seem to work with any gstreamer pipeline.

This is the dmesg log, for reference:

root@apalis-imx6:~# 
root@apalis-imx6:~# dmesg | grep tw68
[    3.178956] pci 0000:01:00.0: Setting PCI class for tw6869 PCIe device
[    7.005880] tw6869: PCI 0000:01:00.0, IRQ 356, MMIO 0x1100000 (memcpy mode)
[    7.011891] tw686x 0000:01:00.0: enabling device (0140 -> 0142)
[    7.027789] tw686x 0000:01:00.0: dma0: unable to allocate P-buffer
[    7.099890] Modules linked in: tw686x(+) videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops libcomposite configfs
[    7.163702] LR is at tw686x_memcpy_dma_free+0x24/0xc8 [tw686x]
[    7.784522] [<806cd944>] (_raw_spin_lock_irqsave) from [<7f02ab10>] (tw686x_memcpy_dma_free+0x24/0xc8 [tw686x])
[    7.799502] [<7f02aaec>] (tw686x_memcpy_dma_free [tw686x]) from [<7f02b484>] (tw686x_video_free+0x60/0x88 [tw686x])
[    7.826729] [<7f02b424>] (tw686x_video_free [tw686x]) from [<7f02ba10>] (tw686x_video_init+0x564/0x750 [tw686x])
[    7.852840] [<7f02b4ac>] (tw686x_video_init [tw686x]) from [<7f029744>] (tw686x_probe+0x3c0/0x450 [tw686x])
[    7.888584] [<7f029384>] (tw686x_probe [tw686x]) from [<80308c14>] (pci_device_probe+0x7c/0xd0)
[    8.087010] [<80308300>] (__pci_register_driver) from [<7f02f024>] (tw686x_pci_driver_init+0x24/0x2c [tw686x])
[    8.111892] [<7f02f000>] (tw686x_pci_driver_init [tw686x]) from [<800096e8>] (do_one_initcall+0x94/0x1e0)
root@apalis-imx6:~# 

Am I using it incorrectly? Please help me out!

Please also append “pci=nomsi coherent_pool=128M” to the defargs u-boot environment variable in u-boot.

That worked, though I haven’t figured out why.

Thanks a lot!

Glad to know it works for you. Let us know if you have queries.

Can you please share some of the pipelines that worked for you?

gst-launch-1.0 v4l2src device=/dev/video6 ! overlaysink

Above pipeline works for me.