2 mount -t proc none /proc
3 mount -t sysfs none /sys
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
9 /addentropy < /addentropy
10 cat /dev/urandom | head -n 2048 | /addentropy
12 # Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU
13 # will communicate to as well as the loopback 127.0.0.1 address.
14 ifconfig eth0 10.0.2.15
17 # Configure DNS resolution of 'localhost' to work
18 echo 'hosts: files dns' >> /ubuntu/etc/nsswitch.conf
19 echo '127.0.0.1 localhost' >> /ubuntu/etc/hosts
22 mount -t proc proc /ubuntu/proc/
23 mount --rbind /sys /ubuntu/sys/
24 mount --rbind /dev /ubuntu/dev/
26 # Execute our `testd` inside the ubuntu chroot
27 cp /testd /ubuntu/testd
28 chroot /ubuntu /testd &