5

i know how to load your module automatically in ubuntu. you put your module in /etc/modules

But, i compile a kernel and filesystem for an embedded system which i am working on it. but there is no "modules" file in /etc directory. (i am using angstrom by the way)

Is there anyway to load my module at boot?

thanks in advance,

fixer1234
  • 27,064
  • 61
  • 75
  • 116
thehilmisu
  • 163
  • 1
  • 7
  • 1
    What distribution are you running on that build with the custom kernel? – Kaurin Mar 07 '12 at 09:42
  • 1
    i am using the device called tam3517 and i downloaded the kernel that they gave me. Build it with my toolchain, angstrom. And i create a filesystem with buildroot. http://www.technexion.com/index.php/support/download-center/arm-cpu-modules/tam-3517 – thehilmisu Mar 07 '12 at 09:47

2 Answers2

2

The init system has to insmod them.

At least for Buildroot / BusyBox, there seems to be not pre-automated way, so you should just add your own /etc/init.d/S99Modules file containing commands of type:

modprobe mymodule
modprobe mymodule2

/etc/init.d/S99Modules is then run from /etc/init.d/rcS:

for i in /etc/init.d/S??* ;do
    ...
            $i start

which in turn is called by the line:

::sysinit:/etc/init.d/rcS

in /etc/inittab, and that file is run by the init process, which is the executable at /init or specified by the init= kernel command line parameter.

Here is a convenient setup to try it out.

2

Do you, perhaps, have a file /etc/rc.modules, or a directory with that name?
If not, you might try and find a file /etc/rc.local, and just add modprobe yourmodule at the end.

/etc/rc.local file contains custom user commands that are executed on boot.

Previous solution works for most distros but not for you. You have some minimal rescue-like linux distro. This is why I suggest just appending modprobe yourmodule to the end of the /etc/inittab.

NOTE: THIS METHOD SHOULD BE AVOIDED IF YOU HAVE A NORMAL LINUX DISTRIBUTION LIKE UBUNTU, MINT, FEDORA, ARCH...
IF YOU USE A NORMAL DISTRIBUTION, PLEASE USE YOUR DISTRIBUTION'S WAY OF ADDING CUSTOM MODULES.

Kaurin
  • 730
  • 5
  • 13
  • i have created rc.local under my /etc folder and add this command but it's not working. – thehilmisu Mar 07 '12 at 10:03
  • Can you paste the output of the following command here: ls -al /etc/ – Kaurin Mar 07 '12 at 10:23
  • it is too long to paste here. i am going to paste it as answer. – thehilmisu Mar 07 '12 at 10:30
  • Since, i am a new user i cannot add answer to my question =) what do you looking for in here ? i can answer you without pasting the output – thehilmisu Mar 07 '12 at 10:32
  • use pastebin http://pastebin.com/ – Kaurin Mar 07 '12 at 11:14
  • http://pastebin.com/3XrB46WJ – thehilmisu Mar 07 '12 at 11:17
  • Is this a recovery image for your device? It seems rather thin! You can delete the rc.local and rc.local~ because this distro is not set to use that file. If you still want to load your module on boot, you can append the command to the end of innittab, or a corresponding default runlevel in init.d. This is a crude way of doing it, but it will work. I will edit my answer if you succeed – Kaurin Mar 07 '12 at 11:24