From 2f639f7646798e035e2f04b361f311e462bb28d6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 3 Jul 2014 15:13:37 +0100 Subject: [PATCH] Initial updates. --- .gitignore | 2 ++ build-supernested.sh.in | 3 ++- init.in | 20 +++++++++++++++----- run-supernested.sh.in | 17 +++++++++++++++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f0866b6..0aec8f5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ Makefile /missing /run-supernested.sh /supernested-*-*.qcow2 +/tmp-appliance.d +/tmp-supermin.d diff --git a/build-supernested.sh.in b/build-supernested.sh.in index e875fca..bd006ae 100644 --- a/build-supernested.sh.in +++ b/build-supernested.sh.in @@ -76,4 +76,5 @@ EOF 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 diff --git a/init.in b/init.in index 32295a8..fb9bf09 100644 --- a/init.in +++ b/init.in @@ -58,7 +58,15 @@ kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf # 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 @@ -68,16 +76,18 @@ cat /sys/devices/system/clocksource/clocksource0/current_clocksource 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 diff --git a/run-supernested.sh.in b/run-supernested.sh.in index 50cd47b..51d84da 100644 --- a/run-supernested.sh.in +++ b/run-supernested.sh.in @@ -27,7 +27,8 @@ initrd=initrd 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" @@ -48,10 +49,11 @@ while true ; do ;; --help) echo "$0: read the README file for information about this script" - shift + exit 1 ;; --) shift + break ;; *) echo "internal error ($1)" @@ -85,6 +87,17 @@ level="$( 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 \ -- 1.8.3.1