Enabling in-tree kernel driver torizon core using torizoncore builder

Hi,

I have read the following documentation on how to build external modules:
https://developer.toradex.com/knowledge-base/building-external-kernel-modules-with-torizon

Is there also an easy way to enable in-tree modules with torizoncore-builder ?
I was usually doing this by making a custom recipe in the yocto enviorment and modifing the defconfig.

Thanks,
Jaume

Greetings @jcabecerans,

TorizonCore Builder is not meant to do any in-tree modifications of the kernel. Only external out-of-tree modules may be added with TorizonCore Builder. The current method for in-tree kernel customization would be modifications via Yocto, as you were already planning.

May I ask for what purpose would you like to modify the kernel?

It sounds like you just want to enable a simple config for driver, correct?

Do you mind sharing the config and driver you’d want to enable. In some cases if there’s no conflict/issues we’d be happy to enable your needed driver as a loadable module by default.

Best Regards,
Jeremias

Hi Jeremias,

I want to enable the goodix i2c touch screen driver.
But I also need to enable the panel-ilitek-ili9881c which needs a patch to it to bring it up to date.

panel-ilitek-ili9881.patch (31.6 KB) (not written by me, rescued it from some github, I just tunned down the clk frequency )

Since I wrote this post yesterday, I “enabled” them with torizoncore-builder by copying the souce code from the linux-toradex repo and adding them as extra modules. That works fine, although I am sure it is not best practice :confused:

Also, I have a question related to this topic that perhaps you might me able to help me with.
To get a defconfig to put in my custom linux-toradex yocto recipe I was doing this:

git clone -branch toradex_5.4-2.3.x-imx git://git.toradex.com/linux-toradex.git
make toradex_defconfig
make nconfig (enable whatever modules needed)
make savedefconfig

I was then coppying this entire file and placing it in my custom linux-toradex folder and referencing it from a linux-toradex%.bbappend.
This worked, but is this the correct way to do it ?

Thanks,
Jaume

Unfortunately due to the external patch this will have to be something you maintain on your side. However looking at the patch itself it seems the main driver code is not a patch on an existing file, rather an entirely brand new driver file on it’s own. I would count this as a “out of tree” driver in this case, which is probably why TorizonCore Builder was able to work. My earlier warning was for trying to add/modify code that already exists in the kernel as this is a bit more complex than a standalone driver file.

As for the defconfig question. The defconfig in the kernel is for our reference BSP, however for Torizon we require a slightly different configuration due to containers and other things. These get included via a kernel-cache with the source here: GitHub - toradex/toradex-kernel-cache: Patches and configuration for the Toradex kernel tree

The recipe here: meta-toradex-torizon/linux-toradex-kmeta.inc at dunfell-5.x.y · toradex/meta-toradex-torizon · GitHub

Then constructs the kernel config based off the machine. You can however still add additional configs via kernel fragments which will then get merged with the existing kernel-cache to produce a final config. But, in short don’t use the defconfig in the kernel for Torizon as this doesn’t have all the configs needed for expected Torizon operations.

Best Regards,
Jeremias