All of lore.kernel.org
 help / color / mirror / Atom feed
* How do I control what kernel modules are being loaded?
@ 2013-03-08 12:08 Hans Beckérus
  2013-03-08 17:12 ` Bruce Ashfield
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Hans Beckérus @ 2013-03-08 12:08 UTC (permalink / raw)
  To: yocto

Hi. I have built some custom kernel modules (.ko) using a .bb that
inherits from the module.bbclass. There is one main kernel module and
the rest are dependent on the first. Building and installing the
modules to the rootfs works fine. Next question is how do I control
what actual modules are loaded at boot, or actually how do I control
this through Yocto? To my surprise one of the kernel module loaded
automatically!? How could this happen? I did not have an entry for it
in /etc/modules. And what do I need to do to actually add entries to
/etc/modules? Or is there some other mechanism that I should use. I
tried going through the module.bbclass but must admit I lost it
somewhere in the middle ;) Any guidance would be appreciated.

Hans


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 12:08 How do I control what kernel modules are being loaded? Hans Beckérus
@ 2013-03-08 17:12 ` Bruce Ashfield
  2013-03-08 17:40   ` Hans Beckérus
  2013-03-08 18:12 ` Eric Bénard
  2013-03-08 19:16 ` Trevor Woerner
  2 siblings, 1 reply; 15+ messages in thread
From: Bruce Ashfield @ 2013-03-08 17:12 UTC (permalink / raw)
  To: Hans Beckérus; +Cc: yocto

On 13-03-08 07:08 AM, Hans Beckérus wrote:
> Hi. I have built some custom kernel modules (.ko) using a .bb that
> inherits from the module.bbclass. There is one main kernel module and
> the rest are dependent on the first. Building and installing the
> modules to the rootfs works fine. Next question is how do I control
> what actual modules are loaded at boot, or actually how do I control
> this through Yocto? To my surprise one of the kernel module loaded
> automatically!? How could this happen? I did not have an entry for it
> in /etc/modules. And what do I need to do to actually add entries to
> /etc/modules? Or is there some other mechanism that I should use. I
> tried going through the module.bbclass but must admit I lost it
> somewhere in the middle ;) Any guidance would be appreciated.

module_autoload_<module package name>, in your module recipe, will
trigger the load on boot.

Cheers,

Bruce

>
> Hans
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 17:12 ` Bruce Ashfield
@ 2013-03-08 17:40   ` Hans Beckérus
  2013-03-08 17:45     ` Bruce Ashfield
  0 siblings, 1 reply; 15+ messages in thread
From: Hans Beckérus @ 2013-03-08 17:40 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: <yocto@yoctoproject.org>



8 mar 2013 kl. 18:12 skrev Bruce Ashfield <bruce.ashfield@windriver.com>:

> On 13-03-08 07:08 AM, Hans Beckérus wrote:
>> Hi. I have built some custom kernel modules (.ko) using a .bb that
>> inherits from the module.bbclass. There is one main kernel module and
>> the rest are dependent on the first. Building and installing the
>> modules to the rootfs works fine. Next question is how do I control
>> what actual modules are loaded at boot, or actually how do I control
>> this through Yocto? To my surprise one of the kernel module loaded
>> automatically!? How could this happen? I did not have an entry for it
>> in /etc/modules. And what do I need to do to actually add entries to
>> /etc/modules? Or is there some other mechanism that I should use. I
>> tried going through the module.bbclass but must admit I lost it
>> somewhere in the middle ;) Any guidance would be appreciated.
> 
> module_autoload_<module package name>, in your module recipe, will
> trigger the load on boot.
> 
> Cheers,
> 
> Bruce
> 
Great! But there must be a catch? My actual module package builds six modules. One mandatory and the rest are optional. How can it know which modules that should actually be loaded? For some to me unknown reason the mandatory one was loaded on boot even though I did nothing to my    .bb?

Hans

>> 
>> Hans
>> _______________________________________________
>> yocto mailing list
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 17:40   ` Hans Beckérus
@ 2013-03-08 17:45     ` Bruce Ashfield
  0 siblings, 0 replies; 15+ messages in thread
From: Bruce Ashfield @ 2013-03-08 17:45 UTC (permalink / raw)
  To: Hans Beckérus; +Cc: <yocto@yoctoproject.org>

