[bootlin/training-materials updates] master: sysdev: switch to musl C library (243fa1ef)
Michael Opdenacker
michael.opdenacker at bootlin.com
Fri Jul 21 18:34:37 CEST 2023
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/243fa1ef0a7763af8f97ff3f21fc5f7cf8a1446f
>---------------------------------------------------------------
commit 243fa1ef0a7763af8f97ff3f21fc5f7cf8a1446f
Author: Clément Ramirez <clement.ramirez at bootlin.com>
Date: Wed Jul 19 14:45:11 2023 +0200
sysdev: switch to musl C library
- Add 'CONFIG_LFS=y' in Busybox config which is required when using
musl C library.
- Replacement of uClibc occurences (aliases,paths,...) by musl ones.
- Remove '--without-versionned' flag during alsa-lib building.
This option was needed because uClibC doesn't support
versionning.
- Add updated u-boot rescue image for qemu lab.
>---------------------------------------------------------------
243fa1ef0a7763af8f97ff3f21fc5f7cf8a1446f
.../embedded-linux-qemu/bootloader/data/u-boot | Bin 4523348 -> 5069004 bytes
.../tinysystem/data/busybox-1.36.config | 2 +-
.../sysdev-application-debugging-qemu.tex | 2 +-
.../sysdev-buildroot-qemu.tex | 7 +++---
labs/sysdev-buildroot/sysdev-buildroot.tex | 7 +++---
.../sysdev-kernel-cross-compiling.tex | 2 +-
.../sysdev-thirdparty-bbb.tex | 16 ++++---------
.../sysdev-thirdparty-qemu.tex | 16 ++++---------
.../sysdev-thirdparty-stm32.tex | 18 +++++---------
labs/sysdev-tinysystem/sysdev-tinysystem.tex | 4 ++--
labs/sysdev-toolchain/sysdev-toolchain.tex | 26 ++++++++-------------
11 files changed, 37 insertions(+), 63 deletions(-)
diff --git a/lab-data/embedded-linux-qemu/bootloader/data/u-boot b/lab-data/embedded-linux-qemu/bootloader/data/u-boot
old mode 100644
new mode 100755
index 08f78af7..5f4b36b3
Binary files a/lab-data/embedded-linux-qemu/bootloader/data/u-boot and b/lab-data/embedded-linux-qemu/bootloader/data/u-boot differ
diff --git a/lab-data/embedded-linux/tinysystem/data/busybox-1.36.config b/lab-data/embedded-linux/tinysystem/data/busybox-1.36.config
index 67ccbf0c..24eb2fa1 100644
--- a/lab-data/embedded-linux/tinysystem/data/busybox-1.36.config
+++ b/lab-data/embedded-linux/tinysystem/data/busybox-1.36.config
@@ -16,7 +16,7 @@ CONFIG_LONG_OPTS=y
CONFIG_SHOW_USAGE=y
CONFIG_FEATURE_VERBOSE_USAGE=y
# CONFIG_FEATURE_COMPRESS_USAGE is not set
-# CONFIG_LFS is not set
+CONFIG_LFS=y
# CONFIG_PAM is not set
# CONFIG_FEATURE_DEVPTS is not set
# CONFIG_FEATURE_UTMP is not set
diff --git a/labs/sysdev-application-debugging-qemu/sysdev-application-debugging-qemu.tex b/labs/sysdev-application-debugging-qemu/sysdev-application-debugging-qemu.tex
index 959ecefa..b1475d98 100644
--- a/labs/sysdev-application-debugging-qemu/sysdev-application-debugging-qemu.tex
+++ b/labs/sysdev-application-debugging-qemu/sysdev-application-debugging-qemu.tex
@@ -9,7 +9,7 @@ Create an \code{nfsroot} directory.
\section{Debugging setup}
-Because of issues in {\em gdb} and {\em ltrace} in the uClibc version
+Because of issues in {\em gdb} and {\em ltrace} in the musl version
that we are using in our toolchain, we will use a different toolchain
in this lab, based on {\em glibc}.
diff --git a/labs/sysdev-buildroot-qemu/sysdev-buildroot-qemu.tex b/labs/sysdev-buildroot-qemu/sysdev-buildroot-qemu.tex
index 9ba4e82e..407a5d8c 100644
--- a/labs/sysdev-buildroot-qemu/sysdev-buildroot-qemu.tex
+++ b/labs/sysdev-buildroot-qemu/sysdev-buildroot-qemu.tex
@@ -119,14 +119,13 @@ button whenever you need more details about a given option:
\item \code{Toolchain type}: \code{External toolchain}
\item \code{Toolchain}: \code{Custom toolchain}
\item \code{Toolchain path}: use the toolchain you built:
- \code{/home/<user>/x-tools/arm-training-linux-uclibcgnueabihf}
+ \code{/home/<user>/x-tools/arm-training-linux-musleabihf}
(replace \code{<user>} by your actual user name)
\item \code{External toolchain gcc version}: \code{12.x}
\item \code{External toolchain kernel headers series}: \texttt{\workingkernel.x}
- \item \code{External toolchain C library}: \code{uClibc/uClibc-ng}
+ \item \code{External toolchain C library}: \code{musl (experimental)}
\item We must tell Buildroot about our toolchain configuration, so
- select \code{Toolchain has WCHAR support?},
- \code{Toolchain has SSP support?} and
+ select \code{Toolchain has SSP support?} and
\code{Toolchain has C++ support?}.
Buildroot will check these parameters anyway.
\end{itemize}
diff --git a/labs/sysdev-buildroot/sysdev-buildroot.tex b/labs/sysdev-buildroot/sysdev-buildroot.tex
index 1df0f7c2..79dd5cfa 100644
--- a/labs/sysdev-buildroot/sysdev-buildroot.tex
+++ b/labs/sysdev-buildroot/sysdev-buildroot.tex
@@ -135,14 +135,13 @@ button whenever you need more details about a given option:
\item \code{Toolchain type}: \code{External toolchain}
\item \code{Toolchain}: \code{Custom toolchain}
\item \code{Toolchain path}: use the toolchain you built:
- \code{/home/<user>/x-tools/arm-training-linux-uclibcgnueabihf}
+ \code{/home/<user>/x-tools/arm-training-linux-musleabihf}
(replace \code{<user>} by your actual user name)
\item \code{External toolchain gcc version}: \code{12.x}
\item \code{External toolchain kernel headers series}: \texttt{\workingkernel.x}
- \item \code{External toolchain C library}: \code{uClibc/uClibc-ng}
+ \item \code{External toolchain C library}: \code{musl (experimental)}
\item We must tell Buildroot about our toolchain configuration, so
- select \code{Toolchain has WCHAR support?},
- \code{Toolchain has SSP support?} and
+ select \code{Toolchain has SSP support?} and
\code{Toolchain has C++ support?}.
Buildroot will check these parameters anyway.
\end{itemize}
diff --git a/labs/sysdev-kernel-cross-compiling/sysdev-kernel-cross-compiling.tex b/labs/sysdev-kernel-cross-compiling/sysdev-kernel-cross-compiling.tex
index cc7b1713..25819f09 100644
--- a/labs/sysdev-kernel-cross-compiling/sysdev-kernel-cross-compiling.tex
+++ b/labs/sysdev-kernel-cross-compiling/sysdev-kernel-cross-compiling.tex
@@ -55,7 +55,7 @@ To cross-compile Linux, you need to have a cross-compiling
toolchain. We will use the cross-compiling toolchain that we
previously produced, so we just need to make it available in the PATH:
-\bashcmd{$ export PATH=$HOME/x-tools/arm-training-linux-uclibcgnueabihf/bin:$PATH}
+\bashcmd{$ export PATH=$HOME/x-tools/arm-training-linux-musleabihf/bin:$PATH}
Also, don't forget to either:
diff --git a/labs/sysdev-thirdparty-bbb/sysdev-thirdparty-bbb.tex b/labs/sysdev-thirdparty-bbb/sysdev-thirdparty-bbb.tex
index de9d7295..be015a75 100644
--- a/labs/sysdev-thirdparty-bbb/sysdev-thirdparty-bbb.tex
+++ b/labs/sysdev-thirdparty-bbb/sysdev-thirdparty-bbb.tex
@@ -180,19 +180,13 @@ by \code{--host}.
The \code{configure} script should end properly now, and create a
Makefile.
-However, there are 2 last subtle issues to handle.
-First, the C library used in our toolchain (uClibc-ng) does not support
-{\em symbol versioning}, we need to tell {\em alsa-lib} about this by passing
-\code{--without-versioned}. Without this option, {\em alsa-lib} will
-build fine, but it will not work properly at runtime\footnote{See
-\url{https://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014999.html}
-for all the details}.
-Next, we need to tell {\em alsa-lib} to disable a feature called alsa topology.
-Like before {\em alsa-lib} will build fine but we will encounter some
+However, there is one subtle issue to handle.
+We need to tell {\em alsa-lib} to disable a feature called alsa topology.
+{\em alsa-lib} will build fine but we will encounter some
problems afterwards, during {\em alsa-utils} building.
So you should configure {\em alsa-lib} as follows:
-\bashcmd{$ ./configure --host=arm-linux --without-versioned --disable-topology}
+\bashcmd{$ ./configure --host=arm-linux --disable-topology}
Run the \code{make} command, which should run just fine.
@@ -267,7 +261,7 @@ the libraries to be installed in the \code{/usr} prefix, so let's tell
the \code{configure} script about this:
\begin{bashinput}
-$ ./configure --host=arm-linux --without-versioned --disable-topology --prefix=/usr
+$ ./configure --host=arm-linux --disable-topology --prefix=/usr
$ make
\end{bashinput}
diff --git a/labs/sysdev-thirdparty-qemu/sysdev-thirdparty-qemu.tex b/labs/sysdev-thirdparty-qemu/sysdev-thirdparty-qemu.tex
index d4b25094..8b0bdb69 100644
--- a/labs/sysdev-thirdparty-qemu/sysdev-thirdparty-qemu.tex
+++ b/labs/sysdev-thirdparty-qemu/sysdev-thirdparty-qemu.tex
@@ -179,19 +179,13 @@ by \code{--host}.
The \code{configure} script should end properly now, and create a
Makefile.
-However, there are 2 last subtle issues to handle.
-First, the C library used in our toolchain (uClibc-ng) does not support
-{\em symbol versioning}, we need to tell {\em alsa-lib} about this by passing
-\code{--without-versioned}. Without this option, {\em alsa-lib} will
-build fine, but it will not work properly at runtime\footnote{See
-\url{https://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014999.html}
-for all the details}.
-Next, we need to tell {\em alsa-lib} to disable a feature called alsa topology.
-Like before {\em alsa-lib} will build fine but we will encounter some
+However, there is one subtle issue to handle.
+We need to tell {\em alsa-lib} to disable a feature called alsa topology.
+{\em alsa-lib} will build fine but we will encounter some
problems afterwards, during {\em alsa-utils} building.
So you should configure {\em alsa-lib} as follows:
-\bashcmd{$ ./configure --host=arm-linux --without-versioned --disable-topology}
+\bashcmd{$ ./configure --host=arm-linux --disable-topology}
Run the \code{make} command, which should run just fine.
@@ -266,7 +260,7 @@ the libraries to be installed in the \code{/usr} prefix, so let's tell
the \code{configure} script about this:
\begin{bashinput}
-$ ./configure --host=arm-linux --without-versioned --disable-topology --prefix=/usr
+$ ./configure --host=arm-linux --disable-topology --prefix=/usr
$ make
\end{bashinput}
diff --git a/labs/sysdev-thirdparty-stm32/sysdev-thirdparty-stm32.tex b/labs/sysdev-thirdparty-stm32/sysdev-thirdparty-stm32.tex
index 79f61f98..05955346 100644
--- a/labs/sysdev-thirdparty-stm32/sysdev-thirdparty-stm32.tex
+++ b/labs/sysdev-thirdparty-stm32/sysdev-thirdparty-stm32.tex
@@ -180,19 +180,13 @@ by \code{--host}.
The \code{configure} script should end properly now, and create a
Makefile.
-However, there are 2 last subtle issues to handle.
-First, the C library used in our toolchain (uClibc-ng) does not support
-{\em symbol versioning}, we need to tell {\em alsa-lib} about this by passing
-\code{--without-versioned}. Without this option, {\em alsa-lib} will
-build fine, but it will not work properly at runtime\footnote{See
-\url{https://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014999.html}
-for all the details}.
-Next, we need to tell {\em alsa-lib} to disable a feature called alsa topology.
-Like before {\em alsa-lib} will build fine but we will encounter some
+However, there is one subtle issue to handle.
+We need to tell {\em alsa-lib} to disable a feature called alsa topology.
+{\em alsa-lib} will build fine but we will encounter some
problems afterwards, during {\em alsa-utils} building.
So you should configure {\em alsa-lib} as follows:
-\bashcmd{$ ./configure --host=arm-linux --without-versioned --disable-topology}
+\bashcmd{$ ./configure --host=arm-linux --disable-topology}
Run the \code{make} command, which should run just fine.
@@ -267,7 +261,7 @@ the libraries to be installed in the \code{/usr} prefix, so let's tell
the \code{configure} script about this:
\begin{bashinput}
-$ ./configure --host=arm-linux --without-versioned --disable-topology --prefix=/usr
+$ ./configure --host=arm-linux --disable-topology --prefix=/usr
$ make
\end{bashinput}
@@ -662,7 +656,7 @@ Installation to the {\em staging} space can be done using the
classical \code{DESTDIR} mechanism:
\begin{bashinput}
-make DESTDIR=$HOME/__SESSION_NAME__-labs/thirdparty/staging/ install
+$ make DESTDIR=$HOME/__SESSION_NAME__-labs/thirdparty/staging/ install
\end{bashinput}
And finally, only manually install and strip the files
diff --git a/labs/sysdev-tinysystem/sysdev-tinysystem.tex b/labs/sysdev-tinysystem/sysdev-tinysystem.tex
index 9d70a6ec..137cdfdb 100644
--- a/labs/sysdev-tinysystem/sysdev-tinysystem.tex
+++ b/labs/sysdev-tinysystem/sysdev-tinysystem.tex
@@ -251,10 +251,10 @@ You can find it by running \code{file hello} on the host:
\begin{verbatim}
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked,
-interpreter /lib/ld-uClibc.so.0, not stripped
+interpreter /lib/ld-musl-armhf.so.1, not stripped
\end{verbatim}
-So, what's missing is the \code{/lib/ld-uClibc.so.0}
+So, what's missing is the \code{/lib/ld-musl-armhf.so.1}
executable, which is the dynamic linker required to execute any
program compiled with shared libraries. Using the \code{find}
command, look for this file in the toolchain install directory,
diff --git a/labs/sysdev-toolchain/sysdev-toolchain.tex b/labs/sysdev-toolchain/sysdev-toolchain.tex
index c926721e..1bd530ea 100644
--- a/labs/sysdev-toolchain/sysdev-toolchain.tex
+++ b/labs/sysdev-toolchain/sysdev-toolchain.tex
@@ -1,5 +1,5 @@
\subchapter{Building a cross-compiling toolchain}{Objective: Learn how
- to compile your own cross-compiling toolchain for the uClibc C
+ to compile your own cross-compiling toolchain for the musl C
library}
After this lab, you will be able to:
@@ -90,6 +90,7 @@ In \code{Path and misc options}:
\code{LOG_DEBUG} in the interface, using the \code{/} key) so that
we can have more details on what happened during the build in case
something went wrong.
+\item If not, enable \code{Try features marked as EXPERIMENTAL}
\end{itemize}
\ifdefstring{\labboard}{stm32mp1}{
@@ -113,7 +114,7 @@ In \code{Toolchain options}:
\item Set \code{Tuple's vendor string} (\code{TARGET_VENDOR}) to \code{training}.
\item Set \code{Tuple's alias} (\code{TARGET_ALIAS}) to \code{arm-linux}.
This way, we will be able to use the compiler as \code{arm-linux-gcc}
- instead of \code{arm-training-linux-uclibcgnueabihf-gcc}, which is
+ instead of \code{arm-training-linux-musleabihf-gcc}, which is
much longer to type.
\end{itemize}
@@ -127,16 +128,9 @@ In \code{Operating System}:
In \code{C-library}:
\begin{itemize}
- \item If not set yet, set \code{C library} to \code{uClibc-ng}
- (\code{LIBC_UCLIBC_NG})
+ \item If not set yet, set \code{C library} to \code{musl}
+ (\code{LIBC_MUSL})
\item Keep the default version that is proposed
- \item If needed, enable \code{Add support for IPv6}
- (\code{LIBC_UCLIBC_IPV6})\footnote{
- That's needed to use the toolchain in Buildroot, which only
- accepts toolchains with IPv6 support},
- \code{Add support for WCHAR} (\code{LIBC_UCLIBC_WCHAR}) and
- \code{Support stack smashing protection (SSP)}
- (\code{LIBC_UCLIBC_HAS_SSP})
\end{itemize}
In \code{C compiler}:
@@ -175,7 +169,7 @@ And wait!
\section{Testing the toolchain}
You can now test your toolchain by adding
-\code{$HOME/x-tools/arm-training-linux-uclibcgnueabihf/bin/} to your
+\code{$HOME/x-tools/arm-training-linux-musleabihf/bin/} to your
\code{PATH} environment variable and compiling the simple
\code{hello.c} program in your main lab directory with
\code{arm-linux-gcc}:
@@ -199,7 +193,7 @@ Now, try to run QEMU ARM user emulator:
\begin{bashinput}
$ qemu-arm hello
-/lib/ld-uClibc.so.0: No such file or directory
+qemu-arm: Could not open '/lib/ld-musl-arm.so.1': No such file or directory
\end{bashinput}
What's happening is that \code{qemu-arm} is missing the shared C library
@@ -207,17 +201,17 @@ What's happening is that \code{qemu-arm} is missing the shared C library
compiled toolchain:
\begin{bashinput}
-$ find ~/x-tools -name ld-uClibc.so.0
+$ find ~/x-tools -name ld-musl-armhf.so.1
\end{bashinput}
\begin{terminaloutput}
-/home/tux/x-tools/arm-training-linux-uclibcgnueabihf/arm-training-linux-uclibcgnueabihf/sysroot/lib/ld-uClibc.so.0
+/home/tux/x-tools/arm-training-linux-musleabihf/arm-training-linux-musleabihf/sysroot/lib/ld-musl-armhf.so.1
\end{terminaloutput}
We can now use the \code{-L} option of \code{qemu-arm} to let it know
where shared libraries are:
\begin{bashinput}
-$ qemu-arm -L ~/x-tools/arm-training-linux-uclibcgnueabihf/arm-training-linux-uclibcgnueabihf/sysroot hello
+$ qemu-arm -L ~/x-tools/arm-training-linux-musleabihf/arm-training-linux-musleabihf/sysroot hello
\end{bashinput}
\begin{terminaloutput}
More information about the training-materials-updates
mailing list