Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find qemu in /usr/libexec or via qemu-system-$(arch) #329

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cmd-run
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ fi

set -- -drive if=virtio"${vm_drive_args:-}",file="${VM_DISK}" "$@"

exec qemu-kvm -name coreos -m "${VM_MEMORY}" -nographic \
# shellcheck disable=SC2086
exec ${QEMU_KVM} -name coreos -m "${VM_MEMORY}" -nographic \
-netdev user,id=eth0,hostname=coreos"${hostfwd:-}" \
-device virtio-net-pci,netdev=eth0 \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
Expand Down
8 changes: 7 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ EOF
fi
}

if [ -x /usr/libexec/qemu-kvm ]; then
QEMU_KVM="/usr/libexec/qemu-kvm"
else
QEMU_KVM="qemu-system-$(arch) -accel kvm"
fi

runvm() {
local vmpreparedir=${workdir}/tmp/supermin.prepare
local vmbuilddir=${workdir}/tmp/supermin.build
Expand Down Expand Up @@ -239,7 +245,7 @@ EOF
srcvirtfs=("-virtfs" "local,id=source,path=${workdir}/src/config,security_model=none,mount_tag=source")
fi

qemu-kvm -nodefaults -nographic -m 2048 -no-reboot \
${QEMU_KVM} -nodefaults -nographic -m 2048 -no-reboot \
-kernel "${vmbuilddir}/kernel" \
-initrd "${vmbuilddir}/initrd" \
-netdev user,id=eth0,hostname=supermin \
Expand Down
4 changes: 3 additions & 1 deletion src/gf-oemid
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ while [ $# -gt 0 ]; do
shift ;;
esac
done
exec qemu-kvm -cpu host,pmu=off "${args[@]}"
EOF
# Expand QEMU_KVM
# shellcheck disable=SC2086 disable=SC2016
echo "exec ${QEMU_KVM} "'-cpu host,pmu=off "${args[@]}"' >> "${qemu_wrapper}"
chmod +x "${qemu_wrapper}"

# This qemu wrapper doesn't work for some reason on EL7, so just skip
Expand Down