summaryrefslogtreecommitdiffstats
path: root/src/ci/docker/scripts/qemu-bare-bones-rcS
diff options
context:
space:
mode:
Diffstat (limited to 'src/ci/docker/scripts/qemu-bare-bones-rcS')
-rw-r--r--src/ci/docker/scripts/qemu-bare-bones-rcS28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ci/docker/scripts/qemu-bare-bones-rcS b/src/ci/docker/scripts/qemu-bare-bones-rcS
new file mode 100644
index 000000000..3c29bedc1
--- /dev/null
+++ b/src/ci/docker/scripts/qemu-bare-bones-rcS
@@ -0,0 +1,28 @@
+#!/bin/sh
+mount -t proc none /proc
+mount -t sysfs none /sys
+/sbin/mdev -s
+
+# fill up our entropy pool, if we don't do this then anything with a hash map
+# will likely block forever as the kernel is pretty unlikely to have enough
+# entropy.
+/addentropy < /addentropy
+cat /dev/urandom | head -n 2048 | /addentropy
+
+# Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU
+# will communicate to as well as the loopback 127.0.0.1 address.
+ifconfig eth0 10.0.2.15
+ifconfig lo up
+
+# Configure DNS resolution of 'localhost' to work
+echo 'hosts: files dns' >> /ubuntu/etc/nsswitch.conf
+echo '127.0.0.1 localhost' >> /ubuntu/etc/hosts
+
+# prepare the chroot
+mount -t proc proc /ubuntu/proc/
+mount --rbind /sys /ubuntu/sys/
+mount --rbind /dev /ubuntu/dev/
+
+# Execute our `testd` inside the ubuntu chroot
+cp /testd /ubuntu/testd
+chroot /ubuntu /testd &