From 284629b6bccaaf2417934c46f7c21b85b6070304 Mon Sep 17 00:00:00 2001
From: Manuel Traut <manut@linutronix.de>
Date: Mon, 1 Sep 2014 13:28:51 +0200
Subject: yocto: rework layout

Signed-off-by: Manuel Traut <manut@linutronix.de>
---
 .../yocto-advanced/pres_yocto-advanced.tex         | 188 +++++++++++++++++++--
 1 file changed, 173 insertions(+), 15 deletions(-)

(limited to 'distribution/yocto-advanced/pres_yocto-advanced.tex')

diff --git a/distribution/yocto-advanced/pres_yocto-advanced.tex b/distribution/yocto-advanced/pres_yocto-advanced.tex
index 2edfe36..a0283fc 100644
--- a/distribution/yocto-advanced/pres_yocto-advanced.tex
+++ b/distribution/yocto-advanced/pres_yocto-advanced.tex
@@ -12,7 +12,7 @@
 \item Define a distribution
 \item Create an image
 \item Writing recipes
-\item Yocto \& ELBE combined
+\item Yocto \& ELBE combined?
 \end{itemize}
 \end{frame}
 
@@ -71,12 +71,17 @@ meta-mylayer
 is useful to debug relations between different layers, options are:
 \begin{description}
 \item [show-layers] shows the current configured layers
+		\pause
 \item [show-recipes] lists available recipes and the layers that provide them.
+		\pause
 \item [show-overlayed] lists overlayed recipes
+		\pause
 \item [show-appends] lists .bbappend files
 	and the recipe files to which they apply
+		\pause
 \item [show-cross-depends] lists dependency relationships
 	between recipes that cross layer boundaries
+		\pause
 \item [flatten] flattens the layer configuration
 	into a separate output directory.
 \end{description}
@@ -87,6 +92,7 @@ is useful to debug relations between different layers, options are:
 \begin{itemize}
 	\item It is possible for a recipe with a lower version number PV in a layer
 that has a higher priority to take precedence.
+		\pause
 	\item Also, the layer priority does not currently affect the precedence
 order of .conf or .bbclass files. Future versions of BitBake might address this.
 \end{itemize}
@@ -100,21 +106,24 @@ poky % git clone git://git.yoctoproject.org/meta-ti
 poky % git branch -r
 poky % git checkout <RELEASE>
 \end{verbatim}
+		\pause
 have a look at it's dependencies
 \begin{verbatim}
 poky % cat meta-ti/conf/layer.conf | grep LAYERDEPENDS
 LAYERDEPENDS_ti = "core"
 \end{verbatim}
-and retrieve them also (if not yet done).
-
-If added a new layer, check its dependencies again.
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{get example layer for trainig}
+		\pause
+and retrieve them also
+\begin{verbatim}
+poky % git clone -b daisy git://git.yoctoproject.org/meta-fsl-arm
+\end{verbatim}
+		\pause
+check dependencies again
 \begin{verbatim}
 poky % git clone /home/devel/yocto/meta-mini
 \end{verbatim}
+		\pause
+\dots no more dependencies?! \dots OK - finished.
 \end{frame}
 
 \begin{frame}[fragile]
@@ -203,18 +212,31 @@ xserver-xorg:
 is used to configure
 \begin{itemize}
 	\item the target machine
+		\pause
 	\item paths
+		\pause
 	\item the used distribution
+		\pause
 	\item package formats
+		\pause
 	\item arch of developer machine
+		\pause
 	\item additional image features
+		\pause
 	\item use additional classes
+		\pause
 	\item enable testing
+		\pause
 	\item devshell terminal
+		\pause
 	\item patch resolver
+		\pause
 	\item disk monitoring
+		\pause
 	\item sstate mirrors
+		\pause
 	\item qemu configuration
+		\pause
 	\item incompatible licenses, e.g. INCOMPATIBLE\_LICENSE = “GPLv3”
 \end{itemize}
 \end{frame}
@@ -226,6 +248,7 @@ to get a list of currently available machines configs:
 poky/build-ti % grep -r '@NAME' ../meta*/conf/machine
 \end{verbatim}
 beaglebone.conf - seems to be the one for our bord, so set
+imx6qsabrelite.conf - seems to be the one for our bord, so set
 \begin{verbatim}
 MACHINE ??= "beaglebone"
 \end{verbatim}
@@ -258,6 +281,27 @@ use
 \begin{verbatim}
 ls ../*/*/images/
 \end{verbatim}
