\documentclass{beamer}


\mode<presentation>
{
  \usetheme{Warsaw}
  % or ...

  \setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}


\usepackage[english]{babel}
% or whatever

\usepackage{pdfpages}

\usepackage{ucs}
\usepackage[utf8x]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}


\title
{Debian Installer Internals}

\author
{Frans ~Pop}
% - Give the names in the same order as the appear in the paper.
% - Use the \inst{?} command only if the authors have different
%   affiliation.

% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date[Debconf 6] % (optional, should be abbreviation of conference name)
{DebConf 6, Oaxtepec,\\ Mexico}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
% yourself) who are reading the slides online




\pgfdeclareimage[height=2cm]{debian-logo}{debian-swirl}
\logo{\pgfuseimage{debian-logo}}



% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
\AtBeginSection[]
{
  \begin{frame}<beamer>
    \frametitle{Outline}
    \tableofcontents[currentsection]
  \end{frame}
}


% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%\AtBeginSubsection[]
%{
%  \begin{frame}<beamer>
%    \frametitle{Outline}
%    \tableofcontents[currentsection,currentsubsection]
%  \end{frame}
%}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command: 
%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
  \tableofcontents
\end{frame}

%%%%%%%%%%%%%%%%%

\section{Introduction}

\begin{frame}
  \frametitle{So what are we going to do?}
	\begin{itemize}
	\item
		Installation methods
	\item
		What happens when the installer is booted and running?
	\item
		Debug the installer
	\item
		Create a udeb
	\item
		Build an installer image
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Some resources}
	\begin{itemize}
	\item
		$<$debian-boot@lists.debian.org$>$
	\item
		http://www.debian.org/devel/debian-installer
	\item
		http://wiki.debian.org/DebianInstaller
	\item
		http://d-i.alioth.debian.org/manual/
	\item
		\$ svn co svn+ssh://svn.debian.org/svn/d-i/trunk
	\end{itemize}
\end{frame}

\section{Installation methods}

\begin{frame}
  \frametitle{Basic stages}
	\begin{enumerate}
	\item
		boot and initialization
	\item
		loading additional components
	\item
		network configuration (unless already done in 1st stage)
	\item
		partitioning
	\item
		installing the target system
	\end{enumerate}
\end{frame}

\begin{frame}
  \frametitle{Stages 1 - 3}
  \begin{small}
    \begin{tabular}{|c|c|c|}
\hline
\textbf{Stage} & \textbf{CD-ROM} & \textbf{NETBOOT} \\
\hline
-  & \multicolumn{2}{c|}{initrd-preseed} \\
\hline
1  & \multicolumn{2}{c|}{localechooser} \\
\hline
1 & \multicolumn{2}{c|}{kbd-chooser} \\
\hline
1 & cdrom-detect & eth-detect \\
\hline
1 & & netcfg \\
\hline
- & file-preseed & network-preseed \\
\hline
2 & & choose-mirror \\
\hline
2 & load-cdrom (anna) & download-installer (anna) \\
\hline
3 & eth-detect & \\
\hline
3 & netcfg & \\
\hline
3 & choose-mirror & \\
\hline
    \end{tabular}
  \end{small}
\end{frame}

\begin{frame}
  \frametitle{Stages 4 \& 5}
  \begin{small}
    \begin{tabular}{|c|c|c|}
\hline
\textbf{Stage} & \textbf{All methods} \\
\hline
4 & hw-detect \\
\hline
4 & partman \\
\hline
5 & tzsetup \\
\hline
5 & clock-setup \\
\hline
5 & user-setup \\
\hline
5 & base-installer \\
\hline
5 & apt-setup \\
\hline
5 & pkgsel \\
\hline
5 & grub/lilo-installer; nobootloader \\
\hline
5 & finish-install (was: prebaseconfig) \\
\hline
  \end{tabular} 
    \end{small}
\end{frame}

\begin{frame}
  \frametitle{Installation methods}
	Installation method is determined by 4 characteristics
	\begin{itemize}
	\item
		how is the installer booted
	\item
		from where are additional udebs retrieved
	\item
		from where are packages for the base system retrieved
	\item
		from where are packages for tasks retrieved
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Most common installation methods}
  \begin{tiny}
    \begin{tabular}{|l|l|l|l|l|}
