Error compiling Real time linux kernel

running “bitbake -k angstrom-lxde-image” (previous: bitbake virtual/kernel -c menuconfig and removing from compilation the vivante gpu …), I obtain this error:

CC [M]  /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_driver.o
In file included from /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/spinlock.h:290:0,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/seqlock.h:35,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/time.h:5,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/stat.h:18,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/module.h:10,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_linux.h:63,
                 from /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:56:
/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c: In function 'gckOS_WaitSignal':
/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:6043:19: error: passing argument 1 of 'rt_spin_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
     spin_lock_irq(&signal->obj.wait.lock);
                   ^
/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/spinlock_rt.h:43:40: note: in definition of macro 'spin_lock'
 #define spin_lock(lock)   rt_spin_lock(lock)
                                        ^~~~
/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:6043:5: note: in expansion of macro 'spin_lock_irq'
     spin_lock_irq(&signal->obj.wait.lock);
     ^~~~~~~~~~~~~
/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/spinlock_rt.h:25:24: note: expected 'spinlock_t * {aka struct spinlock *}' but argument is of type 'raw_spinlock_t * {aka struct raw_spinlock *}'
 extern void __lockfunc rt_spin_lock(spinlock_t *lock);
                        ^~~~~~~~~~~~
/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:6079:31: error: passing argument 1 of '__add_wait_queue_tail' from incompatible pointer type [-Werror=incompatible-pointer-types]
         __add_wait_queue_tail(&signal->obj.wait, &wait);

[  ... MEGA - CUT ...  ]

CC [M]  /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/kernel/arch/gc_hal_kernel_context.o
cc1: all warnings being treated as errors
/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/scripts/Makefile.build:293: recipe for target '/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.o' failed
make[3]: *** [/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/Makefile:1499: recipe for target '_module_/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src' failed
make[2]: *** [_module_/home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src] Error 2
make[2]: Leaving directory '/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-build-artifacts'
Makefile:152: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/temp/log.do_compile.21428)

Some ideas ?
Thank You …

HI Mane

Welcome to the Toradex Community!!!

Which git branch are you using to compile? Could you share your local.conf and state the changes you have done before launching the compilation?

Thanks and best regards, Jaski

Hi jaski.
The git branch is V2.8 (LinuxImageV2.8)
I’ve set the Full Preemptible Kernel in Kernel Features->Preemption model
(RT_FULL), and unselected in Device Drivers->Graphics Support the Vivante GCCore .

In the local.conf I’ve changed:

#MACHINE ?= "apalis-imx6"
#MACHINE ?= "apalis-t30"
#MACHINE ?= "apalis-tk1"
#MACHINE ?= "apalis-tk1-mainline"
#
MACHINE ?= "colibri-imx6"
#MACHINE ?= "colibri-imx6ull"
#MACHINE ?= "colibri-imx7"
#MACHINE ?= "colibri-imx7-emmc"
#MACHINE ?= "colibri-t20"
#MACHINE ?= "colibri-t30"
#MACHINE ?= "colibri-vf"

and added at the end of file:

ACCEPT_FSL_EULA = "1"
PREFERRED_PROVIDER_virtual/kernel = "linux-toradex-rt"

Thanks for the information. It seems you have to disable all the dependencies too. This community post explains a different way to disable the Vivante Gpu Driver. You could try this.

Thank you jaski, but the solution provided in the post,

MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT ??= "0"

is already in the vivante-kernel-driver-handler.bbclass for the LinuxV2.8.

I need to compile the Kernel Real-Time, possibly with the vivante driver enabled.

So, what exactly is your use-case? Real time with or without Vivante Driver Support?

I have the same problem with or without the vivante Driver support.
Disabling it is only for testing.
For our purposes we need the vivante suport.
The first problem encountered is the following:

 /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c: In function 'gckOS_WaitSignal':
 /home/mane/Toradex/iMX6/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.2.p0-r0/kernel-module-imx-gpu-viv-6.2.2.p0/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:6043:19: error: passing argument 1 of 'rt_spin_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
      spin_lock_irq(&signal->obj.wait.lock);
                    ^
 /home/mane/Toradex/iMX6/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/include/linux/spinlock_rt.h:43:40: note: in definition of macro 'spin_lock'
  #define spin_lock(lock)   rt_spin_lock(lock)
                                         ^~~~

Some modifications is needed for the RT_KERNEL in the Vivante kernel module ?

I think the problem is that the wrong defconfig is used.

Can you try updating layers/meta-toradex-nxp/ to latest rocko-next (to make sure this commit is in).

Ok Boys. It work!

Thank You.

Pefect that the compilation worked. Could you tell us if the built image is also working as a real time linux?

Yes. I’m also running cyclictest.

Perfect, thanks for the feedback.

On top of Stefan’s answer you should set the MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE variable where you set the kernel preferred version so that the Vivante kernel driver is built from the kernel sources which are patched for a real-time kernel.

E.g.:

PREFERRED_PROVIDER_virtual/kernel = "linux-toradex-rt"
MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE = "0"