photo lineviral_1.png

Linux Gist Module – Basics

 The Linux operating organisation is based on it as well as deployed on both traditional calculator syste Linux Kernel Module – BasicsThe Linux pith is a monolithic Unix-like calculator operating organisation kernel. The Linux operating organisation is based on it as well as deployed on both traditional calculator systems such equally personal computers as well as servers, normally inwards the shape of Linux distributions, as well as on diverse embedded devices such equally routers, wireless access points, PBXes, set-top boxes, FTA receivers, smart TVs, PVRs as well as NAS appliances. The Android operating organisation for tablet computers, smartphones as well as smartwatches is too based atop the Linux kernel.


Linux allows the Kernel to live configured at run time, to enable or disable dissimilar services equally y'all meet fit. This agency y'all don’t get got to compile a monolithic kernel, as well as tin relieve some retention usage. Some modules you’ll alone involve for a brusk time, others you’ll involve all the time. You tin configure your Linux machine to charge pith modules on startup as well as then y'all don’t get got to retrieve to produce that when (if) y'all reboot.


Module Commands


There are a few commands that allow y'all to manipulate the kernel. Each is rapidly described below, for to a greater extent than data country `man [command]`.



  • depmod – direct keep dependency descriptions for loadable pith modules.

  • insmod – install loadable pith module.

  • lsmod – listing loaded modules.

  • modinfo – display data close a pith module.

  • modprobe – high degree treatment of loadable modules.

  • rmmod – unload loadable modules.


The usage of the commands is demonstrated below, it is left equally an do to the reader to fully empathise the commands.


Using Module Commands


Below the dissimilar pith module commands are demonstrated


# Show the module dependencies.
depmod -n

# Install some module
insmod --autoclean [modnam]

# This lists all currently loaded modules, lsmod takes no useful parameters
lsmod

# Display data close module eepro100
modinfo --author --description --parameters eepro100

# Removing a module (don't role the example)
rmmod --all --stacks ip_tables

Module Configuration Files


The pith modules tin role 2 dissimilar methods of automatic loading. The kickoff method (modules.conf) is my preferred method, only y'all tin produce equally y'all please.



  • modules.conf – This method charge the modules earlier the balance of the services, I intend earlier your calculator chooses which runlevel to use

  • rc.local – Using this method loads the modules afterwards all other services are started


Using ‘modules.conf’ volition require y'all to country `man five modules.conf`. Using ‘rc.local’ requires y'all to house the necessary commands (see above) inwards the correct order.


Sample modules.conf


# modules.conf - configuration file for loading pith modules
# Create a module alias parport_lowlevel to parport_pc
alias parport_lowlevel parport_pc
# Alias eth0 to my eepro100 (Intel Pro 100)
alias eth0 eepro100
# Execute /sbin/modprobe ip_conntrack_ftp afterwards loading ip_tables
post-install ip_tables /sbin/modprobe ip_conntrack_ftp
# Execute /sbin/modprobe ip_nat_ftp afterwards loading ip_tables
post-install ip_tables /sbin/modprobe ip_nat_ftp

Sample rc.local


#!/bin/sh
#
# This script volition live executed *after* all the other init scripts.
# You tin position your ain initialization materials inwards hither if y'all don't
# desire to produce the amount Sys V agency init stuff.

/sbin/insmod ip_tables
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp

Conclusion


You should see/know that modules are necessary. They tin live loaded via ‘modules.conf’ or ‘rc.local’, only ‘modules.conf’ charge them kickoff as well as ‘rc.local’ loads them last. Using the diverse module commands y'all tin add, remove, listing or run yesteryear away data close modules.


Resources



  1. The Linux Documentation Project – TLDP

  2. The Linux Kernel Archive

  3. Linux Hardware Devices

  4. Kernel configuration options.


Buat lebih berguna, kongsi:
close