aboutsummaryrefslogtreecommitdiff
path: root/qemu_multiarch_testing
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-05 09:04:04 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-05 09:04:04 +0200
commit12efcf3285a75d197704d2eef23824b3e4f11e66 (patch)
tree1e518da57b55f527768e2d5031a71fbdca0f998f /qemu_multiarch_testing
parent28b00ce6ff8cde91f3e83632e705709b7cd2ab20 (diff)
downloadbusybox-w32-12efcf3285a75d197704d2eef23824b3e4f11e66.tar.gz
busybox-w32-12efcf3285a75d197704d2eef23824b3e4f11e66.tar.bz2
busybox-w32-12efcf3285a75d197704d2eef23824b3e4f11e66.zip
Add qemu_multiarch_testing/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'qemu_multiarch_testing')
-rw-r--r--qemu_multiarch_testing/README63
-rwxr-xr-xqemu_multiarch_testing/extract_od_binary.sh6
-rwxr-xr-xqemu_multiarch_testing/hdc.dir/build45
-rwxr-xr-xqemu_multiarch_testing/hdc.dir/init9
-rwxr-xr-xqemu_multiarch_testing/make-hdc-img.sh30
-rwxr-xr-xqemu_multiarch_testing/parallel-build-hdc-img.sh40
6 files changed, 193 insertions, 0 deletions
diff --git a/qemu_multiarch_testing/README b/qemu_multiarch_testing/README
new file mode 100644
index 000000000..69ddb76b8
--- /dev/null
+++ b/qemu_multiarch_testing/README
@@ -0,0 +1,63 @@
1How to test build using Aboriginal Linux system images.
2
3* Put a source tree into hdc.dir/.
4For example, this should work:
5git clone git://busybox.net/var/lib/git/busybox.git
6
7* Run ./make-hdc-img.sh: it will generate ext2 image file,
8hdc.img, from hdc.dir/* data. This requires root for loop mount.
9
10* Download and unpack, or build from source and unpack
11one or more system-image-ARCH directories into this directory
12(the one which contains this README).
13
14* Run: ./parallel-build-hdc-img.sh system-image-DIR1 system-image-DIR2...
15(background it if you don't want to see "Waiting to finish" thing).
16This runs build in several qemu virtual machines in parallel.
17
18* Observe system-image-*.log file(s) with growing log of the build.
19
20There is no automated detection of errors for now: you need to examine
21logs yourself.
22
23Log files will also contain uuencoded (or if all else fails, od -tx1'ed)
24binary, if build was successful.
25
26To debug a build problem in one of the sandboxes, change keep_hdb
27to "keep_hdb=true" in parallel-build-hdc-img.sh
28- this preserves system-image-ARCH/hdb.img after the build,
29so you can go into system-image-ARCH and run
30"HDB=hdb.img ./dev-environment.sh" to debug the problem.
31
32You can also run "./parallel-build-hdc-img.sh -s system-image-ARCH"
33- single mode, output is to screen and serial input is from keyboard.
34
35If hdc.dir/bin/busybox-$ARCH exists, it will be used during build
36to supply additional tools.
37
38For me, the following system images worked:
39system-image-armv4l
40system-image-armv4tl
41system-image-armv5l
42 od is buggy on arm*:
43 # echo Hello-hello-hello-hello | od -b
44 0000000 110 145 154 154 157 055 150 145 154 154 157 055 150 145 154 154
45 0000000 157 055 150 145 154 154 157 012
46 0000000
47system-image-i686
48system-image-mips
49system-image-mipsel
50 od is buggy on mips[el]:
51 # echo Hello-hello-hello-hello | od -b
52 0000000 110 145 154 154 157 055 150 145 154 154 157 055 150 145 154 154
53 17767153361 157 055 150 145 154 154 157 012
54 0000000
55system-image-x86_64
56
57And these did not:
58system-image-armv6l - hang on "Uncompressing Linux... done, booting the kernel"
59system-image-powerpc - hang early in kernel boot
60system-image-sparc - hang early in userspace
61system-image-m68k - my qemu doesn't like "-M q800"
62system-image-mips64 - init dies "Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000a"
63system-image-sh4 - qemu segfaults early in kernel boot
diff --git a/qemu_multiarch_testing/extract_od_binary.sh b/qemu_multiarch_testing/extract_od_binary.sh
new file mode 100755
index 000000000..e4c2c2a0a
--- /dev/null
+++ b/qemu_multiarch_testing/extract_od_binary.sh
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3# Converts textual result of "od -tx1 <FILE"
4# back into a binary FILE
5
6grep -a '^[0-7][0-7][0-7][0-7][0-7][0-7][0-7] [0-9a-f][0-9a-f] [0-9a-f][0-9a-f] [0-9a-f][0-9a-f] [0-9a-f][0-9a-f]' | busybox hexdump -R
diff --git a/qemu_multiarch_testing/hdc.dir/build b/qemu_multiarch_testing/hdc.dir/build
new file mode 100755
index 000000000..8a65a5582
--- /dev/null
+++ b/qemu_multiarch_testing/hdc.dir/build
@@ -0,0 +1,45 @@
1#!/bin/sh
2
3umount /mnt # optional
4
5test -x "bin/busybox-$HOST" && {
6 echo "Found bin/busybox-$HOST, using it"
7 cp -a "bin/busybox-$HOST" bin/busybox
8 bin/busybox --install -s bin/
9 # Supply missing stuff (e.g. bzip2):
10 PATH="$PATH:$PWD/bin"
11 # Override known-buggy host binaries:
12 cp -af bin/od `which od`
13}
14
15(
16 #set -e -x
17 cd busybox
18 make defconfig
19 # Want static build
20 sed 's/^.*CONFIG_STATIC.*$/CONFIG_STATIC=y/' -i .config
21 # Drats, newer Aboriginal Linux has no bzip2
22 bzip2 </dev/null >/dev/null || {
23 sed 's/^.*CONFIG_FEATURE_COMPRESS_USAGE.*$/# CONFIG_FEATURE_COMPRESS_USAGE is not set/' -i .config
24 }
25 # These won't build because of toolchain/libc breakage:
26 sed 's/^.*CONFIG_FEATURE_SYNC_FANCY.*$/# CONFIG_FEATURE_SYNC_FANCY is not set/' -i .config # no syncfs()
27 sed 's/^.*CONFIG_FEATURE_WTMP.*$/# CONFIG_FEATURE_WTMP is not set/' -i .config
28 sed 's/^.*CONFIG_FEATURE_UTMP.*$/# CONFIG_FEATURE_UTMP is not set/' -i .config
29 sed 's/^.*CONFIG_FEATURE_INETD_RPC.*$/# CONFIG_FEATURE_INETD_RPC is not set/' -i .config
30 sed 's/^.*CONFIG_BRCTL.*$/# CONFIG_BRCTL is not set/' -i .config
31 sed 's/^.*CONFIG_IFPLUGD.*$/# CONFIG_IFPLUGD is not set/' -i .config
32 make #V=1 || sh
33 size busybox
34 ./busybox || echo "Exit code: $?"
35 if uuencode TEST </dev/null >/dev/null && bzip2 </dev/null >/dev/null; then
36 bzip2 <busybox | uuencode busybox.bz2
37 else
38 od -tx1 <busybox
39 fi
40 #test "x$FTP_PORT" = x ||
41 # ftpput -P "$FTP_PORT" "$FTP_SERVER" strace
42) 2>&1 | tee build.log
43mount -o remount,ro /home
44sync
45sleep 1
diff --git a/qemu_multiarch_testing/hdc.dir/init b/qemu_multiarch_testing/hdc.dir/init
new file mode 100755
index 000000000..692371db6
--- /dev/null
+++ b/qemu_multiarch_testing/hdc.dir/init
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3# Emit a msg to let user know this place was reached
4echo "Copying to /home"
5# Had a case where cp SEGVs, let's have diagnostics for it
6cp -a /mnt /home || { echo "cp: $?"; exit 1; }
7cd /home/mnt || { echo "cd: $?"; exit 1; }
8exec ./build
9echo "Failed to exec ./build"
diff --git a/qemu_multiarch_testing/make-hdc-img.sh b/qemu_multiarch_testing/make-hdc-img.sh
new file mode 100755
index 000000000..3c35f4ead
--- /dev/null
+++ b/qemu_multiarch_testing/make-hdc-img.sh
@@ -0,0 +1,30 @@
1#!/bin/sh -ex
2
3mountpoint -q /
4[ ! -e hdc.img.dir ]
5
6cleanup()
7{
8 trap - EXIT
9 if mountpoint -q hdc.img.dir; then
10 umount -d hdc.img.dir
11 fi
12 mountpoint -q hdc.img.dir ||
13 rm -rf hdc.img.dir
14 exit $@
15}
16
17trap 'cleanup $?' EXIT
18trap 'cleanup 1' HUP PIPE INT QUIT TERM
19
20size=$(du -ks hdc.dir | sed -rn 's/^([0-9]+).*/\1/p')
21[ "$size" -gt 0 ]
22
23rm -f hdc.img
24dd if=/dev/zero of=hdc.img count=1 bs=1024 seek=$(($size*2))
25mkfs.ext3 -q -F -b 1024 -i 4096 hdc.img
26tune2fs -c 0 -i 0 hdc.img
27mkdir hdc.img.dir
28mount -o loop hdc.img hdc.img.dir
29cp -a hdc.dir/* hdc.img.dir/
30umount -d hdc.img.dir
diff --git a/qemu_multiarch_testing/parallel-build-hdc-img.sh b/qemu_multiarch_testing/parallel-build-hdc-img.sh
new file mode 100755
index 000000000..9ee54ebb8
--- /dev/null
+++ b/qemu_multiarch_testing/parallel-build-hdc-img.sh
@@ -0,0 +1,40 @@
1#!/bin/sh
2
3export HDBMEGS=100
4keep_hdb=false
5
6build_in_dir()
7{
8 cd "$1" || exit 1
9 rm -f hdb.img
10 nice -n10 time ./native-build.sh ../hdc.img
11 $keep_hdb || rm -f hdb.img
12 echo >&3 "Finished: $1"
13}
14
15test "$1" = "-s" && {
16 dir="$2"
17 # single mode: build one directory, show output
18 test -d "$dir" || exit 1
19 test -e "$dir/native-build.sh" || exit 1
20 build_in_dir "$dir"
21 exit $?
22}
23
24started=false
25for dir; do
26 test -d "$dir" || continue
27 test -e "$dir/native-build.sh" || continue
28 echo "Starting: $dir"
29 build_in_dir "$dir" 3>&1 </dev/null >"$dir.log" 2>&1 &
30 started=true
31done
32
33$started || {
34 echo "Give me system-image-ARCH directories on command line"
35 exit 1
36}
37
38echo "Waiting to finish"
39wait
40echo "Done, check the logs"