Академический Документы
Профессиональный Документы
Культура Документы
linuxnix.com /linux-load-kernel-modules-at-boot-up/
Linux kernel is a wonderful piece of software which will act a master to all softwares installed in an OS. In this post
we will see how to load servents(aka modules) in to kernel. Though Linux architecture taken inspiration from Unix,
there are some differences between their kernel architecure. One major difference is Linux kernel is a modular
kernel where as Unix kernel is a monolithic kernel.
In this post we will see "How to load a module at the time of boot. " We have two options to do this. One is
prescribed one and other one is a work around which you should not prefer.
Ubuntu/Debian machines:
In Debian based machines like Ubuntu the modules file is located at /etc/modules. For example if you want pptp
#vi /etc/modules
Content:
mac80211
cfg80211
Redhat/Centos/Fedora machines:
In Redhat based machines we have to create a shell script file say for example xyz.modules in
/etc/sysconfig/modules folder and change permissions to executable. We can create as many .modules files you
want or keep all modules in single .modules file.
Example:
#vi /etc/sysconfig/modules/xyz.modules
File content:
1/2
#!/bin/sh
/sbin/insmod xyzmodule
chmod +x /etc/sysconfig/modules/xyz.modules
Note 1: This note is for people who do not know about /etc/rc.local file. This is a file which will be executed after init
completes its booting and before we get login prompt. This is just file with sequence of commands. If you want to
execute any command at the time of boot, you just have to keep that command in this file.
#vi /etc/rc.local
Content:
modprob mac80211
insmod /lib/modules/3.19.0-15-generic/kernel/drivers/net/wireless/iwlwifi/iwlwifi.ko
Now your system will load these modules when ever it boots up.
In our next posts we will see how to use other kernel related commands like lsmod, insmod, modinfo, rmmod,
modprob, depmod, dkms, kmod.
2/2