summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware-version-check
diff options
context:
space:
mode:
authorJonathan Bauer2019-08-12 14:01:46 +0200
committerJonathan Bauer2019-08-12 14:01:46 +0200
commit74a59c2b1a4b23978ac9aad56540aec64cc3f3e0 (patch)
treeddccdb72eda8cb17964ce31c54797f6e5e966fd9 /core/modules/vmware-version-check
parent[kernel] make sure CONFIG_X86_MSR is set (diff)
downloadmltk-74a59c2b1a4b23978ac9aad56540aec64cc3f3e0.tar.gz
mltk-74a59c2b1a4b23978ac9aad56540aec64cc3f3e0.tar.xz
mltk-74a59c2b1a4b23978ac9aad56540aec64cc3f3e0.zip
[vmware-version-check] CPU support check helper
Diffstat (limited to 'core/modules/vmware-version-check')
-rwxr-xr-xcore/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version22
-rw-r--r--core/modules/vmware-version-check/module.build13
-rw-r--r--core/modules/vmware-version-check/module.conf6
-rw-r--r--core/modules/vmware-version-check/module.conf.ubuntu4
4 files changed, 45 insertions, 0 deletions
diff --git a/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version b/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version
new file mode 100755
index 00000000..82bd7d50
--- /dev/null
+++ b/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version
@@ -0,0 +1,22 @@
+#!/bin/ash
+# This script checks whether given VMware version supports the CPU:
+# * Intel: check for "VMX Unrestricted Guest" CPU flag
+# * AMD: check if CPU family is Bulldozer or newer
+
+export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin
+
+get_supported_version() {
+ local vendor="$( awk '$1 == "vendor_id" {print $NF;exit}' /proc/cpuinfo )"
+ local version=12
+ if [ "$vendor" = "GenuineIntel" ]; then
+ modprobe msr
+ flag="$( rdmsr --bitfield 5:5 0x485 )"
+ [ "$flag" = 1 ] && version=15
+ elif [ "$vendor" = "AuthenticAMD" ]; then
+ family="$( awk '$1$2 == "cpufamily" {print $NF;exit}' /proc/cpuinfo )"
+ [ "$family" -ge 21 ] && version=15
+ fi
+ echo "$version"
+}
+
+get_supported_version
diff --git a/core/modules/vmware-version-check/module.build b/core/modules/vmware-version-check/module.build
new file mode 100644
index 00000000..5086d1bc
--- /dev/null
+++ b/core/modules/vmware-version-check/module.build
@@ -0,0 +1,13 @@
+#!/bin/bash
+# fake module simply copying its data/ files
+fetch_source() {
+ :
+}
+
+build() {
+ :
+}
+
+post_copy() {
+ :
+}
diff --git a/core/modules/vmware-version-check/module.conf b/core/modules/vmware-version-check/module.conf
new file mode 100644
index 00000000..49255291
--- /dev/null
+++ b/core/modules/vmware-version-check/module.conf
@@ -0,0 +1,6 @@
+#!/bin/bash
+REQUIRED_BINARIES="
+ rdmsr
+"
+REQUIRED_LIBRARIES=""
+REQUIRED_DIRECTORIES=""
diff --git a/core/modules/vmware-version-check/module.conf.ubuntu b/core/modules/vmware-version-check/module.conf.ubuntu
new file mode 100644
index 00000000..3bab77c9
--- /dev/null
+++ b/core/modules/vmware-version-check/module.conf.ubuntu
@@ -0,0 +1,4 @@
+#!/bin/bash
+REQUIRED_CONTENT_PACKAGES="
+ msr-tools
+"