0

I have a out of tree kernel module(hello.ko) from a vendor which i need to install in rootfs using yocto build. The kernel module is built on the same kernel which yocto build system is using.

I do not have the kernel source for the above module so i cannot build it using recipe.

How can i only install the kernel module in rootfs and to which path it will be installed.

Can anyone share a recipe for this.

I am new to yocto and recently started using it.

Inputs will be helpful.

akumar
  • 39
  • 7

1 Answers1

1

Loadable kernel module are located in /lib/modules/<kernel_version>/kernel/drivers/

You can create a recipe and add your pre-compiled kernel module in files/lib/modules/<kernel_version>/kernel/drivers/

Then, add the line MODULE_NAME = "hello" to the module_autoload list. This is an example :

#Recipe for hello.ko

SUMMARY = "Hello world"
LICENSE = "closed"
SRC_URI = "file://hello.ko"

S="${WORKDIR}"

do_install() 
{
    install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers
    install -m 0644 ${WORKDIR}/hello.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/
}

FILES_${PN} += "/lib/modules/${KERNEL_VERSION}/kernel/drivers/hello.ko"

MODULE_NAME = "hello"

module_autoload = "${MODULE_NAME}"
void_brain
  • 642
  • 2
  • 13
  • Can you please share an example recipe for this. I know how to install application in rootfs but not sure whether it will work for .ko files. – akumar Jan 30 '23 at 13:43
  • https://docs.yoctoproject.org/kernel-dev/index.html I updated my answer – void_brain Jan 30 '23 at 14:11