Ready to be published? LXer is read by around 350,000 individuals each month, and is an excellent place for you to publish your ideas, thoughts, reviews, complaints, etc. Do you have something to say to the Linux community?
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.
What is a modular kernel?
A modular kernel is a type of kernel where you can load a module(a piece of software to make some hardware/software to work properly) or remove a module when that module is no longer required by your Operating System. In windows world these are called as "Drivers". This is the beauty of Linux kernel where you can load only required modules and remove unwanted modules which will have less burden on the system.
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.
Load kernel modules using modules file
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
Save the file and exit.
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.
Save the file and change permissions to executable
chmod +x /etc/sysconfig/modules/xyz.modules
Load kernel modules through /etc/rc.local file
This is common in most of the Linux flavors. Edit /etc/rc.local file to enter modprob/insmod commands to execute them at the time of booting.
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.
A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.
Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help