[FE training-materials-updates] buildroot: move the BR2_EXTERNAL usage later in the labs

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri May 22 11:39:20 CEST 2015


Repository : git://git.free-electrons.com/training-materials.git

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=9f7e35717c4f92759555b566d42800fd08b183f8

>---------------------------------------------------------------

commit 9f7e35717c4f92759555b566d42800fd08b183f8
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date:   Fri May 22 11:38:08 2015 +0200

    buildroot: move the BR2_EXTERNAL usage later in the labs
    
    Rename the lab "buildroot-analysis" to "buildroot-advanced", as it's
    going to be about analysis (dependency graphs, build time,
    legal-info), but also about setting up BR2_EXTERNAL.
    
    Move this lab after covering the "Advanced aspects", which is where we
    introduce BR2_EXTERNAL.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>


>---------------------------------------------------------------

9f7e35717c4f92759555b566d42800fd08b183f8
 Makefile                                           |  2 +-
 .../buildroot-advanced-packages.tex                | 22 ++-----
 .../buildroot-advanced.tex}                        | 67 +++++++++++++++++++++-
 slides/buildroot-advanced/buildroot-advanced.tex   | 12 ++++
 slides/buildroot-analysis/buildroot-analysis.tex   | 10 ----
 5 files changed, 84 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 75afe13..f30fd12 100644
--- a/Makefile
+++ b/Makefile
@@ -385,7 +385,7 @@ BUILDROOT_LABS = setup \
 		buildroot-rootfs \
 		buildroot-new-packages \
 		buildroot-advanced-packages \
-		buildroot-analysis \
+		buildroot-advanced \
 		buildroot-appdev
 
 AUTOTOOLS_LABS = setup \
diff --git a/labs/buildroot-advanced-packages/buildroot-advanced-packages.tex b/labs/buildroot-advanced-packages/buildroot-advanced-packages.tex
index 80b01dd..142f882 100644
--- a/labs/buildroot-advanced-packages/buildroot-advanced-packages.tex
+++ b/labs/buildroot-advanced-packages/buildroot-advanced-packages.tex
@@ -2,7 +2,6 @@
 {Advanced packaging}
 {Objectives:
   \begin{itemize}
-  \item Create a {\em \code{BR2_EXTERNAL}} tree
   \item Package an application with a mandatory dependency and an
     optional dependency
   \item Package a library, hosted on Github
@@ -11,17 +10,6 @@
   \end{itemize}
 }
 
-\section{Create a {\tt BR2\_EXTERNAL} tree}
-
-Create an empty directory outside the Buildroot tree, and add the
-files required for this directory to be a \code{BR2_EXTERNAL} tree.
-
-Configure Buildroot to use that directory as a \code{BR2_EXTERNAL};
-look in the \code{menuconfig} for what has changed.
-
-For the remainder of this lab, we will create and modify files
-exclusively in this \code{BR2_EXTERNAL} directory.
-
 \section{Start packaging application {\tt bar}}
 
 For the purpose of this training, we have created a completely stupid
