In my Linux distribution there are a number of modules loaded during boot up and I'm trying to find where they're loaded from.

[root /proc]# lsmod
Module                  Size  Used by
bufferclass_ti          5409  0
omaplfb                11525  0
musb_dsps               6444  0
musb_hdrc              52530  1 musb_dsps
pvrsrvkm              174837  2 bufferclass_ti,omaplfb
c_can_platform          4172  0
c_can                   8180  1 c_can_platform
can_dev                 6951  1 c_can
musb_am335x             1199  0

By searching in /etc/init.d I can see the scripts which load the USB and frame buffer modules:

[root /etc/init.d]# grep -rsI "modprobe" *
loadusb.sh:modprobe musb_hdrc
loadusb.sh:modprobe musb_am335x
loadusb.sh:modprobe musb_dsps
pvr-init:       modprobe omaplfb
pvr-init:       modprobe bufferclass_ti

But I can't seem to find where the CAN modules are loaded from. There is no /etc/modules or /etc/modules.conf on this platform, and I've searched /etc/ for modprobe/insmod/c_can but no luck. In the dmesg I can see the CAN driver kicking off:

[    3.745933] CAN device driver interface
[    3.891592] c_can_platform 481cc000.d_can: c_can_platform device registered (
regs=fa1cc000, irq=68)

But I don't know what script loaded it. Is there any further information/logs I can dig up to help identify what put the CAN modules into the system?

some info from modinfo and /sys/devices:

[root /etc/udev/rules.d]# modinfo c_can
filename:       /lib/modules/
description:    CAN bus driver for Bosch C_CAN controller
license:        GPL v2
author:         Bhupesh Sharma <bhupesh.sharma@st.com>
srcversion:     692B302E87FD3333EF840FE
depends:        can-dev
intree:         Y
vermagic: mod_unload modversions ARMv6 p2v8
[root /etc/udev/rules.d]# modinfo can_dev
filename:       /lib/modules/
alias:          rtnl-link-can
author:         Wolfgang Grandegger <wg@grandegger.com>
license:        GPL v2
description:    CAN device driver interface
srcversion:     65FA84AFE987C1155CF95A1
intree:         Y
vermagic: mod_unload modversions ARMv6 p2v8
[root /]# modinfo c_can_platform
filename:       /lib/modules/
description:    Platform CAN bus driver for Bosch C_CAN controller
license:        GPL v2
author:         Bhupesh Sharma <bhupesh.sharma@st.com>
srcversion:     DA1DCA3FBA7E75E459BDCEC
alias:          platform:d_can
alias:          platform:c_can
alias:          platform:c_can_platform
alias:          of:N*T*Cbosch,d_can*
alias:          of:N*T*Cbosch,c_can*
depends:        c_can
intree:         Y
vermagic: mod_unload modversions ARMv6 p2v8
[root /sys/devices]# ls
44e10800.pinmux   fixedregulator.3  platform          software
backlight.4       ocp.2             soc.0             system
breakpoint        panel.5           soc0              virtual
  • could be by udev? can't quite think of a good test. Maybe modinfo shows a modalias that matches one of the modalias files you can find in /sys/devices. if no modalias shown then probably not. – sourcejedi Jun 27 '15 at 15:48
  • @sourcejedi - I dumped some info. Looks like c_can doesn't have an alias listed but has a dependency on can_dev. can_dev has an alias of rtnl-link-can but I don't see anything matching that in /sys/devices. I also checked /etc/udev for any other rules but the only entries are for touchscreen and Ethernet, nothing for CAN – Mike Jun 27 '15 at 15:55
  • Check initramfs or similar for your distro, that could load lot of modules – VenkatC Jun 28 '15 at 2:59
  • @VenkatC - Not sure if my distro supports initramfs. Do you have a good way to check? It's not listed in /proc/filesystems, and when I check my defconfig I see CONFIG_INITRAMFS_SOURCE="", not sure what that means yet I'll have to look it up but empty strings aren't normally promising. – Mike Jun 28 '15 at 5:17
  • 1
    check dmesg. If there's an init-thingy it should say like [ 0.404592] Unpacking initramfs... [ 1.021297] Freeing initrd memory: 18764K (ffff880035b4a000 - ffff880036d9d000) – sourcejedi Jun 28 '15 at 11:54

As per my current understanding. No one (user space script) is actually calling modprobe\ insmod to get these CAN drivers inserted, this is because they are Platform Devices.

This is identified by:

  1. The alias: platform: information from the modinfo command
  2. The source code for the c_can_platform which defines the c_can_plat_driver as a platform_driver:

The platform drivers are registered as such in the code then as part of the Linux kernel startup procedure the list of platform drivers are inserted/started.

I need to find more concrete evidence/documentation of this, but this makes sense to me right now so I'll place it as an answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.