Hello-mod kernel module doesn't build

Hi all,

I’m working on AM62 and use my VM host Ubuntu lts 22.04 to build my custom image following the steps in the Toradex documentation.

I’m able to build my custom image and deploy it on my board. This image was lightly customized ( only splasch creen). I’m now trying to customize by adding the hello-mod kernel module but after a lot of trial, i’m still getting a compilation error.
I didn’t modified the kernel module, just got it from git and add it to the tcbuild.yaml file.

Please find in attachment the yaml and the result of the build command for kernel module fail .

  1. Is it necessary to install gcc on my machine ?
  2. By what is the module build if i don’t have the compiler installed on my machine ?
  3. Is the compiler integrated into the docker that run the torizon-builder may be ?

Thanks !

fail_with_autoload (3.2 KB)
tcbuild.yaml (4.6 KB)

Greetings @FloSolio,

I was able to reproduce this issue as well. What’s strange is that it works fine on other arm64 modules like Verdin i.MX8MP. Perhaps the am62 needs a slightly different build setup here. I’ll report this to our team to take a look at.

Is it necessary to install gcc on my machine ?
By what is the module build if i don’t have the compiler installed on my machine ?
Is the compiler integrated into the docker that run the torizon-builder may be ?

None of this is needed all the build tools and requirements should be handled internally by TorizonCore Builder.

Best Regards,
Jeremias

2 Likes

Thanks @jeremias.tx ,

I hope they will fix this quiet fast because it is a bit problematic toimplement kernel module of our custom hardware and will block the dev.

Thank you !

1 Like

The issue was reported to our development team who are currently taking a look into this. I don’t have any real timelines yet as the issue is till being analyzed, but I will let you know once there is news to share.

Best Regards,
Jeremias

Hi Jermias,

Thanks for the update.

Does it mean that I should work with yocto project directly ?

By looking at the dts documentation, i had to checkout the linux folder.
When i go into the floder : linux/drivers/gpio/gpio-pca953x.c , i find one of the driver i need for my system. This GPIO expander is connected on my Som AM62 with the i2c bus.

As the kernel module compiler is not working for the moment , what will be the best method to enable this driver in my custom image ?

Should i build via Yocto directly ?
Build with Yocto Documentation Overview | Toradex Developer Center

I tried this method ( build Torizon OS with Yocto ) but i get an error at the begining of the build:

I don’t know how far the AM62 has been checked with the online documentation but I hope to be able to quickly build something functionnal ( can be really problematic for our buisness case in short term).

The first build fail used by torizon-core-docker. So i tried the torizon-minimal, but same issue:

When i go into the floder : linux/drivers/gpio/gpio-pca953x.c , i find one of the driver i need for my system. This GPIO expander is connected on my Som AM62 with the i2c bus.

Wait is this the driver/kernel module you’re trying to add to your system? I can see the kernel config corresponding to this driver is already enabled in our OS by default:

torizon@verdin-am62-15133500:~$ zcat /proc/config.gz | grep GPIO_PCA953X
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y

Is this what you need? In that case you can probably proceed with integrating your GPIO expander then.

Best Regards,
Jeremias

Thanks , it is this one that I need to use yes.

I still have two others to impement: Module Lora SX1302 for Lora Gateway, and DIO5661ST6 to control the backlight of my 7" Display.

I know that we need to set the # CONFIG linked to the kernel module we want to use, and specify “y” as " yes" to specify the kernel to load the module at boot. ‘m’ to let us mount the drive at run time . But what about if the module is not in the # CONFIG list , like it is the case for my backlight device for example ?

A part of that, have you understand why i’m not able to build the yocto because of the missing receipe ( or the wrong pointed by the linux-firmware .bb file ?

As for the module, i just followed the documentation step without modifications.

I found this ticket but the solution to impelemnt is not working for me : Error when building image with latest Kirkstone branch

But what about if the module is not in the # CONFIG list , like it is the case for my backlight device for example ?

If the driver exists in the Linux Kernel then you can simply request us to add it to our OS by default set to “m”. If the driver does not exist in the Linux Kernel then you need to add it externally.

For these other 2 devices you listed, do you know where there drivers can be found?

A part of that, have you understand why i’m not able to build the yocto because of the missing receipe ( or the wrong pointed by the linux-firmware .bb file ?

This is a known issue see my comment in this other thread here: Installing deb packages with the Yocto Project - #2 by jeremias.tx

Best Regards,
Jeremias

1 Like

Hi Jeremias,

After removing the .bb file, i was able to build the Yocto image… after 10hours of build ! :dizzy_face:

I’m working on a virtual machine with 8Go of allocated ram. I also ad to re create one with 150Go , else i reach the limit of disk space .

For these other 2 devices you listed, do you know where there drivers can be found?

Yes, concerning the PWM backlight, i have found a way to do it into Toradex documentation :

Concerning the Lora Getway, here is the driver:

I guess i have to create a kernel module for it, right ?

Thanks for your precious help !

After removing the .bb file, i was able to build the Yocto image… after 10hours of build !

Yeah doing Yocto builds from scratch can be quite time-consuming and compute intensive.

I guess i have to create a kernel module for it, right ?

Correct. If there is no driver for this hardware available in the Linux kernel then your only real option is to build it as an external kernel module and hope it works.

That said I do have good news. The team seems to have fixed the original issue with TorizonCore Builder. You should now be able to use it to build external kernel modules for AM62.

However, you need to use a very recently nightly image as your base image. The fix involved here required a change on the OS level. For reference I used the nightly image for February 2nd.

Best Regards,
Jeremias

Hi Jeremias,

Hello-mod works, thanks a lot !

I get the same image than you, named :
torizon-core-docker-verdin-am62-Tezi_6.6.0-devel-20240203+build.501

Now let’s go on vscode or application layer :slight_smile: It seems i have deployement issue with code 18 but i will open a new ticket thanks again for the reactivity of the support !

1 Like

Hi @FloSolio ,

Glad that you were able to proceed.

Let us know if you need more help.

Best Regards
Kevin

1 Like