+to get a list of predefined images; however none of them fits my needs\dots
+		\pause
+\begin{verbatim}
+poky/build-fsl % cd ..
+poky % git clone -b daisy https://github.com/Freescale/meta-fsl-demos.git
+poky % git clone -b daisy git://git.openembedded.org/meta-openembedded
+poky % cd -
+\end{verbatim}
+		\pause
+and edit conf/bblayers.conf, to match
+\begin{verbatim}
+BBLAYERS ?= " \
+  /home/devel/poky/meta \
+  /home/devel/poky/meta-yocto \
+  /home/devel/poky/meta-yocto-bsp \
+  /home/devel/poky/meta-fsl-arm \
+  /home/devel/poky/meta-fsl-arm-extra \
+  /home/devel/poky/meta-openembedded/meta-oe \
+  /home/devel/poky/meta-fsl-demos \
+  "
+\end{verbatim}
 \end{frame}
 
 \begin{frame}[fragile]
@@ -277,6 +321,7 @@ ERROR: No new tasks can be executed since
        the disk space monitor action is "STOPTASKS"!
 \end{verbatim}
 what happened??
+		\pause
 \begin{verbatim}
 poky/build-ti % df -h
 Filesystem      Size  Used Avail Use% Mounted on
@@ -286,6 +331,7 @@ poky/build-ti % du -sm .
 poky/build-ti % du -sm ../build
 29172   ../build/
 \end{verbatim}
+		\pause
 \dots so the solution is to cleanup the disk and run
 \begin{verbatim}
 poky/build-ti % bitbake qt4e-demo-image
@@ -314,10 +360,12 @@ ERROR: Task 1105 (/home/local/src/poky/meta-ti-arm/
   gpu-viv-bin-mx6q_3.10.17-1.0.0-hfp.bb, do_unpack) failed
   with exit code '1'
 \end{verbatim}
+		\pause
 to solve this issue:
 \begin{verbatim}
 poky/build-ti % echo 'ACCEPT_FSL_EULA = "1"' >> conf/local.conf
 \end{verbatim}
+		\pause
 \dots and run
 \begin{verbatim}
 poky/build-ti % bitbake qt4e-demo-image
@@ -404,7 +452,9 @@ BBLAYERS ?= " \
 \frametitle{why define a distribution?}
 \begin{itemize}
 \item naming of the toolchain (codenames, vendor)
+		\pause
 \item version numbers
+		\pause
 \item enable default features
 \end{itemize}
 \end{frame}
@@ -413,9 +463,12 @@ BBLAYERS ?= " \
 \frametitle{distro features: file-systems}
 \begin{description}
 \item[cramfs] CramFS support
+		\pause
 \item[ext2] tools for supporting for devices with internal HDD/Microdrive
 	for storing files (instead of Flash only devices)
+		\pause
 \item[nfs] NFS client support (for mounting NFS exports on device)
+		\pause
 \item[smbfs] SMB networks client support
 	(for mounting Samba/Microsoft Windows shares on device)
 \end{description}
@@ -426,9 +479,13 @@ BBLAYERS ?= " \
 \begin{description}
 \item[alsa] ALSA/sound support
 	(OSS compatibility kernel modules installed if available)
+		\pause
 \item[bluetooth] bluetooth support (integrated BT only)
+		\pause
 \item[irda] IrDA support
+		\pause
 \item[wifi] WiFi support (integrated only).
+		\pause
 \item[keyboard] keyboard support (e.g. keymaps will be loaded during boot)
 \end{description}
 \end{frame}
@@ -439,6 +496,7 @@ BBLAYERS ?= " \
 \item[opengl] the Open Graphics Library, which is a cross-language,
 	multi-platform application programming interface used for rendering two
 	and three-dimensional graphics
+		\pause
 \item[directfb] DirectFB support
 \end{description}
 \end{frame}
@@ -447,7 +505,9 @@ BBLAYERS ?= " \
 \frametitle{distro features: networking}
 \begin{description}
 \item[ipsec] IPSec support
+		\pause
 \item[ipv6] IPv6 support
+		\pause
 \item[ppp] PPP dialup support
 \end{description}
 \end{frame}
@@ -456,8 +516,11 @@ BBLAYERS ?= " \
 \frametitle{distro features: bus support}
 \begin{description}
 \item[pci] PCI bus support
+		\pause
 \item[pcmcia] PCMCIA/CompactFlash support
+		\pause
 \item[usbgadget] USB Gadget Device support (for USB networking/serial/storage)
