Re: [yocto] Including a header from an external kernel module
On Tue, Jul 10, 2018 at 12:11 AM, Michael Allwright wrote: > Am I correct in expecting that, if I do everything correctly, my header file > from module-a should end up in > ~/poky/build/tmp/work-shared/machine/kernel-source/include/linux/mfd No, the kernel-source directory is for the kernel recipe and other recipes can't generally add anything too it (if you want a header to show up in the kernel source directory then you could patch the kernel sources though). Other (ie non-kernel) recipes share headers etc via sysroot, which with OE 2.3 and above is created for each recipe in the "recipe-sysroot" subdirectory in the recipe's WORKDIR. >From what you've said so far, I guess module-a's header file is in module-b's sysroot directory under /usr/include, but when module-b is compiled the include path isn't setup to find it. Since /usr/include in sysroot contains headers for user space it's quite correct that it shouldn't be in the include path when building a kernel module (e.g. to prevent accidentally including user space string.h instead of the kernel version, etc, etc). When the kbuild Makefiles call the compiler they will not pass a --sysroot option etc. If module-a is sharing a header in a subdirectory of sysroot, you will need to somehow manually add that directory as an extra include path when module-b is compiled (don't try to add the whole of sysroot /usr/include - just the specific subdirectory you need). A possible alternative approach might be to create one recipe which builds all your kernel modules. That would make the build self more contained as each module can find headers from other modules somewhere in ${S}. -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Including a header from an external kernel module
On Tue., 10 Jul. 2018, 00:15 Andre McCurdy, wrote: > On Mon, Jul 9, 2018 at 3:07 PM, Michael Allwright > wrote: > > Yes, it ended up in the development package in the do_install_append > > attempt > > How did you confirm that (ie that the header ended up in the > module-a-dev package) ? In the build directory, I can see that the header file is in the module-a-dev directory under split packages. > > , but I couldn't #include it in the second module (file didn't exist > > in the include search paths). > > Did you add: > > DEPENDS = "module-a" > > to the module-b recipe? > Yes, I did this. > I would point out though, that I am interested in what is the correct way > to > > do this, and not just in finding some workaround / hack so that it > works... > > That's good to hear. > So am I on the right track or should I be doing this differently? > > On Mon., 9 Jul. 2018, 19:47 Andre McCurdy, wrote: > >> > >> On Mon, Jul 9, 2018 at 8:27 AM, Michael Allwright > >> wrote: > >> > Hello, > >> > > >> > I think it would be useful to extend the hello-mod recipe in > >> > meta-skeleton > >> > to demonstrate some slightly more complicated scenarios. For example, > I > >> > am > >> > trying to find out how to have two external kernel modules A and B, > >> > where > >> > module B #includes a header file provided by module A. > >> > > >> > I have made module B depend on module A, however, I believe I am still > >> > missing one or two steps in my recipe for module A such that the > header > >> > file > >> > is copied into the shared kernel staging directory where module B can > >> > find > >> > it. > >> > > >> > So far I have tried the following: > >> > > >> > FILES_${PN}-dev += "/usr/include/linux/mfd/module-a.h" > >> > > >> > FILES_kernel-headers += "${includedir}/linux/mfd/module-a.h" > >> > > >> > do_install_append () { > >> >install -d ${D}${includedir}/linux/mfd > >> >install -m 644 ${S}/module-a ${D}${includedir}/linux/mfd/module-a.h > >> > } > >> > >> And what happened after you tried the above? Did the header not end up > >> in the -dev package for module A? Did the module A recipe not create a > >> -dev package? Something else? > >> > >> > In module B, I want to be able to: > >> > > >> > #include > >> > > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Including a header from an external kernel module
On Mon, Jul 9, 2018 at 3:07 PM, Michael Allwright wrote: > Yes, it ended up in the development package in the do_install_append > attempt How did you confirm that (ie that the header ended up in the module-a-dev package) ? > , but I couldn't #include it in the second module (file didn't exist > in the include search paths). Did you add: DEPENDS = "module-a" to the module-b recipe? > I would point out though, that I am interested in what is the correct way to > do this, and not just in finding some workaround / hack so that it works... That's good to hear. > On Mon., 9 Jul. 2018, 19:47 Andre McCurdy, wrote: >> >> On Mon, Jul 9, 2018 at 8:27 AM, Michael Allwright >> wrote: >> > Hello, >> > >> > I think it would be useful to extend the hello-mod recipe in >> > meta-skeleton >> > to demonstrate some slightly more complicated scenarios. For example, I >> > am >> > trying to find out how to have two external kernel modules A and B, >> > where >> > module B #includes a header file provided by module A. >> > >> > I have made module B depend on module A, however, I believe I am still >> > missing one or two steps in my recipe for module A such that the header >> > file >> > is copied into the shared kernel staging directory where module B can >> > find >> > it. >> > >> > So far I have tried the following: >> > >> > FILES_${PN}-dev += "/usr/include/linux/mfd/module-a.h" >> > >> > FILES_kernel-headers += "${includedir}/linux/mfd/module-a.h" >> > >> > do_install_append () { >> >install -d ${D}${includedir}/linux/mfd >> >install -m 644 ${S}/module-a ${D}${includedir}/linux/mfd/module-a.h >> > } >> >> And what happened after you tried the above? Did the header not end up >> in the -dev package for module A? Did the module A recipe not create a >> -dev package? Something else? >> >> > In module B, I want to be able to: >> > >> > #include >> > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Including a header from an external kernel module
Yes, it ended up in the development package in the do_install_append attempt, but I couldn't #include it in the second module (file didn't exist in the include search paths). I would point out though, that I am interested in what is the correct way to do this, and not just in finding some workaround / hack so that it works... On Mon., 9 Jul. 2018, 19:47 Andre McCurdy, wrote: > On Mon, Jul 9, 2018 at 8:27 AM, Michael Allwright > wrote: > > Hello, > > > > I think it would be useful to extend the hello-mod recipe in > meta-skeleton > > to demonstrate some slightly more complicated scenarios. For example, I > am > > trying to find out how to have two external kernel modules A and B, where > > module B #includes a header file provided by module A. > > > > I have made module B depend on module A, however, I believe I am still > > missing one or two steps in my recipe for module A such that the header > file > > is copied into the shared kernel staging directory where module B can > find > > it. > > > > So far I have tried the following: > > > > FILES_${PN}-dev += "/usr/include/linux/mfd/module-a.h" > > > > FILES_kernel-headers += "${includedir}/linux/mfd/module-a.h" > > > > do_install_append () { > >install -d ${D}${includedir}/linux/mfd > >install -m 644 ${S}/module-a ${D}${includedir}/linux/mfd/module-a.h > > } > > And what happened after you tried the above? Did the header not end up > in the -dev package for module A? Did the module A recipe not create a > -dev package? Something else? > > > In module B, I want to be able to: > > > > #include > > > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto
Re: [yocto] Including a header from an external kernel module
On Mon, Jul 9, 2018 at 8:27 AM, Michael Allwright wrote: > Hello, > > I think it would be useful to extend the hello-mod recipe in meta-skeleton > to demonstrate some slightly more complicated scenarios. For example, I am > trying to find out how to have two external kernel modules A and B, where > module B #includes a header file provided by module A. > > I have made module B depend on module A, however, I believe I am still > missing one or two steps in my recipe for module A such that the header file > is copied into the shared kernel staging directory where module B can find > it. > > So far I have tried the following: > > FILES_${PN}-dev += "/usr/include/linux/mfd/module-a.h" > > FILES_kernel-headers += "${includedir}/linux/mfd/module-a.h" > > do_install_append () { >install -d ${D}${includedir}/linux/mfd >install -m 644 ${S}/module-a ${D}${includedir}/linux/mfd/module-a.h > } And what happened after you tried the above? Did the header not end up in the -dev package for module A? Did the module A recipe not create a -dev package? Something else? > In module B, I want to be able to: > > #include > -- ___ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto