[bootlin/training-materials updates] master: Embedded Linux: misc updates and improvements (bcbd020f)
Michael Opdenacker
michael.opdenacker at bootlin.com
Tue Sep 29 15:50:52 CEST 2020
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/bcbd020f59771e4cb0955f9e89b59a813c2ab3db
>---------------------------------------------------------------
commit bcbd020f59771e4cb0955f9e89b59a813c2ab3db
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date: Tue Sep 29 15:50:52 2020 +0200
Embedded Linux: misc updates and improvements
Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>
>---------------------------------------------------------------
bcbd020f59771e4cb0955f9e89b59a813c2ab3db
.../sysdev-flash-filesystems.tex | 2 +-
slides/c-libraries/c-libraries.tex | 10 +++--
.../sysdev-dev-environment.tex | 5 ++-
.../sysdev-flash-filesystems.tex | 11 ++++--
slides/sysdev-intro/sysdev-intro.tex | 6 +--
.../sysdev-toolchains-definition.tex | 43 +++++++++++-----------
.../sysdev-toolchains-obtaining.tex | 9 ++---
7 files changed, 46 insertions(+), 40 deletions(-)
diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 67bf68c9..91ae78ad 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -210,7 +210,7 @@ data using the web server.
%Useful u-boot environment variables
%setenv mtdids nand0=atmel_nand
%setenv mtdparts mtdparts=atmel_nand:256k(bootstrap)ro,768k(u-boot)ro,256k(u-boot-env2)ro,256k(u-boot-env1)ro,-(UBI)
-%setenv bootargs_base console=ttyS0,115200 rootfstype=ubifs root=ubi0:root ip=192.168.0.100:::::eth0 ubi.mtd=4 ro
+%setenv bootargs_base console=ttyS0,115200 rootfstype=ubifs %root=ubi0:root ip=192.168.0.100:::::eth0 ubi.mtd=UBI ro
%setenv bootcmd 'ubi part UBI; ubi readvol 0x21000000 kernel;
%ubi readvol 0x22000000 dtb; setenv bootargs ${bootargs_base} ${mtdparts}; bootz 0x21000000 - 0x22000000'
%setenv flash 'nand erase.part UBI; tftp 0x21000000 ubi.img; nand write.trimffs 0x21000000 UBI ${filesize}'
diff --git a/slides/c-libraries/c-libraries.tex b/slides/c-libraries/c-libraries.tex
index caa9f99e..2ff13075 100644
--- a/slides/c-libraries/c-libraries.tex
+++ b/slides/c-libraries/c-libraries.tex
@@ -112,10 +112,12 @@ compare the size
in very small root filesystems.
\item Choices:
\begin{itemize}
- \item Newlib, \url{https://sourceware.org/newlib/}
- \item Klibc, \url{https://kernel.org/pub/linux/libs/klibc/},
- designed for use in an {\em initramfs} or {\em initrd} at boot
- time.
+ \item Newlib, \url{https://sourceware.org/newlib/},
+ maintained by Red Hat, used mostly in Cygwin, in bare metal
+ and in small POSIX RTOS.
+ \item Klibc, \url{https://en.wikipedia.org/wiki/Klibc},
+ from the kernel community, designed to implement small executables
+ for use in an {\em initramfs} at boot time.
\end{itemize}
\end{itemize}
\end{frame}
diff --git a/slides/sysdev-dev-environment/sysdev-dev-environment.tex b/slides/sysdev-dev-environment/sysdev-dev-environment.tex
index 4fc69481..768cb61e 100644
--- a/slides/sysdev-dev-environment/sysdev-dev-environment.tex
+++ b/slides/sysdev-dev-environment/sysdev-dev-environment.tex
@@ -182,14 +182,15 @@
them: \code{picocom}
\begin{itemize}
\item Installation with \code{sudo apt install picocom}
- \item Run with \code{picocom -b BAUD_RATE /dev/SERIAL_DEVICE}
- \item Exit with \code{Control-A Control-X}
+ \item Run with \code{picocom -b BAUD_RATE /dev/SERIAL_DEVICE}.
+ \item Exit with \code{[Ctrl][a] [Ctrl][x]}
\end{itemize}
\item \code{SERIAL_DEVICE} is typically
\begin{itemize}
\item \code{ttyUSBx} for USB to serial converters
\item \code{ttySx} for real serial ports
\end{itemize}
+ \item Most frequent command: \code{picocom -b 115200 /dev/ttyUSB0}
\end{itemize}
\end{frame}
diff --git a/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 4b3c1036..0ae72e92 100644
--- a/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -897,8 +897,11 @@ Device 0 bad blocks:
\item You just have to pass the following information on the kernel
command line:
\begin{itemize}
- \item \code{ubi.mtd=1}\\
- Attach \code{/dev/mtd1} to the UBI layer and create \code{ubi0}
+ \item \code{ubi.mtd=UBI}\\
+ Attach the MTD partition named \code{UBI} to the UBI layer and
+ create \code{ubi0}.\\
+ Note: you can also use the MTD partition number (more error
+ prone): \code{ubi.mtd=1}
\item \code{rootfstype=ubifs root=ubi0:rootfs}\\
Mount the \code{rootfs} volume on ubi0 as a UBIFS filesystem
\item \code{rootfstype=} lets the kernel know what filesystem
@@ -907,7 +910,7 @@ Device 0 bad blocks:
doesn't have to try all the filesystems it supports. This reduces
boot time.
\end{itemize}
- \item Example: \code{rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs}
+ \item Example: \code{rootfstype=ubifs ubi.mtd=UBI root=ubi0:rootfs}
\end{itemize}
\end{frame}
@@ -921,7 +924,7 @@ Device 0 bad blocks:
\item Define the base Linux kernel bootargs, specifying booting
on UBIFS, the UBI volume used as root filesystem, and the MTD
partition attached to UBI. Example:\\
- {\footnotesize \code{setenv bootargs_base console=ttyS0 rootfstype=ubifs root=ubi0:rootfs ubi.mtd=2 ...}}
+ {\footnotesize \code{setenv bootargs_base console=ttyS0 rootfstype=ubifs root=ubi0:rootfs ubi.mtd=UBI}}
\item Define the boot command sequence, loading the U-Boot partition
definitions, loading kernel and DTB images from UBI partitions,
and adding \code{mtdparts} to the kernel command
diff --git a/slides/sysdev-intro/sysdev-intro.tex b/slides/sysdev-intro/sysdev-intro.tex
index 42607b11..e293687d 100644
--- a/slides/sysdev-intro/sysdev-intro.tex
+++ b/slides/sysdev-intro/sysdev-intro.tex
@@ -239,7 +239,7 @@
\item MIPS (mainly networking applications)
\item SuperH (mainly set top box and multimedia applications)
\item c6x (TI DSP architecture)
- \item Microblaze (soft-core for Xilinx FPGA)
+ \item Microblaze (Xilinx), Nios II (Altera): soft cores on FPGAs
\item Others: ARC, m68k, Xtensa...
\end{itemize}
\end{frame}
@@ -264,9 +264,9 @@
\item {\bf Storage}: a very basic Linux system can work within 4 MB
of storage, but usually more is needed.
\begin{itemize}
- \item Flash storage is supported, both NAND and NOR flash, with
+ \item Block storage: SD/MMC/eMMC, USB mass storage, SATA, etc,
+ \item Flash storage is supported too, both NAND and NOR flash, with
specific filesystems
- \item Block storage including SD/MMC cards and eMMC is supported
\end{itemize}
\item Not necessarily interesting to be too restrictive on the
amount of RAM/storage: having flexibility at this level allows to
diff --git a/slides/sysdev-toolchains-definition/sysdev-toolchains-definition.tex b/slides/sysdev-toolchains-definition/sysdev-toolchains-definition.tex
index c9404396..89b68b1e 100644
--- a/slides/sysdev-toolchains-definition/sysdev-toolchains-definition.tex
+++ b/slides/sysdev-toolchains-definition/sysdev-toolchains-definition.tex
@@ -64,8 +64,8 @@
\item \code{as}, the assembler, that generates binary code from
assembler source code
\item \code{ld}, the linker
- \item \code{ar}, \code{ranlib}, to generate \code{.a} archives,
- used for libraries
+ \item \code{ar}, \code{ranlib}, to generate \code{.a} archives
+ (static libraries)
\item \code{objdump}, \code{readelf}, \code{size}, \code{nm},
\code{strings}, to inspect binaries. Very useful analysis tools!
\item \code{objcopy}, to modify binaries
@@ -80,7 +80,7 @@
\begin{frame}
\frametitle{Kernel headers (1)}
\begin{columns}
- \column{0.6\textwidth}
+ \column{0.7\textwidth}
\begin{itemize}
\item The C library and compiled programs needs to interact with the kernel
\begin{itemize}
@@ -92,9 +92,11 @@
applications also require them.
\item Available in \code{<linux/...>} and \code{<asm/...>} and a few
other directories corresponding to the ones visible in
- \kdir{include} in the kernel sources
+ \kdir{include/uapi} and in \code{arch/<arch>/include/uapi} in the kernel sources
+ \item The kernel headers are extracted from the kernel sources using
+ the \code{headers_install} kernel Makefile target.
\end{itemize}
- \column[c]{0.4\textwidth}
+ \column[c]{0.3\textwidth}
\includegraphics[width=\textwidth]{slides/sysdev-toolchains-definition/kernel-headers.pdf}
\end{columns}
\end{frame}
@@ -125,25 +127,24 @@ struct stat {
\end{itemize}
\end{frame}
-\begin{frame}
+\begin{frame}[fragile]
\frametitle{Kernel headers (3)}
+ The kernel to user space ABI is {\bf backward compatible}
\begin{itemize}
- \item The kernel to user space ABI is {\bf backward compatible}
- \begin{itemize}
- \item ABI = {\em Application Binary Interface}\\
- We're talking about binary compatibility
- \item Binaries generated with a toolchain using kernel headers
- older than the running kernel will work without problem, but
- won't be able to use the new system calls, data structures, etc.
- \item Binaries generated with a toolchain using kernel headers
- newer than the running kernel might work on if they don't use
- the recent features, otherwise they will break
- \item Using the latest kernel headers is not necessary, unless
- access to the new kernel features is needed
- \end{itemize}
- \item The kernel headers are extracted from the kernel sources using
- the \code{headers_install} kernel Makefile target.
+ \item ABI = {\em Application Binary Interface} - It's about binary compatibility
+ \item Kernel developers are doing their best to {\bf never}
+ break existing programs when the kernel is upgraded.
+ Otherwise, users would stick to older kernels, which
+ would be bad for everyone.
+ \item Hence, binaries generated with a toolchain using kernel headers
+ older than the running kernel will work without problem, but
+ won't be able to use the new system calls, data structures, etc.
+ \item Binaries generated with a toolchain using kernel headers
+ newer than the running kernel might work only if they don't use
+ the recent features, otherwise they will break.
\end{itemize}
+ What to remember: fine to keep an old toolchain as long as it
+ works fine for your project, even if you update the kernel.
\end{frame}
\begin{frame}
diff --git a/slides/sysdev-toolchains-obtaining/sysdev-toolchains-obtaining.tex b/slides/sysdev-toolchains-obtaining/sysdev-toolchains-obtaining.tex
index 0bfd606b..f4fdab7c 100644
--- a/slides/sysdev-toolchains-obtaining/sysdev-toolchains-obtaining.tex
+++ b/slides/sysdev-toolchains-obtaining/sysdev-toolchains-obtaining.tex
@@ -7,13 +7,12 @@
task! Can take days or weeks!
\begin{itemize}
\item Lots of details to learn: many components to build, complicated
- configuration
- \item Lots of decisions to make (such as C library version, ABI, floating point
- mechanisms, component versions)
- \item Need kernel headers and C library sources
+ configuration. Need to be familiar with building and configuring tools.
+ \item Many decisions to make about the components (such as C library,
+ gcc and binutils versions, ABI, floating point mechanisms...). Not
+ trivial to find working combinations of such components!
\item Need to be familiar with current \code{gcc} issues and patches
on your platform
- \item Useful to be familiar with building and configuring tools
\item See the {\em Crosstool-NG} \code{docs/} directory for details
on how toolchains are built.
\end{itemize}
More information about the training-materials-updates
mailing list