On 13-03-08 12:40 PM, Hans Beckérus wrote:
>
>
> 8 mar 2013 kl. 18:12 skrev Bruce Ashfield <bruce.ashfield@windriver.com>:
>
>> On 13-03-08 07:08 AM, Hans Beckérus wrote:
>>> Hi. I have built some custom kernel modules (.ko) using a .bb that
>>> inherits from the module.bbclass. There is one main kernel module and
>>> the rest are dependent on the first. Building and installing the
>>> modules to the rootfs works fine. Next question is how do I control
>>> what actual modules are loaded at boot, or actually how do I control
>>> this through Yocto? To my surprise one of the kernel module loaded
>>> automatically!? How could this happen? I did not have an entry for it
>>> in /etc/modules. And what do I need to do to actually add entries to
>>> /etc/modules? Or is there some other mechanism that I should use. I
>>> tried going through the module.bbclass but must admit I lost it
>>> somewhere in the middle ;) Any guidance would be appreciated.
>>
>> module_autoload_<module package name>, in your module recipe, will
>> trigger the load on boot.
>>
>> Cheers,
>>
>> Bruce
>>
> Great! But there must be a catch? My actual module package builds six modules. One mandatory and the rest are optional. How can it know which modules that should actually be loaded? For some to me unknown reason the mandatory one was loaded on boot even though I did nothing to my    .bb?

I'd assume that udev or some other kernel -> userspace event triggered
the load of the required module.

If you need more advanced logic than modprobe or udev/systemd can provide,
then custom startup scripts for the services would be in order.

Cheers,

Bruce

>
> Hans
>
>>>
>>> Hans
>>> _______________________________________________
>>> yocto mailing list
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 12:08 How do I control what kernel modules are being loaded? Hans Beckérus
  2013-03-08 17:12 ` Bruce Ashfield
@ 2013-03-08 18:12 ` Eric Bénard
  2013-03-08 19:00   ` Hans Beckerus
  2013-03-08 21:11   ` Hans Beckerus
  2013-03-08 19:16 ` Trevor Woerner
  2 siblings, 2 replies; 15+ messages in thread
From: Eric Bénard @ 2013-03-08 18:12 UTC (permalink / raw)
  To: Hans Beckérus; +Cc: yocto

Hi Hans,

Le Fri, 8 Mar 2013 13:08:21 +0100,
Hans Beckérus <hans.beckerus@gmail.com> a écrit :

> Hi. I have built some custom kernel modules (.ko) using a .bb that
> inherits from the module.bbclass. There is one main kernel module and
> the rest are dependent on the first. Building and installing the
> modules to the rootfs works fine. Next question is how do I control
> what actual modules are loaded at boot, or actually how do I control
> this through Yocto? To my surprise one of the kernel module loaded
> automatically!? How could this happen? I did not have an entry for it
> in /etc/modules. And what do I need to do to actually add entries to
> /etc/modules? Or is there some other mechanism that I should use. I
> tried going through the module.bbclass but must admit I lost it
> somewhere in the middle ;) Any guidance would be appreciated.
> 
when the module is built by the kernel recipe you can use :
module_autoload and you can see somme usage examples here :
http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf
http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc

maybe you could get inspiration from kernel.bbclass to do the same
thing in your recipe.

Eric


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 18:12 ` Eric Bénard
@ 2013-03-08 19:00   ` Hans Beckerus
  2013-03-08 23:45     ` Bruce Ashfield
  2013-03-08 21:11   ` Hans Beckerus
  1 sibling, 1 reply; 15+ messages in thread
From: Hans Beckerus @ 2013-03-08 19:00 UTC (permalink / raw)
  To: Eric Bénard; +Cc: yocto

On 2013-03-08 7:12, Eric Bénard wrote:
> Hi Hans,
>
> Le Fri, 8 Mar 2013 13:08:21 +0100,
> Hans Beckérus <hans.beckerus@gmail.com> a écrit :
>
>> Hi. I have built some custom kernel modules (.ko) using a .bb that
>> inherits from the module.bbclass. There is one main kernel module and
>> the rest are dependent on the first. Building and installing the
>> modules to the rootfs works fine. Next question is how do I control
>> what actual modules are loaded at boot, or actually how do I control
>> this through Yocto? To my surprise one of the kernel module loaded
>> automatically!? How could this happen? I did not have an entry for it
>> in /etc/modules. And what do I need to do to actually add entries to
>> /etc/modules? Or is there some other mechanism that I should use. I
>> tried going through the module.bbclass but must admit I lost it
>> somewhere in the middle ;) Any guidance would be appreciated.
>>
> when the module is built by the kernel recipe you can use :
> module_autoload and you can see somme usage examples here :
> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf
> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc
>
> maybe you could get inspiration from kernel.bbclass to do the same
> thing in your recipe.
>
> Eric
Thanks guys for your quick feedback. I can see that using 
module_autoload_${PN} seems like a good approach, if a package maps 1:1 
to a module.
In my case that is not so. The package/recipe builds six (or even more) 
.ko files using one makefile.
I guess one option could be to split each module build in its own 
recipe, but that is not supported by the makefile and thus would require 
patching from my side in the source tree. I think the only option I have 
left is to try to use /etc/modules and add the modules there in a 
do_install_append().
But the problem then is, what happens if some other package also add a  
/etc/modules.conf to the image folder? Will it be merged or only copied? 
In the latter case last package wins which would not work out very well :(

Out of curiosity, what will module_autoload do? Will it add the .ko to 
/etc/modules or does it implement some other mechanism to make a module 
load automatically at boot?

I do not think that the mandatory module that is loaded originates from 
udev. This is a network CM driver that basically hooks into the Linux 
network stack. I do not think that udev will ever make this driver load 
automatically. But I can not say for sure of course.

Hans





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 12:08 How do I control what kernel modules are being loaded? Hans Beckérus
  2013-03-08 17:12 ` Bruce Ashfield
  2013-03-08 18:12 ` Eric Bénard
@ 2013-03-08 19:16 ` Trevor Woerner
  2 siblings, 0 replies; 15+ messages in thread
