[yocto] Proper Use of KERNEL_MODULE_AUTOLOAD variable

Ken Sloat ken.sloat at ohmlinx.com
Sun Feb 3 11:09:44 PST 2019


On Sun, Feb 3, 2019 at 12:51 AM Ulf Samuelsson <yocto at emagii.com> wrote:
>
> Den 2019-02-03 kl. 04:16, skrev Ken Sloat:
> > 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}"
> >
>
> One would think that the file should be added automatically,
> but this might be required, - or a workaround...
>
> FILES_${PN} = " \
>        /lib/modules/${KERNEL_VERSION}/kernel/${MODULE_NAME} \
>        ${sysconfdir}/modules-load.d/${MODULE_NAME}.conf \
> "
>
>
> --
> Best Regards
> Ulf Samuelsson
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto

Hi Ulf,

Yes it seems that this indeed allows it to end up in the final image.

Not sure why it doesn't work without as I see the kernel-module-split
class seems to have statements to do this automatically:

        files = d.getVar('FILES_%s' % pkg, True)
        files = "%s /etc/modules-load.d/%s.conf
/etc/modprobe.d/%s.conf" % (files, basename, basename)
        d.setVar('FILES_%s' % pkg, files)

Maybe there's some type of name mismatch or something in my case?

Thanks,
Ken Sloat


More information about the yocto mailing list