[bootlin/training-materials updates] master: Boot-time: toolchain lab updates (54a4782c)

Michael Opdenacker michael.opdenacker at bootlin.com
Fri Apr 2 15:31:18 CEST 2021

Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/54a4782c8cfbbed579a2c437869e8ca59fb39abb


commit 54a4782c8cfbbed579a2c437869e8ca59fb39abb
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Fri Apr 2 15:31:18 2021 +0200

    Boot-time: toolchain lab updates
    Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>


 labs/boot-time-toolchain/boot-time-toolchain.tex | 54 ++++++++++++++++++++----
 1 file changed, 45 insertions(+), 9 deletions(-)

diff --git a/labs/boot-time-toolchain/boot-time-toolchain.tex b/labs/boot-time-toolchain/boot-time-toolchain.tex
index 67a3448c..db7e884c 100644
--- a/labs/boot-time-toolchain/boot-time-toolchain.tex
+++ b/labs/boot-time-toolchain/boot-time-toolchain.tex
@@ -60,7 +60,7 @@ Write these two numbers in the first row of the below table:
   Thumb2 toolchain  & & \\
-  Difference (percentage) & & \\
+  Musl toolchain & & \\
@@ -89,6 +89,8 @@ Write down your first results in the below table (\code{total1},
   Thumb2 toolchain & & & & & & & & & \\
+  Musl toolchain & & & & & & & & & \\
+  \hline
 After the first run, the program and its shared libraries are now in the
@@ -142,7 +144,7 @@ executable size, write it down in the table, and compute the difference
 percentages vs. the ARM code.
 \item Update the SD card with the new filesystem, run the same time
 measurements, and write down the results to compare them with the ARM
+ones. You can also add the percentage difference.
 So, was it a good choice to switch to {\em Thumb2}? Where there any size
@@ -150,8 +152,41 @@ and performance benefits?
 Don't hesitate to show your results to your instructor.
+\section{Test the musl C library}
+The last thing to try in this lab is using a toolchain with the {\em
+Musl} C library, instead of {\em uClibc}, which is the C library that
+Buildroot uses by default.
+Once again, keep a copy your current Buildroot directory:
+cd ..
+cp -al buildroot buildroot-thumb2
+Back to the \code{buildroot} directory, run \code{make menuconfig}, and
+in \code{Toolchain}, set \code{C library} to to \code{musl}.
+Save, run \code{make clean} and build the root filesystem once again.
+Once again, write down the two sizes and measure \code{ffmpeg} execution
+Now, what the best combination? {\em ARM} or {\em Thumb2},
+{\em uClibc} or {\em Musl}?
+If you have the same size and performance between {\em uClibc} or {\em
+Musl}, its better to choose the latter, as according to the slides, it
+will allow to generate smaller static executables (we will try that
+in later instructions). Another reason is that the {\em Musl} library
+has a more liberal license, making it easier to ship static executables.
 \section{Generate a Buildroot SDK to rebuild faster}
+Choose Buildroot configuration that worked best for you, renaming
+the directory to \code{buildroot} if that was not the last one you
 With Buildroot, it's frequent to need to run \code{make clean} and
 thus make a full rebuild, typically after configuration changes.
 As you've seen, such rebuilds are expensive with our Buildroot
@@ -159,13 +194,14 @@ configuration that builds the toolchain too.
 Now that we have finalized our toolchain, let's have Buildroot generate
 an SDK that we won't have to build from scratch every time we need a
-full rebuild.
+full rebuild. In the below instructions, you assume that you chose a
+{\em Musl} toolchain:
 make sdk
 cd ~/boot-time-labs/rootfs
-tar xf buildroot/output/images/arm-buildroot-linux-uclibcgnueabihf_sdk-buildroot.tar.gz
-cd arm-buildroot-linux-uclibcgnueabihf_sdk-buildroot
+tar xf buildroot/output/images/arm-buildroot-linux-musleabihf_sdk-buildroot.tar.gz
+cd arm-buildroot-linux-musleabihf_sdk-buildroot
@@ -181,11 +217,11 @@ In the \code{Toolchain} menu:
 \item Set \code{Toolchain} to \code{Custom toolchain}
 \item Set \code{Toolchain origin} to \code{Pre-installed toolchain}
 \item Set \code{Toolchain path} to\\
-      \code{/home/<user>/boot-time-labs/rootfs/arm-buildroot-linux-uclibcgnueabihf_sdk-buildroot}
+      \code{/home/<user>/boot-time-labs/rootfs/arm-buildroot-linux-musleabihf_sdk-buildroot}
       (replace \code{<user>} by your actual user name)
-\item Set \code{External toolchain gcc version} to \code{7.x}
-\item Set \code{External toolchain kernel headers series} to \code{4.19.x}
-\item Disable \code{Toolchain has threads debugging support?}
+\item Set \code{External toolchain gcc version} to \code{9.x}
+\item Set \code{External toolchain kernel headers series} to \code{5.4.x or later}
+\item Set \code{External toolchain C library} to \code{musl (experimental)}
 Now test that your settings are correct:

More information about the training-materials-updates mailing list