#!/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