+		\pause
 \item[usbhost] USB Host support
 	(allows to connect external keyboard, mouse, storage, network etc)
 \end{description}
@@ -469,8 +532,10 @@ BBLAYERS ?= " \
 \item[systemd] support for this init manager, which is a full replacement of
 	for init with parallel starting of services, reduced shell overhead,
 	and other features. This init manager is used by many distributions
+		\pause
 \item[wayland] the Wayland display server protocol
 	and the library that supports it
+		\pause
 \item[x11] X server and libraries
 \end{description}
 \end{frame}
@@ -508,23 +573,37 @@ it can be used, to simplify image definitions
 \begin{frame}[fragile]
 \frametitle{minimal distribution}
 distros are defined in a layer, e.g.
+
+meta-linutronix/conf/distro/mini.conf:
+\begin{verbatim}
 meta-mini/conf/distro/mini.conf:
 DISTRO = "mini"
 DISTRO_NAME = "mini 1.0 (for foo devices)"
 DISTRO_VERSION = "1.0"
 DISTRO_CODENAME = "mal"
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\begin{verbatim}
 SDK_VENDOR = "-linutronix"
 SDK_VERSION := "${@'${DISTRO_VERSION}'}"
+SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${IMAGE_BASENAME}-${TUNE_PKGARCH}"
+SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}"
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\begin{verbatim}
 MAINTAINER = "Manuel Traut <manut@linutronix.de>"
 TARGET_VENDOR = "-linutronix"
 LOCALCONF_VERSION = "1"
 LAYER_CONF_VERSION ?= "6"
 DISTRO_FEATURES ?= "opengl ${DISTRO_FEATURES_DEFAULT} ${DISTRO_FEATURES_LIBC}"
 DISTRO_FEATURES_append = " systemd"
-SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${IMAGE_BASENAME}-${TUNE_PKGARCH}"
-SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}"
 TCLIBCAPPEND = ""
-
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\begin{verbatim}
 PREMIRRORS ??= "\
 bzr://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
 cvs://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
@@ -534,7 +613,10 @@ osc://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
 p4://.*/.*    http://downloads.yoctoproject.org/mirror/sources/ \n \
 svk://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n \
 svn://.*/.*   http://downloads.yoctoproject.org/mirror/sources/ \n"
-
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\begin{verbatim}
 MIRRORS =+ "\
 ftp://.*/.*      http://downloads.yoctoproject.org/mirror/sources/ \n \
 http://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \n \
@@ -543,7 +625,10 @@ https://.*/.*    http://downloads.yoctoproject.org/mirror/sources/ \n"
 CONNECTIVITY_CHECK_URIS ?= " \
              https://eula-downloads.yoctoproject.org/index.php \
              http://bugzilla.yoctoproject.org/report.cgi"
-
+\end{verbatim}
+\end{frame}
+\begin{frame}[fragile]
+\begin{verbatim}
 SANITY_TESTED_DISTROS ?= " \
             Ubuntu-14.04 \n \
             Debian-7.0 \n \
@@ -577,6 +662,7 @@ DISTRO ?= "mini"
 \subsection{Creating images}
 \begin{frame}[fragile]
 \frametitle{based on core-image class}
+build image with ssh support
 \begin{verbatim}
 poky/build-ti % bitbake-layers show-recipes | grep ssh
 Parsing recipes..done.
@@ -585,12 +671,14 @@ openssh:
 packagegroup-core-ssh-dropbear:
 packagegroup-core-ssh-openssh:
 \end{verbatim}
+\pause
 create the file
 'meta-mini/recipes-bsp/mini-image/mini-image.bb'
 \begin{verbatim}
 IMAGE_INSTALL += "openssh"
 inherit core-image
 \end{verbatim}
+\pause
 to build the image, use:
 \begin{verbatim}
 poky/build-ti % bitbake mini-image
@@ -649,6 +737,56 @@ UBOOT_LOADADDRESS = "0x80008000"
 \end{verbatim}
 \end{frame}
 
