diff options
author | Jonathan Bauer | 2021-06-25 14:55:08 +0200 |
---|---|---|
committer | Jonathan Bauer | 2021-06-25 14:55:08 +0200 |
commit | 09f9b20ae36bbbff9e303c52d2a8f2a034cd4f1e (patch) | |
tree | 75f018f5ad995d286de930f0a0c450ab8a208f4b /core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env | |
parent | Merge branch 'master' into installer (diff) | |
parent | [clientrequest] add remote debugging modul from Christoph Schulthess (diff) | |
download | mltk-09f9b20ae36bbbff9e303c52d2a8f2a034cd4f1e.tar.gz mltk-09f9b20ae36bbbff9e303c52d2a8f2a034cd4f1e.tar.xz mltk-09f9b20ae36bbbff9e303c52d2a8f2a034cd4f1e.zip |
Merge branch 'master' into installer
Diffstat (limited to 'core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env')
-rwxr-xr-x | core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env b/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env new file mode 100755 index 00000000..3355b7a0 --- /dev/null +++ b/core/modules/qemu/data/opt/openslx/scripts/systemd-qemu_env @@ -0,0 +1,46 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2017..2021 bwLehrpool-Projektteam +# +# This program/file is free software distributed under the GPL version 2. +# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html +# +# If you have any feedback please consult https://bwlehrpool.de and +# send your feedback to bwlehrpool@hs-offenburg.de. +# +# General information about bwLehrpool can be found at https://bwlehrpool.de +# +# ----------------------------------------------------------------------------- +# systemd-qemu_env +# - This is the preparation script for the configuration of QEMU on Linux. +################################################################################ + +# +# load general KVM module +# +modprobe "kvm" || slxlog "qemu" "Could not load 'kvm' kernel modul!" + +# +# load CPU specific KVM implementation +# +virt=$(egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') || true + +if [ "${virt}" = "vmx" ]; then + kmod="kvm_intel" +elif [ "${virt}" = "svm" ]; then + kmod="kvm_amd" +else + slxlog "qemu" "CPU does not support KVM extensions!" + exit 1 +fi + +modprobe "${kmod}" || slxlog "qemu" "Could not load '${kmod}' kernel modul!" + +# +# check that the KVM exposed device exists +# +if [ ! -e /dev/kvm ]; then + slxlog "qemu" "/dev/kvm not found! Missing kvm kernel module(s)?" + exit 1 +fi |