[yocto] Proper Use of KERNEL_MODULE_AUTOLOAD variable

Ken Sloat ken.sloat at ohmlinxelectronics.com
Sat Feb 2 19:16:46 PST 2019


On Sat, Feb 2, 2019 at 10:03 PM Bruce Ashfield
<bruce.ashfield at windriver.com> wrote:
>
> On 2019-02-02 9:59 p.m., Ken Sloat wrote:
> > Hello,
> >
> > I have an out of tree kernel module which I want autoloaded at startup
> > on my system. Looking at the Yocto project manual, I see that one way
> > I can do this is to add the module name to the KERNEL_MODULE_AUTOLOAD
> > variable within my custom module recipe.
> >
> > What I have found is that the module-split class is indeed generating
> > the "/etc/modules-load.d/mymodule.conf" file, however this file is not
> > actually being installed. To be more precise it is appearing in the
> > "package" directory (i.e.
> > tmp/work/**/mymodule/package/etc/modules-load.d/mymodule.conf) but not
> > within the "image" directory (nor in my final rootfs).
> >
> > Is there something I'm missing in the usage of KERNEL_MODULE_AUTOLOAD?
> > Is the intention for this variable I add extra steps to manually
> > install this file in my recipe? FYI I'm using Morty.
>
> Can you provide your recipe ? It would make suggestions easier. For
> example, my first question is: Is the module being installed to your
> image via IMAGE_INSTALL, or some other similar variable ?
>
> Bruce
>
> >
> > Thanks,
> > Ken Sloat
> >
>

Hi Bruce,

Thanks for your quick reply. Yes the module is being installed via
image_install. Module is installed but generated conf file is not. See
recipe below:

require mymodule.inc

inherit module kernel-module-split

DEPENDS = "virtual/kernel"

EXTRA_OEMAKE_append = " \
    KERNELDIR=${STAGING_KERNEL_DIR} \
    "

MAKE_TARGETS = "module"

MODULE_NAME = "mymodule"

PKG_${PN} = "kernel-module-${MODULE_NAME}"

module_do_install() {
    install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/${MODULE_NAME}
    install -m 0644 ${MODULE_NAME}.ko \
    ${D}/lib/modules/${KERNEL_VERSION}/kernel/${MODULE_NAME}/${MODULE_NAME}.ko
}

FILES_${PN} = " \
    /lib/modules/${KERNEL_VERSION}/kernel/${MODULE_NAME} \
"

KERNEL_MODULE_AUTOLOAD += "${MODULE_NAME}"


More information about the yocto mailing list