I am using an Apalis imx8x module on a custom carrier board. On this carrier we have a M41T81 RTC. I a m trying to compile the rtc-m41-t80.c module from the llinux/drivers/rtc folder. For this i am using the TC Builder and the configured script.
/workdir/modules/m41t81/m41t80.c: In function ‘m41t80_handle_irq’:
/workdir/modules/m41t81/m41t80.c:164:2: error: implicit declaration of function ‘rtc_lock’ [-Werror=implicit-function-declaration]
164 | rtc_lock(m41t80->rtc);
| ^~~~~~~~
/workdir/modules/m41t81/m41t80.c:168:3: error: implicit declaration of function ‘rtc_unlock’; did you mean ‘osq_unlock’? [-Werror=implicit-function-declaration]
168 | rtc_unlock(m41t80->rtc);
| ^~~~~~~~~~
| osq_unlock
/workdir/modules/m41t81/m41t80.c: In function ‘m41t80_probe’:
/workdir/modules/m41t81/m41t80.c:929:13: error: ‘RTC_FEATURE_ALARM’ undeclared (first use in this function)
929 | clear_bit(RTC_FEATURE_ALARM, m41t80_data->rtc->features);
| ^~~~~~~~~~~~~~~~~
/workdir/modules/m41t81/m41t80.c:929:13: note: each undeclared identifier is reported only once for each function it appears in
/workdir/modules/m41t81/m41t80.c:929:48: error: ‘struct rtc_device’ has no member named ‘features’
929 | clear_bit(RTC_FEATURE_ALARM, m41t80_data->rtc->features);
| ^~
/workdir/modules/m41t81/m41t80.c:987:7: error: implicit declaration of function ‘devm_rtc_register_device’; did you mean ‘rtc_register_device’? [-Werror=implicit-function-declaration]
987 | rc = devm_rtc_register_device(m41t80_data->rtc);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| rtc_register_device
cc1: some warnings being treated as errors
What extra files do i need to add to the module directory tog et it to build?
Is there another driver that i can use for the m41t81?
The torizoncore-builder tool can only strictly build “out-of-tree” kernel modules, or put simply modules that don’t exist in the Linux kernel. Trying to build a module like rtc-m41t80.c, which does exist in the Linux kernel will generally not work and lead to very strange behaviors.
The only proper way to build an in-tree kernel module. Would be create a customized TorizonCore image with a recompiled kernel that has this kernel module enabled.
I did not know that. Thank you for clarification.
I already read the article about building external kernel modules and also built one with success.
The issue was with the one “in-the-tree”. As far as i understand i need to build a custom image with Yocto? This would be the next point on my to do list. At the moment i am testing/setting everything up with the Builder.
Thank you for the help. In the mean time i managed to build a custom image with yocto and apply my customization with the torizon builder.
One of the last open topics is how i can add my own service files via the builder so that when i flash a new module i already have the files inside in the correct location.