summaryrefslogtreecommitdiff
path: root/application-devel/cross-devel/pres_cross-devel_de.tex
blob: 39c59a3d34ff8e47f36e0d176df592deb7d11e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
\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 -p /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+x 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 /tftpboot/nfsroot
\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}