\input{configpres}

\title{ELBE internals}
\maketitle

\subsection{source repository}

\begin{frame}[fragile]
\frametitle{source tree}

ELBE development is hosted on github:
\begin{lstlisting}
https://github.com/Linutronix/elbe
\end{lstlisting}

Use git to retrieve the source:
\begin{lstlisting}
git clone git://github.com/Linutronix/elbe.git
\end{lstlisting}

\begin{lstlisting}
.
|-- debian/       # debian packaging
|-- docs/         # man pages, dia files, overview
|-- elbe          # python script calling several scripts from ./elbepack
|-- elbepack/     # implementation of elbe subcommands like 'create'
|  |-- mako/      # script and config file templates for the buildenv
|-- examples/     # example XML files
|-- Makefile      # calls dpkg-buildpackage to generate a debian package
|-- README        # short introduction to ELBE
+-- setup.py      # python typical setup script
\end{lstlisting}

\end{frame}

\subsection{elbepack/create.py}

\begin{frame}
\frametitle{create an elbe project}
\begin{itemize}
\item the 'elbe create' command calls the elbepack/elbe.py script
\item create.py has one mandotary parameter: path and name of an elbe xml file
\item create.py accepts optional parameters that are parsed by OptionParser
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{xml validation}
\begin{itemize}
\item verifies given xml file against elbepack/dbsfed.xsd
\item we try to do as much checks as posible with the schema
\item normaly there are no further checks inside the python code
\item validation can be skipped by --skip-validation parameter
\item elbepack/validate.py is used to verify the schema
\item elbepack/validate.py can be also called directly: 'elbe validate'
\item elbepack/validate.py uses etree from lxml to verify the schema
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{create build directory}
\begin{itemize}
\item creates a directory named 'build' at the current working directory
\item name can be overridden by --directory parameter
\item the buildenvironment will be created inside this directory
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{the debian-installer}
\begin{itemize}
\item the debian-installer is a Linux kernel and a initial ramdisk.
\item the initial ramdisk includes a minimal rootfilesystem and the d-i
  application
\item the debian project distributes the installer in different formats:
  e.g. as a bootable cd or for use with pxeboot
\item normally the debian-installer is booted on the system debian should
  be installed on
\item the debian-installer does disk detection / partitioning, sw installation
  and system configuration
\end{itemize}
\end{frame}

\begin{frame}[fragile]
\frametitle{debian-installer package}
\begin{itemize}
\item the elbe project has packaged the debian-installer as debian package
\item this was done to be able to verify the version of the installer
\item the name of the debian package is specified by the 'kinitrd' tag inside the
  xml file
\item current packages are called testrd and are available on the debian
repository:
\begin{lstlisting}
deb http://debian.linutronix.de/elbe squeeze main
\end{lstlisting}
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{retrieve debian-installer package}
\begin{itemize}
\item elbepack/pkgutils.py:copy\_kinitrd() is called by create.py
\item the pkgutils module uses python virtapt to retrieve the debian package
  from a mirror or cdrom specified in the xml file
\item virtapt takes care on using the correct architecture and debian suite
\item then the package contents are extracted and copied to the build
  directory
\end{itemize}
\end{frame}


\begin{frame}[fragile]
\frametitle{mako}
Mako is a template library written in Python.

It can be used to generate files from templates.

It is normally used to generate webpages.

Documentation and more informations can be found on
\begin{lstlisting}
http://www.makotemplates.org/
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{create Makefile, scripts and config files}
ELBE uses
\begin{lstlisting}
mako.Template(filename=fname).render(**d)
\end{lstlisting}
to insert several values from the XML file into the scripts and configfiles
used in the buildenv. It is called several times, for each *.mako file in
elbepack/mako (fname).

d refers to several lxml.etree XML nodes. etree was initialized with the
ELBE XML file before.
\begin{lstlisting}
d = {"opt": opt,
     "xml": xml,
     "prj": xml.node("/project"),
     "tgt": xml.node("/target"),
     "pkgs": xml.node("/target/pkg-list"),
     "fine": xml.node("/finetuning"),
     "preseed": get_preseed(xml) }
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{create Makefile, scripts and config files}
For example a simple txt file including all package names defined in the
<pkg-list> tag can be created by (pkg-list.mako):
\begin{lstlisting}
% for n in pkgs:
% if n.tag == "pkg":
${n.et.text}
% endif
% endfor
\end{lstlisting}
\end{frame}


\begin{frame}
\frametitle{preseeding}
\end{frame}

\subsection{Makefile (pre-install)}

\begin{frame}
\frametitle{initrd.gz modification}
\end{frame}

\begin{frame}
\frametitle{create buildenv.img}
\end{frame}

\begin{frame}
\frametitle{start emulator}
\end{frame}

\subsection{debian-installer in emulator}

\begin{frame}
\frametitle{preseeding}
\end{frame}

\begin{frame}
\frametitle{post install}
cp-scipts-into-buildenv.sh
changeroot-into-buildenv.sh
\end{frame}

\begin{frame}
\frametitle{target generation}
\end{frame}

\begin{frame}
\frametitle{cdrom generation}
\end{frame}

\subsection{Makefile (post-install)}

\begin{frame}
\frametitle{copy files to host}
\end{frame}


\input{tailpres}
