% DO NOT EDIT GENERATED AUTOMATICALLY FROM gl2.105.1.slides.tex
\input{gl2.slide-header-beamer}% DO NOT EDIT GENERATED AUTOMATICALLY FROM gl2.105.1.slides.tex
\errorcontextlines=99
%% Subtopic Number = '1.105.1'
%% Title from filename: 'Manage/Query kernel and kernel modules at runtime'
%% Weight: 4
%% Description:
%% Candidates should be able to manage and/or query a kernel
%%        and kernel loadable modules. This objective includes using command-line
%%        utilities to get information about the currently running kernel and
%%        kernel modules. It also includes manually loading and unloading modules
%%        as appropriate. It also includes being able to determine when modules
%%        can be unloaded and what parameters a module accepts. Candidates should
%%        be able to configure the system to load modules by names other than
%%        their file name.
%% Key files, terms, and utilities include:
%%        /lib/modules/kernel-version/modules.dep
%%        /etc/modules.conf & /etc/conf.modules
%%        depmod
%%        insmod
%%        lsmod
%%        rmmod
%%        modinfo
%%        modprobe
%%        uname
\title{1.105.1\\Manage/Query kernel and kernel modules at runtime\\Weight 4}
\author[Geoff Robertson]{Angus Lees \texttt{gus@inodes.org} \and Geoffrey Robertson \texttt{ge@ffrey.com} \and Nick Urbanik \texttt{nicku@nicku.org}}
\subtitle{Linux Professional Institute Certification --- 102}


\begin{document}
\maketitle

\begin{frame}
  %% GENERATED SLIDE
  \frametitle{Description of Objective}
  \framesubtitle{1.105.1\ \ Manage/Query kernel and kernel modules at runtime}
  \Large{}Candidates should be able to manage and/or query a kernel
       and kernel loadable modules. This objective includes using command-line
       utilities to get information about the currently running kernel and
       kernel modules. It also includes manually loading and unloading modules
       as appropriate. It also includes being able to determine when modules
       can be unloaded and what parameters a module accepts. Candidates should
       be able to configure the system to load modules by names other than
       their file name.

\end{frame}

\begin{frame}[fragile]
  %% GENERATED SLIDE
  \frametitle{Key files, terms, and utilities include:}
\begin{semiverbatim}\large
/lib/modules/kernel-version/modules.dep
/etc/modules.conf & /etc/conf.modules
depmod
insmod
lsmod
rmmod
modinfo
modprobe
uname
\end{semiverbatim}
\end{frame}


\begin{frame}[fragile]

\frametitle{Manage/Query kernel and kernel modules at runtime}
\framesubtitle{Objective}

Candidates should be able to manage and/or query a kernel and kernel
loadable modules. This objective includes using command-line utilities
to get information about the currently running kernel and kernel
modules. It also includes manually loading and unloading modules as
appropriate. It also includes being able to determine when modules can
be unloaded and what parameters a module accepts. Candidates should be
able to configure the system to load modules by names other than their
file name.

\end{frame}
 
\begin{frame}[fragile]

\frametitle{Manage/Query Kernel and kernel modules at runtime}
\framesubtitle{Key files, terms, and utilities}
\begin{description}
\item[\texttt{/lib/modules/\textit{kernel-version}/modules.dep}]
\item[\texttt{/etc/modules.conf} \& \texttt{/etc/conf.modules}]
\item[depmod]
\item[insmod]
\item[lsmod]
\item[rmmod]
\item[modinfo]
\item[modprobe]
\item[uname]
\end{description}
\end{frame}

\begin{frame}[fragile]

\frametitle{Manage/Query Kernel and kernel modules at runtime}
\framesubtitle{Resources of interest}
\begin{itemize} 
\item \texttt{\textit{linux-source}/Documentation/}
\end{itemize}
\end{frame}


\begin{frame}[fragile]

\frametitle{Kernel Module Basics}

\begin{itemize}

\item Kernel modules are chunks of kernel code which can get loaded
  and unloaded at runtime.

\item Some modules depend on code in other modules.

\item Good for shipping pre-built kernels -- but not loading all
  available code; good for changing between conflicting modules
  (eg. \textsc{OSS} and \textsc{ALSA}), etc.