\hline
\textbf{Method} & \textbf{Boot} & \textbf{Udebs} & \textbf{Base system} & \textbf{Tasks} \\
\hline
netboot & network (TFTP server) & network & network & network \\
\hline
mini.iso & CD & network & network & network \\
\hline
businesscard CD & CD & CD & network & network \\
\hline
netinst CD & CD & CD & CD & network \\
\hline
full CD/DVD & CD & CD & CD & CD (+ network) \\
\hline
hd-media & harddisk/USB stick & CD image & CD image/network & CD image/network \\
\hline
floppy (net) & boot/root/net-drivers & network & network & network \\
\hline
floppy (cd) & boot/root/cd-drivers & CD & CD/network & CD/network \\
\hline
  \end{tabular} 
    \end{tiny}
\end{frame}

\section{Running the installer}

\begin{frame}
  \frametitle{Boot process}
	\begin{itemize}
	\item
		\textbf{/init} (initramfs) or \textbf{/sbin/init} (initrd)
	\item
		\textbf{busybox init} (parses /etc/inittab)
		\begin{itemize}
		\item ::sysinit:/sbin/debian-installer-startup
		\item ::respawn:/sbin/debian-installer
		\item init for VT2 (busybox shell), VT3 (/var/log/messages), VT4 (/var/log/syslog)
		\end{itemize}
	\item
		\textbf{/sbin/debian-installer-startup} \\
		runparts on /lib/debian-installer-startup.d
	\item
		\textbf{/sbin/debian-installer} \\
		runparts on /lib/debian-installer.d; starts main menu
	\end{itemize}
	Scripts in /lib/debian-installer(-startup).d can be architecture-specific.
\end{frame}

\begin{frame}
  \frametitle{Main menu}
	\begin{itemize}
	\item
		not visible at critical and high debconf priority
	\item
		priority adjusted automatically on error and $<$Go Back$>$
	\item
		dynamically assembled
	\item
		order determined by dependencies and menu numbers
	\item
		selection of menu item executes postinst
	\item
		items with menu number higher than finish-install are not run automatically
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Menu udebs in dpkg/status file}
\begin{tiny}
\begin{verbatim}
Package: netcfg
Status: install ok installed
Version: 1.23
Provides: configured-network
Depends: libc6 (>= 2.3.5-1), libdebconfclient0, libdebian-installer4 (>= 0.37),
         dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, libiw28-udeb,
         cdebconf-udeb, ethernet-card-detection
Description: Configure the network
Installer-Menu-Item: 18

Package: choose-mirror
Status: install ok unpacked
Version: 1.19
Depends: libc6 (>= 2.3.5-1), libdebconfclient0, libdebian-installer4 (>= 0.38),
         configured-network
Description: Choose mirror to install from
Installer-Menu-Item: 23
\end{verbatim}
\end{tiny}
\end{frame}

\begin{frame}
  \frametitle{Hooks}
	Hooks are used to provide additional flexibility
	\begin{itemize}
	\item /usr/lib/base-installer.d \\
		Run by base-installer before debootstrap is started
	\item /usr/lib/post-base-installer.d \\
		Run by base-installer just before kernel selection/installation
	\item /usr/lib/finish-install.d
		Run at the end of the installation
	\end{itemize}

	Other hooks
	\begin{itemize}
	\item /lib main-menu.d
	\item /usr/lib/apt-setup/generators
	\item /lib/rescue.d
	\item partman
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Special tools}
	\begin{itemize}
	\item anna-install
	\item apt-install
	\item log-output
	\item in-target
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Preseeding}
\begin{large}
	See the paper...
\end{large}
\end{frame}

\section{Debugging the installer}

\begin{frame}
  \frametitle{Debugging}
\begin{huge}
	Let's just do it!
\end{huge}
\end{frame}

\section{Creating udebs}

