\documentclass{beamer}

\usepackage{beamerthemesplit}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{pstricks}               	% Advanced drawings
\usepackage{fancyhdr}               	% Headers
\usepackage{epsf}
\usepackage{fancyhdr}

\title{The OpenWrt embedded development framework}

\author{Florian Fainelli \\
florian@openwrt.org}
\date{\today}

\institute{Fosdem 2008\\
Brussels\\
Lenght : 1 hour}

\begin{document}

\frame{\titlepage}
\frame[allowframebreaks]
{
\frametitle{Summary}
\tableofcontents
}

\section{Introduction}
\subsection{What is OpenWrt}
\frame
{
\frametitle{What is OpenWrt}
\begin{itemize}
\item Minimalistic Busybox/Linux distribution GPL licensed
\item Set of Makefiles and tools building an embedded rootfs
\item Packages and repositories
\item Hardware donators, package maintainers and kernel hackers community
\end{itemize}
}

\subsection{Challenges}
\frame
{
\frametitle{Challenges}
\begin{itemize}
\item Lots of different hardware platform can run Linux
\item Lots of binary drivers
\item Strong memory footprint constraints
\item Hardware configuration and maintenance abstraction
\end{itemize}
}

\section{Design}
\subsection{What is OpenWrt}
\frame{
\frametitle{What is OpenWrt}
OpenWrt is a set of Makefiles and sources that :
\begin{itemize}
\item Builds the appropriate toolchain for your device
\item Compiles the appropriate kernel w/ patches and options
\item Provides software as IPKG packages
\item Builds the optionnal tools to flash your device
\end{itemize}
}