+\begin{frame}[fragile]
+\frametitle{user and group configuration}
+use this in an image recipe:
+\begin{verbatim}
+inherit extrausers
+EXTRA_USERS_PARAMS = "\
+    useradd -p '' tester; \
+    groupadd developers; \
+    userdel nobody; \
+    groupdel -g video; \
+    groupmod -g 1020 developers; \
+    usermod -s /bin/sh tester; \
+    "
+\end{verbatim}
+or the useradd class, for an example see useradd-example.bb
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{external sources}
+e.g. for a heavily customized kernel
+\begin{itemize}
+\item kernel source directory on the development machine
+\pause
+\item inherit externalsrc class
+\pause
+\item set EXTERNALSRC variable to point to your external source code
+\end{itemize}
+
+this local.conf extension:
+\begin{verbatim}
+INHERIT += "externalsrc"
+EXTERNALSRC_pn-myrecipe = "/some/path/to/your/source/tree"
+\end{verbatim}
+overrides the SOURCE\_URI of pn-myrecipe.bb
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{blacklist packages}
+To blacklist a package, inherit the blacklist.bbclass globally and set
+PNBLACKLIST for each recipe you wish to blacklist.
+
+
+Specify the PN value as a variable flag (varflag) and provide a reason,
+which is reported, if the package is requested to be built as the value:
+\begin{verbatim}
+INHERIT += "blacklist"
+PNBLACKLIST[exoticware] = "Not supported by our organization."
+\end{verbatim}
+\end{frame}
+
 \subsection{Writing recipes}
 \begin{frame}[fragile]
 \frametitle{adding a kernel}
@@ -673,8 +811,6 @@ KERNEL_DEVICETREE_beaglebone-black = \
 "arch/arm/boot/dts/am335x-boneblack.dts"
 
 S = "${WORKDIR}/linux-${PV}"
-
-SRC_URI = " \
 https://www.kernel.org/pub/linux/kernel/v3.x/linux-${PV}.tar.xz \
 file://defconfig \
 "
@@ -726,9 +862,12 @@ PREFERRED\_VERSION\_virtual/kernel = "3.18.5"
 \frametitle{Preferences}
 \begin{itemize}
 \item by default, files have a preference of "0"
+\pause
 \item setting DEFAULT\_PREFERENCE to "-1" makes the recipe unlikely to be used
 	unless it is explicitly referenced.
+\pause
 \item setting DEFAULT\_PREFERENCE to "1" makes it likely the recipe is used
+\pause
 \item PREFERRED\_VERSION overrides any DEFAULT\_PREFERENCE setting
 \end{itemize}
 \end{frame}
@@ -883,7 +1022,9 @@ IMAGE_FSTYPES += "sdcard"
 \frametitle{adding an own application}
 \begin{itemize}
 	\item recipe already available? check http://layers.openembedded.org
+\pause
 	\item look for a similar recipe
+\pause
 	\item proper bbclass available?
 \end{itemize}
 on the next slides, we have a look what is useful for very simple applications,
@@ -954,6 +1095,7 @@ inherit autotools
 │   └── hellocm-0.1.tar.bz2
 └── hellocm_0.1.bb
 \end{verbatim}
+\pause
 \begin{verbatim}
 DESCRIPTION = "hellocm cmake example"
 LICENSE = "MIT"
@@ -975,6 +1117,7 @@ FILES_{PN} = "${bindir}/hellocm"
 │   └── helloqt-1.0.tar.bz2
 └── helloqt_1.0.bb
 \end{verbatim}
+\pause
 \begin{verbatim}
 DESCRIPTION = "helloqt QT example"
 LICENSE = "MIT"
@@ -994,11 +1137,14 @@ do_install() {
 \frametitle{adding a bootscript}
 \begin{itemize}
 	\item add 'systemd' to DISTRO\_FEATURES
+\pause
 	\item inherit from systemd.bbclass
+\pause
 	\item your package needs to set SYSTEMD\_SERVICE variable; e.g.
 		\begin{verbatim}
 SYSTEMD_SERVICE_${PN} = "connman.service"
 		\end{verbatim}
+\pause
 	\item to disable the service, set  SYSTEMD\_AUTO\_ENABLE to 'disable'
 \end{itemize}
 \end{frame}
@@ -1049,6 +1195,18 @@ which is reported, if the package is requested to be built as the value:
 INHERIT += "blacklist"
 PNBLACKLIST[exoticware] = "Not supported by our organization."
 \end{verbatim}
+
+\subsection{Resume}
+\begin{frame}
+	\begin{itemize}
+		\item Yocto is a huge collection of tools
+		\pause
+		\item Bitbake can be used to create Images
+		\pause
+		\item The quality of the Images depend on the maintainance of the Layers
+		\pause
+		\item Only build your own distribution if you really need to!
+	\end{itemize}
 \end{frame}
 
 \input{tailpres}
-- 
cgit v1.2.3

