X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=run-supernested.sh.in;h=ea227f0c62eddc0c6d2e394b938d1a920a48e794;hb=5f2fd216420e0c169f5a15428945c0f7d4f5488e;hp=7e63ceb6c325c5d9e5a33b264cb1f87dc8131c27;hpb=63bd4e97d467b5b102735c62621e16112dbc50de;p=supernested.git diff --git a/run-supernested.sh.in b/run-supernested.sh.in index 7e63ceb..ea227f0 100644 --- a/run-supernested.sh.in +++ b/run-supernested.sh.in @@ -19,15 +19,24 @@ # # Written by Richard W.M. Jones +arch="@host_cpu@" qemu="@QEMU@" image="supernested-@VERSION@-@DISTRO@.qcow2" format=qcow2 kernel=kernel initrd=initrd -append="panic=1 console=ttyS0 udevtimeout=6000 no_timer_check printk.time=1 root=/dev/sda selinux=0" +append="panic=1 udevtimeout=6000 udev.event-timeout=6000 no_timer_check printk.time=1 root=/dev/sda selinux=0" smp= -accel=kvm -cpu="-cpu host" +tcg= + +case "$arch" in + aarch64) + append="$append earlyprintk=pl011,0x9000000 ignore_loglevel efi-rtc=noprobe" + ;; + *) + append="$append console=ttyS0" + ;; +esac TEMP=`getopt \ -o '' \ @@ -61,27 +70,18 @@ while true ; do grep -Eo 'supernested.smp=[[:digit:]]+' /proc/cmdline | grep -Eo '[[:digit:]]+' )" - if [ -n "$smp" ]; then smp="-smp $smp"; fi - accel="$( - grep -Eo 'supernested.accel=tcg' /proc/cmdline - )" - if [ -n "$accel" ]; then - accel=tcg - cpu= - else - accel=kvm + tcg= + if grep -q supernested.tcg=1 /proc/cmdline; then + tcg=1 fi shift ;; --smp) - smp="-smp $2" - append="$append supernested.smp=$2" + smp="$2" shift 2 ;; --tcg) - accel=tcg - cpu= - append="$append supernested.accel=tcg" + tcg=1 shift ;; --help) @@ -115,6 +115,17 @@ if [ $memory -lt 2048 ]; then fi memory=$((memory - 1500)) +# ARM mach_virt (-M virt) model only supports 30GB of RAM. +if [ $memory -gt 30000 ]; then + case "$arch" in + arm*|aarch64) + echo "$0: limiting memory to 30000 MB for ARM mach_virt" + memory=30000 + ;; + *) + esac +fi + # Get current nesting level from /proc/cmdline, increment it, add it # to the command line. level="$( @@ -124,11 +135,28 @@ level="$( if [ -z "$level" ]; then level=0; fi append="$append supernested.level=$((level+1))" +# Append other parameters to nested command line. +append="$append supernested.smp=$smp supernested.tcg=$tcg" + +extra_args= +if [ -n "$smp" ]; then extra_args="$extra_args -smp $smp"; fi +if [ -n "$tcg" ]; then + extra_args="$extra_args -machine accel=tcg" +else + extra_args="$extra_args -cpu host -machine accel=kvm" +fi + +case "$arch" in + i[3456]86|x86_64) + extra_args="$extra_args -no-hpet -device sga" + ;; + *) + ;; +esac + echo "Running" echo " qemu = $qemu" -echo " cpu = $cmp" -echo " smp = $smp" -echo " accel = $accel" +echo " extra_args = $extra_args" echo " memory = $memory" echo " kernel = $kernel" echo " initrd = $initrd" @@ -140,14 +168,11 @@ sync exec \ "$qemu" \ - $cpu \ - $smp \ - -machine accel=$accel \ + $extra_args \ -display none \ -m $memory \ -no-reboot \ -rtc driftfix=slew \ - -no-hpet \ -global kvm-pit.lost_tick_policy=discard \ -kernel "$kernel" \ -initrd "$initrd" \ @@ -156,5 +181,4 @@ exec \ -device scsi-hd,drive=hd0 \ -device virtio-serial-pci \ -serial stdio \ - -device sga \ -append "$append"