[bootlin/training-materials updates] master: slides/buildroot-appdev: add slides about Meson and environment-setup (682f2d3b)
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Sat May 29 17:00:36 CEST 2021
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/682f2d3b18f11e097ea266eda6802414e6fbd1e0
>---------------------------------------------------------------
commit 682f2d3b18f11e097ea266eda6802414e6fbd1e0
Author: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Date: Thu May 20 21:39:50 2021 +0200
slides/buildroot-appdev: add slides about Meson and environment-setup
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
>---------------------------------------------------------------
682f2d3b18f11e097ea266eda6802414e6fbd1e0
slides/buildroot-appdev/buildroot-appdev.tex | 82 ++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/slides/buildroot-appdev/buildroot-appdev.tex b/slides/buildroot-appdev/buildroot-appdev.tex
index fa748980..3373eb25 100644
--- a/slides/buildroot-appdev/buildroot-appdev.tex
+++ b/slides/buildroot-appdev/buildroot-appdev.tex
@@ -117,6 +117,88 @@ app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked.
\end{itemize}
\end{frame}
+\begin{frame}[fragile]{Building code for Buildroot: Meson}
+ \begin{itemize}
+ \item Buildroot generates a Meson {\em cross file}, installed in
+ \code{output/host/etc/meson/cross-compilation.conf}
+ \item Tells {\em Meson} which cross-compilation tools to use
+ \item Passed using the \code{--cross-file} {\em Meson} option
+ \item \url{https://mesonbuild.com/Cross-compilation.html}
+ \item With this file, building {\em Meson} projects outside of
+ Buildroot is easy:
+ \begin{block}{}
+{\scriptsize
+\begin{verbatim}
+$ mkdir build
+$ meson --cross-file=.../buildroot/output/host/etc/meson/cross-compilation.conf ..
+$ ninja
+$ file app
+app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked...
+\end{verbatim}}
+\end{block}
+\end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]{Building code for Buildroot: {\tt environment-setup}}
+ \begin{itemize}
+ \item Enable \code{BR2_PACKAGE_HOST_ENVIRONMENT_SETUP}
+ \item Installs an helper shell script
+ \code{output/host/environment-setup} that can be sourced in the
+ shell to define a number of useful environment variables and
+ aliases.
+ \item Defines: \code{CC}, \code{LD}, \code{AR}, \code{AS},
+ \code{CFLAGS}, \code{LDFLAGS}, \code{ARCH}, etc.
+ \item Defines \code{configure} as an alias to run a {\em configure}
+ script with the right arguments, \code{cmake} as an alias to run
+ {\em cmake} with the right arguments
+ \item Drawback: once sourced, the shell environment is really only
+ suitable for cross-compiling with Buildroot.
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]{Building code for Buildroot: {\tt environment-setup}}
+ \begin{block}{}
+ {\tiny
+\begin{verbatim}
+$ source output/host/environment-setup
+ _ _ _ _ _
+| |__ _ _(_) | __| |_ __ ___ ___ | |_
+| '_ \| | | | | |/ _` | '__/ _ \ / _ \| __|
+| |_) | |_| | | | (_| | | | (_) | (_) | |_
+|_.__/ \__,_|_|_|\__,_|_| \___/ \___/ \__|
+
+ Making embedded Linux easy!
+
+Some tips:
+* PATH now contains the SDK utilities
+* Standard autotools variables (CC, LD, CFLAGS) are exported
+* Kernel compilation variables (ARCH, CROSS_COMPILE, KERNELDIR) are exported
+* To configure do "./configure $CONFIGURE_FLAGS" or use
+ the "configure" alias
+* To build CMake-based projects, use the "cmake" alias
+\end{verbatim}
+ }
+\end{block}
+
+ \begin{block}{}
+ {\tiny
+\begin{verbatim}
+$ echo $CC
+/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc
+$ echo $CFLAGS
+-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -D_FORTIFY_SOURCE=1
+$ echo $CROSS_COMPILE
+/home/thomas/projets/buildroot/output/host/bin/arm-linux-
+$ alias configure
+alias configure='./configure --target=arm-buildroot-linux-gnueabihf --host=arm-buildroot-linux-gnueabihf \
+ --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var \
+ --program-prefix='
+\end{verbatim}
+ }
+\end{block}
+
+\end{frame}
+
\begin{frame}{Building during development}
\begin{itemize}
\item Buildroot is mainly a {\em final integration} tool: it is
More information about the training-materials-updates
mailing list