Where can I get access to linux-headers for TorizonCore images?

I am trying to compile a specific driver for a piece of hardware connected at PCI of our Verdin Development board, but for that to happen we need to have the linux-headers of the linux-image running on the machine.

Where can I get access to linux-headers for TorizonCore images ?

Here are more details from our Development Board:

sudo tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.148-6.7.0+git.bfdbfb2c85fb #1-TorizonCore SMP PREEMPT Thu Jun 20 15:59:41 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/e81878773da7cb84df22dfc3108fa98703a54183a50b88c0eeb46705d5d934b7/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.7.0-build.18
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-imx8mp-15402088
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus on Verdin Development Board
Toradex version:          0063 V1.1B
Serial number:            15402088
Processor arch:           aarch64
------------------------------------------------------------

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

To obtain Linux headers for TorizonCore images, which are essential for compiling drivers, you can follow these steps:

  1. Build TorizonCore with Yocto:

    • Set Up the Environment: First, set up a Yocto Project build environment on your host machine. This involves installing necessary packages and tools.
    • Clone the Toradex Manifest: Use the Toradex manifest repository to configure your Yocto build environment. This repository includes the configurations needed to build TorizonCore.
    • Select the Correct Branch: Ensure you are using the branch of the manifest that matches your TorizonCore version (e.g., 6.7.0).
    • Build the Image: Execute the bitbake command to build the TorizonCore image. The Linux headers will be generated as part of this build process.
  2. Accessing Headers:

    • After the build completes, you can find the headers in the build directory, typically under tmp/work/.../linux-toradex/.../build/.
    • Copy these headers to your development environment where you will compile the driver.

By following these steps, you should be able to obtain the Linux headers needed for your driver compilation on TorizonCore. If you have any specific questions during the process, feel free to ask!

Best regards, Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Fail to integrate a driver in TorizonCore build.

Greetings @douglassilva,

If you have an external kernel driver/module you are trying to compile you can use TorizonCore Builder to do so as documented here: Building External Kernel Modules With Torizon | Toradex Developer Center

This should get the correct Linux headers and other sources automatically as well as package your driver into the OS image for you.

Best Regards,
Jeremias

Hi @jeremias.tx

I started following the tutorial you linked and I have couple of questions.

  1. How can I use customization on yaml file for adding custom packages ? Like if I wanted to add gcc, cmake, lrzsz, minicom, nmcli and others.

  2. How can I guarantee that I will be also generating linux-headers ?

  3. If I choose a newer version like torizon-core-7.1, can I still have access to linux-headers ? or is better to choose something like toradex_6.6-2.0.x-imx with headers available on linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

Best regards,
Douglas Silva.

How can I use customization on yaml file for adding custom packages ? Like if I wanted to add gcc, cmake, lrzsz, minicom, nmcli and others.

TorizonCore Builder can only add simple file customizations and kernel drivers/modules. Adding packages is out of scope for the tool.

It is recommended you run a Debian container on the device and install any needed packages inside that container, via the package manager, for use as seen here: Modifying Torizon OS Debian Based Container Images | Toradex Developer Center

Anyways, the intended design of Torizon OS is that your application would be running in a container. Therefore your packages should also be in the container with your application. There’s very little reason to need to install additional packages on the host OS itself.

If you must absolutely have these custom packages on the host OS itself then the officially supported way would be to create a custom OS image with Yocto and add your packages there. Though this is a fairly involved process if you are not familiar with Yocto.

That said I would also question for what reason specifically you would want to install these packages on the host OS, and why not just install them in a container.

How can I guarantee that I will be also generating linux-headers ?

I’m not sure what you’re asking for here exactly. Using TorizonCore Builder, the tool will automatically use the correct Linux kernel sources to compile your procided kernel driver/module.

Do you need the linux headers yourself outside of the tool? And if so why? Also all of our Linux sources are open to clone and use.

If I choose a newer version like torizon-core-7.1, can I still have access to linux-headers ? or is better to choose something like toradex_6.6-2.0.x-imx with headers available on

Again, the TorizonCore Builder tool will automatically choose the correct Linux sources to use for compiling your kernel driver/module. Provided you supply the correct versioned input image.

If you need our Linux source for some other reason than just clone it from the repo you already found.

Best Regards,
Jeremias

I am trying to install HailoRT, which depends on having the Hailo PCIe driver compiled on the host(it can’t be compiled on the container according to their documentation). However I was trying to compile the driver on Docker container just to see whether it is possible, and what is stopping me now is having the linux-headers required for compiling the driver, if I had that I might be able to compile it inside docker container.

Do you know where can I download that linux-headers of the version below?

Kernel version:           5.15.148-6.7.0+git.bfdbfb2c85fb #1-TorizonCore SMP PREEMPT Thu Jun 20 15:59:41 UTC 2024

which depends on having the Hailo PCIe driver compiled on the host(it can’t be compiled on the container according to their documentation).

Again if it’s just a simple driver then TorizonCore Builder can do this for you as per the documentation I’ve already linked you. The tool will compile the driver using the correct Linux sources, you shouldn’t need to worry about Linux headers for this.

Have you already tried to compile your driver using TorizonCore Builder as I have suggested? If not, please try to do so.

Do you know where can I download that linux-headers of the version below?

We use our own Linux kernel so there’s no pre-made Linux headers to download there’s just the source itself which has all the include and header files in source form. But again, I must reiterate if it’s just this HalioRT driver then TorizonCore Builder should be able to compile this without you needing to get the sources yourself manually. Unless this driver is special for some reason.

Best Regards,
Jeremias

Sorry I am still not getting it, I have a Ubuntu 20.04 machine with torizoncore-builder installed, there I have my tcbuild.yaml file with

local: torizon-docker-version-imx8mp-Tezi_7.2.0-devel-202502+build.5.tar

What should I change on this file to add the driver compilation?

I also have tried to cross-compile Hailort PCie driver using Toradex Cross-compiler aarch64-linux-gnu-gcc, but I cannot advance because of fatal error: asm/types.h: No such file or directory.

Best regards,
Douglas Silva.

Did you read the article I linked at the start fully? Is there a section in the documentation you are specifically confused about?

It provides instructions on how to setup the tool and your driver source code for compilation. It even provides an example with a simple hello-world kernel module to show how the process works.

Best Regards,
Jeremias