Tweaks to support 32- and 64-bit VMs better
authorSteve McIntyre <steve.mcintyre@arm.com>
Mon, 11 May 2020 12:07:49 +0000 (13:07 +0100)
committerSteve McIntyre <steve.mcintyre@arm.com>
Mon, 11 May 2020 12:07:49 +0000 (13:07 +0100)
scripts/start_runtime

index 7808149..01307dc 100755 (executable)
@@ -13,10 +13,12 @@ case $MACHINE in
               [ "$MACH"x = "aarch64"x ] || \
               [ "$MACH"x = "arm64" ] ; then
            MACH=aarch64
               [ "$MACH"x = "aarch64"x ] || \
               [ "$MACH"x = "arm64" ] ; then
            MACH=aarch64
+           QEMU=qemu-system-aarch64
            CPU_OPTS="-cpu host --enable-kvm"
            MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
        elif [ "$MACH"x = "arm"x ]; then
            MACH=arm
            CPU_OPTS="-cpu host --enable-kvm"
            MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
        elif [ "$MACH"x = "arm"x ]; then
            MACH=arm
+           QEMU=qemu-system-aarch64
            CPU_OPTS="-cpu host,aarch64=off --enable-kvm"
            MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
        else
            CPU_OPTS="-cpu host,aarch64=off --enable-kvm"
            MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
        else
@@ -29,10 +31,12 @@ case $MACHINE in
               [ "$MACH"x = "aarch64"x ] || \
               [ "$MACH"x = "arm64" ] ; then
            MACH=aarch64
               [ "$MACH"x = "aarch64"x ] || \
               [ "$MACH"x = "arm64" ] ; then
            MACH=aarch64
+           QEMU=qemu-system-aarch64
            CPU_OPTS="-cpu cortex-a57"
            MACH_OPTS="-M virt"
        elif [ "$MACH"x = "arm"x ]; then
            MACH=arm
            CPU_OPTS="-cpu cortex-a57"
            MACH_OPTS="-M virt"
        elif [ "$MACH"x = "arm"x ]; then
            MACH=arm
+           QEMU=qemu-system-arm
            CPU_OPTS="-cpu cortex-a15"
            MACH_OPTS="-M virt"
        else
            CPU_OPTS="-cpu cortex-a15"
            MACH_OPTS="-M virt"
        else
@@ -50,6 +54,9 @@ fi
 DISPLAY="-daemonize -vnc :1"
 PFLASH="-pflash $MACH-OVMF.fd -pflash $MACH-storage.fd"
 
 DISPLAY="-daemonize -vnc :1"
 PFLASH="-pflash $MACH-OVMF.fd -pflash $MACH-storage.fd"
 
+if [ "$CD"x != ""x ]; then
+    CD="-device virtio-scsi-pci,id=scsi -drive if=none,id=cd,file=$CD,readonly -device scsi-cd,drive=cd,bootindex=0"
+fi
 
 if [ "$NOSHARE"x = ""x ]; then
     P9="-virtfs local,path=$SHARE/,mount_tag=host0,security_model=passthrough,id=host0"
 
 if [ "$NOSHARE"x = ""x ]; then
     P9="-virtfs local,path=$SHARE/,mount_tag=host0,security_model=passthrough,id=host0"
@@ -64,12 +71,13 @@ NET="$NET,id=eth0"
 NET="$NET,hostfwd=tcp:127.0.0.1:${SSH_PORT}-10.0.2.15:22"
 NET="$NET -device virtio-net-device,netdev=eth0"
 
 NET="$NET,hostfwd=tcp:127.0.0.1:${SSH_PORT}-10.0.2.15:22"
 NET="$NET -device virtio-net-device,netdev=eth0"
 
-CMD="qemu-system-$MACH -m $MEM \
+CMD="$QEMU -m $MEM \
     $DISPLAY \
     $MACH_OPTS $CPU_OPTS \
     $PFLASH \
     -drive file=$DISK,format=raw,if=virtio \
     $NET \
     $DISPLAY \
     $MACH_OPTS $CPU_OPTS \
     $PFLASH \
     -drive file=$DISK,format=raw,if=virtio \
     $NET \
+    $CD \
     $P9"
 
 echo $CMD
     $P9"
 
 echo $CMD