From 40929aee684996ccdedb82b1fed73ccb0ce6f2e3 Mon Sep 17 00:00:00 2001
From: Manuel Traut <manut@linutronix.de>
Date: Fri, 29 Aug 2014 14:35:27 +0200
Subject: yocto: describe adding an own kernel

Signed-off-by: Manuel Traut <manut@linutronix.de>
---
 .../yocto-advanced/pres_yocto-advanced.tex         | 195 +++++++++++++++------
 1 file changed, 145 insertions(+), 50 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 f7b3bec..44d8997 100644
--- a/distribution/yocto-advanced/pres_yocto-advanced.tex
+++ b/distribution/yocto-advanced/pres_yocto-advanced.tex
@@ -10,14 +10,33 @@
 \item Build a predefined image (sabrelite)
 \item Creating a layer
 \item Define a distribution
+\item Create an image
 \item Writing recipes
-\item Create images
 \item Yocto \& ELBE combined
 \end{itemize}
 \end{frame}
 
 \subsection{Using BSP layers}
 
+\begin{frame}[fragile]
+\frametitle{folder layout}
+\begin{verbatim}
+meta-mylayer
++ conf
+|  + layer.conf
++ classes
+|  + class1.bbclass
+|  + class2.bbclass
++ recipes-category1
+|  + package-1
+|      + package-1.bb
+|  + package-2
+|      + package-2.bb
++ recipes-category2
+| ..
+\end{verbatim}
+\end{frame}
+
 \begin{frame}[fragile]
 	\frametitle{meta-*/conf/layer.conf}
 	each layer needs a configuration file
@@ -47,7 +66,6 @@
 	\end{itemize}
 \end{frame}
 
-
 \begin{frame}
 \frametitle{bitbake-layers}
 is useful to debug relations between different layers, options are:
@@ -104,7 +122,7 @@ poky/build-fsl %
 \end{verbatim}
 \end{frame}
 
-\subsection{Build configuration}
+\subsection{Build a predefined image}
 \begin{frame}
 \frametitle{overview}
 builds are configured using two configuration files
@@ -196,11 +214,10 @@ is used to configure
 	\item disk monitoring
 	\item sstate mirrors
 	\item qemu configuration
-	\item layer priorities
+	\item incompatible licenses, e.g. INCOMPATIBLE\_LICENSE = “GPLv3”
 \end{itemize}
 \end{frame}
 
-\subsection{sabrelite configuration}
 \begin{frame}[fragile]
 \frametitle{configure the machine}
 to get a list of currently available machines configs:
@@ -320,8 +337,20 @@ poky/build-fsl % bitbake qt-in-use-image
 again.
 \end{frame}
 
+\begin{frame}[fragile]
+\frametitle{flashing the image}
+if the build is completed the image can be transfered to a sdcard:
+\begin{verbatim}
+poky/build-fsl % sudo dd \
+if=tmp/deploy/images/imx6qsabrelite/qt-in-use-image-imx6qsabrelite.sdcard \
+of=/dev/mmcblk0 bs=1M
+412+0 records in
+412+0 records out
+432013312 bytes (432 MB) copied, 90.4824 s, 4.8 MB/s
+\end{verbatim}
+\end{frame}
 
-\subsection{creating a layer}
+\subsection{Creating a layer}
 \begin{frame}[fragile]
 \frametitle{with yocto helper script}
 \begin{verbatim}
@@ -346,7 +375,7 @@ poky/meta-linutronix % git commit -sam 'inital version'
 \end{verbatim}
 \end{frame}
 
-\subsection{define a distro}
+\subsection{Define a distribution}
 \begin{frame}
 \frametitle{why define a distribution?}
 \begin{itemize}
@@ -507,11 +536,115 @@ DISTRO ?= "linutronix"
 \end{verbatim}
 \end{frame}
 
-\begin{frame}
+\subsection{Creating images}
+\begin{frame}[fragile]
+\frametitle{based on core-image class}
+\begin{verbatim}
+poky/build-fsl % bitbake-layers show-recipes | grep ssh
+Parsing recipes..done.
+libssh:
+openssh:
+packagegroup-core-ssh-dropbear:
+packagegroup-core-ssh-openssh:
+\end{verbatim}
+create the file
+'meta-linutronix/recipes-bsp/linutronix-image/linutronix-image.bb'
+\begin{verbatim}
+IMAGE_INSTALL += "openssh"
+inherit core-image
+\end{verbatim}
+to build the image, use:
+\begin{verbatim}
+poky/build-fsl % bitbake linutronix-image
+\end{verbatim}
+\end{frame}
+
+\begin{frame}[fragile]
+	\frametitle{image features}
+t.b.d. use IMAGE\_FEATURES
+% http://www.yoctoproject.org/docs/1.6/ref-manual/ref-manual.html#ref-features-image
+
+% http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html#usingpoky-extend-customimage-imagefeatures
+\end{frame}
+
+\subsection{Writing recipes}
+\begin{frame}[fragile]
 \frametitle{adding a kernel}
