[FE training-materials-updates] buildroot-analysis: new chapter
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Thu May 7 11:08:09 CEST 2015
Repository : git://git.free-electrons.com/training-materials.git
On branch : master
Link : http://git.free-electrons.com/training-materials/commit/?id=c7546bdfd0af1794084ca145494ae8fa9383a5e3
>---------------------------------------------------------------
commit c7546bdfd0af1794084ca145494ae8fa9383a5e3
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date: Thu May 7 11:08:01 2015 +0200
buildroot-analysis: new chapter
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>---------------------------------------------------------------
c7546bdfd0af1794084ca145494ae8fa9383a5e3
slides/buildroot-analysis/build-hist-build.pdf | Bin 0 -> 18348 bytes
slides/buildroot-analysis/buildroot-analysis.tex | 155 +++++++++++++++++++++++
slides/buildroot-analysis/graph-depends.pdf | Bin 0 -> 30098 bytes
3 files changed, 155 insertions(+)
diff --git a/slides/buildroot-analysis/build-hist-build.pdf b/slides/buildroot-analysis/build-hist-build.pdf
new file mode 100644
index 0000000..87b0e26
Binary files /dev/null and b/slides/buildroot-analysis/build-hist-build.pdf differ
diff --git a/slides/buildroot-analysis/buildroot-analysis.tex b/slides/buildroot-analysis/buildroot-analysis.tex
index fa836b7..f8dee0f 100644
--- a/slides/buildroot-analysis/buildroot-analysis.tex
+++ b/slides/buildroot-analysis/buildroot-analysis.tex
@@ -1,5 +1,160 @@
+\setbeamerfont{block title}{size=\scriptsize}
+
\section{Analyzing the build}
+\begin{frame}{Analyzing the build: available tools}
+ \begin{itemize}
+ \item Buildroot provides several useful tools to analyze the build:
+ \begin{itemize}
+ \item The {\bf licensing report}, covered in a previous section,
+ which allows to analyze the list of packages and their licenses.
+ \item The {\bf dependency graphing} tools
+ \item The {\bf build time graphing} tools
+ \end{itemize}
+ \item A tool to analyze the contribution of each package to the
+ filesystem size is under development, it should be merged in
+ Buildroot 2015.08. Patches are already available.
+ \item Additional tools can be constructed using {\bf instrumentation
+ scripts}
+ \end{itemize}
+\end{frame}
+
+\begin{frame}{Dependency graphing}
+ \begin{itemize}
+ \item Exploring the dependencies between packages is useful to
+ understand
+ \begin{itemize}
+ \item why a particular package is being brought into the
+ build
+ \item if the build size and duration can be reduced
+ \end{itemize}
+ \item \code{make graph-depends} to generate a full dependency graph,
+ which can be huge!
+ \item \code{make <pkg>-graph-depends} to generate the dependency
+ graph of a given package
+ \item The graph is done according to the current Buildroot
+ configuration.
+ \item Resulting graphs in \code{$(O)/graphs/}
+ \end{itemize}
+\end{frame}
+
+\begin{frame}{Dependency graph example}
+ \begin{center}
+ \includegraphics[height=0.8\textheight]{slides/buildroot-analysis/graph-depends.pdf}
+ \end{center}
+\end{frame}
+
+\begin{frame}[fragile]{Dependency graphing: advanced}
+ \begin{itemize}
+ \item Variable \code{BR2_GRAPH_OUT}, to select the output
+ format. Defaults to \code{pdf}, can be \code{png} or \code{svg}
+ for example.
+ \item Internally, the graph is generated by the Python script
+ \code{support/scripts/graph-depends}
+ \item All options that this script supports can be passed using the
+ \code{BR2_GRAPH_DEPS_OPTS} variable when calling \code{make
+ graph-depends}
+ \item Example
+ \begin{itemize}
+ \item Generate a PNG graph of the \code{openssh} package
+ dependencies
+ \item Custom colors
+ \item Stop graphing on the \code{host-automake} package, to remove
+ a part of the graph we're not interested in
+ \end{itemize}
+ \end{itemize}
+
+ \begin{block}{}
+{\tiny
+\begin{verbatim}
+BR2_GRAPH_OUT=png \
+ BR2_GRAPH_DEPS_OPTS="--colours red,blue,green --stop-on=host-automake" \
+ make openssh-graph-depends
+\end{verbatim}}
+ \end{block}
+\end{frame}
+
+\begin{frame}{Build time graphing}
+ \begin{itemize}
+ \item When the generated embedded Linux system grows bigger and
+ bigger, the build time also increases.
+ \item It is sometimes useful to analyze this build time, and see if
+ certain packages are particularly problematic.
+ \item Buildroot collects build duration data in the file
+ \code{$(O)/build/build-time.log}
+ \item \code{make graph-build} generates several graphs in
+ \code{$(O)/graphs/}:
+ \begin{itemize}
+ \item \code{build.hist-build.pdf}, build time in build order
+ \item \code{build.hist-duration.pdf}, build time by duration
+ \item \code{build.hist-name.pdf}, build time by package name
+ \item \code{build.pie-packages.pdf}, pie chart of the per-package
+ build time
+ \item \code{build.pie-steps.pdf}, pie chart of the per-step build
+ time
+ \end{itemize}
+ \end{itemize}
+\end{frame}
+
+\begin{frame}{Build time graphing: example}
+ \begin{center}
+ \includegraphics[width=\textwidth]{slides/buildroot-analysis/build-hist-build.pdf}
+ \end{center}
+\end{frame}
+
+\begin{frame}{Instrumentation scripts}
+ \begin{itemize}
+ \item Additional analysis tools can be constructed using the {\bf
+ instrumentation scripts} mechanism.
+ \item \code{BR2_INSTRUMENTATION_SCRIPTS} is an environment variable,
+ containing a space-separated list of scripts, that will be called
+ before and after each step of the build of all packages.
+ \item Three arguments are passed to the scripts:
+ \begin{enumerate}
+ \item \code{start} or \code{stop} to indicate whether it's the
+ beginning or end of the step
+ \item the name of the step
+ \item the name of the package
+ \end{enumerate}
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]{Instrumentation scripts: example}
+ \begin{block}{instrumentation.sh}
+{\tiny
+\begin{verbatim}
+#!/bin/sh
+echo "${3} now ${1}s ${2}"
+\end{verbatim}}
+ \end{block}
+
+ \begin{block}{Output}
+{\tiny
+\begin{verbatim}
+$ make BR2_INSTRUMENTATION_SCRIPTS="./instrumentation.sh"
+strace now starts extract
+>>> strace 4.10 Extracting
+xzcat /home/thomas/dl/strace-4.10.tar.xz | tar --strip-components=1 \
+ -C /home/thomas/projets/buildroot/output/build/strace-4.10 -xf -
+strace now ends extract
+strace now starts patch
+>>> strace 4.10 Patching
+
+Applying 0001-linux-aarch64-add-missing-header.patch using patch:
+patching file linux/aarch64/arch_regs.h
+>>> strace 4.10 Updating config.sub and config.guess
+for file in config.guess config.sub; do for i in $(find \
+ /home/thomas/projets/buildroot/output/build/strace-4.10 -name $file); do \
+ cp support/gnuconfig/$file $i; done; done
+>>> strace 4.10 Patching libtool
+strace now ends patch
+strace now starts configure
+>>> strace 4.10 Configuring
+\end{verbatim}}
+ \end{block}
+
+\end{frame}
+
\setuplabframe
{Analyzing the build}
{
diff --git a/slides/buildroot-analysis/graph-depends.pdf b/slides/buildroot-analysis/graph-depends.pdf
new file mode 100644
index 0000000..18c5aa4
Binary files /dev/null and b/slides/buildroot-analysis/graph-depends.pdf differ
More information about the training-materials-updates
mailing list