<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ><HEAD ><TITLE >Linux Loadable Kernel Module HOWTO</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="NEXT" TITLE="Preface" HREF="x64.html"></HEAD ><BODY CLASS="ARTICLE" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="ARTICLE" ><DIV CLASS="TITLEPAGE" ><H1 CLASS="TITLE" ><A NAME="AEN2" ></A >Linux Loadable Kernel Module HOWTO</H1 ><H3 CLASS="AUTHOR" ><A NAME="AEN4" >Bryan Henderson</A ></H3 ><P CLASS="PUBDATE" >2006-09-24<BR></P ><DIV CLASS="REVHISTORY" ><TABLE WIDTH="100%" BORDER="0" ><TR ><TH ALIGN="LEFT" VALIGN="TOP" COLSPAN="3" ><B >Revision History</B ></TH ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.09</TD ><TD ALIGN="LEFT" >2006-09-24</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Fix typos.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.08</TD ><TD ALIGN="LEFT" >2006-03-03</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Add copyright information.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.07</TD ><TD ALIGN="LEFT" >2005-07-20</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Add some 2.6 info and disclaimers. Update references to Linux Device Drivers book, Linux Kernel Module Programming Guide.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.06</TD ><TD ALIGN="LEFT" >2005-01-12</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Cover Linux 2.6 briefly. Update hello.c and reference to Lkmpg. Add information about perils of unloading. Mention dmesg as way to see kernel messages.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.05</TD ><TD ALIGN="LEFT" >2004-01-05</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Add information on module.h and -DMODULE. Fix tldb.org to tldp.org. Add information on kallsyms.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.04</TD ><TD ALIGN="LEFT" >2003-10-10</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Fix typo: AHA154x should be AHA152x Add information on what module names the kernel module loader calls for. Add information on what an LKM does when you first load it. Add information on loop module. Change linuxdoc.org to tldp.org.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.03</TD ><TD ALIGN="LEFT" >2003-07-03</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Update on kernels that don't load into vmalloc space. Add explanation of "deleted" state of an LKM. Explain GPLONLY.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.02</TD ><TD ALIGN="LEFT" >2002-05-21</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Correct explanation of symbol versioning. Correct author of Linux Device Drivers. Add info about memory allocation penalty of LKM vs bound-in. Add LKM-to-LKM symbol matching requirement. Add open source licensing issue in LKM symbol resolution. Add SMP symbol versioning info.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.01</TD ><TD ALIGN="LEFT" >2001-08-18</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Add material on various features created in the last few years: kernel module loader, ksymoops symbols, kernel-version-dependent LKM file location.</TD ></TR ><TR ><TD ALIGN="LEFT" >Revision v1.00</TD ><TD ALIGN="LEFT" >2001-06-14</TD ><TD ALIGN="LEFT" >Revised by: bjh</TD ></TR ><TR ><TD ALIGN="LEFT" COLSPAN="3" >Initial release.</TD ></TR ></TABLE ></DIV ><DIV ><DIV CLASS="ABSTRACT" ><A NAME="AEN62" ></A ><P ></P ><P >This is the HOWTO for Linux loadable kernel modules (LKMs). It explains what they are and how to use and create them. It also includes documentation of parameters and other details of use of some particular modules.</P ><P ></P ></DIV ></DIV ><HR></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT >1. <A HREF="x64.html" >Preface</A ></DT ><DT >2. <A HREF="x73.html" >Introduction to Linux Loadable Kernel Modules</A ></DT ><DD ><DL ><DT >2.1. <A HREF="x73.html#AEN77" >Terminology</A ></DT ><DT >2.2. <A HREF="x73.html#AEN90" >History of Loadable Kernel Modules</A ></DT ><DT >2.3. <A HREF="x73.html#THECASE" >The Case For Loadable Kernel Modules</A ></DT ><DT >2.4. <A HREF="x73.html#AEN107" >What LKMs Can't Do</A ></DT ><DT >2.5. <A HREF="x73.html#AEN110" >What LKMs Are Used For</A ></DT ></DL ></DD ><DT >3. <A HREF="x126.html" >Making Loadable Kernel Modules</A ></DT ><DT >4. <A HREF="x146.html" >LKM Utilities</A ></DT ><DT >5. <A HREF="x197.html" >How To Insert And Remove LKMs</A ></DT ><DD ><DL ><DT >5.1. <A HREF="x197.html#AEN248" >Could Not Find Kernel Version...</A ></DT ><DT >5.2. <A HREF="x197.html#AEN269" >What Happens When An LKM Loads</A ></DT ><DT >5.3. <A HREF="x197.html#INTELLIGENT" >Intelligent Loading Of LKMs - Modprobe</A ></DT ><DT >5.4. <A HREF="x197.html#AUTOLOAD" >Automatic LKM Loading and Unloading</A ></DT ><DT >5.5. <A HREF="x197.html#PROCMODULES" >/proc/modules</A ></DT ><DT >5.6. <A HREF="x197.html#MODLOCATION" >Where Are My LKM Files On My System?</A ></DT ></DL ></DD ><DT >6. <A HREF="basekerncompat.html" >Unresolved Symbols</A ></DT ><DD ><DL ><DT >6.1. <A HREF="basekerncompat.html#AEN502" >Some LKMs Prerequire Other LKMs</A ></DT ><DT >6.2. <A HREF="basekerncompat.html#AEN507" >An LKM Must Match The Base Kernel</A ></DT ><DT >6.3. <A HREF="basekerncompat.html#MULTIPLEKERNELS" >If You Run Multiple Kernels</A ></DT ><DT >6.4. <A HREF="basekerncompat.html#AEN567" >SMP symbols</A ></DT ><DT >6.5. <A HREF="basekerncompat.html#AEN574" >You Are Not Licensed To Access The Symbol</A ></DT ><DT >6.6. <A HREF="basekerncompat.html#AEN586" >An LKM Must Match Prerequisite LKMs</A ></DT ></DL ></DD ><DT >7. <A HREF="x589.html" >How To Boot Without A Disk Device Driver</A ></DT ><DT >8. <A HREF="parm.html" >About Module Parameters</A ></DT ><DT >9. <A HREF="x615.html" >Persistent Data</A ></DT ><DT >10. <A HREF="x627.html" >Technical Details</A ></DT ><DD ><DL ><DT >10.1. <A HREF="x627.html#HOWTHEYWORK" >How They Work</A ></DT ><DT >10.2. <A HREF="x627.html#MODINFO" >The .modinfo Section</A ></DT ><DT >10.3. <A HREF="x627.html#AEN712" >The __ksymtab And .kstrtab Sections</A ></DT ><DT >10.4. <A HREF="x627.html#AEN722" >Ksymoops Symbols</A ></DT ><DT >10.5. <A HREF="x627.html#AEN782" >Other Symbols</A ></DT ><DT >10.6. <A HREF="x627.html#AEN793" >Debugging Symbols</A ></DT ><DT >10.7. <A HREF="x627.html#MEMALLOC" >Memory Allocation For Loading</A ></DT ><DT >10.8. <A HREF="x627.html#AEN830" >Linux internals</A ></DT ></DL ></DD ><DT >11. <A HREF="x839.html" >Writing Your Own Loadable Kernel Module</A ></DT ><DD ><DL ><DT >11.1. <A HREF="x839.html#AEN846" >Simpler hello.c</A ></DT ><DT >11.2. <A HREF="x839.html#AEN870" >Using the Kernel Build System</A ></DT ><DT >11.3. <A HREF="x839.html#AEN876" >Rubini et al: Linux Device Drivers</A ></DT ><DT >11.4. <A HREF="x839.html#USECOUNT" >Module Use Counts</A ></DT ></DL ></DD ><DT >12. <A HREF="linuxversions.html" >Differences Between Versions Of Linux</A ></DT ><DD ><DL ><DT >12.1. <A HREF="linuxversions.html#AEN911" >Linux 2.4 - Linux 2.6</A ></DT ></DL ></DD ><DT >13. <A HREF="copyright.html" >Copyright Considerations With LKMs</A ></DT ><DT >14. <A HREF="x973.html" >Related Documentation</A ></DT ><DT >15. <A HREF="individual.html" >Individual Modules</A ></DT ><DD ><DL ><DT >15.1. <A HREF="individual.html#AEN985" >Executable Interpreters</A ></DT ><DT >15.2. <A HREF="individual.html#AEN1016" >Block Device Drivers</A ></DT ><DT >15.3. <A HREF="individual.html#SCSI" >SCSI Drivers</A ></DT ><DT >15.4. <A HREF="individual.html#AEN1555" >Network Device Drivers</A ></DT ><DT >15.5. <A HREF="individual.html#AEN2553" >CDROM Device Drivers</A ></DT ><DT >15.6. <A HREF="individual.html#AEN2694" >Filesystem Drivers</A ></DT ><DT >15.7. <A HREF="individual.html#AEN2813" >Miscellaneous Device Driver</A ></DT ><DT >15.8. <A HREF="individual.html#AEN2821" >Serial Device Drivers</A ></DT ><DT >15.9. <A HREF="individual.html#AEN2868" >Parallel Device Drivers</A ></DT ><DT >15.10. <A HREF="individual.html#AEN2877" >Bus Mouse Device Drivers</A ></DT ><DT >15.11. <A HREF="individual.html#AEN2907" >Tape Device Drivers</A ></DT ><DT >15.12. <A HREF="individual.html#AEN2955" >Watchdog Timers</A ></DT ><DT >15.13. <A HREF="individual.html#AEN2979" >Sound Device Drivers</A ></DT ></DL ></DD ><DT >16. <A HREF="x2986.html" >Maintenance Of This Document</A ></DT ><DT >17. <A HREF="history.html" >History</A ></DT ><DT >18. <A HREF="x2997.html" >Copyright</A ></DT ></DL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x64.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Preface</TD ></TR ></TABLE ></DIV ></BODY ></HTML >