1#!/bin/sh 2mount -t proc none /proc 3mount -t sysfs none /sys 4/sbin/mdev -s 5 6# fill up our entropy pool, if we don't do this then anything with a hash map 7# will likely block forever as the kernel is pretty unlikely to have enough 8# entropy. 9/addentropy < /addentropy 10cat /dev/urandom | head -n 2048 | /addentropy 11 12# Set up IP that qemu expects. This configures eth0 with the public IP that QEMU 13# will communicate to as well as the loopback 127.0.0.1 address. 14ifconfig eth0 10.0.2.15 15ifconfig lo up 16 17# Configure DNS resolution of 'localhost' to work 18echo 'hosts: files dns' >> /ubuntu/etc/nsswitch.conf 19echo '127.0.0.1 localhost' >> /ubuntu/etc/hosts 20 21# prepare the chroot 22mount -t proc proc /ubuntu/proc/ 23mount --rbind /sys /ubuntu/sys/ 24mount --rbind /dev /ubuntu/dev/ 25 26# Execute our `testd` inside the ubuntu chroot 27cp /testd /ubuntu/testd 28chroot /ubuntu /testd & 29