From 0996948c27a1c3668bf36fa6ada78ed99da3b561 Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Thu, 9 Jan 2014 11:11:53 +0100 Subject: add elbe example and hands-on slides Signed-off-by: Manuel Traut --- distribution/elbe-example/Makefile | 9 + distribution/elbe-example/mini-incl-target.xml | 77 ++++ distribution/elbe-example/mini.xml | 42 ++ distribution/elbe-example/myapp/AUTHORS | 0 distribution/elbe-example/myapp/ChangeLog | 0 distribution/elbe-example/myapp/Makefile.am | 5 + distribution/elbe-example/myapp/NEWS | 0 distribution/elbe-example/myapp/README | 0 distribution/elbe-example/myapp/autogen.sh | 2 + distribution/elbe-example/myapp/configure.ac | 23 ++ distribution/elbe-example/myapp/myapp.c | 12 + .../elbe-example/myrepo/conf/distributions | 9 + distribution/elbe-example/myrepo/conf/updates | 6 + distribution/elbe-example/pres_elbe-example_en.tex | 448 +++++++++++++++++++++ 14 files changed, 633 insertions(+) create mode 100644 distribution/elbe-example/Makefile create mode 100644 distribution/elbe-example/mini-incl-target.xml create mode 100644 distribution/elbe-example/mini.xml create mode 100644 distribution/elbe-example/myapp/AUTHORS create mode 100644 distribution/elbe-example/myapp/ChangeLog create mode 100644 distribution/elbe-example/myapp/Makefile.am create mode 100644 distribution/elbe-example/myapp/NEWS create mode 100644 distribution/elbe-example/myapp/README create mode 100755 distribution/elbe-example/myapp/autogen.sh create mode 100644 distribution/elbe-example/myapp/configure.ac create mode 100644 distribution/elbe-example/myapp/myapp.c create mode 100644 distribution/elbe-example/myrepo/conf/distributions create mode 100644 distribution/elbe-example/myrepo/conf/updates create mode 100644 distribution/elbe-example/pres_elbe-example_en.tex diff --git a/distribution/elbe-example/Makefile b/distribution/elbe-example/Makefile new file mode 100644 index 0000000..d641258 --- /dev/null +++ b/distribution/elbe-example/Makefile @@ -0,0 +1,9 @@ +all: + for pdf in `ls -1 *.tex` ; do \ + TEXINPUTS=`pwd`/../..:.:..:$(TEXINPUTS) pdflatex $$pdf; \ + TEXINPUTS=`pwd`/../..:.:..:$(TEXINPUTS) pdflatex $$pdf; \ + done + +clean: + rm -f *.aux *.log *.pdf *.log *.snm *.toc *.vrb *.nav *.out + diff --git a/distribution/elbe-example/mini-incl-target.xml b/distribution/elbe-example/mini-incl-target.xml new file mode 100644 index 0000000..fcb8181 --- /dev/null +++ b/distribution/elbe-example/mini-incl-target.xml @@ -0,0 +1,77 @@ + + + mini xml + 1 + + minimal target rfs including a simple app + buildenv to build the simple app + + armel + + ftp.debian.org + /debian + http + + + http://debian.linutronix.de/elbe wheezy main + + + http://LOCALMACHINE/debian wheezy main + http://LOCALMACHINE/debian wheezy main + + + + wheezy + + elbe-bootstrap + + build-essential + debhelper + devscripts + autotools-dev + automake + + + + + mini + linutronix + foo + ttyAMA0,115200 + + + rootfs.tar.gz + + + + + my.img + 200MiB + + remain + + + + + + + + / + + ext4 + -i 0 + + + + + + + var/cache/apt/archives/*.deb + echo "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100" >> etc/inittab + + + bash + myapp + + + diff --git a/distribution/elbe-example/mini.xml b/distribution/elbe-example/mini.xml new file mode 100644 index 0000000..fe1d65f --- /dev/null +++ b/distribution/elbe-example/mini.xml @@ -0,0 +1,42 @@ + + + mini xml + 1 + + optimal to use as buildenv + + armel + + ftp.debian.org + /debian + http + + + http://debian.linutronix.de/elbe wheezy main + + + + wheezy + + elbe-bootstrap + + build-essential + debhelper + devscripts + autotools-dev + automake + + + + + mini + linutronix + foo + + + + bash + + + diff --git a/distribution/elbe-example/myapp/AUTHORS b/distribution/elbe-example/myapp/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/distribution/elbe-example/myapp/ChangeLog b/distribution/elbe-example/myapp/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/distribution/elbe-example/myapp/Makefile.am b/distribution/elbe-example/myapp/Makefile.am new file mode 100644 index 0000000..73ff4e8 --- /dev/null +++ b/distribution/elbe-example/myapp/Makefile.am @@ -0,0 +1,5 @@ +bin_PROGRAMS = myapp +myapp_SOURCES = myapp.c + +EXTRA_DIST = debian/changelog debian/compat debian/control debian/rules \ + debian/source/format diff --git a/distribution/elbe-example/myapp/NEWS b/distribution/elbe-example/myapp/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/distribution/elbe-example/myapp/README b/distribution/elbe-example/myapp/README new file mode 100644 index 0000000..e69de29 diff --git a/distribution/elbe-example/myapp/autogen.sh b/distribution/elbe-example/myapp/autogen.sh new file mode 100755 index 0000000..9088512 --- /dev/null +++ b/distribution/elbe-example/myapp/autogen.sh @@ -0,0 +1,2 @@ +#!/bin/bash +autoreconf -sif diff --git a/distribution/elbe-example/myapp/configure.ac b/distribution/elbe-example/myapp/configure.ac new file mode 100644 index 0000000..109e8ea --- /dev/null +++ b/distribution/elbe-example/myapp/configure.ac @@ -0,0 +1,23 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([myapp], [1.0], [manut@linutronix.de]) +AM_INIT_AUTOMAKE([-Wall -Werror]) +AC_CONFIG_SRCDIR([myapp.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT diff --git a/distribution/elbe-example/myapp/myapp.c b/distribution/elbe-example/myapp/myapp.c new file mode 100644 index 0000000..4e39438 --- /dev/null +++ b/distribution/elbe-example/myapp/myapp.c @@ -0,0 +1,12 @@ +#include +#include + +int main (int argc, char **argv) +{ + while (1) { + printf ("Hello ELBE\n"); + sleep (1); + } + + return 0; +} diff --git a/distribution/elbe-example/myrepo/conf/distributions b/distribution/elbe-example/myrepo/conf/distributions new file mode 100644 index 0000000..f6cb43a --- /dev/null +++ b/distribution/elbe-example/myrepo/conf/distributions @@ -0,0 +1,9 @@ +Origin: myrepo +Label: myrepo +Suite: stable +Codename: wheezy +Update: - myremoterepo +Version: +Architectures: i386 amd64 armel source +Components: main +Description: my debian packages diff --git a/distribution/elbe-example/myrepo/conf/updates b/distribution/elbe-example/myrepo/conf/updates new file mode 100644 index 0000000..8430306 --- /dev/null +++ b/distribution/elbe-example/myrepo/conf/updates @@ -0,0 +1,6 @@ +Name: myremoterepo +Method: http://localhost/debian +Components: main +Architectures: i386 amd64 source +VerifyRelease: blindtrust +IgnoreRelease: yes diff --git a/distribution/elbe-example/pres_elbe-example_en.tex b/distribution/elbe-example/pres_elbe-example_en.tex new file mode 100644 index 0000000..eb64782 --- /dev/null +++ b/distribution/elbe-example/pres_elbe-example_en.tex @@ -0,0 +1,448 @@ +\input{configpres} + +\lstset{language=c} + +\title{ELBE example} +\maketitle + + +\subsection{What will be done?} + +\begin{frame} +\frametitle{Goal} +\begin{itemize} +\item generate an ELBE buildenv +\item generate a software component and manage it with debian tools +\item build own software component inside the ELBE buildenv +\item include own application in target RFS +\item define a stripped target RFS +\end{itemize} +\end{frame} + +\subsection{generate a buildenv} + +\begin{frame}[fragile] +\frametitle{minimal XML file} +\begin{lstlisting} + + + mini xml + 1 + + optimal to use as buildenv + + armel + + ftp.debian.org + /debian + http + + + http://debian.linutronix.de/elbe wheezy main + + + +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{minimal XML file} +\begin{lstlisting} + wheezy + + elbe-bootstrap + + build-essential + debhelper + devscripts + autotools-dev + automake + + + + + mini + linutronix + foo + + + + bash + + + +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{create and build mini.xml} +\begin{lstlisting} +$ elbe create --directory=./buildenv mini.xml +$ cd buildenv +$ make +\end{lstlisting} +\end{frame} + +\subsection{build an own application} + +\begin{frame}[fragile] +\frametitle{myapp.c} +\begin{lstlisting} +$ mkdir myapp +$ cd myapp +$ $EDITOR myapp.c +\end{lstlisting} +\begin{lstlisting} +#include +#include + +int main (int argc, char **argv) +{ + while (1) { + printf ("Hello ELBE\n"); + sleep (1); + } + + return 0; +} +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{use autotools} +\begin{lstlisting} +$ $EDITOR Makefile.am +\end{lstlisting} +\begin{lstlisting} +bin_PROGRAMS = myapp +myapp_SOURCES = myapp.c +\end{lstlisting} +\begin{lstlisting} +$ autoscan +$ mv configure.scan configure.ac +$ rm autoscan.log +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle {use autotools} +\begin{lstlisting} +$ $EDITOR configure.ac +\end{lstlisting} +\begin{lstlisting} +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([myapp], [1.0], [manut@linutronix.de]) +AM_INIT_AUTOMAKE([-Wall -Werror]) +AC_CONFIG_SRCDIR([myapp.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{use autotools} +\begin{lstlisting} +$ touch NEWS README AUTHORS ChangeLog +$ $EDITOR autogen.sh +\end{lstlisting} +\begin{lstlisting} +#!/bin/bash +automake --add-missing +autoreconf -sif +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{use autotools} +\begin{lstlisting} +$ chmod +x autogen.sh +$ ls -lh +insgesamt 12K +-rw-r--r-- 1 local local 0 Jan 7 09:45 AUTHORS +-rwxr-xr-x 1 local local 28 Jan 7 09:24 autogen.sh +-rw-r--r-- 1 local local 0 Jan 7 09:45 ChangeLog +-rw-r--r-- 1 local local 496 Jan 7 09:20 configure.ac +-rw-r--r-- 1 local local 35 Jan 7 09:35 Makefile.am +-rw-r--r-- 1 local local 143 Jan 7 09:18 myapp.c +-rw-r--r-- 1 local local 0 Jan 7 09:45 NEWS +-rw-r--r-- 1 local local 0 Jan 7 09:45 README +# these files may be added to your vcs +$ ./autogen.sh +$ ./configure +$ make +$ ./myapp +Hello ELBE +Hello ELBE +Hello ELBE +^C +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{debianize myapp} +\begin{lstlisting} +$ dh_make -n -p myapp_1.0 -e manut@linutronix.de +$ cd debian +$ rm *.ex *.EX docs README* copyright +$ $EDITOR changelog +\end{lstlisting} +\begin{lstlisting} +myapp (1.0) stable; urgency=low + + * Initial Release. + + -- Manuel Traut Tue, 07 Jan 2014 10:20:20 +0100 +\end{lstlisting} +\begin{lstlisting} +$ ls -lh +insgesamt 16K +-rw-r--r-- 1 local local 122 Jan 7 10:20 changelog +-rw-r--r-- 1 local local 2 Jan 7 10:20 compat +-rw-r--r-- 1 local local 517 Jan 7 10:20 control +-rwxr-xr-x 1 local local 135 Jan 7 10:20 rules +drwxr-xr-x 2 local local 19 Jan 7 10:20 source +# these files may be added to your vcs +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{debianize myapp} +\begin{lstlisting} +$ cd .. +$ $EDITOR Makefile.am +\end{lstlisting} +\begin{lstlisting} +bin_PROGRAMS = myapp +myapp_SOURCES = myapp.c + +EXTRA_DIST = debian/changelog debian/compat debian/control debian/rules \ + debian/source/format +\end{lstlisting} +\begin{lstlisting} +$ dpkg-buildpackage +$ ls .. +myapp myapp_1.0_i386.deb +myapp_1.0.dsc myapp_1.0.tar.gz +myapp_1.0_i386.changes +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{host myapp in a debian repository} +\begin{lstlisting} +$ cd .. +$ mkdir -p myrepo/conf +$ cd myrepo +$ $EDITOR conf/distributions +\end{lstlisting} +\begin{lstlisting} +Origin: myrepo +Label: myrepo +Suite: stable +Codename: wheezy +Update: - myremoterepo +Version: +Architectures: i386 amd64 source +Components: main +Description: my debian packages +\end{lstlisting} +\begin{lstlisting} +$ $EDITOR conf/updates +\end{lstlisting} +\begin{lstlisting} +Name: myremoterepo +Method: http://localhost/debian +Components: main +Architectures: i386 amd64 armel source +VerifyRelease: blindtrust +IgnoreRelease: yes +\end{lstlisting} +\end{frame} + + +\begin{frame}[fragile] +\frametitle{host myapp in a debian repository} +\begin{lstlisting} +$ reprepro include wheezy ../myapp_1.0_i386.changes +$ sudo mkdir /var/www/ +$ sudo rsync -av --exclude=db --exclude=conf * /var/www/debian/ +\end{lstlisting} +\end{frame} + + +\begin{frame}[fragile] +\frametitle{build debian package inside the buildenv} +\begin{lstlisting} +$ cd ../buildenv +$ make run-con +# login into buildenv +$ echo 'deb-src http://10.0.2.2/debian wheezy main' >> /etc/apt/sources.list +$ apt-get update +$ apt-get source myapp +$ cd myapp-1.0 +$ ./autogen.sh +$ dpkg-buildpackage -b +$ scp ../myapp*.changes ../myapp*.deb 10.0.2.2:/tmp +$ dpkg -i ../myapp*.deb +\end{lstlisting} +\end{frame} + + +\begin{frame}[fragile] +\frametitle{add myapp armel package to the repo} +\begin{lstlisting} +$ cd ../myrepo +$ reprepro include wheezy /tmp/myapp_1.0_armel.changes +$ sudo rsync -av --exclude=db --exclude=conf * /var/www/debian/ +\end{lstlisting} +\end{frame} + + +\subsection{include own application in target RFS} + +\begin{frame}[fragile] +\frametitle{create target image and add myapp} +\begin{lstlisting} +$ cd .. +$ $EDIT mini.xml +\end{lstlisting} +\begin{lstlisting} + + + mini xml + 1 + + minimal target rfs including a simple app + buildenv to build the simple app + + armel + + ftp.debian.org + /debian + http + + + http://debian.linutronix.de/elbe wheezy main + + + http://LOCALMACHINE/debian wheezy main + http://LOCALMACHINE/debian wheezy main + + + +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{create target image and add myapp} +\begin{lstlisting} + wheezy + + elbe-bootstrap + + build-essential + debhelper + devscripts + autotools-dev + automake + + + + + mini + linutronix + foo + + var/cache/apt/archives/*.deb + + + bash + myapp + + + +\end{lstlisting} +\end{frame} + +\subsection{define a striped target RFS} +\begin{frame}[fragile] +\frametitle{set elbe mode and define images} +\begin{lstlisting} +... + + mini + linutronix + foo + ttyAMA0,115200 + + + rootfs.tar.gz + + + + + my.img + 200MiB + + remain + + + + + + + + / + + ext4 + -i 0 + + + + + + + var/cache/apt/archives/*.deb + echo "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100" >> etc/inittab + + + bash + myapp + + +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{build target rfs} +\begin{lstlisting} +$ elbe create mini.xml --directory=./target +$ cd target +$ make + +\input{tailpres} -- cgit v1.2.3