From: Quentin Schulz <quentin.schulz@cherry.de>
To: yocto@lists.yoctoproject.org, yishai1999@gmail.com
Subject: Re: [yocto] Out-of-tree Kernel Modules
Date: Wed, 30 Oct 2024 14:25:32 +0100 [thread overview]
Message-ID: <7affdd4a-b9f2-4177-b336-100b0e475337@cherry.de> (raw)
In-Reply-To: <CAJw49vrd9njM9kfOCXgnXwmdPcUoFCc4EoY560nnFcWUvHcGxA@mail.gmail.com>
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.com@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
next prev parent reply other threads:[~2024-10-30 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 12:58 Out-of-tree Kernel Modules Yishai Jaffe
2024-10-30 13:25 ` Quentin Schulz [this message]
2024-10-30 14:54 ` [yocto] " Yishai Jaffe
2024-10-30 15:01 ` Quentin Schulz
2024-10-30 19:01 ` Yishai Jaffe
2024-10-31 7:33 ` Yoann Congal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7affdd4a-b9f2-4177-b336-100b0e475337@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=yishai1999@gmail.com \
--cc=yocto@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.