/missing
/run-supernested.sh
/supernested-*-*.qcow2
+/tmp-appliance.d
+/tmp-supermin.d
mv tmp-appliance.d/kernel .
mv tmp-appliance.d/initrd .
qemu-img convert -f raw tmp-appliance.d/root -O qcow2 "$output"
-rm -rf tmp-supermin.d tmp-appliance.d
+
+#rm -rf tmp-supermin.d tmp-appliance.d
# Set up tmpfiles (must run after kmod.conf is created above).
systemd-tmpfiles --prefix=/dev --create
+# libiscsi puts itself in a non-standard directory.
+/sbin/ldconfig
+
# Print some information about the system.
+echo "/proc/cpuinfo ------------------------------"
+cat /proc/cpuinfo
+echo "--------------------------------------------"
+echo
+
echo -n "cmdline: "
cat /proc/cmdline
echo -n "kernel: "
uname -r
-echo "/proc/cpuinfo ------------------------------"
-cat /proc/cpuinfo
-echo "--------------------------------------------"
-
# ls -lR /dev
# cat /proc/mounts
# lsmod
+level="$(
+ grep -Eo 'supernested.level=[[:digit:]]+' /proc/cmdline |
+ grep -Eo '[[:digit:]]+'
+ )"
+echo "*** This is the L$level hypervisor ***"
+
# Run the nested guest.
-/run-supernested.sh
+/run-supernested.sh --nested
# Exit and reboot.
# qemu has the -no-reboot flag, so issuing a reboot here actually
append="panic=1 console=ttyS0 udevtimeout=6000 no_timer_check printk.time=1 root=/dev/sda selinux=0"
TEMP=`getopt \
- --long nested \
+ -o '' \
+ --longoptions 'help,nested' \
-n run-supernested.sh -- "$@"`
if [ $? != 0 ]; then
echo "$0: problem parsing the command line arguments"
;;
--help)
echo "$0: read the README file for information about this script"
- shift
+ exit 1
;;
--)
shift
+ break
;;
*)
echo "internal error ($1)"
if [ -z "$level" ]; then level=0; fi
append="$append supernested.level=$((level+1))"
+echo "Running"
+echo " qemu = $qemu"
+echo " memory = $memory"
+echo " kernel = $kernel"
+echo " initrd = $initrd"
+echo " disk = $image"
+echo " append = $append"
+
+# Since this could crash the machine, better to sync ...
+sync
+
exec \
"$qemu" \
-cpu host \