Hi Yishai,
On 10/30/24 1:58 PM, Yishai Jaffe via lists.yoctoproject.org wrote:
You don't often get email from yishai1999=gmail....@lists.yoctoproject.org. Learn why
this is important<https://aka.ms/LearnAboutSenderIdentification>
Hi,
I'm having a problem compiling my out of tree kernel module.
I've managed to reproduce my problem with the meta-skeleton hello-mod recipe.
I'm working with poky on branch scarthgap.
Here are the necessary changes:
diff --git a/meta-skeleton/recipes-kernel/hello-mod/files/hello.c
b/meta-skeleton/recipes-kernel/hello-mod/files/hello.c
index 4f73455d20..221b5da97c 100644
--- a/meta-skeleton/recipes-kernel/hello-mod/files/hello.c
+++ b/meta-skeleton/recipes-kernel/hello-mod/files/hello.c
@@ -7,9 +7,13 @@
*****************************************************************************/
#include <linux/module.h>
+#include <linux/sched/types.h>
static int __init hello_init(void)
{
+ struct sched_param a = {
+ .sched_priority = 1,
+ };
pr_info("Hello World!\n");
return 0;
}
As you can see I'm trying to use the sched_param struct but when compiling I
get the following error:
|
/home/user/dev/yishai/yocto/build/tmp/work/qemux86_64-poky-linux/hello-mod/0.1/hello.c:
In function 'hello_init':
|
/home/user/dev/yishai/yocto/build/tmp/work/qemux86_64-poky-linux/hello-mod/0.1/hello.c:14:16:
error: variable 'a' has initializer but incomplete type
| 14 | struct sched_param a = {
This looks as if the struct isn't defined anywhere but if I look at
tmp/work/qemux86_64-poky-linux/hello-mod/0.1/recipe-sysroot/usr/include/linux/sched/types.h
which should be the header that I included - I can see that it is defined.
Therefore, it seems like that is not the actual header being included.
Would love to get some help on this!
Just giving hints at where to look at next, not sure this is really
valuable information but here it is.
6.6 had the structure defined in include/uapi/linux/sched/types.h but
6.7+ has it in include/linux/sched.h, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d844fe65f0957024c3e1b0bf2a0615246184d9bc
If I am not mistaken, the kernel headers are coming from
linux-libc-headers which would be 6.6 on Scarthgap, and not your kernel
recipe (because it is **REALLY** bad to use non-upstream kernel headers,
feel free to read the big comment in
meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc :)
If that is the case, then you probably need to include
uapi/linux/sched/types.h instead?
You probably need a different include for 6.7+ which would simply be
include/sched.h?
Hope this helps.
Cheers,
Quentin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64182): https://lists.yoctoproject.org/g/yocto/message/64182
Mute This Topic: https://lists.yoctoproject.org/mt/109295266/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-