Skip to content

Commit f237641

Browse files
nmantheywipawel
authored andcommitted
qemu: cpu host only with kvm
In case there is no KVM, do not use the cpu host model for QEMU. Signed-off-by: Norbert Manthey <[email protected]>
1 parent 296462c commit f237641

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,27 @@ clean:
116116
$(VERBOSE) find $(ROOT) -name \*.img -delete
117117
$(VERBOSE) find $(ROOT) -name cscope.\* -delete
118118

119+
# Check whether we can use kvm for qemu
119120
ifeq ($(SYSTEM),LINUX)
121+
ifneq ($(USE_KVM), false) # you can hard-disable KVM use with the USE_KVM environment variable
122+
HAVE_KVM=$(shell lsmod | awk '/^kvm / {print $$1}')
123+
endif # USE_KVM
124+
endif # SYSTEM == LINUX
125+
126+
# Set qemu parameters
127+
ifeq ($(SYSTEM)$(HAVE_KVM),LINUXkvm)
120128
QEMU_PARAMS := -cpu host
121129
else
122130
QEMU_PARAMS := -cpu max
123131
endif
132+
ifeq ($(HAVE_KVM), kvm)
133+
QEMU_PARAMS += -enable-kvm
134+
endif # HAVE_KVM
124135
QEMU_PARAMS += -m 8192
125136
QEMU_PARAMS += -display none -vga none -vnc none
126137
QEMU_PARAMS += -serial stdio
127138
QEMU_PARAMS += -no-reboot -no-shutdown
128139
QEMU_PARAMS += -smp cpus=2
129-
ifeq ($(SYSTEM),LINUX)
130-
ifneq ($(USE_KVM), false) # you can hard-disable KVM use with the USE_KVM environment variable
131-
HAVE_KVM=$(shell lsmod | awk '/^kvm / {print $$1}')
132-
ifeq ($(HAVE_KVM), kvm)
133-
QEMU_PARAMS += -enable-kvm
134-
endif # HAVE_KVM
135-
endif # USE_KVM
136-
endif # SYSTEM == LINUX
137140

138141
QEMU_PARAMS_KERNEL := -append "param1 param2 param3"
139142
QEMU_PARAMS_DEBUG := -s &

0 commit comments

Comments
 (0)