Kernel module dependencies not created correctly

Hi,

I am building a custom image based off the tdx-reference-minimal-image for an imx8mp verdin SoM.
I have 2 custom images (minimal and dev).
The only difference between the 2 images is:

IMAGE_FEATURES += " \
    dbg-pkgs \
    dev-pkgs \
    staticdev-pkgs \
    tools-sdk \
    tools-debug \
"

IMAGE_INSTALL += " \
    packagegroup-tdx-cli \
    packagegroup-fsl-isp \
    imx-test \
    kernel-devsrc \
    nano \
    tcpdump \
"

My minimal image seems to be working fine without any issues, but my dev image has lots of kernel module loading failures.
When I look through the image the modules.dep file appears to show root driver *.ko files, but with dependencies on .debug/*.ko files. in some cases the base driver is also from the .debug folder.
The most common one to see of this is the mwifiex_sdio driver, which is the only base driver not taken from the .debug folder but has dependencies in the .debug folder.
This seems to cause an issue where the driver fails to load properly, even when called via modprobe.
Is there a recipe that is building this file and is there a way for it to either not use or always use the debug versions?

Regards,

Dear @izzy_building,

Thank you for writing to us. Please excuse the delay in reply due to vacation time.
May I ask you what the reason for your inclusion of dbg-pkgs, dev-pkgs, staticdev-pkgs and kernel-devsrc? Is the goal to try compiling on target?

Generally dbg-pkgs, dev-pkgs, staticdev-pkgs and kernel-devsrc can be excluded from the code, since they are not necessary to build.

Best regards
Collin

Hi @collin.tx

The use-case for our “dev” image is for building and debugging any and all things on the target device.
This includes kernel, device drivers, device-tree-overlays and custom applications.
All of these are initially provided in our base image, but we include everything in our dev image to aid in live coding and debugging activities for our custom modifications and fixes.

Regards,
Izzy

Dear @izzy_building,

It would appear to us that this problematic is a yocto based one. The depmod function is only executed during the creation of rootfs. However, depmod can not handle the fact that multiple .ko files with the same name exist.

We would not recommend building the debug files into the “real” rootfs. As an alternative you could try the approach of creating a companion filesystem. For example with this:
IMAGE_GEN_DEBUGFS = "1"
There is further information on that in this article.
Eventually you should be able link it all together.

Let me know how you fare with this.

Best regards
Collin

@collin.tx - For now I have removed the kernel-src and staticdev-pkgs from the build and will see what that does.

However, when I use the IMAGE_GEN_DEBUGFS = "1" in my local.conf the build fails creating the rootfs. Originally it failed because of missing dev and dbg packages. But after removing those it then failed due to locale-en-gb having an unmet dependency on glibc-locale-en-gb.
Is this something you have ever seen before?
Wondering if I am doing something wrong with that variable?

Regards,

Dear @izzy_building,

I have not encountered such behaviour before. Such a use case is unfortunately not tested by us, since it is most likely a Yocto issue which we can not fix. Have you tried reaching out to Yocto?

Best regards,
Collin