From 27321f4513e60d4f1707d430cebc1c73f81e8c3d Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 25 Jan 2011 13:20:03 +0100 Subject: flash-filesystems: Added some basic information about, MTD partitioning, JFFS2, UBI, UBIFS --- flash-memory/flash-filesystems/images/jffs2.dia | Bin 0 -> 1054 bytes flash-memory/flash-filesystems/images/jffs2.png | Bin 0 -> 4327 bytes flash-memory/flash-filesystems/images/ubi.dia | Bin 0 -> 1550 bytes flash-memory/flash-filesystems/images/ubi.png | Bin 0 -> 7151 bytes flash-memory/flash-filesystems/images/ubifs.dia | Bin 0 -> 1203 bytes flash-memory/flash-filesystems/images/ubifs.png | Bin 0 -> 5407 bytes .../flash-filesystems/pres_flashfilesystems_en.tex | 37 +++++++++++++++++++++ 7 files changed, 37 insertions(+) create mode 100644 flash-memory/flash-filesystems/images/jffs2.dia create mode 100644 flash-memory/flash-filesystems/images/jffs2.png create mode 100644 flash-memory/flash-filesystems/images/ubi.dia create mode 100644 flash-memory/flash-filesystems/images/ubi.png create mode 100644 flash-memory/flash-filesystems/images/ubifs.dia create mode 100644 flash-memory/flash-filesystems/images/ubifs.png diff --git a/flash-memory/flash-filesystems/images/jffs2.dia b/flash-memory/flash-filesystems/images/jffs2.dia new file mode 100644 index 0000000..21394ec Binary files /dev/null and b/flash-memory/flash-filesystems/images/jffs2.dia differ diff --git a/flash-memory/flash-filesystems/images/jffs2.png b/flash-memory/flash-filesystems/images/jffs2.png new file mode 100644 index 0000000..63b4fe1 Binary files /dev/null and b/flash-memory/flash-filesystems/images/jffs2.png differ diff --git a/flash-memory/flash-filesystems/images/ubi.dia b/flash-memory/flash-filesystems/images/ubi.dia new file mode 100644 index 0000000..35eb9aa Binary files /dev/null and b/flash-memory/flash-filesystems/images/ubi.dia differ diff --git a/flash-memory/flash-filesystems/images/ubi.png b/flash-memory/flash-filesystems/images/ubi.png new file mode 100644 index 0000000..0575579 Binary files /dev/null and b/flash-memory/flash-filesystems/images/ubi.png differ diff --git a/flash-memory/flash-filesystems/images/ubifs.dia b/flash-memory/flash-filesystems/images/ubifs.dia new file mode 100644 index 0000000..82105f2 Binary files /dev/null and b/flash-memory/flash-filesystems/images/ubifs.dia differ diff --git a/flash-memory/flash-filesystems/images/ubifs.png b/flash-memory/flash-filesystems/images/ubifs.png new file mode 100644 index 0000000..2b23aa9 Binary files /dev/null and b/flash-memory/flash-filesystems/images/ubifs.png differ diff --git a/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex index 2708766..0249aa0 100644 --- a/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex +++ b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex @@ -63,6 +63,27 @@ $ dmesg \end{lstlisting} \end{frame} +\begin{frame}[fragile] +\frametitle{MTD Flash partitioning} +\begin{itemize} +\item Redboot partition parsing +\item Boardsupport +\item Kernelparameters: +\begin{verbatim} +mtdparts=edb7312-nor:256k(ARMboot)ro, +-(root);edb7312-nand:-(home) +\end{verbatim} +\end{itemize} +\end{frame} + +\begin{frame} +\frametitle{JFFS2} +\begin{figure}[h] +\centering +\includegraphics[width=8cm]{images/jffs2.png} +\end{figure} +\end{frame} + \begin{frame}[fragile] \frametitle{Using JFFS2} \begin{lstlisting} @@ -86,6 +107,22 @@ root=/dev/mtdblock0 rootfstype=jffs2 \end{verbatim} \end{frame} +\begin{frame} +\frametitle{UBI: Unsorted Block Images} +\begin{figure}[h] +\centering +\includegraphics[width=8cm]{images/ubi.png} +\end{figure} +\end{frame} + +\begin{frame} +\frametitle{UBIFS} +\begin{figure}[h] +\centering +\includegraphics[width=8cm]{images/ubifs.png} +\end{figure} +\end{frame} + \begin{frame}[fragile] \frametitle{Using UBIFS} \begin{lstlisting} -- cgit v1.2.3 From 419ee2957e35830d4726b329307cfae6de274dde Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Tue, 25 Jan 2011 15:37:04 +0100 Subject: linux-processes: Added CPU affinity and resource limits --- .../linux-processes/pres_linux-processes_en.tex | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/linux-basics/linux-processes/pres_linux-processes_en.tex b/linux-basics/linux-processes/pres_linux-processes_en.tex index 73582d8..142ab50 100644 --- a/linux-basics/linux-processes/pres_linux-processes_en.tex +++ b/linux-basics/linux-processes/pres_linux-processes_en.tex @@ -193,6 +193,30 @@ Scheduling policies: \end{verbatim} \end{frame} +\begin{frame}[fragile] +\frametitle{Setting scheduling class and priority} +\begin{lstlisting} +#include + +struct sched_param param; +int ret; + +params.prio = 80; +ret = sched_setscheduler(0, SCHED_FIFO, ¶m); +[...] +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Resource limits} +\begin{lstlisting} +#include + +int setrlimit(int resource, + const struct rlimit *rlim); +\end{lstlisting} +\end{frame} + \section{Daemons} \begin{frame} \frametitle{Daemons} @@ -214,6 +238,38 @@ working directory and so on...) \end{itemize} \end{frame} +\begin{frame}[fragile] +\frametitle{Scheduling on Multicore Systems} +\begin{itemize} +\item CPU affinity +\item Kernelparameters: +\begin{itemize} +\item num\_cpus= +\item isolcpus= +\item cpuset= +\end{itemize} +\end{itemize} +\end{frame} + +\section{Multicore specific scheduling} +\begin{frame}[fragile] +\frametitle{CPU affinity} +\begin{lstlisting} +#define _GNU_SOURCE +#include + +cpu_set_t set; + +CPU_ZERO(&set); +CPU_SET(0, &set); +CPU_SET(1, &set); + +[...] + +sched_setaffinity(pid, CPU_SETSIZE, &set); +\end{lstlisting} +\end{frame} + \section*{sources} \begin{frame} \begin{thebibliography}{1} -- cgit v1.2.3 From 3605c8958e8e2beb32b4c9b0fe166d561d3cfa4f Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Tue, 25 Jan 2011 17:20:16 +0100 Subject: Added a basic introduction ti libraries: - Creating static and shared libraries - Naming schemes for dynamic libraries --- .../embedded-devel/pres_embedded-devel_de.tex | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/application-devel/embedded-devel/pres_embedded-devel_de.tex b/application-devel/embedded-devel/pres_embedded-devel_de.tex index 889d49a..ef31830 100644 --- a/application-devel/embedded-devel/pres_embedded-devel_de.tex +++ b/application-devel/embedded-devel/pres_embedded-devel_de.tex @@ -287,6 +287,110 @@ $ addr2line -e hello 40050c \end{lstlisting} \end{frame} +\section{Bibliotheken} +\subsection{Statische Bibliotheken} +\begin{frame}[fragile] +\frametitle{Statische Bibliotheken} +\begin{lstlisting} +# Erstellen +$ gcc -c file1.c file2.c +$ ar r libhello.a file1.o file2.o +# Benutzen +$ gcc -o hello hello.o libhello.a +\end{lstlisting} +\end{frame} + +\subsection{Dynamische Bibliotheken} + +\begin{frame}[fragile] +\frametitle{Dynamische Bibliotheken} +\begin{lstlisting} +# Erstellen dynamischer Bibliotheken +$ gcc -fPIC file1.c file2.c +$ gcc -shared -o libhello.so file1.o file2.o +# Gegen die Bibliothek linken +$ gcc -o hello hello.c libhello.so +# Versuchen Sie nun das Programm zu starten +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Wir erinnern uns an den Dynamic Loader!} +Also, entweder LD\_LIBRARY\_PATH setzen, oder nach /lib bzw. /usr/lib +kopieren. +\end{frame} + +\begin{frame} +\frametitle{\textbf{P}osition \textbf{Independent} \textbf{Code}} +Die Option -fPIC bewirkt die Erzeugung von ''position independent code''. +Das heißt, es wird Code erzeugt, der zur Laufzeit an jeder beliebigen virtuellen +Adresse lauffähig ist. +\end{frame} + +\begin{frame}[fragile] +\frametitle{SONAME} +\begin{lstlisting} +# Erstellen dynamischer Bibliotheken +$ gcc -fPIC file1.c file2.c +$ gcc -shared -Wl,-soname,libsayhello.so \ + -o libhello.so file1.o file2.o +\end{lstlisting} +Die -soname Linker-Option bewirkt, daß beim Linken der Name +''libsayhello.so'' eingetragen wird. Das heißt der Loader +sucht beim Starten der Applikation nach einer Bibliothek mit +dem Namen ''libsayhello.so''. +\end{frame} + +\begin{frame} +\frametitle{Namensgebung} +\begin{itemize} +\item linker name +\item SONAME +\item real name +\end{itemize} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Namensgebung} +\begin{verbatim} +libhello.so.1 -> libhello.so.1.0.2 +# New minor version +libhello.so.1 -> libhello.so.1.0.3 +# New Major version +libhello.so.2 -> libhello.so.1.0.1 +\end{verbatim} +SONAME beeinhaltet die Majornumber. Der Symbolic Link mit +der Majornumber(SONAME) zeigt normalerweise auf die Bibliotheksversion +mit der aktuellsten Minornumber (real name). +\end{frame} + +\begin{frame}[fragile] +\frametitle{Namensgebung} +\begin{verbatim} +libhello.so -> libhello.so.1 +\end{verbatim} +Oft wird auch ein Link ohne Versionsnummer angelegt, der auf die +aktuellste Majornumber Zeigt. Man spricht hier vom sogenannten +''linker name''. +\end{frame} + +\begin{frame}[fragile] +\frametitle{DT\_RPATH und DT\_RUNPATH} +\begin{lstlisting} +$ gcc -Wl,-rpath,/mypath -o hello hello.c \ + libhello.so +\end{lstlisting} +-rpath erzeugt per Default DT\_RPATH. Um DT\_RUNPATH zu erzeugen, +benötigt man die Option --enable-new-dtags. Beispiel: +\begin{lstlisting} +$ gcc -Wl,--enable-new-dtags \ + -Wl,-rpath,/mypath \ + -o hello hello.c libhello.so +# Was faellt bei folgendem Kommando auf: +$ objdump -p hello | grep PATH +\end{lstlisting} +\end{frame} + \section{Buildprozess automatisieren} \subsection{Übersicht} \begin{frame} -- cgit v1.2.3 From 3b9f4a0ca8282a8c660c3faf20a6dc0adf8531a3 Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Tue, 25 Jan 2011 17:28:52 +0100 Subject: Mention the ELF format Explain the memory layout of a process --- .../linux-processes/pres_linux-processes_en.tex | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/linux-basics/linux-processes/pres_linux-processes_en.tex b/linux-basics/linux-processes/pres_linux-processes_en.tex index 142ab50..3ac3f8d 100644 --- a/linux-basics/linux-processes/pres_linux-processes_en.tex +++ b/linux-basics/linux-processes/pres_linux-processes_en.tex @@ -47,6 +47,23 @@ \def\lximg{none} \section{Process Management} +\begin{frame} +\frametitle{Binary formats} +A program file includes meta information which describes the format +of the executable. Linux uses the ELF format (Executable Linking Format) +\end{frame} + +\begin{frame} +\frametitle{Process Memory Layout} +\begin{itemize} +\item text segment +\item initialized data segment +\item uninitialized data segment +\item stack +\item heap +\end{itemize} +\end{frame} + \begin{frame} \frametitle{Process creation} From the operatings system's point of view, there are basically two steps, -- cgit v1.2.3 From 5c1118f6f422555b7d16b0336bc0792745ea9e11 Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Tue, 25 Jan 2011 17:48:27 +0100 Subject: Bugfix: Kernel parameters for SMP --- linux-basics/linux-processes/pres_linux-processes_en.tex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-basics/linux-processes/pres_linux-processes_en.tex b/linux-basics/linux-processes/pres_linux-processes_en.tex index 3ac3f8d..6ac373f 100644 --- a/linux-basics/linux-processes/pres_linux-processes_en.tex +++ b/linux-basics/linux-processes/pres_linux-processes_en.tex @@ -261,9 +261,8 @@ working directory and so on...) \item CPU affinity \item Kernelparameters: \begin{itemize} -\item num\_cpus= +\item max\_cpus= \item isolcpus= -\item cpuset= \end{itemize} \end{itemize} \end{frame} -- cgit v1.2.3 From a0dae75b137a16b70a1ba324cf961178ba748b71 Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Thu, 27 Jan 2011 13:02:37 +0100 Subject: Fix typo --- linux-basics/linux-processes/pres_linux-processes_en.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-basics/linux-processes/pres_linux-processes_en.tex b/linux-basics/linux-processes/pres_linux-processes_en.tex index 6ac373f..911cffc 100644 --- a/linux-basics/linux-processes/pres_linux-processes_en.tex +++ b/linux-basics/linux-processes/pres_linux-processes_en.tex @@ -36,7 +36,7 @@ % on the following slides, include icon in the left sidebar \def\lximg{/usr/share/lx/icons/fueller.png} -\title{Linux process mangagement / Scheduling / Daemons} +\title{Linux process management / Scheduling / Daemons} \institute{Linutronix GmbH} \begin{document} -- cgit v1.2.3 From dfc8ac76d16bc874d3110bc8934e0475fed2c471 Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Fri, 28 Jan 2011 12:36:36 +0100 Subject: Debugging: Fixed ''core dump'' and duma example --- application-devel/app-debugging/pres_app-debugging_de.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application-devel/app-debugging/pres_app-debugging_de.tex b/application-devel/app-debugging/pres_app-debugging_de.tex index f90c551..d95cfde 100644 --- a/application-devel/app-debugging/pres_app-debugging_de.tex +++ b/application-devel/app-debugging/pres_app-debugging_de.tex @@ -187,7 +187,7 @@ Loaded symbols for /lib64/ld-linux-x86-64.so.2 Core was generated by `./hello_segfault'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000400538 in main () at hello_crash.c:6 -6 printf("Hello segfaulting world\n", +6 printf("Hello segfaulting world %s\n", *arthur_dent); (gdb) bt #0 0x0000000000400538 in main () at hello_crash.c:6 @@ -394,7 +394,7 @@ int main(void) { int *my_array = (int*) malloc(10 * sizeof(int)); int i = 0; - memset(my_array, 0, 10); + memset(my_array, 0, 10 * sizeof(int)); for(i = 0; i < 11; i++) printf("%d ", my_array[i]); -- cgit v1.2.3 From 572647504a3d7f62405e19ac44916bbae9d1bb82 Mon Sep 17 00:00:00 2001 From: Jan Altenberg Date: Fri, 28 Jan 2011 12:38:50 +0100 Subject: Fixed shared library example. --- application-devel/embedded-devel/pres_embedded-devel_de.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application-devel/embedded-devel/pres_embedded-devel_de.tex b/application-devel/embedded-devel/pres_embedded-devel_de.tex index ef31830..0623724 100644 --- a/application-devel/embedded-devel/pres_embedded-devel_de.tex +++ b/application-devel/embedded-devel/pres_embedded-devel_de.tex @@ -306,7 +306,7 @@ $ gcc -o hello hello.o libhello.a \frametitle{Dynamische Bibliotheken} \begin{lstlisting} # Erstellen dynamischer Bibliotheken -$ gcc -fPIC file1.c file2.c +$ gcc -c -fPIC file1.c file2.c $ gcc -shared -o libhello.so file1.o file2.o # Gegen die Bibliothek linken $ gcc -o hello hello.c libhello.so @@ -331,7 +331,7 @@ Adresse lauffähig ist. \frametitle{SONAME} \begin{lstlisting} # Erstellen dynamischer Bibliotheken -$ gcc -fPIC file1.c file2.c +$ gcc -c -fPIC file1.c file2.c $ gcc -shared -Wl,-soname,libsayhello.so \ -o libhello.so file1.o file2.o \end{lstlisting} -- cgit v1.2.3 -- cgit v1.2.3 From 5bc3f53265144faf43e16031483d92f581766a2b Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Fri, 28 Jan 2011 13:09:45 +0100 Subject: move images to root directory Signed-off-by: Manuel Traut --- flash-memory/flash-filesystems/images/jffs2.dia | Bin 1054 -> 0 bytes flash-memory/flash-filesystems/images/jffs2.png | Bin 4327 -> 0 bytes flash-memory/flash-filesystems/images/ubi.dia | Bin 1550 -> 0 bytes flash-memory/flash-filesystems/images/ubi.png | Bin 7151 -> 0 bytes flash-memory/flash-filesystems/images/ubifs.dia | Bin 1203 -> 0 bytes flash-memory/flash-filesystems/images/ubifs.png | Bin 5407 -> 0 bytes images/jffs2.dia | Bin 0 -> 1054 bytes images/jffs2.png | Bin 0 -> 4327 bytes images/ubi.dia | Bin 0 -> 1550 bytes images/ubi.png | Bin 0 -> 7151 bytes images/ubifs.dia | Bin 0 -> 1203 bytes images/ubifs.png | Bin 0 -> 5407 bytes 12 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 flash-memory/flash-filesystems/images/jffs2.dia delete mode 100644 flash-memory/flash-filesystems/images/jffs2.png delete mode 100644 flash-memory/flash-filesystems/images/ubi.dia delete mode 100644 flash-memory/flash-filesystems/images/ubi.png delete mode 100644 flash-memory/flash-filesystems/images/ubifs.dia delete mode 100644 flash-memory/flash-filesystems/images/ubifs.png create mode 100644 images/jffs2.dia create mode 100644 images/jffs2.png create mode 100644 images/ubi.dia create mode 100644 images/ubi.png create mode 100644 images/ubifs.dia create mode 100644 images/ubifs.png diff --git a/flash-memory/flash-filesystems/images/jffs2.dia b/flash-memory/flash-filesystems/images/jffs2.dia deleted file mode 100644 index 21394ec..0000000 Binary files a/flash-memory/flash-filesystems/images/jffs2.dia and /dev/null differ diff --git a/flash-memory/flash-filesystems/images/jffs2.png b/flash-memory/flash-filesystems/images/jffs2.png deleted file mode 100644 index 63b4fe1..0000000 Binary files a/flash-memory/flash-filesystems/images/jffs2.png and /dev/null differ diff --git a/flash-memory/flash-filesystems/images/ubi.dia b/flash-memory/flash-filesystems/images/ubi.dia deleted file mode 100644 index 35eb9aa..0000000 Binary files a/flash-memory/flash-filesystems/images/ubi.dia and /dev/null differ diff --git a/flash-memory/flash-filesystems/images/ubi.png b/flash-memory/flash-filesystems/images/ubi.png deleted file mode 100644 index 0575579..0000000 Binary files a/flash-memory/flash-filesystems/images/ubi.png and /dev/null differ diff --git a/flash-memory/flash-filesystems/images/ubifs.dia b/flash-memory/flash-filesystems/images/ubifs.dia deleted file mode 100644 index 82105f2..0000000 Binary files a/flash-memory/flash-filesystems/images/ubifs.dia and /dev/null differ diff --git a/flash-memory/flash-filesystems/images/ubifs.png b/flash-memory/flash-filesystems/images/ubifs.png deleted file mode 100644 index 2b23aa9..0000000 Binary files a/flash-memory/flash-filesystems/images/ubifs.png and /dev/null differ diff --git a/images/jffs2.dia b/images/jffs2.dia new file mode 100644 index 0000000..21394ec Binary files /dev/null and b/images/jffs2.dia differ diff --git a/images/jffs2.png b/images/jffs2.png new file mode 100644 index 0000000..63b4fe1 Binary files /dev/null and b/images/jffs2.png differ diff --git a/images/ubi.dia b/images/ubi.dia new file mode 100644 index 0000000..35eb9aa Binary files /dev/null and b/images/ubi.dia differ diff --git a/images/ubi.png b/images/ubi.png new file mode 100644 index 0000000..0575579 Binary files /dev/null and b/images/ubi.png differ diff --git a/images/ubifs.dia b/images/ubifs.dia new file mode 100644 index 0000000..82105f2 Binary files /dev/null and b/images/ubifs.dia differ diff --git a/images/ubifs.png b/images/ubifs.png new file mode 100644 index 0000000..2b23aa9 Binary files /dev/null and b/images/ubifs.png differ -- cgit v1.2.3