Building kernelmodules fails

I’m in the process of converting my yocto based image from rocko to kirkstone.

When building one of my device drivers I get a lot of errors in the kernel include files.

Below a snapshot from the compiler output, e.g:

| In file included from /home/alberto/oe-core/build/tmp/work-shared/colibri-imx6-dsg-a/kernel-source/arch/arm/include/asm/uaccess.h:13,
| from /home/alberto/oe-core/build/tmp/work/colibri_imx6_dsg_a-poky-linux-gnueabi/kernel-module-dsg-dxbdriver/0.21+git98b20ade8ed3c84d377e8979e7caa445eae0bcd3-r0/git/DxbDriver/DxbDriver/DxbDevice.c:7:
| /home/alberto/oe-core/build/tmp/work-shared/colibri-imx6-dsg-a/kernel-source/arch/arm/include/asm/domain.h: In function ‘get_domain’:
| /home/alberto/oe-core/build/tmp/work-shared/colibri-imx6-dsg-a/kernel-source/arch/arm/include/asm/domain.h:92:17: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration]
| 92 | : “m” (current_thread_info()->cpu_domain));
| | ^~~~~~~~~~~~~~~~~~~
| /home/alberto/oe-core/build/tmp/work-shared/colibri-imx6-dsg-a/kernel-source/arch/arm/include/asm/domain.h:92:38: error: invalid type argument of ‘->’ (have ‘int’)
| 92 | : “m” (current_thread_info()->cpu_domain));
| | ^~

Kernel release: 6.1.9

Can anybody tell me what is going on?

The errors you are seeing during the build process of your device driver are related to changes in the Linux kernel source code between the Rocko and Kirkstone releases.

The error message indicates that the function “current_thread_info()” is being used in the driver code, but is no longer defined in the version of the kernel headers being used in the build process. This is likely due to changes in the kernel headers and APIs between the two releases.

To resolve this issue, you will need to update your device driver code to use the appropriate APIs and data structures that are defined in the version of the kernel headers used in the Kirkstone release. You may need to consult the kernel documentation and release notes for the Kirkstone release to identify the appropriate changes that need to be made.

Alternatively, you can try using the kernel headers from the Rocko release instead of the Kirkstone release to see if this resolves the build errors. However, this may not be a sustainable solution in the long term, as it could result in compatibility issues with other components of your Yocto-based system that are designed to work with the Kirkstone release.

As you can see, the function current_thread_info is being invoked from a standard kernel header “domain.h”

So please explain this inconsistency.

Did the standard flags for the cross compiler changed on the kirkstone release, e.g. -Werror=implicit-function-declaration ?

Hi @Spinola,

May I know what device driver you are trying to build? Where does it come from?

As @alex.tx has already pointed out, some compatibility issues on the Linux kernel might be expected while moving from rocko to kirkstone. Please take a look into this document to get more information on different versions of our BSPs: Embedded Linux Release Matrix | Toradex Developer Center
Also, have you already taken a look into this document where you find helpful information regarding configuring your kernel: Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center

Hi Rudhi,

This is our own device driver.

As you can you the error is reported in a include file provided with the kernel:

kernel-source/arch/arm/include/asm/domain.h:92:17: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration]

I’ve come to the conclusion that the newer version of the c compiler that is used in kirkstone now makes an error of this issue where as the version of the c compiler that is used in the rocko distribution did not.

I will try to verify this today.

Kind regards,

Hi @Spinola ,

What is the status of this issue? Were you able to solve it?

Best Regards
Kevin