From: Trevor Woerner @ 2013-03-08 19:16 UTC (permalink / raw)
  To: Hans Beckérus; +Cc: yocto@yoctoproject.org

On Fri, Mar 8, 2013 at 7:08 AM, Hans Beckérus <hans.beckerus@gmail.com> wrote:
> I
> tried going through the module.bbclass but must admit I lost it
> somewhere in the middle ;) Any guidance would be appreciated.

Have you had a chance to look at the Yocto hands-on kernel lab?
https://lists.yoctoproject.org/pipermail/yocto/2013-February/014408.html


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 18:12 ` Eric Bénard
  2013-03-08 19:00   ` Hans Beckerus
@ 2013-03-08 21:11   ` Hans Beckerus
  1 sibling, 0 replies; 15+ messages in thread
From: Hans Beckerus @ 2013-03-08 21:11 UTC (permalink / raw)
  To: Eric Bénard; +Cc: yocto

On 2013-03-08 7:12, Eric Bénard wrote:
> Hi Hans,
>
> Le Fri, 8 Mar 2013 13:08:21 +0100,
> Hans Beckérus <hans.beckerus@gmail.com> a écrit :
>
>> Hi. I have built some custom kernel modules (.ko) using a .bb that
>> inherits from the module.bbclass. There is one main kernel module and
>> the rest are dependent on the first. Building and installing the
>> modules to the rootfs works fine. Next question is how do I control
>> what actual modules are loaded at boot, or actually how do I control
>> this through Yocto? To my surprise one of the kernel module loaded
>> automatically!? How could this happen? I did not have an entry for it
>> in /etc/modules. And what do I need to do to actually add entries to
>> /etc/modules? Or is there some other mechanism that I should use. I
>> tried going through the module.bbclass but must admit I lost it
>> somewhere in the middle ;) Any guidance would be appreciated.
>>
> when the module is built by the kernel recipe you can use :
> module_autoload and you can see somme usage examples here :
> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf
> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc
>
> maybe you could get inspiration from kernel.bbclass to do the same
> thing in your recipe.
>
> Eric

Coming to think about it, module_autoload should actually specify 
module, not package right?
That would work then. But is this only supported in a machine.conf? Can 
it not be used also in e.g. the image.bb or a distro.conf?
The reason is that I do not have a machine.conf in my highest layer! My 
layer is a simple distro that does not have any real knowledge of what 
hardware it is running on. My local.conf points out the actual MACHINE.  
The kernel modules are not hardware dependent either since they are pure 
network extensions so it would be wrong to have them in the machine.conf.

Hans




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-08 19:00   ` Hans Beckerus
@ 2013-03-08 23:45     ` Bruce Ashfield
       [not found]       ` <CAFyqS9rT=amDBNTO_awzXL3zNS-vCx1+0ERCspXTps8u_VpHwA@mail.gmail.com>
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Ashfield @ 2013-03-08 23:45 UTC (permalink / raw)
  To: Hans Beckerus; +Cc: yocto

