Fix kvm support in Ubuntu 24/262024/1
authorHyunggi Lee <hyunggi.lee@samsung.com>
Mon, 2 Aug 2021 01:25:21 +0000 (10:25 +0900)
committerHyunggi Lee <hyunggi.lee@samsung.com>
Mon, 2 Aug 2021 01:25:35 +0000 (10:25 +0900)
In Ubuntu, there is no qemu-kvm, only kvm executable.
check qemu-kvm, and kvm executable file.

qemu options has changed.
problem:
  [  129s] qemu-system-x86_64: -drive file=/home/hglee/GBS-ROOT/t65std/local/BUILD-ROOTS/scratch.armv7l.0.img,format=raw,if=none,id=disk,serial=1,cache=unsafe: Block format 'raw' does not support the option 'serial'

fix serial option

ref:
- https://github.com/openSUSE/obs-build/commit/2514958e1d6af6c10515eea995ae03b01a9b762c

Change-Id: I32c51a923b25cb25f6ec1551a3b73e66f3f782e6
Signed-off-by: Hyunggi Lee <hyunggi.lee@samsung.com>
build-vm-kvm

index 641bc4dd097e3822a3d034ea8973f1dbb5d39a94..c557317aee0eb5487a7bcd771397110cfb33433d 100644 (file)
@@ -22,6 +22,7 @@
 ################################################################
 
 kvm_bin=/usr/bin/qemu-kvm
+test ! -x $kvm_bin  -a -x /usr/bin/kvm && kvm_bin=/usr/bin/kvm
 kvm_console=ttyS0
 
 # assume virtio support by default
@@ -214,7 +215,7 @@ vm_verify_options_kvm() {
 
 vm_startup_kvm() {
     qemu_bin="$kvm_bin"
-    qemu_args=(-drive file="$VM_IMAGE",format=raw,if=none,id=disk,serial=0,cache=unsafe -device "$kvm_device",drive=disk)
+    qemu_args=(-drive file="$VM_IMAGE",format=raw,if=none,id=disk,cache=unsafe -device "$kvm_device",drive=disk,serial=0)
     if [ -n "$VM_USER" ] ; then
        getent passwd "$VM_USER" > /dev/null || complain 22 "cannot find KVM user '$VM_USER'"
     else
@@ -223,7 +224,7 @@ vm_startup_kvm() {
     fi
     [ -n "$VM_USER" ] && kvm_options="$kvm_options -runas $VM_USER"
     if test -n "$VM_SWAP" ; then
-       qemu_args=("${qemu_args[@]}" -drive file="$VM_SWAP",format=raw,if=none,id=swap,serial=1,cache=unsafe -device "$kvm_device",drive=swap)
+       qemu_args=("${qemu_args[@]}" -drive file="$VM_SWAP",format=raw,if=none,id=swap,cache=unsafe -device "$kvm_device",drive=swap,serial=1)
     fi
     # the serial console device needs to be compiled into the target kernel
     # which is why we can not use virtio-serial on other platforms