\begin{frame}
  \frametitle{Creating udebs}
	\begin{itemize}
	\item
		optimized for size
	\item
		relaxed policy requirements for binary packages
	\item
		no version management
	\item
		fully supported by debhelper
	\item
		types of udebs
		\begin{itemize}
		\item
			rootskel
		\item
			kernel image and kernel module udebs
		\item
			menu items and components
		\item
			library and utility udebs
		\end{itemize}
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
  \frametitle{udeb dependencies}
	Recently added "type" support in shlibs files
	\begin{itemize}
	\item
		\begin{small}
		\begin{verbatim}
libz 1 zlib1g (>= 1:1.2.1)
udeb: libz 1 zlib1g-udeb (>= 1:1.2.1)
		\end{verbatim}
		\end{small}
	\item
		\begin{small}
		\begin{verbatim}
dh_makeshlibs -V -s --add-udeb="libusb-0.1-udeb"
		\end{verbatim}
		\end{small}
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
  \frametitle{debian/control}
\begin{tiny}
\begin{semiverbatim}
Source: kbd-chooser
Section: debian-installer
Priority: optional
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: [...]
Build-Depends: debhelper (>= 5.0.22), libdebian-installer4-dev (>= 0.41),
               po-debconf (>= 0.5.0), flex | flex-old , bison,
               libdebconfclient0-dev (>= 0.49)

Package: kbd-chooser
Architecture: i386 amd64 powerpc alpha hppa sparc [...]
\color{red}XC-Package-Type: udeb\normalcolor
Depends: $\{shlibs:Depends\}, $\{misc:Depends\}, console-keymaps
Description: Detect a keyboard and select layout
\color{red}XB-Installer-Menu-Item: 12\normalcolor
\end{semiverbatim}
\end{tiny}
\end{frame}

\begin{frame}
  \frametitle{Let's create a udeb}
	What is the one killer feature that most installers have, \\
	but that Debian Installer lacks?
\end{frame}

\begin{frame}
  \frametitle{Let's create a udeb}
\begin{huge}
	Entry of a licence key
\end{huge}
\bigskip
\bigskip
\begin{tiny}
\begin{flushright}
Credits for this idea go to Martin Zobel-Helas
\end{flushright}
\end{tiny}
\end{frame}

\section{Building installer images}

\begin{frame}
  \frametitle{Images}
	\begin{itemize}
	\item
		Most d-i images are "ready for use"
	\item
		Exception: d-i images for CD-ROMs => debian-cd
	\item
		Exception to the exception: mini.iso
	\item
		Images can be built separately or as part of a release
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Release}
	\begin{itemize}
	\item
		dpkg-buildpackage
	\item
		upload
	\item
		BYHAND
	\item
		buildds
	\item
		more BYHAND
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Requirements for building}
	To build the current development version:
	\begin{itemize}
	\item
		unstable environment
	\item
		SVN checkout of trunk
	\item
		apt-get build-dep debian-installer
	\item
		available mirror
		\begin{itemize}
		\item
			sources.list.udeb: based on /etc/apt/sources.list
		\item
			sources.list.udeb.local: manual
		\end{itemize}
	\end{itemize}
	To build the Sarge installer a stable environment and
	a checkout of the sarge branch are needed.
\end{frame}

\begin{frame}
  \frametitle{Structure of the build system}
	\begin{itemize}
	\item
		based on 'make'
	\item
		hierarchical and recursive
	\linebreak
	\item
		config: defines available targets (per architecture)
	\item
		pkg-lists: defines which udebs go into an image (per type)
	\item
		boot: configuration files and make targets to make images bootable
	\item
		localudebs: allows to include debs not on the mirror
	\item
		util: contains helper scripts called from the Makefile
	\item
		tmp: working directory where image is "assembled"
	\item
		dest: built images, logfiles and manifests
	\end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Library reduction}
	\begin{itemize}
	\item
		Used to minimize the size of the initrd
	\item
		Selected libraries are relinked, leaving out unused symbols
	\item
		For some libs the full version is installed during the installation
	\item
		Sometimes the cause of trouble...
	\item
		See paper for further info
	\end{itemize}
\end{frame}

\end{document}
