Posts Tagged ‘module’

1. Download the latest kernel-compatible module. Most of the files come from released tarballs. These are compressed archives with extensions like .tar.gz or .tar.bz2.

2. Install the following packages for building, in case both packages are not installed:

sudo apt-get install build-essential
sudo apt-get install linux-kernel-headers

3. Decompress the downloaded file.

tar -xzvvf tarball_name.tar.gz 
or
tar -xjvvf tarball_name.tar.bz2 

4. Go to the directory of the untarred(decompressed) source code.

cd directory

5. Build the package.

sudo make

6. Install the package.

sudo make install

7. Add the module or reboot.

sudo modprobe modulename
or
restart -r now

The kernel is the heart of the Operating System. Linux Kernel could be Monolithic or Modular. A monolithic kernel supports everything (hardware, network, file systems) compiled from a single file; mostly used in embedded systems. A Modular kernel comprises of some drivers compiled as object files, which can be loaded or removed anytime. Modular kernel doesn’t need to be always recompiled when a hardware is added.

To check you current kernel version, enter the command:
uname -a
uname -r

More on Modular Kernel…
The modular kernel consists of the kernel itself and athe kernel modules.
All modules of a kernel are stored in /lib/modules/$(uname -r) and have a file extension of ko.

Controlling Kernel modules: utilities supplied by nmdutils package

lsmod – lists currently loaded kernel modules
syntax:

lsmod

rmmod – low level command used to remove a module
syntax:

rmmod modulename

insmod – low level command used to insert a module
syntax:

insmod filename

modinfo – display module details

depmode – determines module dependencies and rebuilds /lib/modules/kernel-version/modules.dep

modprobe – loads and removes modules, takes care of dependencies. configuration files is stored in /etc/module.conf & /etc/conf.modules.
syntax:

sudo modprobe modulename
sudo modprobe -r modulename

e.g.

sudo modprobe vfat
lsmod  | grep fat output:
vfat	17335	0
fat	55505	1 vfat

sudo modprobe -r vfat
lsmod | grep fat output:
--output blank--