\input{gl2.slide-header-beamer} \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[Angus Lees]{Angus Lees \texttt{gus@inodes.org} \and Nick Urbanik \texttt{nicku@nicku.org}\\ {\tiny This document Licensed under GPL---see section~\ref{sec:license}}}% \subtitle{Linux Professional Institute Certification --- 102}% \mode
{\chead{1.105.1}}% % TODO Nick: % Add coverage of Debian system % improve description of loading modules, e.g. /etc/rc.d/rc.local, etc. \begin{document} \maketitle \mode
{\thispagestyle{empty}} \begin{frame} \frametitle{Outline} \mode {% %\footnotesize \begin{multicols}{2} \tableofcontents \end{multicols} % You might wish to add the option [pausesections] }% \mode
{% \tableofcontents }% \end{frame} \section{Context} \label{sec:context} \begin{frame} \frametitle{Topic 105 Kernel [7]}% \framesubtitle{Where we are up to}% \begin{description} % \uline depends on \usepackage[normalem]{ulem}: \item[1.105.1] \textbf{\uline{Manage/Query kernel and kernel modules at runtime [4]}} \item[1.105.2] Reconfigure, build, and install a custom kernel and kernel [3] \end{description} \end{frame} \section{Objectives} \begin{frame} %% GENERATED SLIDE \frametitle{Description of Objective}% \framesubtitle{1.105.1\ \ Manage/Query kernel and kernel modules at runtime}% \mode{\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:}% \framesubtitle{1.105.1\ \ Manage/Query kernel and kernel modules at runtime}% \mode{\large} \begin{description} \item[\texttt{/lib/modules/kernel-version/modules.dep}] --- the file built by \texttt{depmod} showing which module depends on what other modules \item[\texttt{/etc/modules.conf} \textnormal{\&} \texttt{/etc/conf.modules}] --- configuration file for \texttt{modprobe} \item[\texttt{depmod}] --- determines module dependencies and rebuilds \texttt{modules.dep} \item[\texttt{insmod}] --- low level command to insert a module into running kernel \item[\texttt{lsmod}] --- list modules loaded into kernel \item[\texttt{rmmod}] --- low level command to remove a module from kernel \item[\texttt{modinfo}] --- shows details about a particular module \item[\texttt{modprobe}] --- the tool for inserting and removing modules into/from the running kernel \item[\texttt{uname}] --- shows information about the system, including the kernel version info. \end{description} \end{frame} \section{Documentation} \begin{frame}[fragile] \frametitle{Manage/Query Kernel and kernel modules at runtime} \framesubtitle{Resources of interest} \begin{itemize} \item \texttt{\meta{linux-source}/Documentation/} \end{itemize} \end{frame} \section{Kernel Modules} \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} \section{Utilities} \subsection{\texttt{uname}} \label{sec:uname} \begin{frame} \frametitle{\textbf{\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} \subsection{lsmod} \label{sec:lsmod} \begin{frame}[fragile] \frametitle{\textbf{\texttt{lsmod}} -- Currently loaded modules} \textbf{lsmod} uses \texttt{/proc/modules} to show you which kernel modules are currently loaded. \mode{\small}% \begin{semiverbatim} 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} \subsection{\texttt{modprobe}} \label{sec:modprobe} \begin{frame} \frametitle{\textbf{\texttt{modprobe}} -- Loading and removing modules}% \begin{block}{Load a module and its dependencies:} \par% \cmdbox{sudo modprobe \meta{modulename} [\meta{module options}]} \par% \textnormal{eg:} \cmdbox{sudo modprobe ftape ft\_fdc\_base=0x123} \end{block} \mode{\par\vspace{2em}}\par \begin{block}{Unload a module if it's unused:} \cmdbox{sudo modprobe -r \meta{modulename}} \par% \textnormal{eg:} \cmdbox{sudo modprobe -r ftape} \end{block} \end{frame} \subsection{\texttt{modinfo}} \label{sec:modinfo} \begin{frame}[fragile] \frametitle{\textbf{\texttt{modinfo}} -- Module options} ``modinfo ftape'' gives: \mode{\scriptsize}% \mode
{\footnotesize}% \begin{semiverbatim} 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} \section{\texttt{/etc/modules.conf}} \label{modules.conf} \begin{frame}[fragile] \frametitle{\textbf{\texttt{modprobe}} maintenance}% Configuration in \texttt{/etc/modules.conf} (aka \texttt{/etc/conf.modules}).% {\mode{\small} \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} }% \mode{\par\vspace{2em}}\par \textbf{depmod} builds \texttt{modules.dep}, describing module dependencies. \end{frame} \section{Low level commands} \label{sec:low-level-commands} \begin{frame}[fragile] \frametitle{Loading modules - low-level} Low level commands to actually insert or remove a module: \begin{semiverbatim} insmod \meta{filename} \meta{module options} rmmod \meta{modulename} \end{semiverbatim} \mode{\par\vspace{2em}}\par You will probably never use these directly; use \texttt{modprobe} or \texttt{modprobe~-r} instead. \end{frame} \mode {% \begin{frame} \frametitle{Topics Covered} %\footnotesize %\begin{multicols}{2} \tableofcontents[pausesections,pausesubsections] %\end{multicols} % You might wish to add the option [pausesections] \end{frame} } \section{License} \label{sec:license} \begin{frame} \frametitle{License Of This Document}% \raggedright% Copyright \copyright\ 2005, 2003 Angus Lees and Nick Urbanik . \par 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}