blob: ee17aaf7c6b9c9d7aeda42fa74a165b54c80c0c1 (
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
|
\subsection{Add base-files/busybox}
\begin{frame}
\frametitle{Workflow}
\begin{itemize}
\item busybox provides common commands, init and sh
\item symlinks need to be created
\item inittab and rcS needs to be provided
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Add a busybox recipe}
\begin{lstlisting}
$ cd ~/poky/meta-schulung
$ mkdir -p recipes-core/busybox
$ pluma recipes-core/busybox/busybox_1.29.3.bb
\end{lstlisting}
\begin{verbatim}
LICENSE = "GPLv2 & bzip2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb"
SRC_URI = "http://www.busybox.net/downloads/${P}.tar.bz2;name=upstream"
SRC_URI[upstream.md5sum] = "0a367e19cdfd157e8258d87f893ee516"
SRC_URI[upstream.sha256sum] =
"97648636e579462296478e0218e65e4bc1e9cd69089a3b1aeb810bff7621efb7"
DEPENDS += "virtual/crypt"
EXTRA_OEMAKE += "CROSS_COMPILE=${TARGET_PREFIX}"
EXTRA_OEMAKE += "CONFIG_SYSROOT=${PKG_CONFIG_SYSROOT_DIR}"
EXTRA_OEMAKE += "V=1"
FILES_${PN}-dev += " ${datadir}/busybox/busybox.links"
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Add a busybox recipe \#2}
\begin{verbatim}
do_configure() {
oe_runmake defconfig
}
do_compile() {
export CFLAGS="${TARGET_CC_ARCH} $CFLAGS"
oe_runmake busybox_unstripped
oe_runmake busybox.links
}
do_install() {
test "${prefix}" != "/usr" && \
sed -i -e "s:^/usr/:DONE${prefix}/:" busybox.links
test "${base_sbindir}" != "/sbin" && \
sed -i -e "s:^/sbin/:DONE${base_sbindir}/:" busybox.links
test "${base_bindir}" != "/bin" && \
sed -i -e "s:^/bin/:DONE${base_bindir}/:" busybox.links
sed -i -e "s:^DONE::" busybox.links
install -D -m 0755 busybox_unstripped ${D}${base_bindir}/busybox
install -D -m 0644 busybox.links ${D}${datadir}/busybox/busybox.links
}
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Add inittab}
\begin{lstlisting}
$ cd ~/poky/meta-schulung
$ mkdir -p recipes-core/rootfs/files
$ pluma recipes-core/rootfs/files/busybox_inittab
\end{lstlisting}
\begin{verbatim}
::sysinit:/etc/rcS
::askfirst:-/bin/sh
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Add startscript}
\begin{lstlisting}
$ cd ~/poky/meta-schulung
$ pluma recipes-core/rootfs/files/rcS
\end{lstlisting}
\begin{verbatim}
#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t tmpfs tmpfs /dev
mount -t tmpfs tmpfs /run
mdev -s
echo /sbin/mdev > /proc/sys/kernel/hotplug
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
mkdir -p /run/lock/subsys
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Add base-files recipe}
\begin{lstlisting}
$ cd ~/poky/meta-schulung
$ pluma recipes-core/rootfs/schulung-base.bb
\end{lstlisting}
\begin{verbatim}
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
RDEPENDS_${PN} = "busybox"
SRC_URI = "file://busybox_inittab file://rcS"
do_install() {
install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/rcS
install -D -m 0644 ${WORKDIR}/busybox_inittab ${D}${sysconfdir}/inittab
install -d ${D}/run
install -d ${D}/tmp
install -d ${D}/dev
install -d ${D}/proc
install -d ${D}/sys
}
FILES_${PN} += "/run /tmp /dev /proc /sys"
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Use base-files recipe in image}
\begin{lstlisting}
$ cd ~/poky/meta-schulung
$ pluma recipes-core/images/core-image-schulung.bb
\end{lstlisting}
\begin{verbatim}
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit core-image
IMAGE_LINGUAS = ""
CORE_IMAGE_BASE_INSTALL = " \
schulung-base \
kernel-modules \
example \
"
DEPENDS += "busybox"
setup_busybox_links() {
LINKS="${PKG_CONFIG_SYSROOT_DIR}${datadir}/busybox/busybox.links"
for lnfile in `cat $LINKS`; do
test $lnfile = /linuxrc && continue
install -d ${IMAGE_ROOTFS}`dirname $lnfile`
ln -s ${base_bindir}/busybox ${IMAGE_ROOTFS}$lnfile || true
done
}
do_rootfs[postfuncs] += "setup_busybox_links"
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Build and run image}
\begin{lstlisting}
$ cd ~/poky/build-schulung
$ bitbake core-image-schulung
$ ./tmp/sysroots-components/x86_64/qemu-native/usr/bin/qemu-system-arm \
-M vexpress-a9 -nographic \
-net nic -net user,hostfwd=tcp::1534-:1534,hostfwd=tcp::2345-:2345 \
-drive if=sd,format=raw,\
file=tmp/deploy/images/vexpress/core-image-schulung-vexpress.wic \
-dtb tmp/deploy/images/vexpress/vexpress-v2p-ca9.dtb \
-kernel tmp/deploy/images/vexpress/zImage \
-append "console=ttyAMA0,115200 root=/dev/mmcblk0p1 rw ip=dhcp"
[..]
Please press Enter to activate this console.
/ # df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 81.9M 8.4M 69.3M 11% /
[..]
\end{lstlisting}
\end{frame}
|