Device Drivers in Linux

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 15:06, 13 September 2022 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

  • Linux device driver kernel files are in /dev
  • Drivers are either compiled into the kernel, or loaded as kernel modules
  • Linux device driver kernel modules can be configured, loaded, unloaded without rebooting the system
  • Not all device drivers are kernel devices, such as video drivers for xwindows
  • The programs insmod, rmmod, ksyms, lsmod, genksyms, modprobe, and depmod are part of "module utilities" and when installed, the commands are in /sbin

Loading a Device Driver Kernel Module:

Use modprobe to load a kernel module into the running kernel. You can specify parameters with modprobe too.

 modeprobe <module name>

Other commands, such as to show the loaded modules or inserting a module into the running kernel

 lsmod
 insmod

Modules usually have an extension of ".o"

Modules can be loaded when the system boots. They are specified in the text configuration file: /etc/modules It contains a list of modules to be loaded. Options for the modules are in the file: /etc/conf.modules Rather than directly editing the conf.modules with vi, use the script provided for that purpose

 update-modules

Unloading a Device Driver Kernel Module:

If the module is not used by the system, it may be unloaded by either of the following methods:

 modprobe -r <module_name>
 rmmod <module_name>

Module related command reference:

 lsmod - list loaded modules
 insmod - install loadable kernel module
 modprobe - high level handling of loadable modules
 depmod - handle dependency descriptions for loadable kernel modules
 rmmod - unload loadable modules
 ksyms - display exported kernel symbols
 udevadm - device manager for the Linux kernel replacing devfsd and hotplug. manages device nodes in the /dev directory