On 13-03-08 2:00 PM, Hans Beckerus wrote:
> On 2013-03-08 7:12, Eric Bénard wrote:
>> Hi Hans,
>>
>> Le Fri, 8 Mar 2013 13:08:21 +0100,
>> Hans Beckérus <hans.beckerus@gmail.com> a écrit :
>>
>>> Hi. I have built some custom kernel modules (.ko) using a .bb that
>>> inherits from the module.bbclass. There is one main kernel module and
>>> the rest are dependent on the first. Building and installing the
>>> modules to the rootfs works fine. Next question is how do I control
>>> what actual modules are loaded at boot, or actually how do I control
>>> this through Yocto? To my surprise one of the kernel module loaded
>>> automatically!? How could this happen? I did not have an entry for it
>>> in /etc/modules. And what do I need to do to actually add entries to
>>> /etc/modules? Or is there some other mechanism that I should use. I
>>> tried going through the module.bbclass but must admit I lost it
>>> somewhere in the middle ;) Any guidance would be appreciated.
>>>
>> when the module is built by the kernel recipe you can use :
>> module_autoload and you can see somme usage examples here :
>> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf
>> http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc
>>
>>
>> maybe you could get inspiration from kernel.bbclass to do the same
>> thing in your recipe.
>>
>> Eric
> Thanks guys for your quick feedback. I can see that using
> module_autoload_${PN} seems like a good approach, if a package maps 1:1
> to a module.
> In my case that is not so. The package/recipe builds six (or even more)
> .ko files using one makefile.
> I guess one option could be to split each module build in its own
> recipe, but that is not supported by the makefile and thus would require
> patching from my side in the source tree. I think the only option I have
> left is to try to use /etc/modules and add the modules there in a
> do_install_append().
> But the problem then is, what happens if some other package also add a
> /etc/modules.conf to the image folder? Will it be merged or only copied?
> In the latter case last package wins which would not work out very well :(
>
> Out of curiosity, what will module_autoload do? Will it add the .ko to
> /etc/modules or does it implement some other mechanism to make a module
> load automatically at boot?

It depends on what release you are using. In yocto 1.3 and before the
autoload variables translated to mod-util loading, using just what you'd
think. In yocto 1.4 and kmod in the picture:

         # If autoloading is requested, output 
/etc/modules-load.d/<name>.conf and append
         # appropriate modprobe commands to the postinst
         autoload = d.getVar('module_autoload_%s' % basename, True)
         if autoload:
             name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
             f = open(name, 'w')
             for m in autoload.split():
                 f.write('%s\n' % m)
             f.close()
             postinst = d.getVar('pkg_postinst_%s' % pkg, True)
             if not postinst:
                 bb.fatal("pkg_postinst_%s not defined" % pkg)
             postinst += d.getVar('autoload_postinst_fragment', True) % 
autoload
             d.setVar('pkg_postinst_%s' % pkg, postinst)

         # Write out any modconf fragment
         modconf = d.getVar('module_conf_%s' % basename, True)
         if modconf:
             name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
             f = open(name, 'w')
             f.write("%s\n" % modconf)
             f.close()

Cheers,

Bruce


>
> I do not think that the mandatory module that is loaded originates from
> udev. This is a network CM driver that basically hooks into the Linux
> network stack. I do not think that udev will ever make this driver load
> automatically. But I can not say for sure of course.
>
> Hans
>
>
>
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto



^ permalink raw reply	[flat|nested] 15+ messages in thread

* How do I control what kernel modules are being loaded?
       [not found]       ` <CAFyqS9rT=amDBNTO_awzXL3zNS-vCx1+0ERCspXTps8u_VpHwA@mail.gmail.com>
@ 2013-03-11 13:28         ` Hans Beckérus
  2013-03-11 13:37           ` Bruce Ashfield
  0 siblings, 1 reply; 15+ messages in thread
From: Hans Beckérus @ 2013-03-11 13:28 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 5052 bytes --]

On Sat, Mar 9, 2013 at 12:45 AM, Bruce Ashfield <
bruce.ashfield@windriver.com> wrote:

> On 13-03-08 2:00 PM, Hans Beckerus wrote:
>
>> On 2013-03-08 7:12, Eric Bénard wrote:
>>
>>> Hi Hans,
>>>
>>> Le Fri, 8 Mar 2013 13:08:21 +0100,
>>> Hans Beckérus <hans.beckerus@gmail.com> a écrit :
>>>
>>>  Hi. I have built some custom kernel modules (.ko) using a .bb that
>>>> inherits from the module.bbclass. There is one main kernel module and
>>>> the rest are dependent on the first. Building and installing the
>>>> modules to the rootfs works fine. Next question is how do I control
>>>> what actual modules are loaded at boot, or actually how do I control
>>>> this through Yocto? To my surprise one of the kernel module loaded
>>>> automatically!? How could this happen? I did not have an entry for it
>>>> in /etc/modules. And what do I need to do to actually add entries to
>>>> /etc/modules? Or is there some other mechanism that I should use. I
>>>> tried going through the module.bbclass but must admit I lost it
>>>> somewhere in the middle ;) Any guidance would be appreciated.
>>>>
>>>>  when the module is built by the kernel recipe you can use :
>>> module_autoload and you can see somme usage examples here :
>>> http://cgit.openembedded.org/**meta-handheld/tree/conf/**
>>> machine/palmtx.conf<http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf>
>>> http://cgit.openembedded.org/**meta-handheld/tree/conf/**
>>> machine/include/palm.inc<http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc>
>>>
>>>
>>> maybe you could get inspiration from kernel.bbclass to do the same
>>> thing in your recipe.
>>>
>>> Eric
>>>
>> Thanks guys for your quick feedback. I can see that using
>> module_autoload_${PN} seems like a good approach, if a package maps 1:1
>> to a module.
>> In my case that is not so. The package/recipe builds six (or even more)
>> .ko files using one makefile.
>> I guess one option could be to split each module build in its own
>> recipe, but that is not supported by the makefile and thus would require
>> patching from my side in the source tree. I think the only option I have
>> left is to try to use /etc/modules and add the modules there in a
>> do_install_append().
>> But the problem then is, what happens if some other package also add a
>> /etc/modules.conf to the image folder? Will it be merged or only copied?
>> In the latter case last package wins which would not work out very well :(
>>
>> Out of curiosity, what will module_autoload do? Will it add the .ko to
>> /etc/modules or does it implement some other mechanism to make a module
>> load automatically at boot?
>>
>
> It depends on what release you are using. In yocto 1.3 and before the
> autoload variables translated to mod-util loading, using just what you'd
> think. In yocto 1.4 and kmod in the picture:
>
>         # If autoloading is requested, output /etc/modules-load.d/<name>.*
> *conf and append
>         # appropriate modprobe commands to the postinst
>         autoload = d.getVar('module_autoload_%s' % basename, True)
>         if autoload:
>             name = '%s/etc/modules-load.d/%s.**conf' % (dvar, basename)
>             f = open(name, 'w')
>             for m in autoload.split():
>                 f.write('%s\n' % m)
>             f.close()
>             postinst = d.getVar('pkg_postinst_%s' % pkg, True)
>             if not postinst:
>                 bb.fatal("pkg_postinst_%s not defined" % pkg)
>             postinst += d.getVar('autoload_postinst_**fragment', True) %
> autoload
>             d.setVar('pkg_postinst_%s' % pkg, postinst)
>
>         # Write out any modconf fragment
>         modconf = d.getVar('module_conf_%s' % basename, True)
>         if modconf:
>             name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
>             f = open(name, 'w')
>             f.write("%s\n" % modconf)
>             f.close()
>
> Cheers,
>
> Bruce
>
> I do not have much luck getting this to work I am afraid. No matter what I
try with module_autoload it does not seem to have any effect on my system
(no file(s) created in /etc). I have tried adding module_autoload to both
my machine config and/or distro. I am running danny 8.0 which is version
1.3 of the poky distro I guess. I can see how module_autoload_%s is parsed
in kernel.bb but how is that recipe called as part om my module package? I
can not see that anything is inheriting from it so when is the
module_autoload supposed to be parsed and place files in in the package
/etc? Do I need to rebuild something other than my module package? My guess
Is that I should see something in the package image folder, or? All I see
is the lib folder holding the kernel module hierarchy and the .ko files of
course. I would really like getting this to work. Otherwise the only ugly
workaround I can see is to write my own simplistic init script that calls
modprobe on the modules I need after boot.

Hans

[-- Attachment #2: Type: text/html, Size: 6188 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-11 13:28         ` Hans Beckérus
@ 2013-03-11 13:37           ` Bruce Ashfield
  2013-03-11 13:46             ` Eric Bénard
  2013-03-11 13:49             ` Eric Bénard
  0 siblings, 2 replies; 15+ messages in thread
From: Bruce Ashfield @ 2013-03-11 13:37 UTC (permalink / raw)
  To: Hans Beckérus; +Cc: yocto

On 13-03-11 09:28 AM, Hans Beckérus wrote:
>
> On Sat, Mar 9, 2013 at 12:45 AM, Bruce Ashfield
> <bruce.ashfield@windriver.com <mailto:bruce.ashfield@windriver.com>> wrote:
>
>     On 13-03-08 2:00 PM, Hans Beckerus wrote:
>
>         On 2013-03-08 7:12, Eric Bénard wrote:
>
>             Hi Hans,
>
>             Le Fri, 8 Mar 2013 13:08:21 +0100,
>             Hans Beckérus <hans.beckerus@gmail.com
>             <mailto:hans.beckerus@gmail.com>> a écrit :
>
>                 Hi. I have built some custom kernel modules (.ko) using
>                 a .bb that
>                 inherits from the module.bbclass. There is one main
>                 kernel module and
>                 the rest are dependent on the first. Building and
>                 installing the
>                 modules to the rootfs works fine. Next question is how
>                 do I control
>                 what actual modules are loaded at boot, or actually how
>                 do I control
>                 this through Yocto? To my surprise one of the kernel
>                 module loaded
>                 automatically!? How could this happen? I did not have an
>                 entry for it
>                 in /etc/modules. And what do I need to do to actually
>                 add entries to
>                 /etc/modules? Or is there some other mechanism that I
>                 should use. I
>                 tried going through the module.bbclass but must admit I
>                 lost it
>                 somewhere in the middle ;) Any guidance would be
>                 appreciated.
>
>             when the module is built by the kernel recipe you can use :
>             module_autoload and you can see somme usage examples here :
>             http://cgit.openembedded.org/__meta-handheld/tree/conf/__machine/palmtx.conf
>             <http://cgit.openembedded.org/meta-handheld/tree/conf/machine/palmtx.conf>
>             http://cgit.openembedded.org/__meta-handheld/tree/conf/__machine/include/palm.inc
>             <http://cgit.openembedded.org/meta-handheld/tree/conf/machine/include/palm.inc>
>
>
>             maybe you could get inspiration from kernel.bbclass to do
>             the same
>             thing in your recipe.
>
>             Eric
>
>         Thanks guys for your quick feedback. I can see that using
>         module_autoload_${PN} seems like a good approach, if a package
>         maps 1:1
>         to a module.
>         In my case that is not so. The package/recipe builds six (or
>         even more)
>         .ko files using one makefile.
>         I guess one option could be to split each module build in its own
>         recipe, but that is not supported by the makefile and thus would
>         require
>         patching from my side in the source tree. I think the only
>         option I have
>         left is to try to use /etc/modules and add the modules there in a
>         do_install_append().
>         But the problem then is, what happens if some other package also
>         add a
>         /etc/modules.conf to the image folder? Will it be merged or only
>         copied?
>         In the latter case last package wins which would not work out
>         very well :(
>
>         Out of curiosity, what will module_autoload do? Will it add the
>         .ko to
>         /etc/modules or does it implement some other mechanism to make a
>         module
>         load automatically at boot?
>
>
>     It depends on what release you are using. In yocto 1.3 and before the
>     autoload variables translated to mod-util loading, using just what you'd
>     think. In yocto 1.4 and kmod in the picture:
>
>              # If autoloading is requested, output
>     /etc/modules-load.d/<name>.__conf and append
>              # appropriate modprobe commands to the postinst
>              autoload = d.getVar('module_autoload_%s' % basename, True)
>              if autoload:
>                  name = '%s/etc/modules-load.d/%s.__conf' % (dvar, basename)
>                  f = open(name, 'w')
>                  for m in autoload.split():
>                      f.write('%s\n' % m)
>                  f.close()
>                  postinst = d.getVar('pkg_postinst_%s' % pkg, True)
>                  if not postinst:
>                      bb.fatal("pkg_postinst_%s not defined" % pkg)
>                  postinst += d.getVar('autoload_postinst___fragment',
>     True) % autoload
>                  d.setVar('pkg_postinst_%s' % pkg, postinst)
>
>              # Write out any modconf fragment
>              modconf = d.getVar('module_conf_%s' % basename, True)
>              if modconf:
>                  name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
>                  f = open(name, 'w')
>                  f.write("%s\n" % modconf)
>                  f.close()
>
>     Cheers,
>
>     Bruce
>
> I do not have much luck getting this to work I am afraid. No matter what
> I try with module_autoload it does not seem to have any effect on my
> system (no file(s) created in /etc). I have tried adding module_autoload
> to both my machine config and/or distro. I am running danny 8.0 which is
> version 1.3 of the poky distro I guess. I can see how module_autoload_%s
> is parsed in kernel.bb <http://kernel.bb> but how is that recipe called
> as part om my module package? I can not see that anything is inheriting
> from it so when is the module_autoload supposed to be parsed and place
> files in in the package /etc? Do I need to rebuild something other than
> my module package? My guess Is that I should see something in the
> package image folder, or? All I see is the lib folder holding the kernel
> module hierarchy and the .ko files of course. I would really like
> getting this to work. Otherwise the only ugly workaround I can see is to
> write my own simplistic init script that calls modprobe on the modules I
> need after boot.

Can you post your exact changes where we can see them ? You need to put
the module_autload variable in a .conf file, whether that be your
local.conf, your machine.conf or you distro configuration file (which
it appears that you are doing), but you also must have the name of
the module package correct, and the module needs to be part of your
IMAGE_INSTALL, since the code fragment I pasted above is from the
post installation fragment created for the various module packages
as they are created.

i.e. I have this in a .conf file:

    module_autoload_nfsd = "nfsd"

To ensure that the nfsd .ko is loaded on boot, when the module is built
and present on the rootfs.

Cheers,

Bruce



>
> Hans
>
>
>
>
>
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-11 13:37           ` Bruce Ashfield
@ 2013-03-11 13:46             ` Eric Bénard
  2013-03-11 13:49               ` Bruce Ashfield
  2013-03-11 13:49             ` Eric Bénard
  1 sibling, 1 reply; 15+ messages in thread
From: Eric Bénard @ 2013-03-11 13:46 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: yocto

Hi Bruce,

Le Mon, 11 Mar 2013 09:37:44 -0400,
Bruce Ashfield <bruce.ashfield@windriver.com> a écrit :
> Can you post your exact changes where we can see them ? You need to put
> the module_autload variable in a .conf file, whether that be your
> local.conf, your machine.conf or you distro configuration file (which
> it appears that you are doing), but you also must have the name of
> the module package correct, and the module needs to be part of your
> IMAGE_INSTALL, since the code fragment I pasted above is from the
> post installation fragment created for the various module packages
> as they are created.
> 
> i.e. I have this in a .conf file:
> 
>     module_autoload_nfsd = "nfsd"
> 
> To ensure that the nfsd .ko is loaded on boot, when the module is built
> and present on the rootfs.
> 
I think the problem is that this works when building modules inside the
kernel (module_autoload is handled in kernel.bbclass), but not when
building a module with its own recipe (using module.bbclass) as Hans
is doing, that's why I previously told him to "get inspiration from
kernel.bbclass to do the same thing in your recipe".

Eric


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-11 13:37           ` Bruce Ashfield
  2013-03-11 13:46             ` Eric Bénard
@ 2013-03-11 13:49             ` Eric Bénard
  2013-03-11 18:36               ` Hans Beckerus
  1 sibling, 1 reply; 15+ messages in thread
From: Eric Bénard @ 2013-03-11 13:49 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: yocto

Hi Bruce,

Le Mon, 11 Mar 2013 09:37:44 -0400,
Bruce Ashfield <bruce.ashfield@windriver.com> a écrit :
> Can you post your exact changes where we can see them ? You need to put
> the module_autload variable in a .conf file, whether that be your
> local.conf, your machine.conf or you distro configuration file (which
> it appears that you are doing), but you also must have the name of
> the module package correct, and the module needs to be part of your
> IMAGE_INSTALL, since the code fragment I pasted above is from the
> post installation fragment created for the various module packages
> as they are created.
> 
> i.e. I have this in a .conf file:
> 
>     module_autoload_nfsd = "nfsd"
> 
> To ensure that the nfsd .ko is loaded on boot, when the module is built
> and present on the rootfs.
> 
I think the problem is that this works when building modules inside the
kernel (module_autoload is handled in kernel.bbclass), but not when
building a module with its own recipe (using module.bbclass) as Hans
is doing, that's why I previously told him to "get inspiration from
kernel.bbclass to do the same thing in your recipe".

Thinking again to this (after pressing send of course ;-) : Or maybe he
needs to build again its kernel after setting module_autoload_hismodule
= "hismodule" so that the module name gets handled by the kernel
recipe ?

Eric


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-11 13:46             ` Eric Bénard
@ 2013-03-11 13:49               ` Bruce Ashfield
  0 siblings, 0 replies; 15+ messages in thread
From: Bruce Ashfield @ 2013-03-11 13:49 UTC (permalink / raw)
  To: Eric Bénard; +Cc: yocto

On 13-03-11 09:46 AM, Eric Bénard wrote:
> Hi Bruce,
>
> Le Mon, 11 Mar 2013 09:37:44 -0400,
> Bruce Ashfield <bruce.ashfield@windriver.com> a écrit :
>> Can you post your exact changes where we can see them ? You need to put
>> the module_autload variable in a .conf file, whether that be your
>> local.conf, your machine.conf or you distro configuration file (which
>> it appears that you are doing), but you also must have the name of
>> the module package correct, and the module needs to be part of your
>> IMAGE_INSTALL, since the code fragment I pasted above is from the
>> post installation fragment created for the various module packages
>> as they are created.
>>
>> i.e. I have this in a .conf file:
>>
>>      module_autoload_nfsd = "nfsd"
>>
>> To ensure that the nfsd .ko is loaded on boot, when the module is built
>> and present on the rootfs.
>>
> I think the problem is that this works when building modules inside the
> kernel (module_autoload is handled in kernel.bbclass), but not when

Not in master anymore, but agreed, we are talking Danny here IIRC.

> building a module with its own recipe (using module.bbclass) as Hans
> is doing, that's why I previously told him to "get inspiration from
> kernel.bbclass to do the same thing in your recipe".

Ah yes. I do recall a nuance of a package with mixed kernel modules and
userspace code.

The new module-split class from master would handle this nicely, so
taking inspiration from master's would would probably be an even
shorter route to getting something working.

Cheers,

Bruce

>
> Eric
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: How do I control what kernel modules are being loaded?
  2013-03-11 13:49             ` Eric Bénard
@ 2013-03-11 18:36               ` Hans Beckerus
  0 siblings, 0 replies; 15+ messages in thread
From: Hans Beckerus @ 2013-03-11 18:36 UTC (permalink / raw)
  To: Eric Bénard; +Cc: yocto

On 2013-03-11 2:49, Eric Bénard wrote:
> Hi Bruce,
>
> Le Mon, 11 Mar 2013 09:37:44 -0400,
> Bruce Ashfield <bruce.ashfield@windriver.com> a écrit :
>> Can you post your exact changes where we can see them ? You need to put
>> the module_autload variable in a .conf file, whether that be your
>> local.conf, your machine.conf or you distro configuration file (which
>> it appears that you are doing), but you also must have the name of
>> the module package correct, and the module needs to be part of your
>> IMAGE_INSTALL, since the code fragment I pasted above is from the
>> post installation fragment created for the various module packages
>> as they are created.
>>
>> i.e. I have this in a .conf file:
>>
>>      module_autoload_nfsd = "nfsd"
>>
>> To ensure that the nfsd .ko is loaded on boot, when the module is built
>> and present on the rootfs.
>>
> I think the problem is that this works when building modules inside the
> kernel (module_autoload is handled in kernel.bbclass), but not when
> building a module with its own recipe (using module.bbclass) as Hans
> is doing, that's why I previously told him to "get inspiration from
> kernel.bbclass to do the same thing in your recipe".
>
> Thinking again to this (after pressing send of course ;-) : Or maybe he
> needs to build again its kernel after setting module_autoload_hismodule
> = "hismodule" so that the module name gets handled by the kernel
> recipe ?
>
> Eric
>
Bringing in the split kernel module support (by looking at the .bbclass) 
from master should do the trick.
But, after adding more functionality to my system, I suddenly realized 
this was in fact never needed :(
Since the kernel is built with "Kernel Module Loader" support, the 
modules I needed was automatically
modprobed. I now also understand why the mandatory module was loaded 
automatically.
I will still test the split module functionality since it is probably 
interesting to know if it works as expected or not.
Again, thanks for all the help.

Hans






^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-03-11 18:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 12:08 How do I control what kernel modules are being loaded? Hans Beckérus
2013-03-08 17:12 ` Bruce Ashfield
2013-03-08 17:40   ` Hans Beckérus
2013-03-08 17:45     ` Bruce Ashfield
2013-03-08 18:12 ` Eric Bénard
2013-03-08 19:00   ` Hans Beckerus
2013-03-08 23:45     ` Bruce Ashfield
     [not found]       ` <CAFyqS9rT=amDBNTO_awzXL3zNS-vCx1+0ERCspXTps8u_VpHwA@mail.gmail.com>
2013-03-11 13:28         ` Hans Beckérus
2013-03-11 13:37           ` Bruce Ashfield
2013-03-11 13:46             ` Eric Bénard
2013-03-11 13:49               ` Bruce Ashfield
2013-03-11 13:49             ` Eric Bénard
2013-03-11 18:36               ` Hans Beckerus
2013-03-08 21:11   ` Hans Beckerus
2013-03-08 19:16 ` Trevor Woerner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.