\subsection[Installation on the host]{Compiling and installing the
  kernel for the host system}

\begin{frame}
  \frametitle{Kernel compilation}
  \begin{itemize}
  \item \code{make}
    \begin{itemize}
    \item in the main kernel source directory
    \item Remember to run \code{make -j 4} if you have multiple CPU
      cores to speed up the compilation process
    \item No need to run as root !
    \end{itemize}
  \item Generates
    \begin{itemize}
    \item \code{vmlinux}, the raw uncompressed kernel image, at the
      ELF format, useful for debugging purposes, but cannot be booted
    \item \code{arch/<arch>/boot/*Image}, the final, usually
      compressed, kernel image that can be booted
      \begin{itemize}
      \item \code{bzImage} for x86, \code{zImage} for ARM,
        \code{vmImage.gz} for Blackfin, etc.
      \end{itemize}
    \item All kernel modules, spread over the kernel source tree, as
      \code{.ko} files.
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Kernel installation}
  \begin{itemize}
  \item \code{make install}
    \begin{itemize}
    \item Does the installation for the host system by default, so
      needs to be run as root. Generally not used when compiling for
      an embedded system, and it installs files on the development
      workstation.
    \end{itemize}
  \item Installs
    \begin{itemize}
    \item \code{/boot/vmlinuz-<version>} \\
      Compressed kernel image. Same as the one in
      \code{arch/<arch>/boot}
    \item \code{/boot/System.map-<version>}\\
      Stores kernel symbol addresses
    \item \code{/boot/config-<version>}\\
      Kernel configuration for this version
    \end{itemize}
  \item Typically re-runs the bootloader configuration utility to take
    into account the new kernel.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Module installation}
  \begin{itemize}
  \item \code{make modules_install}
    \begin{itemize}
    \item Does the installation for the host system by default, so
      needs to be run as root
    \end{itemize}
  \item Installs all modules in \code{/lib/modules/<version>/}
    \begin{itemize}
    \item \code{kernel/}\\
      Module \code{.ko} (Kernel Object) files, in the same directory
      structure as in the sources.
    \item \code{modules.alias}\\
      Module aliases for module loading utilities. Example line:\\
      \code{alias sound-service-?-0 snd_mixer_oss}
    \item \code{modules.dep}\\
      Module dependencies
    \item \code{modules.symbols}\\
      Tells which module a given symbol belongs to.
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Kernel cleanup targets}
  \begin{columns}
    \column{0.8\textwidth}
    \begin{itemize}
    \item Clean-up generated files (to force re-compilation):\\
      \code{make clean}
    \item Remove all generated files. Needed when switching from one
      architecture to another. Caution: also removes your .config file!\\
      \code{make mrproper}
    \item Also remove editor backup and patch reject files (mainly to
      generate patches):\\
      \code{make distclean}
    \end{itemize}
    \column{0.2\textwidth}
    \includegraphics[width=0.9\textwidth]{slides/sysdev-linux-intro-compilation/kernel-mrproper.png}
  \end{columns}
\end{frame}
