diff options
author | Jonathan Bauer | 2018-02-14 13:15:54 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-02-14 13:15:54 +0100 |
commit | 780e9ebdf01db68760d95d86d09f8bc37d676dba (patch) | |
tree | 6ada795174dd2b8fc4a76ead45026e670eb8e399 /core/modules/vmware | |
parent | [lightdm-greeter-bwlp] fix path (diff) | |
parent | [run-virt] relax /tmp mount detection regex (diff) | |
download | mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.gz mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.xz mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.zip |
Merge branch 'master' into install-mode
Diffstat (limited to 'core/modules/vmware')
12 files changed, 334 insertions, 117 deletions
diff --git a/core/modules/vmware/data/opt/openslx/bin/vmplayer b/core/modules/vmware/data/opt/openslx/bin/vmplayer index cfb91a0a..05a4ec3a 100755 --- a/core/modules/vmware/data/opt/openslx/bin/vmplayer +++ b/core/modules/vmware/data/opt/openslx/bin/vmplayer @@ -5,13 +5,12 @@ PREFIX=/usr/lib/vmware # depends on the vmware location # HACK: Let the OpenGL driver report s3tc capability even if not present, so 3D will be enabled export force_s3tc_enable=true -PROG=$(basename $0) - -exec "$PREFIX/lib/wrapper-gtk24.sh" \ - "$PREFIX/lib" \ - "$PREFIX/bin/$PROG" \ - "$PREFIX/libconf" "$@" - +# Turn off "helpful" DE features +export APPMENU_DISPLAY_BOTH=1 +export UBUNTU_MENUPROXY=0 +export GNOME_DISABLE_CRASH_DIALOG=1 +PROG=$(basename $0) +exec "$PREFIX/bin/$PROG" "$@" diff --git a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env index 0f3e270e..18959170 100755 --- a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env +++ b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env @@ -1,18 +1,18 @@ #!/bin/ash # ----------------------------------------------------------------------------- -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # systemd-vmware_env # - This is the systemd configuration and provisioning script for the various -# VMware modules and services +# VMware modules and services ################################################################################ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" @@ -20,49 +20,78 @@ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" VMWARE_CONF_DIR=/opt/openslx/vmchooser/vmware VMCHOOSER_CONF_DIR=/opt/openslx/vmchooser/config +. /opt/openslx/config + load_modules () { local FAILED="" - # module stuff - insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" - insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" - #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" - #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" - #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" + # module stuff + insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" + insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" + #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" + #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" + #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" [ -n "$FAILED" ] && slxlog "vmware-insmod" "Error loading vmware kernel module(s) $FAILED" } -unload_modules () { - rmmod vmnet vmmon #vsock vmci vmblock +unload_modules () { + rmmod vmnet vmmon #vsock vmci vmblock +} + +vmnet_create() { + vmnet="$1" + # first, create device node + dev="/dev/vmnet${vmnet}" + if ! [ -c "$dev" ] && ! mknod "${dev}" c 119 "${vmnet}"; then + slxlog "vmware-node-vmnet" "Could not create ${dev}" + return 1 + fi + chmod 0700 "${dev}" + # now bring it up + if ! /usr/bin/vmnet-netifup -d "/var/run/vmnet-netifup-vmnet${vmnet}.pid" "${dev}" "vmnet${vmnet}" ; then + slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet${vmnet} failed." + fi + ip link set dev "vmnet${vmnet}" up } -vmnetif () { +vmnetif () { + local vmnet nic NICS # create the needed devices which effects all vmware options # they are not created automatically via module load - for device in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \ - "/dev/vmnet2 c 119 2" "/dev/vmmon c 10 165"; do - mknod ${device} + if ! [ -e /dev/vmmon ]; then + mknod /dev/vmmon c 10 165 || slxlog "vmware-node-vmmon" "Could not create /dev/vmmon" + fi + # network interfaces + # 1) default ones + for vmnet in 0 1 2; do + vmnet_create "$vmnet" done - chmod 0700 /dev/vmnet* - + # Set the vmware interface to 9000 too, as br0 will use the smallest of all slave devices + [ "x$SLX_JUMBO_FRAMES" = "xyes" ] && ip link set dev vmnet0 mtu 9000 # setup bridge (vmnet0), nat (vmnet1) and software defined networking (vmnet2) interfaces - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet0.pid /dev/vmnet0 vmnet0 ; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet0 failed." - fi - ip link set dev vmnet0 up - brctl addif br0 vmnet0 - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid /dev/vmnet1 vmnet1; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet1 failed." - fi - ip link set dev vmnet1 up - brctl addif nat1 vmnet1 - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet2.pid /dev/vmnet2 vmnet2; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet2 failed." + brctl addif br0 vmnet0 + brctl addif nat1 vmnet1 + brctl addif vsw2 vmnet2 + # 2) see if we should bridge additional interfaces + NICS= + if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then + # These will have been set up in our init + NICS=$( ls -1 /sys/class/net | grep '^br-nic-' | cut -c 8- ) + vmnet=10 + for nic in $NICS; do + if ! [ "$nic" -gt 0 ] && ! [ "$nic" -eq 0 ]; then + slxlog "vmware-other-nics" "NaN: br-nic-X has X='$nic'" + continue + fi + # create vmnet10 - vmnetN for these + vmnet_create "$vmnet" + brctl addif "br-nic-${nic}" "vmnet${vmnet}" + vmnet="$(( vmnet + 1 ))" + done fi - ip link set dev vmnet2 up - brctl addif vsw2 vmnet2 + } -vmblock () { +vmblock () { if ! /usr/bin/vmware-usbarbitrator; then slxlog "vmware-usbarb" "Launching /usr/bin/vmware-usbarbitrator failed." fi @@ -72,31 +101,31 @@ vmblock () { mkdir -p "/tmp/virt/vmware" "/dev/shm/vmware" "/run/vmware" -m 1777 # FixMe: Should be rewritten for proper systemd operation -case "$1" in - start) - # hack to access the first serial/parallel port - [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0 - [ -c /dev/parport0 ] && chmod a+rw /dev/parport0 - load_modules - vmnetif - vmblock - ;; - stop) - #stop: defines stop function for initscript - killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray - # might take a while until all services are shut down - sleep 0.5 - unload_modules - - ;; - restart) - #restart: defines restart function for initscript - $0 stop && $0 start - ;; - status) - #status: defines status function for initscript - vmstatus - ;; +case "$1" in + start) + # hack to access the first serial/parallel port + [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0 + [ -c /dev/parport0 ] && chmod a+rw /dev/parport0 + load_modules + vmnetif + vmblock + ;; + stop) + #stop: defines stop function for initscript + killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray + # might take a while until all services are shut down + sleep 0.5 + unload_modules + + ;; + restart) + #restart: defines restart function for initscript + $0 stop && $0 start + ;; + status) + #status: defines status function for initscript + vmstatus + ;; esac # Breaks performance with certain workloads, so disable. diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc index 2e1ed1c4..b4197051 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc @@ -58,6 +58,8 @@ create_vmhome_preferences_file() { pref.vmplayer.confirmOnExit = "TRUE" pref.backgroundOnClose = "FALSE" pref.trayicon.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.count = "0" # shared folders pref.enableAllSharedFolders = "TRUE" diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc index 85fafc9f..d7ad77c6 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc @@ -27,7 +27,9 @@ declare -rg VM_CONF_DIR="/tmp/virt/vmware/${USER}.$$" declare -rg VM_RUN_FILE="${VM_CONF_DIR}/run-vmware.conf" # Users vmware config folder -[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$(whoami)" | awk -F ':' '{print $6}') +[ -z "$UID" ] && UID=$(id -u) +[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$UID" | awk -F ':' '{print $6}') +[ -z "${HOME}" ] && slxlog "run-virt-vmware-home" "Could not get home directory of user $(whoami) ($UID)" declare -rg VM_HOME="${HOME}/.vmware" # mltk generates a vmware config file with several version infos for vmware/player, read it diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc index 6ca82acb..47330bb0 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc @@ -3,6 +3,17 @@ ###################################################################### ## Functions parse_vmx() { + # To avoid potential syntax problems from the vmx served by dmsd, sanitize + # it before continuing with filling in the gaps + local TMPTMPCONFIG="$(mktemp)" + grep -E '^\s*(#|[^=]+=[^"]*"[^"]*"\s*$|[^=]+=[^"]+$|$)' "$TMPCONFIG" > "$TMPTMPCONFIG" + if ! diff -q "$TMPCONFIG" "$TMPTMPCONFIG"; then + # file was corrupted, log it + writelog "'$TMPCONFIG' had bad syntax and was pruned by the post-download sanitizer!" + slxlog -s "virt-vmware-vmx-corrupt" "Downloaded .vmx for '$IMGUUID' has a corrupted format!" "$TMPCONFIG" + fi + mv -f -- "$TMPTMPCONFIG" "$TMPCONFIG" + writelog "Parsing virtual machine description file..." local -i HW_VERSION=$(grep -i -m1 '^virtualHW.version *= *' "${TMPCONFIG}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g') if notempty HW_VERSION; then @@ -19,4 +30,3 @@ else writelog "Path to VMX file is not set or empty! Aborting..." EXIT_TYPE="internal" EXIT_REASON="Konnte Pfad zur VMX-Datei nicht finden!" cleanexit 1 fi - diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc index 84ddee1d..a7d3d837 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc @@ -22,6 +22,38 @@ replace_placeholders() { setup_ethernet() { echo 'ethernet0.addressType = "static"' >> "${TMPCONFIG}" echo 'ethernet0.address = "'"${VM_MAC_ADDR}"'"' >> "${TMPCONFIG}" + if [ -n "$OTHER_NICS" ]; then + local devtype mac cnt eth + # Copy type of eth0, in case the others don't specify a type in the vmx, we'll use the same + # so we know the drivers are there + devtype=$(< "${TMPCONFIG}" grep -m1 -i '^ethernet0\.virtualDev' | sed -r 's/^[^=]+//;s/^(\s|=|")*//;s/(\s|")+$//') # TODO: Make a helper like "getVmxOption" + cnt=0 + for mac in $OTHER_NICS; do + vmnet=$(( cnt + 10 )) + cnt=$(( cnt + 1 )) + eth="ethernet${cnt}" + # Check device exists + if ! [ -c "/dev/vmnet${vmnet}" ]; then + slxlog "vmware-bridge-setup" "Cannot bridge NIC into VM: /dev/vmnet${vmnet} does not exist" + continue + fi + # Remove lines that could break things + sed -i "/^${eth}\.connectionType/Id;/^${eth}\.present/Id" "${TMPCONFIG}" + # Set up devType + devline= + if ! grep -q -i "^${eth}\.virtualDev" "${TMPCONFIG}" && [ -n "$devtype" ]; then + devline="${eth}.virtualDev = "'"'"${devtype}"'"' + fi + cat >> "${TMPCONFIG}" <<-HEND + ${eth}.connectionType = "custom" + ${eth}.present = "TRUE" + ${eth}.vnet = "vmnet${vmnet}" + ${eth}.addressType = "static" + ${eth}.address = "${mac}" + ${devline} + HEND + done + fi } # DVD, CDROM @@ -50,8 +82,8 @@ setup_floppies() { # Floppies: cat >> "${TMPCONFIG}" <<-HEREEND - floppy0.present = "$FLOPPY0" - floppy0.startConnected = "FALSE" + floppy0.present = "TRUE" + floppy0.startConnected = "$FLOPPY0" floppy0.autodetect = "TRUE" floppy0.fileName = "auto detect" floppy1.present = "$SLX_FLOPPY" diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram Binary files differindex 85125f1e..88074390 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include index 181ae44c..a552038b 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include @@ -43,6 +43,17 @@ run_plugin() { # For debugging cp "$VM_RUN_FILE" "/tmp/vmware-last-config" + + # HACK: make the mouse disappear + ( + local WINDOWS="$(xdotool search --sync --name '.*VMware.*Player.*')" + isempty WINDOWS && writelog "Could not find any vmplayer windows." + for WINDOW in $WINDOWS; do + xdotool set_desktop_for_window $WINDOW 0 || writelog "Could not move vmplayer to desktop 0" + xdotool windowactivate --sync $WINDOW || writelog "Could not activate vmplayer window" + xdotool key --delay 2000 --clearmodifiers ctrl+g || writelog "Could not send ctrl+g to vmplayer window" + done + ) & # HACK: using the modified version of the wrapper script declare -rg VIRTCMD="/opt/openslx/bin/vmplayer" diff --git a/core/modules/vmware/module.build b/core/modules/vmware/module.build index b056ccc4..cfb6fb39 100644 --- a/core/modules/vmware/module.build +++ b/core/modules/vmware/module.build @@ -37,6 +37,7 @@ fetch_source() { } build() { + local KMOD SHORT PATCH MIN_KERN MAX_KERN [ -z "$VMWARE_BUNDLE_FILE" ] && VMWARE_BUNDLE_FILE=$(basename "$(find "${MODULE_WORK_DIR}/src" -iname "vmware-*" | head -n 1)") local DELETE_FILES=$(for LINE in $REQUIRED_VMWARE_DELETIONS;do echo "rm -rf -- $LINE"; done) @@ -50,7 +51,23 @@ build() { # prepare the build directory with the files needed during the chroot cp "${MODULE_WORK_DIR}/src/$VMWARE_BUNDLE_FILE" "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE" - cp -r "${MODULE_DIR}/patches" "${MODULE_BUILD_DIR}" + # copy required patches + mkdir -p "${MODULE_BUILD_DIR}/patches" + for PATCH in $(find "${MODULE_DIR}/patches/" -name "*__*__*.patch"); do + parse_patch_name "$PATCH" + [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" + if version_lt "$TARGET_KERNEL_SHORT" "$MIN_KERN" || version_gt "$TARGET_KERNEL_SHORT" "$MAX_KERN"; then + pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + continue # Not suitable for our kernel + fi + if version_lt "$OFFICIAL_VERSION" "$MIN_VMWARE" || version_gt "$OFFICIAL_VERSION" "$MAX_VMWARE"; then + pinfo "*NOT* applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + continue # Not suitable for our kernel + fi + pinfo "Kernel: Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + pinfo "VMware: Applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + cp "$PATCH" "${MODULE_BUILD_DIR}/patches/" || perror "Could not copy patch $PATCH to $MODULE_BUILD_DIR/patches" + done # sanity check to see if KERNEL_HEADERS_DIR is set and exists [ -z "${KERNEL_HEADERS_DIR}" -o ! -e "${KERNEL_HEADERS_DIR}" ] && perror "KERNEL_HEADERS_DIR ('"${KERNEL_HEADERS_DIR}"') not found. Was the kernel module built?" @@ -58,55 +75,44 @@ build() { # build in two steps, to be able to use mltk function while patching modules pinfo "Installing vmware per chroot..." chroot_run "${MODULE_BUILD_DIR}" <<-EOF + perror() { + echo "[ERROR ERROR] " "\$@" >&6 + exit 1 + } # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot $DELETE_FILES yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required - EOF - # check if we need to patch modules - cd "${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source" \ - || perror "Could not cd to '${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source'" - - local KMOD SHORT PATCH MIN_KERN MAX_KERN - for KMOD in *.tar; do - SHORT="${KMOD%%.tar}" - [ -e ".${SHORT}.patched" ] && continue - for PATCH in $(find "${MODULE_DIR}/patches/" -name "${SHORT}__*__*.patch"); do - parse_patch_name "$PATCH" - [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" - if version_lt "$TARGET_KERNEL_SHORT" "$MIN_KERN" || version_gt "$TARGET_KERNEL_SHORT" "$MAX_KERN"; then - pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" - continue # Not suitable for our kernel - fi - if version_lt "$OFFICIAL_VERSION" "$MIN_VMWARE" || version_gt "$OFFICIAL_VERSION" "$MAX_VMWARE"; then - pinfo "*NOT* applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" - continue # Not suitable for our kernel - fi - pinfo "Kernel: Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" - pinfo "VMware: Applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" - [ ! -d "${SHORT}-only" ] && tar xf "$KMOD" - [ ! -d "${SHORT}-only" ] && perror "untar of $KMOD failed." - cd "${SHORT}-only" || perror "Where is ${SHORT}-only?" - if ! patch -p1 < "$PATCH"; then + set -x + # Patch kernel modules + # check if we need to patch modules + cd "/usr/lib/vmware/modules/source" \ + || perror "Could not cd to '/usr/lib/vmware/modules/source'" + for file in /patches/*.patch; do + [ -s "\$file" ] || continue + echo "Applying patch $file" + SHORT="\$(basename "\${file%%__*}")" + KMOD="\${SHORT}.tar" + [ -s "\$KMOD" ] || perror "Kmod \$KMOD does not exist" + [ ! -d "\${SHORT}-only" ] && tar xf "\$KMOD" + [ ! -d "\${SHORT}-only" ] && perror "untar of \$KMOD failed." + cd "\${SHORT}-only" || perror "Where is \${SHORT}-only?" + if ! patch -p1 < "\$file"; then cd .. - rm -rf -- "${SHORT}-only" - perror "Applying $PATCH failed." + rm -rf -- "\${SHORT}-only" + perror "Applying \$file failed." fi cd .. + if [ -d "\${SHORT}-only" ]; then + tar cf "\$KMOD" "\${SHORT}-only/" || perror "repacking of \$KMOD failed." + rm -rf -- "\${SHORT}-only" + fi done - if [ -d "${SHORT}-only" ]; then - tar cf "$KMOD" "${SHORT}-only/" || perror "repacking of $KMOD failed." - rm -rf -- "${SHORT}-only" - touch ".${SHORT}.patched" - fi - done - cd "${MODULE_WORK_DIR}" || perror "Could not cd to '${MODULE_WORK_DIR}'" - - # now build modules inside the chroot - chroot_run "${MODULE_BUILD_DIR}" <<-EOF - vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmnet $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmnet - vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmnet $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmnet || perror "vmnet build failed" + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon || perror "vmmon build failed" EOF + cd "${MODULE_WORK_DIR}" || perror "Could not cd to '${MODULE_WORK_DIR}'" + # cleanup unneeded files rm -rf -- "${MODULE_BUILD_DIR}/etc/vmware-installer" rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-installer" @@ -154,6 +160,9 @@ post_copy() { parse_patch_name() { [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count." local PATCH="$1" + # Module + SHORT=$(echo "$PATCH" | sed -r 's/^([^_]+)__.*$/\1/g') + KMOD="${SHORT}.tar" # Kernel restriction MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g') [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') diff --git a/core/modules/vmware/module.conf b/core/modules/vmware/module.conf index 7e0280a7..31766419 100644 --- a/core/modules/vmware/module.conf +++ b/core/modules/vmware/module.conf @@ -1,5 +1,5 @@ #!/bin/bash -REQUIRED_VERSION="12.5.7" +REQUIRED_VERSION="14.0.0" REQUIRED_TYPE="workstation" REQUIRED_MODULES=" kernel @@ -15,6 +15,7 @@ REQUIRED_DIRECTORIES=" /usr/lib/vmware/libconf /usr/lib/vmware/licenses /usr/lib/vmware/resources + /usr/lib/vmware/roms /usr/lib/vmware/scripts /usr/lib/vmware/share /usr/lib/vmware/xkeymap diff --git a/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch b/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch new file mode 100644 index 00000000..5278d645 --- /dev/null +++ b/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch @@ -0,0 +1,61 @@ +--- a/linux/hostif.c 2017-09-18 15:22:18.000000000 +0200 ++++ b/linux/hostif.c 2017-11-17 13:35:49.600578115 +0100 +@@ -79,6 +79,37 @@ + #error CONFIG_HIGH_RES_TIMERS required for acceptable performance + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++# define global_zone_page_state global_page_state ++#endif ++ ++static unsigned long get_nr_slab_unreclaimable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE); ++#else ++ return global_page_state(NR_SLAB_UNRECLAIMABLE); ++#endif ++} ++ ++static unsigned long get_nr_unevictable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_UNEVICTABLE); ++#else ++ return global_page_state(NR_UNEVICTABLE); ++#endif ++} ++ ++static unsigned long get_nr_anon_mapped(void) ++{ ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_ANON_MAPPED); ++ #else ++ return global_page_state(NR_ANON_PAGES); ++ #endif ++} ++ + /* + * Although this is not really related to kernel-compatibility, I put this + * helper macro here for now for a lack of better place --hpreg +@@ -1516,16 +1547,11 @@ + unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES; + unsigned int hugePages = (vm == NULL) ? 0 : + BYTES_2_PAGES(vm->memInfo.hugePageBytes); +- unsigned int lockedPages = global_page_state(NR_PAGETABLE) + +- global_page_state(NR_SLAB_UNRECLAIMABLE) + +- global_page_state(NR_UNEVICTABLE) + ++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) + ++ get_nr_slab_unreclaimable() + ++ get_nr_unevictable() + + hugePages + reservedPages; +- unsigned int anonPages = +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +- global_page_state(NR_ANON_MAPPED); +-#else +- global_page_state(NR_ANON_PAGES); +-#endif ++ unsigned int anonPages = get_nr_anon_mapped(); + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { diff --git a/core/modules/vmware/patches/vmmon__4.14__14.0.patch b/core/modules/vmware/patches/vmmon__4.14__14.0.patch new file mode 100644 index 00000000..5278d645 --- /dev/null +++ b/core/modules/vmware/patches/vmmon__4.14__14.0.patch @@ -0,0 +1,61 @@ +--- a/linux/hostif.c 2017-09-18 15:22:18.000000000 +0200 ++++ b/linux/hostif.c 2017-11-17 13:35:49.600578115 +0100 +@@ -79,6 +79,37 @@ + #error CONFIG_HIGH_RES_TIMERS required for acceptable performance + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++# define global_zone_page_state global_page_state ++#endif ++ ++static unsigned long get_nr_slab_unreclaimable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE); ++#else ++ return global_page_state(NR_SLAB_UNRECLAIMABLE); ++#endif ++} ++ ++static unsigned long get_nr_unevictable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_UNEVICTABLE); ++#else ++ return global_page_state(NR_UNEVICTABLE); ++#endif ++} ++ ++static unsigned long get_nr_anon_mapped(void) ++{ ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_ANON_MAPPED); ++ #else ++ return global_page_state(NR_ANON_PAGES); ++ #endif ++} ++ + /* + * Although this is not really related to kernel-compatibility, I put this + * helper macro here for now for a lack of better place --hpreg +@@ -1516,16 +1547,11 @@ + unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES; + unsigned int hugePages = (vm == NULL) ? 0 : + BYTES_2_PAGES(vm->memInfo.hugePageBytes); +- unsigned int lockedPages = global_page_state(NR_PAGETABLE) + +- global_page_state(NR_SLAB_UNRECLAIMABLE) + +- global_page_state(NR_UNEVICTABLE) + ++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) + ++ get_nr_slab_unreclaimable() + ++ get_nr_unevictable() + + hugePages + reservedPages; +- unsigned int anonPages = +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +- global_page_state(NR_ANON_MAPPED); +-#else +- global_page_state(NR_ANON_PAGES); +-#endif ++ unsigned int anonPages = get_nr_anon_mapped(); + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { |