summaryrefslogtreecommitdiff
path: root/Kernel/run
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-04 13:03:33 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-04 13:04:02 +0100
commite4c80961d961d0cb02c991fa6da521057cfb3371 (patch)
treeabe51bd1c14a9f47602327799c55380471d40a12 /Kernel/run
parent50d937152ae0b2f35ac342fdcf5527169adb981d (diff)
downloadserenity-e4c80961d961d0cb02c991fa6da521057cfb3371.zip
run: Only enable KVM if /dev/kvm is r/w for the current user
Diffstat (limited to 'Kernel/run')
-rwxr-xr-xKernel/run10
1 files changed, 6 insertions, 4 deletions
diff --git a/Kernel/run b/Kernel/run
index 777fa58bcb..d8dcd0fa87 100755
--- a/Kernel/run
+++ b/Kernel/run
@@ -1,5 +1,7 @@
#!/bin/sh
+[ -e /dev/kvm -a -r /dev/kvm -a -w /dev/kvm ] && SERENITY_KVM_ARG="-enable-kvm"
+
[ -z "$SERENITY_QEMU_BIN" ] && SERENITY_QEMU_BIN="qemu-system-i386"
[ -z "$SERENITY_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
@@ -33,7 +35,7 @@ elif [ "$1" = "qtap" ]; then
# ./run qtap: qemu with tap
sudo $SERENITY_QEMU_BIN \
$SERENITY_COMMON_QEMU_ARGS \
- -enable-kvm \
+ $SERENITY_KVM_ARG \
-object filter-dump,id=hue,netdev=br0,file=e1000.pcap \
-netdev tap,ifname=tap0,id=br0 \
-device e1000,netdev=br0 \
@@ -43,7 +45,7 @@ elif [ "$1" = "qgrub" ]; then
# ./run qgrub: qemu with grub
$SERENITY_QEMU_BIN \
$SERENITY_COMMON_QEMU_ARGS \
- -enable-kvm \
+ $SERENITY_KVM_ARG \
-object filter-dump,id=hue,netdev=breh,file=e1000.pcap \
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
-device e1000,netdev=breh
@@ -58,10 +60,10 @@ else
# ./run: qemu with user networking
$SERENITY_QEMU_BIN \
$SERENITY_COMMON_QEMU_ARGS \
- -enable-kvm \
+ $SERENITY_KVM_ARG \
-object filter-dump,id=hue,netdev=breh,file=e1000.pcap \
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
-device e1000,netdev=breh \
-kernel kernel \
-append "${SERENITY_KERNEL_CMDLINE}"
-fi \ No newline at end of file
+fi