[FE training-materials-updates] Add more boot time slides

Michael Opdenacker michael.opdenacker at free-electrons.com
Fri May 2 01:15:11 CEST 2014


Repository : git://git.free-electrons.com/training-materials.git

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=4283ae3142c338f7b1e7c27a0e24059da3ca2207

>---------------------------------------------------------------

commit 4283ae3142c338f7b1e7c27a0e24059da3ca2207
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Thu May 1 16:14:01 2014 -0700

    Add more boot time slides
    
    - From ELC presentation
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


>---------------------------------------------------------------

4283ae3142c338f7b1e7c27a0e24059da3ca2207
 slides/boottime-bootloader/boottime-bootloader.tex |   28 +++++++++
 .../boottime-init-scripts.tex                      |   62 +++++++++++++-------
 slides/boottime-kernel/boottime-kernel.tex         |    2 +-
 3 files changed, 71 insertions(+), 21 deletions(-)

diff --git a/slides/boottime-bootloader/boottime-bootloader.tex b/slides/boottime-bootloader/boottime-bootloader.tex
index 06e351e..04ea327 100644
--- a/slides/boottime-bootloader/boottime-bootloader.tex
+++ b/slides/boottime-bootloader/boottime-bootloader.tex
@@ -43,6 +43,34 @@ Recompile U-Boot to remove features not needed in production
 \end{itemize}
 \end{frame}
 
+\begin{frame}[fragile]
+\frametitle{U-Boot - Simplify scripts}
+Some boards have over-complicated scripts:
+\begin{block}{}
+\scriptsize
+\begin{verbatim}
+bootcmd=run bootf0
+bootf0=run ${args0}; setenv bootargs ${bootargs} \
+maximasp.kernel=maximasp_nand.0:kernel0; nboot 0x70007fc0 kernel0
+\end{verbatim}
+\end{block}
+Let's replace this by:
+\begin{block}{}
+\tiny
+\begin{verbatim}
+setenv bootargs 'mem=128M console=tty0 consoleblank=0
+console=ttyS0,57600 \
+mtdparts=maximasp_nand.0:2M(u-boot)ro,512k(env0)ro,512k(env1)ro,\
+4M(kernel0),4M(kernel1),5M(kernel2),100M(root0),100M(root1),-(other)\
+rw ubi.mtd=root0 root=ubi0:rootfs rootfstype=ubifs earlyprintk debug \
+user_debug=28 maximasp.board=EEKv1.3.x \
+maximasp.kernel=maximasp_nand.0:kernel0'
+setenv bootcmd 'nboot 0x70007fc0 kernel0'
+\end{verbatim}
+\end{block}
+This saved 56 ms on this ARM9 system (400 MHz)!
+\end{frame}
+
 \begin{frame}
 \frametitle{Bootloader: copy the exact kernel size}
 \begin{itemize}
diff --git a/slides/boottime-init-scripts/boottime-init-scripts.tex b/slides/boottime-init-scripts/boottime-init-scripts.tex
index 9743950..2b06f1d 100644
--- a/slides/boottime-init-scripts/boottime-init-scripts.tex
+++ b/slides/boottime-init-scripts/boottime-init-scripts.tex
@@ -122,33 +122,55 @@ After:
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{Reduce forking}
+\frametitle{Reduce forking (1)}
 \begin{itemize}
-	\item \code{fork}/\code{exec} system calls are very expensive.
-		Because of this, calls to executables from shells are slow.
-	\item Even executing \code{echo} in \code{busybox} shells results
-	      in a \code{fork} syscall!
-	\item Select \code{Shells -> Standalone shell} in \code{busybox}
-	      configuration to make the \code{busybox} shell call applets
-	      whenever possible.
-	\item Pipes and back-quotes are also implemented by
-	      \code{fork}/\code{exec}.  You can reduce their usage in
-	      scripts. Example:
-	      \begin{block}{}
-			\begin{verbatim}
+\item \code{fork}/\code{exec} system calls are very expensive.
+      Because of this, calls to executables from shells are slow.
+\item Even an \code{echo} in a BusyBox shell results in a \code{fork}
+syscall!
+\item Select \code{Shells -> Standalone shell} in BusyBox
+      configuration to make the shell call applets whenever possible.
+\item Pipes and back-quotes are also implemented by
+      \code{fork}/\code{exec}.  You can reduce their usage in
+      scripts. Example:
+      \begin{block}{}
+      \begin{verbatim}
 cat /proc/cpuinfo | grep model
-			\end{verbatim}
-		\end{block}
-		Replace it with:
-		\begin{block}{}
-			\begin{verbatim}
+      \end{verbatim}
+      \end{block}
+Replace it with:
+      \begin{block}{}
+      \begin{verbatim}
 grep model /proc/cpuinfo
-			\end{verbatim}
-		\end{block}
+      \end{verbatim}
+      \end{block}
 \end{itemize}
 See \url{http://elinux.org/Optimize_RC_Scripts}
 \end{frame}
 
+\begin{frame}[fragile]
+\frametitle{Reduce forking (2)}
+Replaced:
+\begin{block}{}
+\begin{verbatim}
+if [ $(expr match "$(cat /proc/cmdline)" '.* debug.*')\
+       -ne 0 -o -f /root/debug ]; then
+DEBUG=1
+\end{verbatim}
+\end{block}
+By a much cheaper command running only one process:
+\begin{block}{}
+\begin{verbatim}
+res=`grep " debug" /proc/cmdline`
+if [ "$res" -o -f /root/debug ]; then
+DEBUG=1
+\end{verbatim}
+\end{block}
+This only optimization allowed to save 87 ms on an ARM AT91SAM9263
+system (200 MHz)!
+\end{frame}
+
+
 \begin{frame}
 \frametitle{Reduce size (1)}
 \begin{itemize}
diff --git a/slides/boottime-kernel/boottime-kernel.tex b/slides/boottime-kernel/boottime-kernel.tex
index 5807548..bfccdad 100644
--- a/slides/boottime-kernel/boottime-kernel.tex
+++ b/slides/boottime-kernel/boottime-kernel.tex
@@ -89,7 +89,7 @@ First, we focus on reducing the size without removing features
 	\item The main mechanism is to use kernel modules
 	\item Compile everything that is not needed at boot time as a
 		module
-	\item Two benefits: the kernel will be smaller and load faster and
+	\item Two benefits: the kernel will be smaller and load faster, and
 		less initialization code will get executed
 	\item Remove features that are not used by userland:
 		\code{CONFIG_KALLSYMS}, \code{CONFIG_DEBUG_FS},



More information about the training-materials-updates mailing list