Skip to content

Commit

Permalink
Linux: detect KVM availability
Browse files Browse the repository at this point in the history
Allow users to explicitly disable KVM via environment variable USE_KVM. Add a
mechanism that checks if KVM is actually available before setting the
respective QEMU command line flag.

Signed-off-by: Bjoern Doebel <[email protected]>
  • Loading branch information
bjoernd authored and wipawel committed Aug 28, 2020
1 parent 4d89b29 commit 1d878cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ QEMU_PARAMS += -serial stdio
QEMU_PARAMS += -no-reboot -no-shutdown
QEMU_PARAMS += -smp cpus=4
ifeq ($(SYSTEM),LINUX)
ifneq ($(USE_KVM), false) # you can hard-disable KVM use with the USE_KVM environment variable
HAVE_KVM=$(shell lsmod | awk '/^kvm / {print $$1}')
ifeq ($(HAVE_KVM), kvm)
QEMU_PARAMS += -enable-kvm
endif
endif # HAVE_KVM
endif # USE_KVM
endif # SYSTEM == LINUX

QEMU_PARAMS_KERNEL := -append "param1 param2 param3"
QEMU_PARAMS_DEBUG := -s &
Expand Down

0 comments on commit 1d878cb

Please sign in to comment.