issue building an out-of-tree module with torizonCore builder

I am trying to build the “hello world” kernel module as explained in this tutorial:
https://developer.toradex.com/knowledge-base/building-external-kernel-modules-with-torizon

I use wsl2 on windows 10 (> 2004) and my torizonCore builder “workdir” directory is /home/rfonck/tcbworkdir.
On every shell I open I type the following commands before to try to compile:

$ cd /home/rfonck/tcbworkdir/
$ source tcb-env-setup.sh
$ torizoncore-builder images unpack torizon-core-docker-apalis-imx6-Tezi_5.1.0+build.1.tar
(the .tar file was previously downloaded)

I don’t have error message with these commands. But when I try to compile a module, the compilation fail with the following error code :

rfonck@LAPTOP:~/tcbworkdir$ torizoncore-builder kernel build_module source_dir/
An unexpected Exception occured. Please provide the following stack trace to
the Toradex TorizonCore support team:


Traceback (most recent call last):
  File "/builder/torizoncore-builder", line 175, in <module>
    mainargs.func(mainargs)
  File "/builder/tcbuilder/cli/kernel.py", line 106, in do_kernel_build_module
    kernel_build_module(source_dir=args.source_directory,
  File "/builder/tcbuilder/cli/kernel.py", line 71, in kernel_build_module
    assert linux_src, "panic: missing Linux kernel source!"
AssertionError: panic: missing Linux kernel source!

I thought this error might be related to the variable $KERNEL_SRC that is used in the makefile but that is not set on the shell but I suppose that it is set on the container that torizonCore builder use (I don’t know how to check that).

do you have any idea what can cause this error?

Thanks a lot
rfonck

I think I found the origin of my error thanks to this topic: https://www.toradex.cn/community/questions/62496/building-external-kernel-module-with-torizoncore-b.html

I used an oldest version of torizon easy installer.

I have totally installed torizoncore-builder and it woked well.

rfonck

Dear @rfonck,

thanks for using the community.

Is your issue solved?

Best Regards
Kevin

Dear @kevin.tx

my problem is effectively solved.

Best Regards rfonck

Dear @rfonck,

Thanks for letting us now.

Best Regards
Kevin