\subsection{Getting OpenWrt}
\frame{
\frametitle{Getting OpenWrt}
\begin{itemize}
\item Subversion repository at \url{https://svn.openwrt.org/openwrt}
\item Trac interface at \url{https://dev.openwrt.org/}
\item \textbf{trunk/} directory for development branch
\item \textbf{kamikaze} and \textbf{whiterussian} tags for stable versions
\item \textbf{packages/} directory for non-kernel related packages
\end{itemize}
}

\subsection{uClibc buildroot heritage}
\frame{
\frametitle{uClibc buildroot heritage}
OpenWrt was created in late 2003, and used a modified uClibc buildroot :
\begin{itemize}
\item Needed to be hacked to have support for a package maintainer
\item Lots of Makefile writting to add support for a software
\item Could use more Makefile templating
\end{itemize}
}

\subsection{Key directories}
\frame{
\frametitle{Key directories}
There are four key directories in the base:
\begin{itemize}
    \item \texttt{tools}
    \item \texttt{toolchain}
    \item \texttt{package}
    \item \texttt{target}
\end{itemize}
}

\subsection{Packages and external repositories}
\frame{
\frametitle{Packages and external repositories}
OpenWrt uses IPKG as the package format and manager.
\begin{itemize}
\item OpenWrt provides essential and kernel-related packages in \textbf{trunk/}
\item Other packages are split into a different repository \textbf{packages/} which subsections
\item Support for external repository can be done either in \textbf{/etc/ipkg.conf} or in the \textbf{feeds}
\end{itemize}
}

\subsection{Packages feeds}
\frame{
\frametitle{Packages feeds}
Package feeds allows you to provide your own set of packages :
\begin{itemize}
\item Source feeds can be fetched using svn
\item They appear as packages while running make menuconfig
\item User can choose to build them directly into the rootfs or as separate packages
\end{itemize}
}

\subsection{Toolchain}
\frame{
\frametitle{Toolchain}
\begin{itemize}
\item Switch between binutils, gcc, kernel-headers versions and uClibc tuples
\item Change compiler CFLAGS to tune/optimize size and features
\item Add custom patches to any of the above components
\end{itemize}
}

\frame{
\frametitle{Software architecture}
\subsection{Software architecture}
\begin{center}
\includegraphics[scale=0.5]{software-stack.eps}
\end{center}
}

\subsection{System and package configuration}
\frame{
\frametitle{System and package configuration}
OpenWrt uses UCI :
\begin{itemize}
\item Universal Configuration Interface
\item MIB-like structure (\textbf{config.section.key=value})
\item Born from the lack of NVRAM on all supported hardware
\end{itemize}
}

\frame{
\frametitle{UCI specificites}
\begin{itemize}
\item C library, easy to link with
\item program can interface with it to store their configuration
\item Config to MIB bridges to easily manage devices using SNMP
\item More configuration storage backends : LDAP, SQL
\item Web interface with integrated UCI support
\end{itemize}
}
\frame[containsverbatim]{
\frametitle{Add UCI configuration for your package}
For instance adding a new configuration file is as simple as creating a new file in \textbf{/etc/config/package} which should contain the following lines:

\begin{verbatim}
config      <type> ["<name>"]      # Section
    option  <name> "<value>"       # Option
\end{verbatim}
}

\section{Developing with OpenWrt}

\subsection{Creating packages}
\frame{
\frametitle{Creating packages}

Typical package directory layout :

\begin{itemize}
    \item \texttt{package/\textit{<name>}/Makefile}
    \item \texttt{package/\textit{<name>}/patches}
    \item \texttt{package/\textit{<name>}/files}
\end{itemize}
}

\subsection{Package source download}
\frame{
\frametitle{Package source download}
Support for different download methods :
\begin{itemize}
\item GIT
\item Subversion
\item CVS
\item HTTP
\item local source
\end{itemize}
}

\frame[containsverbatim]{
\frametitle{Example}
For instance, if you wish to checkout a particular revision of a package using Subversion, just define the following download method in your package Makefile

\begin{verbatim}
PKG_VER:=963
PKG_BRANCH:=batman-adv-userspace
PKG_VERSION:=r\$(PKG\_REV)
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_URL:=http://downloads.open-mesh.net/svn/batman/\\
trunk/
\end{verbatim}
}

\subsection{Creating kernel modules packages}
\frame{
\frametitle{Creating kernel modules packages}
Extending the kernel/rootfs with modules is really easy within OpenWrt :
\begin{itemize}
\item Build-time update the kernel configuration based on your kernel modules selection
\item External kernel modules are seen as packages, they use the KernelPackage instead
\end{itemize}
}

\subsection{Adding support for a new target}
\frame{
\frametitle{Adding support for a new target}
Adding support for a new kernel is made easy :
\begin{itemize}
\item Create \texttt{target/linux/\textit{<my target>}} directory
\item Define the kernel version you want to use
\item Add your additionnal patches in \texttt{target/linux/\textit{<my target>/}/patches}
\end{itemize}
}

\frame{
\frametitle{Copying architecture files}
You can also put your files in \texttt{target/linux/\textit{<my target>/}/files} :
\begin{itemize}
\item They will be copied at kernel build time
\item They should match the kernel directory structure \texttt{arch/mips/kernel/*}
\item You can directly version C files that are part of your drivers, architecture code ..
\item Only need to generate patches against Kconfig and Makefiles
\end{itemize}
}

\subsection{Using quilt}
\frame{
\frametitle{Using quilt}
OpenWrt natively supports using quilt :
\begin{itemize}
\item Refresh, create and update patches for any component
\item Test modifications with \texttt{make component/subcomponent/\textit{compile}}
\item Patches modifications are tracked with Subversion in your local copy
\end{itemize}
}

\subsection{Building an external kernel tree}
\frame{
\frametitle{Building an external kernel tree}
OpenWrt supports the building of an external kernel tree :
\begin{itemize}
\item Test a git kernel tree with your board code
\item Use the OpenWrt toolchain to cross-compile for other architectures
\item Test local modifications to a git subtree for later inclusion in mainline
\end{itemize}
}

\section{Deploying OpenWrt}

\subsection{Supported root filesystems}
\frame{
\frametitle{Supported root filesystems}
OpenWrt has currently support for :
\begin{itemize}
\item JFFS2, SquashFS, Ext2/3, CPIO, TGZ
\item With LZMA, GZIP, BZIP2 compression (when applicable)
\item Binary firmware generation tools (Broadcom, ZyXEL, Mikrotik ...)
\end{itemize}
}

\subsection{The Image builder}
\frame{
\frametitle{The Image builder}
\begin{itemize}
\item Deployment tools
\item Contains compiled toolchain and kernel for your architecture
\item Add custom files / IPKG packages to include in the rootfs
\end{itemize}
}

\subsection{The SDK}
\frame{
\frametitle{The SDK}
\begin{itemize}
\item Contains the compiled toolchain
\item Useful for packages upgrading and live testing
\item Package maintainers tool
\end{itemize}
}

\section{Becoming a developper}

\frame
{
\frametitle{Becoming a developper}
\begin{itemize}
\item Submit patches to the mainling-list \textbf{openwrt-devel@lists.openwrt.org}
\item Do as much test and bugreport as you can
\item Port OpenWrt to a new device / architecture
\item Write documentation
\end{itemize}
}

\frame{
\frametitle{Promoting OpenWrt}
\begin{itemize}
\item Ideal firmware for Wireless communities, Wireless ISPs ..
\item Fastest embedded platform to port a new architecture on
\item Abstracted network and Wireless configuration for all supported hardware
\end{itemize}
}


\frame
{
\frametitle{Thank you very much}
Thank you very much for your attention, question session is now open.
}

\end{document}
