From a27c72e072813081e79798db5e54deaa5b7ad5d5 Mon Sep 17 00:00:00 2001
From: jan <jan@hopfropf.lan>
Date: Fri, 23 Apr 2010 09:05:38 +0200
Subject: Initial version of the cross development presentation: - Cross
 compile - Testing with qemu-user - Preparing a test system: Create a simple
 RFS from scratch - Exporting the RFS via NFS - Boot Testing the RFS with
 qemu-system

---
 .../cross-devel/pres_cross-devel_de.tex            | 224 +++++++++++++++++++++
 1 file changed, 224 insertions(+)
 create mode 100644 application-devel/cross-devel/pres_cross-devel_de.tex

(limited to 'application-devel/cross-devel/pres_cross-devel_de.tex')

diff --git a/application-devel/cross-devel/pres_cross-devel_de.tex b/application-devel/cross-devel/pres_cross-devel_de.tex
new file mode 100644
index 0000000..c792682
--- /dev/null
+++ b/application-devel/cross-devel/pres_cross-devel_de.tex
@@ -0,0 +1,224 @@
+\documentclass{beamer}
+\usetheme{linutronix}
+\usepackage{german}
+\usepackage[utf8]{inputenc}
+\usepackage{pgf}
+\usepackage{graphicx}
+\usepackage{lxextras}
+
+\title{Block \lq Cross Development\rq}
+\institute{Linutronix GmbH}
+
+\lstset{keywordstyle=\color{blue},commentstyle=\color{orange}}
+
+\begin{document}
+
+\maketitle
+
+\begin{frame}
+\frametitle{Übersicht}
+\tableofcontents
+\end{frame}
+
+\section{Cross Übersetzen}
+\begin{frame}[containsverbatim]
+\frametitle{Cross ''Hello world''}
+\begin{lstlisting}[language=c]
+/* cross_hello.c */
+#include <stdio.h>
+
+int main(void)
+{
+        printf("Hello cross compiling world\n");
+        return 0;
+}
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Übersetzen für das Zielsystem}
+\begin{lstlisting}[language=bash]
+# Uebersetzen
+powerpc-linux-gnu-gcc -static -o cross_hello \
+cross_hello.c
+\end{lstlisting}
+\begin{lstlisting}[language=bash]
+# Executable ueberpruefen
+$ file cross_hello
+cross_hello: ELF 32-bit MSB executable, PowerPC
+or cisco 4500, version 1 (SYSV),
+dynamically linked (uses shared libs),
+for GNU/Linux 2.6.10, with unknown
+[...]
+not stripped
+\end{lstlisting}
+\end{frame}
+
+\section{Testing auf dem Host}
+
+\begin{frame}
+\frametitle{Qemu als Werkzeug zur Cross Entwicklung}
+\begin{alertblock}{Was ist Qemu?}
+Qemu ist eine sehr performante Emulations- und Virtualisierungsumgebung für alle
+gängigen CPU Architekturen.
+\end{alertblock}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Testen eines Executables mit der Qemu user emulation}
+\begin{lstlisting}[language=bash]
+$ ./cross_hello
+bash: ./cross_hello: cannot execute binary file
+$ qemu-ppc ./cross_hello
+Hello cross compiling world
+\end{lstlisting}
+\end{frame}
+
+\section{Rootfilesystem}
+\subsection{Filesystem from scratch}
+\begin{frame}[containsverbatim]
+\frametitle{Erstellen eines Rootfilesystems für die Zielarchitektur}
+1) Busybox
+\begin{lstlisting}[language=bash]
+mkdir /tftpboot/nfsroot
+cd busybox-1.16.1
+make menuconfig
+make CROSS_COMPILE=powerpc-linux-gnu- install
+rsync -Hav _install/ /tftpboot/nfsroot
+cd /tftpboot/nfsroot
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Erstellen eines Rootfilesystems für die Zielarchitektur}
+2) Grundstruktur erstellen:
+\begin{lstlisting}[language=bash]
+# Verzeichnisstruktur
+mkdir lib etc tmp dev mnt sys proc
+
+# Devices nodes (als root!)
+mknod dev/console c 5 1
+mknod dev/null c 1 3
+mknod dev/ttyS0 c 4 64
+mknod dev/tty0 c 4 0
+mknod dev/tty1 c 4 1
+mknod dev/tty2 c 4 2
+mknod dev/tty3 c 4 3
+mknod dev/tty4 c 4 4
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Erstellen eines Rootfilesystems für die Zielarchitektur}
+3) Startscript(e) erstellen
+\begin{lstlisting}[language=bash]
+cd /tftpboot/nfsroot
+mkdir etc/rc.d
+vim etc/init.d/rcS
+\end{lstlisting}
+/etc/rc.d/rcS:
+\begin{verbatim}
+#!/bin/sh
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+
+mount -o remount,rw /
+\end{verbatim}
+\begin{lstlisting}[language=bash]
+chmod u+rw etc/rc.d/rcS
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Erstellen eines Rootfilesystems für die Zielarchitektur}
+4) Libraries kopieren
+\begin{lstlisting}[language=bash]
+# Loader
+$ cp /path_to_my_libc/lib/ld.so.1 \
+/tftpboot/nfsroot/lib
+# Getting the dependencies and copy them
+$ powerpc-linux-gnu-objdump -x \
+/tftpboot/nfsroot/bin/busybox | grep NEEDED
+  NEEDED               libm.so.6
+  NEEDED               libc.so.6
+$ cp /path_to_my_libc/lib/libm.so.6 \
+/tftpboot/nfsroot/lib
+$ cp /path_to_my_libc/lib/libc.so.6 \
+/tftpboot/nfsroot/lib
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[containsverbatim]
+\frametitle{Erstellen eines Rootfilesystems für die Zielarchitektur}
+5) Berechtigungen korrigieren:
+\begin{lstlisting}[language=bash]
+chown -R root:root rootfs
+\end{lstlisting}
+That's it!! :)
+\end{frame}
+
+\subsection{Exportieren per NFS}
+\subsubsection{Konfiguration}
+\begin{frame}[containsverbatim]
+\frametitle{Exportieren per NFS}
+1) nfs-kernel-server installieren
+\begin{lstlisting}
+# Auf Debian basierten Systemen (als root)
+apt-get install nfs-kernel-server
+\end{lstlisting}
+\end{frame}
+\begin{frame}[containsverbatim]
+\frametitle{Exportieren per NFS}
+2) Directory exportieren
+\begin{lstlisting}[language=bash]
+vim /etc/exports
+\end{lstlisting}
+\begin{verbatim}
+/tftpboot/nfsroot \
+192.168.0.0/255.255.255.0\
+(rw,no_root_squash,no_subtree_check,insecure) \
+127.0.0.1\
+(rw,no_root_squash,no_subtree_check,insecure) \
+10.0.2.0/255.255.255.0\
+(rw,no_root_squash,no_subtree_check,insecure)
+\end{verbatim}
+\begin{lstlisting}[language=bash]
+/etc/init.d/nfs-kernel-server restart
+\end{lstlisting}
+\end{frame}
+\subsubsection{Filesystem mit Qemu testen}
+\begin{frame}[containsverbatim]
+\frametitle{RFS mit Qemu booten}
+\begin{lstlisting}
+qemu-system-ppc -nographic \
+-kernel images/vmlinux \
+-append \
+"console=ttyS0 ip=dhcp \
+root=/dev/nfs \
+nfsroot=10.0.2.2:/tftpboot/nfsroot" \
+-net nic -net user
+\end{lstlisting}
+\end{frame}
+\begin{frame}[containsverbatim]
+\frametitle{RFS mit Qemu booten}
+\begin{verbatim}
+[...]
+IP-Config: Got DHCP answer from 10.0.2.2, my address
+IP-Config: Complete:
+      device=eth0, addr=10.0.2.15, mask=255.255.255.0
+     host=10.0.2.15, domain=, nis-domain=(none),
+     bootserver=10.0.2.2, rootserver=10.0.2.2, rootpath=
+Looking up port of RPC 100003/2 on 10.0.2.2
+Looking up port of RPC 100005/1 on 10.0.2.2
+VFS: Mounted root (nfs filesystem) readonly.
+Freeing unused kernel memory: 208k init
+
+Please press Enter to activate this console.
+\end{verbatim}
+\end{frame}
+\subsubsection{Filesystem auf dem Target testen}
+\begin{frame}
+\frametitle{Auf dem Target}
+HAND'S ON! :)
+\end{frame}
+\end{document}
-- 
cgit v1.2.3

