[bitbake-devel] [yocto] Adding KVM kernel modules to Yocto Kernel

Bruce Ashfield bruce.ashfield at gmail.com
Wed Nov 6 21:22:34 UTC 2019


On Wed, Nov 6, 2019 at 11:56 AM Wayne Li <waynli329 at gmail.com> wrote:
>
> The thing is I don't know how to pick specific kernel modules and add it to the system.  Me and my coworker were able to add missing TUN/TAP kernel modules using the same process I described (i.e. pulling up the GUI, saving a .config file for TUN/TAP device driver support, and copying the .config file's content into the kernel configuration file).  And that worked and the TUN module was added.  So I was just trying the same thing as that but for KVM.  I assumed that picking the right option in the GUI and using the right .config file from there would build the right specific kernel modules into the kernel.

That will ensure the kernel is configured to build the modules, but
that doesn't mean they are installed to the image.

>
> I mean is there another way to specify specific kernel modules I want built into the system?  What do you mean by the generic meta package "kernel-modules".  Just so you know, my coworker was the one who did most of the work building the Yocto kernel.  But he's left the company so now I'm picking up the pieces.

The "kernel-modules" package is a meta package that installs all built
modules onto the system.

So unless you are really size constrained on the device, use it, and
you'll get everything that was configured and built as a module.

Bruce

>
> -Thanks!, Wayne Li
>
> On Wed, Nov 6, 2019 at 10:40 AM Bruce Ashfield <bruce.ashfield at gmail.com> wrote:
>>
>> On Wed, Nov 6, 2019 at 11:30 AM Wayne Li <waynli329 at gmail.com> wrote:
>> >
>> > Dear Yocto Developers,
>> >
>> > I'm trying to get KVM added and working on a Yocto kernel I built up for a T4240 RDB (has a PowerPC CPU).  KVM isn't working and the reason why it isn't working seems to be I'm missing the necessary kernel modules.  More specifically, I don't seem to have a kvm.ko file that I can load.  Here's how I attempted to add KVM to the kernel.
>> >
>> > I went to the SDK install folder and ran ". fsl-setup-env -m t4240rdb-64b" and then "bitbake virtual/kernel -c menuconfig".  After the GUI comes up, I went to Virtualization -> KVM support for PowerPC E500MC/E5500/E6500 processors and hit "Save" to save the configuration.  I then went and copied the content of the .config file created by this into the kernel configuration file specified by the following path; "build_t4240rdb-64b/virt1.config".  This path was specified by the variable KERNEL_DEFCONFIG in sources/meta_freescale/conf/machine/t4240rdb-64b.conf.  Here's what I currently have in the kernel configuration file (i.e. the virt1.config file I mentioned above):
>> >
>> > https://gist.github.com/WayneZhenLi/4172cd4a819b71a11b85fc5aaa57ebd1
>> >
>> > After this, I built the kernel by running "bitbake -c compile -f virtual/kernel" and rebuilt the full linux image.  I re-added everything to the SD card and booted up the T4240 RDB with the newly modified Yocto kernel.  At this point if I run lsmod, only the following two kernel modules show up:
>> >
>> > Module                  Size  Used by
>> > nfsd                  100940  11
>> > exportfs                6723  1 nfsd
>> >
>> > But if I do a "find . -name "kvm"" I get the following:
>> >
>> > ./usr/src/kernel/Documentation/virtual/kvm
>> > ./usr/src/kernel/arch/arm/kvm
>> > ./usr/src/kernel/arch/arm64/kvm
>> > ./usr/src/kernel/arch/mips/kvm
>> > ./usr/src/kernel/arch/powerpc/kvm
>> > ./usr/src/kernel/arch/s390/kvm
>> > ./usr/src/kernel/arch/tile/kvm
>> > ./usr/src/kernel/arch/x86/kvm
>> > ./usr/src/kernel/drivers/s390/kvm
>> > ./usr/src/kernel/include/config/kvm
>> > ./usr/src/kernel/include/config/have/kvm
>> > ./usr/src/kernel/include/kvm
>> > ./usr/src/kernel/virt/kvm
>> > ./dev/kvm
>> > ./sys/devices/virtual/misc/kvm
>> > ./sys/class/misc/kvm
>> > ./sys/kernel/debug/kvm
>> > ./sys/module/kvm
>> >
>> > So it does look like kvm-related files were added to the Yocto kernel because of the changes I made to the kernel configuration file.  But there is no kvm.ko (or any .ko file related to kvm) anywhere in the file system.
>>
>> Is the image you are building installing the specific kernel modules
>> you need, or the generic meta package "kernel-modules" ? Without
>> something like that, you can build the support, but the modules won't
>> be present on the image.
>>
>> Bruce
>>
>> >
>> > Is there something I'm doing wrong here?  Am I missing important lines in my kernel configuration file?  Let me know your thoughts.
>> >
>> > -Thanks!, Wayne Li
>> > --
>> > _______________________________________________
>> > yocto mailing list
>> > yocto at yoctoproject.org
>> > https://lists.yoctoproject.org/listinfo/yocto
>>
>>
>>
>> --
>> - Thou shalt not follow the NULL pointer, for chaos and madness await
>> thee at its end
>> - "Use the force Harry" - Gandalf, Star Trek II



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


More information about the bitbake-devel mailing list