Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 334e0b5

Browse files
authored
Merge pull request #173 from nathanchance/enable-kvm
driver.sh: Use KVM when possible
2 parents b35d6a7 + 79c396f commit 334e0b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

driver.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ setup_variables() {
9999
qemu_cmdline=( -drive "file=images/x86_64/rootfs.ext4,format=raw,if=ide"
100100
-append "console=ttyS0 root=/dev/sda" ) ;;
101101
esac
102+
# Use KVM if the processor supports it (first part) and the KVM module is loaded (second part)
103+
[[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] && qemu_cmdline=( "${qemu_cmdline[@]}" -enable-kvm )
102104
image_name=bzImage
103105
qemu="qemu-system-x86_64" ;;
104106
"ppc32")

0 commit comments

Comments
 (0)