<div dir="ltr"><div>As I said, I am a man of experimental try-outs. And here is the try!<br></div><div><br></div><div>Now, after setting sources, I tried to compile the example (from my Git):</div><div><a href="https://github.com/ZoranStojsavljevic/bbb-yocto/tree/master/Issues/LKM">https://github.com/ZoranStojsavljevic/bbb-yocto/tree/master/Issues/LKM</a></div><div><br></div><div>The results are the following (all on the target):</div><div>root@beaglebone:~# pwd<br>/home/root<br>root@beaglebone:~# ls -al<br>drwx------   2 root   root       0 May 24 13:11 .<br>drwxr-xr-x   3 root   root       0 May 23 13:03 ..<br>-rw-r--r--   1 root   root      159 May 24 12:54 Makefile<br>-rw-r--r--   1 root   root      1228 May 24 12:54 p15_test.c<br></div><div>root@beaglebone:~# make all<br>make -C /lib/modules/5.0.15-jumpnow/build M=/home/root modules<br>make[1]: Entering directory '/lib/modules/5.0.15-jumpnow/build'<br> CC [M]  /home/root/p15_test.o<br>In file included from ./include/asm-generic/int-ll64.h:11,<br>         from ./arch/arm/include/uapi/asm/types.h:5,<br>         from ./include/uapi/linux/types.h:5,<br>         from ./include/linux/types.h:6,<br>         from ./include/linux/list.h:5,<br>         from ./include/linux/module.h:9,<br>         from /home/root/p15_test.c:5:<br><span style="color:rgb(255,0,0)"><i><b>./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory</b></i></span><br> #include <asm/bitsperlong.h><br>     ^~~~~~~~~~~~~~~~~~~<br>compilation terminated.<br><span style="color:rgb(255,0,0)"><i><b>make[2]: *** [scripts/Makefile.build:283: /home/root/p15_test.o] Error 1<br>make[1]: *** [Makefile:1577: _module_/home/root] Error 2<br>make[1]: Leaving directory '/lib/modules/5.0.15-jumpnow/build'<br>make: *** [Makefile:4: all] Error 2</b></i></span></div><div><span style="color:rgb(255,0,0)"><i><b><br></b></i></span></div><div><span style="color:rgb(0,0,0)">I see that you have changed the kernel from 5.0.7-jumpnow to 5.0.15-jumpnow . Did you?<br></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">This example works on the same target out of Debian (flashed in eMMC), without the problems.<br></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">Something is wrong with the YOCTO source kernel tree.</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">You are free to try example on YOCTO and Embedded Debian yourselves!<br></span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div>Zoran</div><div>_______<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 6:37 AM Khem Raj <<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 5/23/19 9:14 PM, Zoran Stojsavljevic wrote:<br>
>Â > I think this is a fair suggestion. Having prebuilt kernel available<br>
>Â > that contains the configuration and header files used in the build is<br>
>Â > all that is required for external modules to build in addition to<br>
>Â > toolchain, so maybe its worth a try to create such a package and then<br>
>Â > have kernel-source separated out which can be installed on top if one<br>
>Â > needs<br>
> <br>
> I am man of experimental try-outs. So, in order to see how big kernel is,<br>
> I did the following:<br>
> Fedora 29 (which I am using as a host) with kernel-headers (NOT full<br>
> kernel source tree):<br>
> [vuser@fedora29-ssd 5.0.16-200.fc29.x86_64]$ pwd<br>
> /usr/src/kernels/5.0.16-200.fc29.x86_64<br>
> [vuser@fedora29-ssd 5.0.16-200.fc29.x86_64]$ du --summarize<br>
> /*102124 Â Â . <<======= ~95MB*/<br>
> <br>
> Kernel.org kernel 5.0.6, the full kernel source tree size:<br>
> [vuser@fedora29-ssd linux-5.0.6]$ pwd<br>
> /home/vuser/projects/<a href="http://kernel.org/linux-5.0.6" rel="noreferrer" target="_blank">kernel.org/linux-5.0.6</a> <<a href="http://kernel.org/linux-5.0.6" rel="noreferrer" target="_blank">http://kernel.org/linux-5.0.6</a>><br>
> [vuser@fedora29-ssd linux-5.0.6]$ du --summarize<br>
> /*960592 Â Â . <<======= ~900MB*/<br>
> <br>
> These are ballpark numbers. You can draw conclusions for yourselves!<br>
> <br>
> It is ~ 7x to 9x reduction in size. Having BBB's DDR2 of size 512MB,<br>
> and initramfs for testing purposes, in speaks for itself.<br>
> <br>
<br>
yes thats what I was expecting too. Anything smaller helps.<br>
<br>
<br>
> (I am aware that YOCTO kernels are less/smaller in size, but how smaller?)<br>
> <br>
<br>
Not in source. The binaries may be<br>
<br>
> Zoran<br>
> _______<br>
> <br>
> <br>
> On Fri, May 24, 2019 at 3:00 AM Khem Raj <<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a> <br>
> <mailto:<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>>> wrote:<br>
> <br>
> <br>
> <br>
>Â Â Â On 5/23/19 3:32 AM, Zoran Stojsavljevic wrote:<br>
>Â Â Â > After some tests (and I had other problems to take care of, as well),<br>
>Â Â Â > here is the following:<br>
>Â Â Â ><br>
>Â Â Â >> These have all been discussed off an on over the past 5 years.<br>
>Â Â Â >> I can't get at bugzilla right now, but all the details are<br>
>Â Â Â logged in cases.<br>
>Â Â Â >> A survey of all the distros, their kernel package, etc, were all<br>
>Â Â Â looked at.<br>
>Â Â Â >> We had to balance the traditional packaging with some new concepts<br>
>Â Â Â >> and landed with what we have now.<br>
>Â Â Â ><br>
>Â Â Â > I tried several tests. This is my final conclusion (two cases):<br>
>Â Â Â ><br>
>Â Â Â <a href="https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/Issues/kernel-development.txt" rel="noreferrer" target="_blank">https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/Issues/kernel-development.txt</a><br>
>Â Â Â ><br>
>Â Â Â > The kernel issue is described here: there is need to have the YOCTO<br>
>Â Â Â > minimum configuration with the kernel setup:<br>
>Â Â Â > [1] The entire kernel source code in:<br>
>Â Â Â > /usr/src/kernel/`uname-r`/<kernel source code><br>
>Â Â Â > [2] The header files in: /usr/src/kernel/`uname-r`/<header file<br>
>Â Â Â > directory structures><br>
>Â Â Â ><br>
>Â Â Â > Point [1] is achieved with the following local.config file:<br>
>Â Â Â ><br>
>Â Â Â <a href="https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/Issues/local-devsrc.conf" rel="noreferrer" target="_blank">https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/Issues/local-devsrc.conf</a><br>
>Â Â Â ><br>
>Â Â Â > Namely, with the following snippets in the local.conf:<br>
>Â Â Â > TOOLCHAIN_TARGET_TASK_append = " packagegroup-core-tools-profile<br>
>Â Â Â > packagegroup-core-buildessential kernel-devsrc"<br>
>Â Â Â > KERNEL_DEV_TOOLS = "packagegroup-core-tools-profile<br>
>Â Â Â > packagegroup-core-buildessential kernel-devsrc"<br>
>Â Â Â > KERNEL_DEV_MODULE = "kernel-modules"<br>
>Â Â Â > CORE_IMAGE_EXTRA_INSTALL += "${KERNEL_DEV_MODULE} \<br>
>Â Â Â > ${KERNEL_DEV_TOOLS} \<br>
>Â Â Â > systemtap \<br>
>Â Â Â > "<br>
>Â Â Â ><br>
>Â Â Â > Problem with this approach is that such a kernel makes the rootfs too<br>
>Â Â Â > big and impractical:<br>
>Â Â Â > -rw-r--r--. 2 user vboxusers 101499952 May 17 14:32<br>
>Â Â Â > core-image-minimal-beaglebone.rootfs.tar.xz<br>
>Â Â Â ><br>
>Â Â Â > The main issue is point [2]: how to achieve it?<br>
>Â Â Â > The suggestion is to introduce the new package in YOCTO kernel,<br>
>Â Â Â > called: kernel-headers<br>
>Â Â Â > The OBVIOUS benefit is that it will serve to the purpose of building<br>
>Â Â Â > modules out of the tree on the target with<br>
>Â Â Â > minimal mpact to rootfs!<br>
> <br>
>Â Â Â I think this is a fair suggestion. Having prebuilt kernel available<br>
>Â Â Â that contains the configuration and header files used in the build is<br>
>Â Â Â all that is required for external modules to build in addition to<br>
>Â Â Â toolchain, so maybe its worth a try to create such a package and then<br>
>Â Â Â have kernel-source separated out which can be installed on top if one<br>
>Â Â Â needs<br>
> <br>
>Â Â Â ><br>
>Â Â Â > Thank you,<br>
>Â Â Â > Zoran Stojsavljevic<br>
>Â Â Â > _______<br>
>Â Â Â ><br>
>Â Â Â > On Thu, May 16, 2019 at 12:04 AM Bruce Ashfield<br>
>Â Â Â > <<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a> <mailto:<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a>>> wrote:<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >> On Wed, May 15, 2019 at 4:09 PM Zoran Stojsavljevic<br>
>Â Â Â <<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a><br>
>Â Â Â <mailto:<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a>>> wrote:<br>
>Â Â Â >>><br>
>Â Â Â >>>> The core-image-kernel-dev image is how I do all my on target<br>
>Â Â Â >>>> testing when I introduce a new reference kernel for a release.<br>
>Â Â Â >>><br>
>Â Â Â >>> Maybe you are correct. Maybe I should use/add in my local.conf<br>
>Â Â Â the following:<br>
>Â Â Â >>><br>
>Â Â Â >>> KERNEL_DEV_TOOLS ?= "packagegroup-core-tools-profile<br>
>Â Â Â >>> packagegroup-core-buildessential kernel-devsrc"<br>
>Â Â Â >>> KERNEL_DEV_MODULE ?= "kernel-modules"<br>
>Â Â Â >>> CORE_IMAGE_EXTRA_INSTALL += "${KERNEL_DEV_MODULE} \<br>
>Â Â Â >>>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ${KERNEL_DEV_TOOLS} \<br>
>Â Â Â >>>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â systemtap \<br>
>Â Â Â >>>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "<br>
>Â Â Â >>> I need to try these... Maybe this addendum will solve the $1<br>
>Â Â Â mio USD problem?!<br>
>Â Â Â >>><br>
>Â Â Â >>>> And IIRC the autobuilders are using a sato based image (Richard<br>
>Â Â Â >>>> could confirm more easily that I could what image type the<br>
>Â Â Â >>>> autobuilders are using for hello-world on target module tests).<br>
>Â Â Â >>><br>
>Â Â Â >>> I am just advertising something more simple. To have mandatory<br>
>Â Â Â >>> /lib/modules/`uname -r` directory. And introduce few more<br>
>Â Â Â packages, as<br>
>Â Â Â >>> Fedora distro, for example, has: kernel-headers (assuming YOCTO<br>
>Â Â Â >>> rootfs, the following will be installed: /usr/src/kernel/`uname<br>
>Â Â Â >>> -r`/<header file directory structures>. This also makes addition of<br>
>Â Â Â >>> /lib/modules/`uname -r`/build file (which is soft link to<br>
>Â Â Â >>> usr/src/kernel/`uname -r`).<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >> These have all been discussed off an on over the past 5 years. I<br>
>Â Â Â can't get at bugzilla right now, but all the details are logged in<br>
>Â Â Â cases. A survey of all the distros, their kernel package, etc, were<br>
>Â Â Â all looked at. We had to balance the traditional packaging with some<br>
>Â Â Â new concepts and landed with what we have now.<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >>><br>
>Â Â Â >>> Or kernel-devel package. Then, the whole current kernel source code<br>
>Â Â Â >>> will be introduced, and also support for it.<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >> There's a case for this one as well, I'll probably have it done<br>
>Â Â Â for the fall release. But our devsrc used to pretty much be the full<br>
>Â Â Â source it has now been pruned down to something more manageable. <br>
>Â Â Â There are definitely some cases for having the full source on the<br>
>Â Â Â target again, and it will be a separate package, just not the<br>
>Â Â Â minimal one to build out of tree modules, etc.<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >>><br>
>Â Â Â >>><br>
>Â Â Â >>> SDK building with such a support is good/cool. But sometimes,<br>
>Â Â Â before<br>
>Â Â Â >>> introducing SDK, some tests should be done on target. NO need to<br>
>Â Â Â >>> optionally include built-in layer hello-world driver example.<br>
>Â Â Â Since I<br>
>Â Â Â >>> (or you name the person) have own test drivers, which will be<br>
>Â Â Â imported<br>
>Â Â Â >>> out of tree, externally, to the target test bed!<br>
>Â Â Â >>><br>
>Â Â Â >><br>
>Â Â Â >> I never use the SDK myself, so you are not alone in not going to<br>
>Â Â Â it first. Hopefully I'll get some new patches out in the coming<br>
>Â Â Â month before summer holidays really kick in.<br>
>Â Â Â >><br>
>Â Â Â >> Bruce<br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >>><br>
>Â Â Â >>> Just thinking loud...<br>
>Â Â Â >>><br>
>Â Â Â >>> Zoran<br>
>Â Â Â >>> _______<br>
>Â Â Â >>><br>
>Â Â Â >>> On Wed, May 15, 2019 at 4:25 PM Bruce Ashfield<br>
>Â Â Â <<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a> <mailto:<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a>>> wrote:<br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>> On Wed, May 15, 2019 at 3:44 AM Zoran Stojsavljevic<br>
>Â Â Â <<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a><br>
>Â Â Â <mailto:<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a>>> wrote:<br>
>Â Â Â >>>>><br>
>Â Â Â >>>>>> That's correct. That command only adds the kernel source and<br>
>Â Â Â >>>>>> build infrastructure to the SDK, not to your target image.<br>
>Â Â Â You'd still<br>
>Â Â Â >>>>>> need to arrange to have the kernel-devsrc package installed<br>
>Â Â Â on the<br>
>Â Â Â >>>>>> target image if you want it on the board's rootfs. How you<br>
>Â Â Â arrange<br>
>Â Â Â >>>>>> to have the package installed to the image varies with the image<br>
>Â Â Â >>>>>> (since they all don't have the same image install variables,<br>
>Â Â Â etc).<br>
>Â Â Â >>>>><br>
>Â Â Â >>>>> And here is a $1,000,000 USD question? How to do it on Poky (as<br>
>Â Â Â >>>>> example of what you have stated in RED)? ;-)<br>
>Â Â Â >>>>><br>
>Â Â Â >>>>> In other words: how to arrange it on Poky (as a Referent<br>
>Â Â Â example)?<br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>> The core-image-kernel-dev image is how I do all my on target<br>
>Â Â Â testing when I introduce a new reference kernel for a release. And<br>
>Â Â Â IIRC the autobuilders are using a sato based image (Richard could<br>
>Â Â Â confirm more easily that I could what image type the autobuilders<br>
>Â Â Â are using for hello-world on target module tests).<br>
>Â Â Â >>>><br>
>Â Â Â >>>> Bruce<br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>>><br>
>Â Â Â >>>>><br>
>Â Â Â >>>>> Thank you,<br>
>Â Â Â >>>>> Zoran<br>
>Â Â Â >>>>> _______<br>
>Â Â Â >>>>><br>
>Â Â Â >>>>><br>
>Â Â Â >>>>> On Wed, May 15, 2019 at 7:41 AM Bruce Ashfield<br>
>Â Â Â <<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a> <mailto:<a href="mailto:bruce.ashfield@gmail.com" target="_blank">bruce.ashfield@gmail.com</a>>> wrote:<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>> On Tue, May 14, 2019 at 1:30 PM Zoran Stojsavljevic<br>
>Â Â Â <<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a><br>
>Â Â Â <mailto:<a href="mailto:zoran.stojsavljevic@gmail.com" target="_blank">zoran.stojsavljevic@gmail.com</a>>> wrote:<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> Hello Chris, Bruce,<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> I have some additional data to share with you both, since I<br>
>Â Â Â have tried<br>
>Â Â Â >>>>>>> something. And here is my take on the things!<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>>> 1. Build using a bb recipe.<br>
>Â Â Â >>>>>>>> Take a look at meta-skeleton/recipes-kernel/hello-mod for<br>
>Â Â Â an example.<br>
>Â Â Â >>>>>>>> You just need to add meta-skeleton to your bblayers.conf<br>
>Â Â Â and then<br>
>Â Â Â >>>>>>>>Â Â bitbake hello-mod<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> I looked into this example, and, yes, it is classic kernel<br>
>Â Â Â module<br>
>Â Â Â >>>>>>> definition out of the tree. With some outdated data, all<br>
>Â Â Â cool, the<br>
>Â Â Â >>>>>>> YOCTO designer should take care himself to fix these data,<br>
>Â Â Â if using<br>
>Â Â Â >>>>>>> this stuff.<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> But this is NOT mandatory, since I can add out of the tree<br>
>Â Â Â module NOT<br>
>Â Â Â >>>>>>> actually using built-in module. I just use<br>
>Â Â Â .../tmp/deploy/images/bbb/*<br>
>Â Â Â >>>>>>> generated stuff, since I have automated scripts which are<br>
>Â Â Â bringing all<br>
>Â Â Â >>>>>>> these on my BBB target. Then I tftp my source code module<br>
>Â Â Â to the<br>
>Â Â Â >>>>>>> target.<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>>> 2. Build from the SDK:<br>
>Â Â Â >>>>>>>> First, add the kernel source to the SDK by adding this to<br>
>Â Â Â conf/local.conf<br>
>Â Â Â >>>>>>>>Â Â TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> YES, this is THE command which should generate<br>
>Â Â Â >>>>>>> /usr/src/kernel(s)/`uname -r` or similar... But adding it to<br>
>Â Â Â >>>>>>> local.conf and after deleting kernel, then regenerating<br>
>Â Â Â bitbake -k<br>
>Â Â Â >>>>>>> core-image-minimal does not bring this path into the rootfs<br>
>Â Â Â image!?<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>> That's correct. That command only adds the kernel source and<br>
>Â Â Â build infrastructure to the SDK, not to your target image. You'd<br>
>Â Â Â still need to arrange to have the kernel-devsrc package installed on<br>
>Â Â Â the target image if you want it on the board's rootfs. How you<br>
>Â Â Â arrange to have the package installed to the image varies with the<br>
>Â Â Â image (since they all don't have the same image install variables, etc).<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> I did it actually using meta-bbb, and using poky referent<br>
>Â Â Â distro as<br>
>Â Â Â >>>>>>> two additional layers to the more complex bbb image!<br>
>Â Â Â >>>>>>> <a href="https://github.com/jumpnow/meta-bbb.git" rel="noreferrer" target="_blank">https://github.com/jumpnow/meta-bbb.git</a><br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> The (KAS - you can figure out out of it local.conf) script<br>
>Â Â Â I am using<br>
>Â Â Â >>>>>>> to build such a BBB image is here:<br>
>Â Â Â >>>>>>><br>
>Â Â Â <a href="https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/bbb-releases/bbb-warrior/kas-bbb-warrior.yml" rel="noreferrer" target="_blank">https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/bbb-releases/bbb-warrior/kas-bbb-warrior.yml</a><br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> I did not try it with BBB reference poky only! Maybe I<br>
>Â Â Â should try it<br>
>Â Â Â >>>>>>> as only referent poky? What do you think?<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> Does in this case is SDK build really mandatory??? Should<br>
>Â Â Â NOT be!<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>> You only do the SDK steps if you want to support building<br>
>Â Â Â out of tree modules in an SDK install. So it is not mandatory for on<br>
>Â Â Â target module builds.<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>> Bruce<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>>> Once the SDK is installed, generate the kernel headers:<br>
>Â Â Â >>>>>>>>Â Â sudo -i<br>
>Â Â Â >>>>>>>>Â Â .<br>
>Â Â Â /opt/poky/2.6.2/environment-setup-cortexa8hf-neon-poky-linux-gnueabi<br>
>Â Â Â >>>>>>>>Â Â cd<br>
>Â Â Â /opt/poky/2.6.2/sysroots/cortexa8hf-neon-poky-linux-gnueabi<br>
>Â Â Â >>>>>>>>Â Â cd /usr/src/kernel<br>
>Â Â Â >>>>>>>>Â Â make oldconfig scripts<br>
>Â Â Â >>>>>>>>Â Â exit<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> This is in nutshell the same what I did (a bit different)<br>
>Â Â Â for Embedded<br>
>Â Â Â >>>>>>> Debian. This is already on the target BBB, NOT while<br>
>Â Â Â building YOCTO<br>
>Â Â Â >>>>>>> BBB image!<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>>> Finally, build your module using a Makefile like this<br>
>Â Â Â >>>>>>>>Â Â obj-m := hello-mod.o<br>
>Â Â Â >>>>>>>>Â Â all:<br>
>Â Â Â >>>>>>>>Â Â Â Â Â make -C $(SDKTARGETSYSROOT)/usr/src/kernel<br>
>Â Â Â M=$(shell pwd)<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> As said before: bringing my own module into the target BBB<br>
>Â Â Â (I have my<br>
>Â Â Â >>>>>>> own examples, and I build them on the target with the<br>
>Â Â Â almost the same<br>
>Â Â Â >>>>>>> Makefiles)<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> Zoran<br>
>Â Â Â >>>>>>> _______<br>
>Â Â Â >>>>>>><br>
>Â Â Â >>>>>>> On Sun, May 12, 2019 at 3:15 PM Chris Simmonds<br>
>Â Â Â <<a href="mailto:chris@2net.co.uk" target="_blank">chris@2net.co.uk</a> <mailto:<a href="mailto:chris@2net.co.uk" target="_blank">chris@2net.co.uk</a>>> wrote:<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> Hi Zoran,<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> There are two ways to do this<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> 1. Build using a bb recipe.<br>
>Â Â Â >>>>>>>> Take a look at meta-skeleton/recipes-kernel/hello-mod for<br>
>Â Â Â an example.<br>
>Â Â Â >>>>>>>> You just need to add meta-skeleton to your bblaysers.conf<br>
>Â Â Â and then<br>
>Â Â Â >>>>>>>>Â Â bitbake hello-mod<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> 2. Build from the SDK:<br>
>Â Â Â >>>>>>>> First, add the kernel source to the SDK by adding this to<br>
>Â Â Â conf/local/conf<br>
>Â Â Â >>>>>>>>Â Â TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> Then build the SDK<br>
>Â Â Â >>>>>>>>Â Â bitbake -c populate_sdk [your image recipe]<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> Once the SDK is installed, generate the kernel headers:<br>
>Â Â Â >>>>>>>>Â Â sudo -i<br>
>Â Â Â >>>>>>>>Â Â .<br>
>Â Â Â /opt/poky/2.6.2/environment-setup-cortexa8hf-neon-poky-linux-gnueabi<br>
>Â Â Â >>>>>>>>Â Â cd<br>
>Â Â Â /opt/poky/2.6.2/sysroots/cortexa8hf-neon-poky-linux-gnueabi<br>
>Â Â Â >>>>>>>>Â Â cd /usr/src/kernel<br>
>Â Â Â >>>>>>>>Â Â make oldconfig scripts<br>
>Â Â Â >>>>>>>>Â Â exit<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> Finally, build your module using a Makefile like this<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>>Â Â obj-m := hello-mod.o<br>
>Â Â Â >>>>>>>>Â Â all:<br>
>Â Â Â >>>>>>>>Â Â Â Â Â make -C $(SDKTARGETSYSROOT)/usr/src/kernel<br>
>Â Â Â M=$(shell pwd)<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> HTH,<br>
>Â Â Â >>>>>>>> Chris<br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> On 12/05/2019 11:53, Zoran Stojsavljevic wrote:<br>
>Â Â Â >>>>>>>>> Hello to the YOCTO community,<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> I am using (to build the target for Beagle Bone Black)<br>
>Â Â Â the following script:<br>
>Â Â Â >>>>>>>>> <a href="https://github.com/ZoranStojsavljevic/bbb-yocto" rel="noreferrer" target="_blank">https://github.com/ZoranStojsavljevic/bbb-yocto</a><br>
>Â Â Â >>>>>>>>><br>
>Â Â Â <a href="https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/bbb-yocto.sh" rel="noreferrer" target="_blank">https://github.com/ZoranStojsavljevic/bbb-yocto/blob/master/bbb-yocto.sh</a><br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> The latest kernel I am using from the following repo:<br>
>Â Â Â >>>>>>>>> <a href="https://github.com/jumpnow/meta-bbb" rel="noreferrer" target="_blank">https://github.com/jumpnow/meta-bbb</a><br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> Is kernel 5.0.14 .<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> Here is the snippet of the boot traces:<br>
>Â Â Â >>>>>>>>> Starting kernel ...<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] Booting Linux on physical CPU 0x0<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] Linux version 5.0.14-jumpnow<br>
>Â Â Â (oe-user@oe-host) (gcc<br>
>Â Â Â >>>>>>>>> version 8.3.0 (GCC)) #1 Fri May 10 13:12:33 UTC 2019<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] CPU: ARMv7 Processor [413fc082] revision 2<br>
>Â Â Â (ARMv7), cr=10c5387d<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] CPU: PIPT / VIPT nonaliasing data cache,<br>
>Â Â Â VIPT aliasing<br>
>Â Â Â >>>>>>>>> instruction cache<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] OF: fdt: Machine model: TI AM335x<br>
>Â Â Â BeagleBone Black<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] Memory policy: Data cache writeback<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] cma: Reserved 16 MiB at 0x9f000000<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] CPU: All CPU(s) started in SVC mode.<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] AM335X ES2.1 (sgx neon)<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] random: get_random_bytes called from<br>
>Â Â Â >>>>>>>>> start_kernel+0xa4/0x460 with crng_init=0<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] Built 1 zonelists, mobility grouping on. <br>
>Â Â Â Total pages: 130048<br>
>Â Â Â >>>>>>>>> [Â Â 0.000000] Kernel command line: console=ttyO0,115200n8<br>
>Â Â Â >>>>>>>>> root=/dev/ram0 ip=dhcp<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> According to the documentation, the following:<br>
>Â Â Â >>>>>>>>> 2.10.1. Building Out-of-Tree Modules on the Target<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â <a href="https://www.yoctoproject.org/docs/latest/kernel-dev/kernel-dev.html" rel="noreferrer" target="_blank">https://www.yoctoproject.org/docs/latest/kernel-dev/kernel-dev.html</a><br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> I tried to find /usr/src/kernels/<a href="http://5.0.14." rel="noreferrer" target="_blank">5.0.14.</a><br>
>Â Â Â <<a href="http://5.0.14" rel="noreferrer" target="_blank">http://5.0.14</a>.>.. Directory, since I see<br>
>Â Â Â >>>>>>>>> from the build that kernel-dev and kernel-devsrc are<br>
>Â Â Â included:<br>
>Â Â Â >>>>>>>>> [user@fedora29-ssd bbb-yocto]$ bitbake -s | grep kernel<br>
>   >>>>>>>>> core-image-kernel-dev                 :1.0-r0<br>
>   >>>>>>>>> kernel-devsrc                     :1.0-r0<br>
>   >>>>>>>>> kernel-selftest                    :1.0-r0<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> THE PROBLEM: But I could not find ob BBB target<br>
>Â Â Â /usr/src/kernels<br>
>Â Â Â >>>>>>>>> directory at all!?<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> Two questions here?<br>
>Â Â Â >>>>>>>>> [1] Do you have any advice on this problem (what I am<br>
>Â Â Â missing here)?<br>
>Â Â Â >>>>>>>>> [2] Alternative to [1]: how I can use cross compiler from<br>
>Â Â Â >>>>>>>>> .../build/tmp to build Out-of-Tree Module for the BBB<br>
>Â Â Â target on the<br>
>Â Â Â >>>>>>>>> host?<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>>> Thank you,<br>
>Â Â Â >>>>>>>>> Zoran<br>
>Â Â Â >>>>>>>>> _______<br>
>Â Â Â >>>>>>>>><br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>><br>
>Â Â Â >>>>>>>> --<br>
>Â Â Â >>>>>>>> Chris Simmonds, trainer and consultant at 2net<br>
>Â Â Â >>>>>>>> <a href="http://www.2net.co.uk" rel="noreferrer" target="_blank">http://www.2net.co.uk</a><br>
>Â Â Â >>>>>>>> Author of "Mastering Embedded Linux Programming"<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>><br>
>Â Â Â >>>>>> --<br>
>Â Â Â >>>>>> - Thou shalt not follow the NULL pointer, for chaos and<br>
>Â Â Â madness await thee at its end<br>
>Â Â Â >>>>>> - "Use the force Harry" - Gandalf, Star Trek II<br>
>Â Â Â >>>>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>><br>
>Â Â Â >>>> --<br>
>Â Â Â >>>> - Thou shalt not follow the NULL pointer, for chaos and<br>
>Â Â Â madness await thee at its end<br>
>Â Â Â >>>> - "Use the force Harry" - Gandalf, Star Trek II<br>
>Â Â Â >>>><br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >><br>
>Â Â Â >> --<br>
>Â Â Â >> - Thou shalt not follow the NULL pointer, for chaos and madness<br>
>Â Â Â await thee at its end<br>
>Â Â Â >> - "Use the force Harry" - Gandalf, Star Trek II<br>
>Â Â Â >><br>
> <br>
</blockquote></div>