@@ -29,11 +17,11 @@ and useless application called \code{bar}. Its home page is
 \url{http://free-electrons.com/~thomas/bar/}, from where you can
 download an archive of the application's source code.
 
-Create an initial package for \code{bar} in \code{package/bar} in your
-\code{BR2_EXTERNAL} directory, with the necessary code in
-\code{package/bar/bar.mk} and \code{package/bar/Config.in}. Don't
-forget \code{package/bar/bar.hash}. At this point, your \code{bar.mk}
-should only define the \code{<pkg>_VERSION}, \code{<pkg>_SOURCE} and
+Create an initial package for \code{bar} in \code{package/bar}, with
+the necessary code in \code{package/bar/bar.mk} and
+\code{package/bar/Config.in}. Don't forget
+\code{package/bar/bar.hash}. At this point, your \code{bar.mk} should
+only define the \code{<pkg>_VERSION}, \code{<pkg>_SOURCE} and
 \code{<pkg>_SITE} variables, and a call to a package infrastructure.
 
 Enable the \code{bar} package in your Buildroot configuration, and
diff --git a/labs/buildroot-analysis/buildroot-analysis.tex b/labs/buildroot-advanced/buildroot-advanced.tex
similarity index 72%
rename from labs/buildroot-analysis/buildroot-analysis.tex
rename to labs/buildroot-advanced/buildroot-advanced.tex
index c579394..51eef62 100644
--- a/labs/buildroot-analysis/buildroot-analysis.tex
+++ b/labs/buildroot-advanced/buildroot-advanced.tex
@@ -1,11 +1,12 @@
 \subchapter
-{Use build time and dependency graphing, licensing report features}
+{Advanced aspects}
 {Objectives:
   \begin{itemize}
   \item Use build time graphing capabilities
   \item Use dependency graphing capabilities
   \item Use licensing report generation, and add licensing
     informations to your own packages
+  \item Use \code{BR2_EXTERNAL}
   \end{itemize}
 }
 
@@ -159,3 +160,67 @@ the \code{.txt} files, and the various directories. Buildroot has
 gathered for you most of what is needed to help with licensing
 compliance.
 
+\section{Use {\tt BR2\_EXTERNAL}}
+
+We should have used \code{BR2_EXTERNAL} since the beginning of the
+training, but we were busy learning about so many other things! So
+it's finally time to use \code{BR2_EXTERNAL}.
+
+The whole point of \code{BR2_EXTERNAL} is to allow storing your
+project-specific packages, configuration files, root filesystem
+overlay or patches outside of the Buildroot tree itself. It makes it
+easier to separate the open-source packages from the proprietary ones,
+and it makes updating Buildroot itself a lot simpler.
+
+So, as recommended in the slides, the goal now is to use
+\code{BR2_EXTERNAL} to move away from the main Buildroot tree the
+following elements:
+
+\begin{itemize}
+
+\item The \code{bar} and \code{libfoo} packages. We will keep the
+  \code{ninvaders} package in the Buildroot tree, since it's a
+  publicly available open-source package, so it should be submitted to
+  the official Buildroot rather than kept in a \code{BR2_EXTERNAL}
+  tree.
+
+\item The Linux kernel patch and Linux kernel configuration file. For
+  the Linux kernel patch, use \code{BR2_GLOBAL_PATCH_DIR} instead of
+  the Linux-specific \code{BR2_LINUX_KERNEL_PATCH} option.
+
+\item The {\em rootfs overlay}
+
+\item The {\em post-build script}
+
+\item The {\em defconfig}
+
+\end{itemize}
+
+Your \code{BR2_EXTERNAL} tree should look like this:
+
+\begin{verbatim}
++-- board/
+|   +-- felabs/
+|       +-- beagleboneblack/
+|           +-- linux.config
+|           +-- post-build.sh
+|           +-- linux-patches/
+|               +-- 0001-Add-nunchuk-driver.patch
+|               +-- 0002-Add-i2c1-and-nunchuk-nodes-in-dts.patch
+|           +-- rootfs-overlay/
+|               +-- etc
+|                   +-- network
+|                       +-- interfaces
++-- package/
+|   +-- bar
+|       +-- bar.mk
+|       +-- Config.in
+|   +-- libfoo
+|       +-- libfoo.mk
+|       +-- Config.in
++-- configs
+|   +-- felabs_defconfig
++-- Config.in
++-- external.mk
+\end{verbatim}
+
diff --git a/slides/buildroot-advanced/buildroot-advanced.tex b/slides/buildroot-advanced/buildroot-advanced.tex
index 77dfb94..7162846 100644
--- a/slides/buildroot-advanced/buildroot-advanced.tex
+++ b/slides/buildroot-advanced/buildroot-advanced.tex
@@ -201,3 +201,15 @@ make BR2_EXTERNAL=/path/to/external
     \end{itemize}
   \end{itemize}
 \end{frame}
+
+\setuplabframe
+{Advanced aspects}
+{
+  \begin{itemize}
+  \item Use \code{legal-info} for legal information extraction
+  \item Use \code{graph-depends} for dependency graphing
+  \item Use \code{graph-build} for build time graphing
+  \item Use \code{BR2_EXTERNAL} to isolate the project-specific
+    changes (packages, configs, etc.)
+  \end{itemize}
+}
diff --git a/slides/buildroot-analysis/buildroot-analysis.tex b/slides/buildroot-analysis/buildroot-analysis.tex
index b439486..9cd4dcc 100644
--- a/slides/buildroot-analysis/buildroot-analysis.tex
+++ b/slides/buildroot-analysis/buildroot-analysis.tex
@@ -156,13 +156,3 @@ strace now starts configure
 
 \end{frame}
 
-\setuplabframe
-{Analyzing the build}
-{
-  \begin{itemize}
-  \item Use \code{legal-info} for legal information extraction
-  \item Use \code{graph-depends} for dependency graphing
-  \item Use \code{graph-build} for build time graphing
-  \end{itemize}
-}
-



More information about the training-materials-updates mailing list