\end{itemize}
\end{frame}


\begin{frame}[fragile]

\frametitle{\texttt{uname} -- Who the kernel thinks it is}

Modules are stored in \texttt{/lib/modules/\textit{`uname -r`}/kernel/}

\begin{description}
\item[-a] print all information
\item[-s] kernel name  (``Linux'')
\item[-n] ``node name'' (hostname)
\item[-r] kernel release (``2.4.20-3-686'')
\item[-v] kernel version (compile time)
\item[-m] machine hardware name (``i686'')
\item[-o] operating system (``GNU/Linux'')
\end{description}

\end{frame}


\begin{frame}[fragile]

\frametitle{\textbf{lsmod} -- Currently loaded modules}

\textbf{lsmod} uses \texttt{/proc/modules} to show you which kernel
modules are currently loaded.

\begin{semiverbatim}\small
Module                  Size  Used by
bsd_comp                5888  1 
ppp_async              10624  1 
ppp_generic            29072  6 bsd_comp,ppp_async
slhc                    7040  1 ppp_generic
ipv6                  230624  10 
ds                     14596  0 
pcmcia_core            62688  1 ds
irda                  174400  0 
parport_pc             34088  1 
lp                     10560  0 
parport                40552  2 parport_pc,lp
\end{semiverbatim}
\end{frame}


\begin{frame}[fragile]

\frametitle{\textbf{modprobe} -- Loading modules}

Load a module and its dependencies:
\begin{semiverbatim}
modprobe \textit{modulename} \textit{[module options]}

\textrm{eg:}  modprobe ftape ft_fdc_base=0x123
\end{semiverbatim}

\vspace{2em}

Unload a module if it's unused:
\begin{semiverbatim}
modprobe -r \textit{modulename}

\textrm{eg:}  modprobe -r ftape
\end{semiverbatim}

\end{frame}


\begin{frame}[fragile]

\frametitle{\textbf{modinfo} -- Module options}

``modinfo ftape'' gives:
\begin{semiverbatim}\small
parm:        ft_fdc_base:Base address of FDC controller.
parm:        ft_fdc_irq:IRQ (interrupt channel) to use.
parm:        ft_fdc_dma:DMA channel to use.
parm:        ft_fdc_threshold:Threshold of the FDC Fifo.
  \vdots
author:      (c) 1993-1996 Bas Laarhoven (bas@vimec.nl), (c) 1995-1996 Kai Harrekilde-Petersen (khp@dolphinics.no), (c) 1996, 1997 Claus-Justus Heine (claus@momo.math.rwth-aachen.de)
description: QIC-117 driver for QIC-40/80/3010/3020 floppy tape drives.
license:     GPL
\end{semiverbatim}

\end{frame}


\begin{frame}[fragile]

\frametitle{\texttt{modprobe} maintenance}

Configuration in \texttt{/etc/modules.conf} (aka
\texttt{/etc/conf.modules}).

\begin{semiverbatim}
# bogus example
options ftape ft_fdc_base=0x123 fg_fdc_irq=5 ft_fdc_dma=1
alias char-major-27 ftape
\end{semiverbatim}

\vspace{2em}

\textbf{depmod} builds \texttt{modules.dep}, describing module
dependencies.

\end{frame}


\begin{frame}[fragile]

\frametitle{Loading modules - low-level}

Low level commands to actually insert or remove a module:

\begin{semiverbatim}
insmod \textit{filename} \textit{module options}
rmmod \textit{modulename}
\end{semiverbatim}

\vspace{2em}

You will probably never use these directly.

\end{frame}



\begin{frame}
  \frametitle{License Of This Document}
  Copyright \copyright\ 2005, 2003 Angus Lees <gus@inodes.org>, Geoffrey Robertson <ge@ffrey.com> and Nick Urbanik <nicku@nicku.org>. Permission is granted to make
and distribute verbatim copies or modified versions of this document
provided that this copyright notice and this permission notice are
preserved on all copies under the terms of the GNU General Public
License as published by the Free Software Foundation---either version
2 of the License or (at your option) any later version.

\end{frame}
\end{document}