-bla
+create the file 'meta-linutronix/recipes-bsp/linux-sabrelite/linux-sabrelite\_3.16.bb':
+\begin{verbatim}
+SECTION = "kernel"
+DESCRIPTION = "Linux 3.16 for sabrelite"
+LICENSE = "GPLv2"
+KERNEL_IMAGETYPE = "uImage"
+
+inherit kernel
+require recipes-kernel/linux/linux-dtb.inc
+require recipes-kernel/linux/setup-defconfig.inc
+
+COMPATILBE_MACHINE = "imx6qsabrelite"
+KERNEL_DEVICETREE_imx6qsabrelite = "arch/arm/boot/dts/imx6q-sabrelite.dts"
+
+S = "${WORKDIR}/git
+BRANCH = "master"
+SRCREV = "19583ca584d6f574384e17fe7613dfaeadcdc4a6"
+PV = "3.16"
+# cause a rebuild on new kernel version
+MACHINE_KERNEL_PR_append = "d+gitr${SRCPV}"
+SRC_URI = " \
+git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux;protocol=git;branch=${BRANCH} \
+file://defconfig \
+"
+KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
+# to modify cmdline, use APPEND += ""
+\end{verbatim}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{adding a defconfig}
+copy your .config file to
+'meta-linutronix/recipes-bsp/linux-sabrelite/files/imx6qsabrelite/defconfig'
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{using a specific kernel}
+add
+\begin{verbatim}
+PREFERRED_PROVIDER_virtual/kernel = "linux-sabrelite"
+\end{verbatim}
+to meta-linutronix/conf/distro/linutronix.conf
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{Providers}
+\begin{verbatim}
+--8<- -my-kernel\_3.16.bb --
+PROVIDES += "virtual/kernel"
+--8<------------------------
+\end{verbatim}
+
+PREFERRED\_PROVIDER\_virtual/kernel = "linux-yocto"
+
+
+\pause
+\vspace{2em}
+also a preferred version can be set:
+
+PREFERRED\_VERSION\_virtual/kernel = "3.16"
+\end{frame}
+
+\begin{frame}
+\frametitle{Preferences}
+\begin{itemize}
+\item by default, files have a preference of "0"
+\item setting DEFAULT\_PREFERENCE to "-1" makes the recipe unlikely to be used
+	unless it is explicitly referenced.
+\item setting DEFAULT\_PREFERENCE to "1" makes it likely the recipe is used
+\item PREFERRED\_VERSION overrides any DEFAULT\_PREFERENCE setting
+\end{itemize}
 \end{frame}
 
+
+
 \begin{frame}
 \frametitle{adding own applications}
 already available? check http://layers.openembedded.org
@@ -523,25 +656,9 @@ bla
 bla
 \end{frame}
 
-
 \begin{frame}
-\frametitle{create bootable images for x86}
-t.b.d.
-
-The boot-directdisk class creates an image that can be placed directly onto a
-hard disk using dd and then booted. The image uses SYSLINUX.
-
-The end result is a 512 boot sector populated with a Master Boot Record (MBR)
-and partition table followed by an MSDOS FAT16 partition containing SYSLINUX
-and a Linux kernel completed by the ext2 and ext3 root filesystems.
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle {bootable image for embedded device}
-t.b.d. use IMAGE\_FEATURES
-% http://www.yoctoproject.org/docs/1.6/ref-manual/ref-manual.html#ref-features-image
-
-% http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html#usingpoky-extend-customimage-imagefeatures
+\frametitle{adding a bootscript}
+bla
 \end{frame}
 
 \begin{frame}[fragile]
@@ -592,29 +709,7 @@ PNBLACKLIST[exoticware] = "Not supported by our organization."
 \end{verbatim}
 \end{frame}
 
-\begin{frame}[fragile]
-\frametitle{Providers}
-\begin{verbatim}
---8<- -my-kernel\_3.16.bb --
-PROVIDES += "virtual/kernel"
---8<------------------------
-\end{verbatim}
-
-PREFEREED\_PROVIDER\_virtual/kernel = "linux-yocto"
-\end{frame}
-
-\begin{frame}
-\frametitle{Preferences}
-\begin{itemize}
-\item PREFERRED\_VERSION is used to specify a particular version
-\item by default, files have a preference of "0"
-\item setting DEFAULT\_PREFERENCE to "-1" makes the recipe unlikely to be used
-	unless it is explicitly referenced.
-\item setting DEFAULT\_PREFERENCE to "1" makes it likely the recipe is used
-\item PREFERRED\_VERSION overrides any DEFAULT\_PREFERENCE setting
-\end{itemize}
-\end{frame}
-
+\subsection{Yocto \& ELBE}
 \begin{frame}
 \frametitle{Yocto \& ELBE combined}
 	bla
-- 
cgit v1.2.3

