Ok . . . So here is the deal.

$ lsmod
Module                  Size  Used by
bnep                   13297  2
rfcomm                 52320  0
bluetooth             394459  10 bnep,rfcomm
usb_f_ecm               9505  1
g_ether                 4794  0
usb_f_rndis            22459  2 g_ether
u_ether                11057  3 usb_f_ecm,usb_f_rndis,g_ether
libcomposite           43376  3 usb_f_ecm,usb_f_rndis,g_ether
nfsd                  220016  2
evdev                   7956  0
tda998x                11683  1
omap_aes               13033  0
omap_sham              19152  0
tilcdc                 27869  0
omap_rng                4346  0
rng_core                7233  1 omap_rng
drm_kms_helper        106705  3 tda998x,tilcdc
uio_pdrv_genirq         3313  0
uio                     8350  1 uio_pdrv_genirq
leds_gpio               3102  0

That's a bit ridiculous especially considering I only use a few of those
modules. nfsd obviously I use, but what has been on my nerves lately are
all these gadget drivers I never use. Or even if I were to use them I would
prefer to load them, or even just g_ether / g_serial as I need them. uio
related modules do not bother me as I use those often enough, and leds_gpio
. . . well I can take it or leave it. The rest, as far as I'm concerned
need to go. The bluetooth modules, I would probably need to remove the
bluetooth package to get rid of these, or fake install . . .

So there are a few options that I can think of.


   1. Recompile the kernel, and deselect all this garbage, and just live
   without gadget drivers period.
   2. Recompile the kernel, and compile out initrd capability.
   3. Modify the initramfs, which seems complex, but doable ( still reading
   ).
   4. Create conf files for all the modules I do not want running all the
   time, and insert a fake install . .


Anyway, I'm not an expert here, and would appreciate some feedback. Even a
"hey dumbass, thats not how you do things, you do it like <this>".
Documentation on the web in this regard is fairly sparse, and much of that
is outdated. Short term though . . . I wrote a script to modprobe -r
$module, and have since changed it around to "blacklist" these modules via
fake install. It needs to be run with elevated privs of course, and one
needs to manually remove the /etc/modprobe.d/*conf files they actually want
running. Since the script is simple, and will blacklist every module that
is loaded at the time it's run . . .

#!/bin/sh

modules=$(lsmod|cut -d ' ' -f 1)
modpath="/etc/modprobe.d"
for module in  $modules
do
        if [ $module != 'Module' ] ; then
                touch $modpath/$module.conf
                echo 'install ' $module ' /bin/true' > $modpath/$module.conf
        fi
done

Ideal ? hardly . . .

$ ls /etc/modprobe.d/
blacklist  fbdev-blacklist.conf  uio.conf.bak

$ sudo ./remove-modules.sh

$ ls /etc/modprobe.d/
blacklist            evdev.conf            libcomposite.conf
omap_sham.conf  tilcdc.conf   uio_pdrv_genirq.conf
bluetooth.conf       fbdev-blacklist.conf  nfsd.conf
rfcomm.conf     u_ether.conf  usb_f_ecm.conf
bnep.conf            g_ether.conf          omap_aes.conf
rng_core.conf   uio.conf      usb_f_rndis.conf
drm_kms_helper.conf  leds_gpio.conf        omap_rng.conf
tda998x.conf    uio.conf.bak

$ cat /etc/modprobe.d/g_ether.conf
install  g_ether  /bin/true



On Fri, Dec 4, 2015 at 9:10 AM, William Hermans <[email protected]> wrote:

> So, nothing ? Nada ? Zilch ?
>
> Am I the only one that understands the point of using kernel modules, is
> to load these modules when, and only when you want / need them ? Not all
> the time ?
>
> On Fri, Dec 4, 2015 at 8:11 AM, William Hermans <[email protected]> wrote:
>
>> So, I've looked into this a bit myself, and have mostly run into a brick
>> wall. What is the best way to remove modules from the initial ram disk, and
>> then keep the initrd from putting future kernel module into it ?
>>
>> It,s a bit of a pain in the arse that blacklisting modules does not work,
>> and in fact the only thing I have found to work is something like:
>>
>> # touch /etc/modprobe.d/g_ether.conf && echo 'install g_ether /bin/true'
>> > /etc/modprobe.d/g_ether.conf
>>
>> Seems a bit of a hack. . .
>>
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to