Building External Kernel Module with TorizonCore Builder

I am trying to work through the following guide on an Ubuntu machine:

I have torizoncore_builder setup using the tcb-env-setup.sh script and I have a a Toradex easy installer image downloaded. I also cloned the linux-toradex git repository into my working directory. Therefore, I have the following in my working directory:
./linux-toradex
./source_dir
./tcb-env-setup.sh
./torizon-core-docker-verdin-imx8mm-Tezi_5.1.0+build.1

From the working directory, I run the tcb script and try running the following command:

torizoncore-builder kernel build_module source_dir

but I get the error:
File “/builder/tcbuilder/cli/kernel.py”, line 71, in do_kernel_build_module
assert linux_src, “panic: missing Linux kernel source!”

Looking through all the guides, I can’t figure out what I’ve missed. How do I tell the builder where the Linux source code is?

Do I actually need the linux-toradex repository or is the kernel source referenced through the Tezi image?

Greetings @NickWhitelonis,

We include enough of the linux source in the TorizonCore images to build kernel modules. However we only started including the sources starting with TorizonCore 5.2. Meaning you’ll need to be working on a TorizonCore 5.2 image. Also don’t forget to unpack the image into the tool with the images sub-command.

Best Regards,
Jeremias

Hello, I set up a new TCB yesterday. I downloaded the kernel source and device-trees source per the instructions.

Today, I was able to create my OS in Yocto. I moved my OS file Colibri-iMX7-eMMC_MP-OS-Image-Tezi_7.2.0-devel-20250312170710+build.0.tar into ./images in my TCB directory.

I ran torizoncore-builder images unpack ./images/Colibri-iMX7-eMMC_MP-OS-Image-Tezi_7.2.0-devel-20250312170710+build.0.tar

Then torizoncore-builder build, but it results in this error:

Traceback (most recent call last):
  File "/builder/torizoncore-builder", line 230, in <module>
    mainargs.func(mainargs)
  File "/builder/tcbuilder/cli/build.py", line 665, in do_build
    build(args.config_fname, args.storage_directory,
  File "/builder/tcbuilder/cli/build.py", line 628, in build
    fs_changes = handle_customization_section(
  File "/builder/tcbuilder/cli/build.py", line 197, in handle_customization_section
    handle_kernel_customization(props["kernel"], storage_dir=storage_dir)
  File "/builder/tcbuilder/cli/build.py", line 253, in handle_kernel_customization
    kernel_cli.kernel_build_module(
  File "/builder/tcbuilder/cli/kernel.py", line 81, in kernel_build_module
    assert linux_src, "panic: missing Linux kernel source!"
AssertionError: panic: missing Linux kernel source!

I suppose the issue has something to do with my custom Yocto output. Can you point me in the right direction?

@kdubious,

Please open a new thread instead of resurrecting a 4 year old thread.

As you wish… (I was assuming that there would be a benefit to the next person who searches for this error)