summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Marc Lenoir2022-11-19 18:56:04 +0100
committerJean-Marc Lenoir2022-11-19 18:56:04 +0100
commit4f3797932dd839379e584afdb3fc1e987c26784a (patch)
tree3160ce1b231ae4811025b93f2e3ecfc637bbfee3
downloadaur-4f3797932dd839379e584afdb3fc1e987c26784a.tar.gz
Initial commit.
-rw-r--r--.SRCINFO64
-rw-r--r--Makefile21
-rw-r--r--PKGBUILD431
-rw-r--r--config21
-rwxr-xr-xconfigure-initscript.sh91
-rw-r--r--dkms.conf.in15
-rw-r--r--efi-patches.txt25
-rw-r--r--unlocker.py387
-rw-r--r--vmmon.patch57
-rw-r--r--vmnet.patch220
-rw-r--r--vmware-bootstrap11
-rw-r--r--vmware-environment.sh2
-rw-r--r--vmware-networks-configuration.service9
-rw-r--r--vmware-networks.path8
-rw-r--r--vmware-networks.service13
-rw-r--r--vmware-usbarbitrator.path8
-rw-r--r--vmware-usbarbitrator.service8
-rw-r--r--vmware-vix-bootstrap2
-rw-r--r--vmware-workstation.install29
19 files changed, 1422 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..6581e759d39d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,64 @@
+pkgbase = vmware-workstation16
+ pkgdesc = The industry standard for running multiple operating systems as virtual machines on a single Linux PC.
+ pkgver = 16.2.4
+ pkgrel = 1
+ url = https://www.vmware.com/products/workstation-for-linux.html
+ install = vmware-workstation.install
+ arch = x86_64
+ license = custom
+ makedepends = sqlite
+ depends = dkms
+ depends = fuse2
+ depends = gtkmm3
+ depends = libcanberra
+ depends = libaio
+ depends = pcsclite
+ depends = hicolor-icon-theme
+ depends = libxcrypt-compat
+ depends = gtk3
+ depends = gcr
+ depends = vmware-keymaps
+ optdepends = linux-headers: build modules against Arch kernel
+ provides = vmware-workstation=16.2.4
+ provides = vmware-ovftool
+ conflicts = vmware-workstation
+ conflicts = vmware-modules-dkms
+ conflicts = vmware-ovftool
+ conflicts = vmware-patch
+ conflicts = vmware-systemd-services
+ options = !strip
+ options = emptydirs
+ backup = etc/vmware/config
+ backup = etc/conf.d/vmware
+ source = https://download3.vmware.com/software/WKST-1624-LX/VMware-Workstation-Full-16.2.4-20089737.x86_64.bundle
+ source = vmware-bootstrap
+ source = vmware-vix-bootstrap
+ source = config
+ source = configure-initscript.sh
+ source = vmware-environment.sh
+ source = vmware-networks-configuration.service
+ source = vmware-networks.service
+ source = vmware-usbarbitrator.service
+ source = vmware-networks.path
+ source = vmware-usbarbitrator.path
+ source = dkms.conf.in
+ source = Makefile
+ source = vmmon.patch
+ source = vmnet.patch
+ sha256sums = 2e46708db46630edc96cdb11514d5e338f5300c46f51a90132e9a4cd11c3f3c0
+ sha256sums = 12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e
+ sha256sums = da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141
+ sha256sums = cdbe20096ace104fab0de43796192a4940a887d35d6ff76fa1a0ebd1b9e251ef
+ sha256sums = 48d203450db426e8780f3696a2cf85ee08db004e93f8aca50a9aa24129b1e839
+ sha256sums = b94959a11b28e51b541321be0588190eb10825e9ff55cbd16eb01483a839a69f
+ sha256sums = 9b4fbe0ba83f761a2eb9ecd05d48428f8b0a5b3abd8404ccbd928408e682f02b
+ sha256sums = c0a5aea785db06921fb350d36d5e0fd9a14f5eee0c835686ec6fea1af8c92245
+ sha256sums = d7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d
+ sha256sums = 16a73931894a65d43da489ff25d07647c0ecddf60d443b103bceca63504910fe
+ sha256sums = fe1b1be8297f4170406f97dd1f8b385d911faf45afe19cbc0c26b8092b3ddf8d
+ sha256sums = 10562d11d50edab9abc2b29c8948714edcb9b084f99b3766d07ddd21259e372e
+ sha256sums = 273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac
+ sha256sums = 53c3f008738eba3d64c715ac74d734c3bbfa6b3c153abf13f042a58521cbba22
+ sha256sums = 79d85026fcba43944857d6bc0a4f45208515f23dc8b452de6b990c77c56e1263
+
+pkgname = vmware-workstation16
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..f025addbd4b1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+
+MODULES = \
+ vmmon \
+ vmnet
+
+all: $(foreach m, $(MODULES), $m.ko)
+
+%.ko: %
+ $(MAKE) KVERSION=$(KVERSION) VM_KBUILD=yes -C $*-only
+
+$(MODULES): %:
+ cp -r $(SRCDIR)/$*-only $*-only
+
+vsock.ko: vmci.ko
+
+clean:
+ rm -rf $(MODULES)
+ rm -rf $(foreach m, $(MODULES), $m-only)
+ rm -f $(foreach m, $(MODULES), $m.ko)
+ rm -f $(foreach m, $(MODULES), $m.o)
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..17d841b18f7c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,431 @@
+# Maintainer: Jean-Marc Lenoir <archlinux "at" jihemel "dot" com>
+
+# To enable macOS guests support, uncomment the line below:
+#_enable_macOS_guests=y
+# CAUTION: Running macOS on VMware Workstation on non Apple computer is forbidden by
+# Apple and VMware EULAs.
+
+# vmware-keymaps dependency is needed to avoid some conflicts when you install
+# this package with vmware-horizon-client. If you don't plan to install
+# vmware-horizon-client and don't want to add this dependency, you can
+# uncomment the line below:
+#_remove_vmware_keymaps_dependency=y
+
+#PKGEXT=.pkg.tar
+pkgname=vmware-workstation16
+pkgver=16.2.4
+_buildver=20089737
+_pkgver=${pkgver}_${_buildver}
+pkgrel=1
+pkgdesc='The industry standard for running multiple operating systems as virtual machines on a single Linux PC.'
+arch=(x86_64)
+url='https://www.vmware.com/products/workstation-for-linux.html'
+license=(custom)
+install="vmware-workstation.install"
+conflicts=(
+ vmware-workstation
+ vmware-modules-dkms
+ vmware-ovftool
+ vmware-patch
+ vmware-systemd-services
+)
+provides=(
+ vmware-workstation=$pkgver
+ vmware-ovftool
+)
+depends=(
+ dkms
+ fuse2
+ gtkmm3
+ libcanberra
+ libaio
+ pcsclite
+ hicolor-icon-theme
+ libxcrypt-compat # needed for ovftool
+ # needed to use Arch GTK3 library (for theme integration)
+ gtk3
+ gcr
+)
+optdepends=(
+ 'linux-headers: build modules against Arch kernel'
+)
+makedepends=(
+ sqlite
+)
+backup=(
+ 'etc/vmware/config'
+ 'etc/conf.d/vmware'
+)
+source=(
+ "https://download3.vmware.com/software/WKST-${pkgver//./}-LX/VMware-Workstation-Full-${_pkgver/_/-}.${CARCH}.bundle"
+
+ 'vmware-bootstrap'
+ 'vmware-vix-bootstrap'
+ 'config'
+ 'configure-initscript.sh'
+ 'vmware-environment.sh'
+
+ 'vmware-networks-configuration.service'
+ 'vmware-networks.service'
+ 'vmware-usbarbitrator.service'
+ 'vmware-networks.path'
+ 'vmware-usbarbitrator.path'
+
+ 'dkms.conf.in'
+ 'Makefile'
+ 'vmmon.patch'
+ 'vmnet.patch'
+)
+sha256sums=(
+ '2e46708db46630edc96cdb11514d5e338f5300c46f51a90132e9a4cd11c3f3c0'
+
+ '12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e'
+ 'da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141'
+ 'cdbe20096ace104fab0de43796192a4940a887d35d6ff76fa1a0ebd1b9e251ef'
+ '48d203450db426e8780f3696a2cf85ee08db004e93f8aca50a9aa24129b1e839'
+ 'b94959a11b28e51b541321be0588190eb10825e9ff55cbd16eb01483a839a69f'
+
+ '9b4fbe0ba83f761a2eb9ecd05d48428f8b0a5b3abd8404ccbd928408e682f02b'
+ 'c0a5aea785db06921fb350d36d5e0fd9a14f5eee0c835686ec6fea1af8c92245'
+ 'd7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d'
+ '16a73931894a65d43da489ff25d07647c0ecddf60d443b103bceca63504910fe'
+ 'fe1b1be8297f4170406f97dd1f8b385d911faf45afe19cbc0c26b8092b3ddf8d'
+
+ '10562d11d50edab9abc2b29c8948714edcb9b084f99b3766d07ddd21259e372e'
+ '273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac'
+ '53c3f008738eba3d64c715ac74d734c3bbfa6b3c153abf13f042a58521cbba22'
+ '79d85026fcba43944857d6bc0a4f45208515f23dc8b452de6b990c77c56e1263'
+)
+options=(!strip emptydirs)
+
+if [ -z "$_remove_vmware_keymaps_dependency" ]; then
+depends+=(
+ vmware-keymaps
+)
+fi
+
+
+_isoimages=(linux linuxPreGlibc25 netware solaris windows winPre2k winPreVista)
+_isovirtualprinterimages=(Linux Windows)
+
+if [ -n "$_enable_macOS_guests" ]; then
+
+_vmware_fusion_ver=12.2.4
+_vmware_fusion_buildver=20071091
+_vmware_fusion_ver_full=${_vmware_fusion_ver}_${_vmware_fusion_buildver}
+# List of VMware Fusion versions: https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/
+
+makedepends+=(
+ python
+ dmg2img
+ p7zip
+ uefipatch
+)
+
+source+=(
+ "https://download3.vmware.com/software/FUS-${_vmware_fusion_ver//./}/VMware-Fusion-${_vmware_fusion_ver_full/_/-}_x86.dmg"
+ "unlocker.py"
+ "efi-patches.txt"
+)
+sha256sums+=(
+ '0b0516f4d5f70e759ae08a40d2e14f487c0b66d84ee467e38972ad013e1f6c7f'
+ '8a61e03d0edbbf60c1c84a43aa87a6e950f82d2c71b968888f019345c2f684f3'
+ '392c1effcdec516000e9f8ffc97f2586524d8953d3e7d6f2c5f93f2acd809d91'
+)
+
+_fusion_isoimages=(darwin darwinPre15)
+fi
+
+
+_create_database_file() {
+ # Create a database which contains the list of guest tools (necessary to avoid that vmware try to download them)
+ local database_filename="$pkgdir/etc/vmware-installer/database"
+ echo -n "" > "$database_filename"
+
+ sqlite3 "$database_filename" "CREATE TABLE settings(key VARCHAR PRIMARY KEY, value VARCHAR NOT NULL, component_name VARCHAR NOT NULL);"
+ sqlite3 "$database_filename" "INSERT INTO settings(key,value,component_name) VALUES('db.schemaVersion','2','vmware-installer');"
+ sqlite3 "$database_filename" "CREATE TABLE components(id INTEGER PRIMARY KEY, name VARCHAR NOT NULL, version VARCHAR NOT NULL, buildNumber INTEGER NOT NULL, component_core_id INTEGER NOT NULL, longName VARCHAR NOT NULL, description VARCHAR, type INTEGER NOT NULL);"
+
+ for isoimage in ${_isoimages[@]}
+ do
+ local version=$(cat "$srcdir/extracted/vmware-tools-$isoimage/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
+ sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"$version\",\"${_pkgver#*_}\",1,\"$isoimage\",\"$isoimage\",1);"
+ done
+
+if [ -n "$_enable_macOS_guests" ]; then
+ for isoimage in ${_fusion_isoimages[@]}
+ do
+ sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"1\",\"${_vmware_fusion_ver_full#*_}\",1,\"$isoimage\",\"$isoimage\",1);"
+ done
+fi
+}
+
+prepare() {
+ extracted_dir="$srcdir/extracted"
+ [[ -d "$extracted_dir" ]] && rm -r "$extracted_dir"
+
+ bash \
+ "$(readlink -f "$srcdir/VMware-Workstation-Full-${_pkgver/_/-}.${CARCH}.bundle")" \
+ --extract "$extracted_dir"
+
+if [ -n "$_enable_macOS_guests" ]; then
+ dmg2img -s VMware-Fusion-${_vmware_fusion_ver_full/_/-}_x86.dmg VMware-Fusion-${_vmware_fusion_ver_full/_/-}.iso
+ 7z e -y VMware-Fusion-${_vmware_fusion_ver_full/_/-}.iso VMware\ Fusion/VMware\ Fusion.app/Contents/Library/isoimages/\* -o"fusion-isoimages" > /dev/null 2>&1 || true
+
+ sed -i -e "s|/usr/lib/vmware/|${pkgdir}/usr/lib/vmware/|" "$srcdir/unlocker.py"
+fi
+}
+
+package() {
+ local vmware_installer_version=$(cat "$srcdir/extracted/vmware-installer/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
+
+ # Make directories and copy files.
+
+ mkdir -p \
+ "$pkgdir/etc"/{cups,pam.d,modprobe.d,thnuclnt,vmware} \
+ "$pkgdir/usr"/{share,bin} \
+ "$pkgdir/usr/include/vmware-vix" \
+ "$pkgdir/usr/lib"/{vmware/setup,vmware-vix,vmware-ovftool,vmware-installer/"$vmware_installer_version",cups/filter,modules-load.d} \
+ "$pkgdir/usr/share"/{doc/vmware-vix,licenses/"$pkgname"} \
+ "$pkgdir/var/lib/vmware/Shared VMs"
+
+ cd "$srcdir/extracted"
+
+ cp -r \
+ vmware-workstation/share/* \
+ vmware-workstation/man \
+ vmware-network-editor-ui/share/* \
+ vmware-player-app/share/* \
+ "$pkgdir/usr/share"
+
+ cp -r \
+ vmware-workstation/bin/* \
+ vmware-vmx/{,s}bin/* \
+ vmware-vix-core/bin/* \
+ vmware-vprobe/bin/* \
+ vmware-player-app/bin/* \
+ "$pkgdir/usr/bin"
+
+ cp -r \
+ vmware-workstation/lib/* \
+ vmware-player-app/lib/* \
+ vmware-vmx/{lib/*,roms} \
+ vmware-vprobe/lib/* \
+ vmware-usbarbitrator/bin \
+ vmware-network-editor/lib \
+ "$pkgdir/usr/lib/vmware"
+
+ cp -r \
+ vmware-player-setup/vmware-config \
+ "$pkgdir/usr/lib/vmware/setup"
+
+ cp -r \
+ vmware-vix-lib-Workstation1600/lib/Workstation-16.0.0 \
+ vmware-vix-core/{lib/*,vixwrapper-config.txt} \
+ "$pkgdir/usr/lib/vmware-vix"
+
+ cp -r \
+ vmware-vix-core/doc/* \
+ "$pkgdir/usr/share/doc/vmware-vix"
+
+ cp -r \
+ vmware-ovftool/* \
+ "$pkgdir/usr/lib/vmware-ovftool"
+
+ cp -r \
+ vmware-installer/{python,sopython,vmis,vmis-launcher,vmware-installer,vmware-installer.py} \
+ "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version"
+
+ cp -r \
+ vmware-player-app/etc/cups/* \
+ "$pkgdir/etc/cups"
+ cp -r \
+ vmware-player-app/extras/.thnumod \
+ "$pkgdir/etc/thnuclnt"
+ cp -r \
+ vmware-player-app/extras/thnucups \
+ "$pkgdir/usr/lib/cups/filter"
+
+ cp -r \
+ vmware-vix-core/include/* \
+ "$pkgdir/usr/include/vmware-vix"
+
+ for isoimage in ${_isoimages[@]}
+ do
+ install -Dm 644 "vmware-tools-$isoimage/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso"
+ done
+
+ for isoimage in ${_isovirtualprinterimages[@]}
+ do
+ install -Dm 644 "vmware-virtual-printer/VirtualPrinter-$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/VirtualPrinter-$isoimage.iso"
+ done
+
+ install -Dm 644 "vmware-workstation/doc/EULA" "$pkgdir/usr/share/doc/vmware-workstation/EULA"
+ ln -s "/usr/share/doc/vmware-workstation/EULA" "$pkgdir/usr/share/licenses/$pkgname/VMware Workstation - EULA.txt"
+ ln -s "/usr/lib/vmware-ovftool/vmware.eula" "$pkgdir/usr/share/licenses/$pkgname/VMware OVF Tool - EULA.txt"
+ install -Dm 644 "vmware-workstation/doc"/open_source_licenses.txt "$pkgdir/usr/share/licenses/$pkgname/VMware Workstation open source license.txt"
+ install -Dm 644 "vmware-workstation/doc"/ovftool_open_source_licenses.txt "$pkgdir/usr/share/licenses/$pkgname/VMware OVF Tool open source license.txt"
+ install -Dm 644 "vmware-vix-core"/open_source_licenses.txt "$pkgdir/usr/share/licenses/$pkgname/VMware VIX open source license.txt"
+ rm "$pkgdir/usr/lib/vmware-ovftool"/{vmware-eula.rtf,open_source_licenses.txt,manifest.xml}
+
+ install -d -m 755 "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version"/{lib/lib,artwork}
+ install -Dm 755 "$srcdir/configure-initscript.sh" "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version/bin/configure-initscript.sh"
+
+ install -Dm 644 "vmware-vmx/etc/modprobe.d/modprobe-vmware-fuse.conf" "$pkgdir/etc/modprobe.d/vmware-fuse.conf"
+
+ install -Dm 644 vmware-vmx/extra/modules.xml "$pkgdir"/usr/lib/vmware/modules/modules.xml
+ install -Dm 644 vmware-installer/bootstrap "$pkgdir"/etc/vmware-installer/bootstrap
+ install -Dm 644 "$srcdir"/vmware-vix-bootstrap "$pkgdir"/etc/vmware-vix/bootstrap
+ install -Dm 644 "$srcdir"/vmware-bootstrap "$pkgdir"/etc/vmware/bootstrap
+ install -Dm 644 "$srcdir"/config "$pkgdir"/etc/vmware/config
+
+if [ -z "$_remove_vmware_keymaps_dependency" ]; then
+ rm -r "$pkgdir/usr/lib/vmware/xkeymap" # these files are provided by vmware-keymaps package
+fi
+
+ echo -e "vmw_vmci\nvmmon" > "$pkgdir/usr/lib/modules-load.d/vmware.conf"
+
+ for service_file in \
+ vmware-networks-configuration.service \
+ vmware-networks.service \
+ vmware-usbarbitrator.service \
+ vmware-networks.path \
+ vmware-usbarbitrator.path
+ do
+ install -Dm 644 \
+ "$srcdir/$service_file" \
+ "$pkgdir/usr/lib/systemd/system/$service_file"
+ done
+
+
+ # Apply permissions where necessary.
+
+ chmod +x \
+ "$pkgdir/usr/bin"/* \
+ "$pkgdir/usr/lib/vmware/bin"/* \
+ "$pkgdir/usr/lib/vmware/setup"/* \
+ "$pkgdir/usr/lib/vmware/lib"/libvmware-gksu.so/gksu-run-helper \
+ "$pkgdir/usr/lib/vmware-ovftool"/{ovftool,ovftool.bin} \
+ "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version"/{vmware-installer,vmis-launcher} \
+ "$pkgdir/usr/lib/cups/filter"/* \
+ "$pkgdir/usr/lib/vmware-vix/setup"/* \
+ "$pkgdir/etc/thnuclnt/.thnumod"
+
+ chmod +s \
+ "$pkgdir/usr/bin"/vmware-authd \
+ "$pkgdir/usr/lib/vmware/bin"/{vmware-vmx,vmware-vmx-debug,vmware-vmx-stats}
+
+
+ # Add symlinks the installer would create.
+
+ for link in \
+ licenseTool \
+ vmplayer \
+ vmware \
+ vmware-app-control \
+ vmware-enter-serial \
+ vmware-fuseUI \
+ vmware-gksu \
+ vmware-modconfig \
+ vmware-modconfig-console \
+ vmware-mount \
+ vmware-netcfg \
+ vmware-setup-helper \
+ vmware-tray \
+ vmware-vmblock-fuse \
+ vmware-vprobe \
+ vmware-zenity
+ do
+ ln -s /usr/lib/vmware/bin/appLoader "$pkgdir/usr/lib/vmware/bin/$link"
+ done
+
+ for link in \
+ vmrest
+ do
+ ln -s /usr/lib/vmware/bin/appLoader "$pkgdir/usr/bin/$link"
+ done
+
+ for link in \
+ vmware-fuseUI \
+ vmware-mount \
+ vmware-netcfg \
+ vmware-usbarbitrator
+ do
+ ln -s /usr/lib/vmware/bin/$link "$pkgdir/usr/bin/$link"
+ done
+
+ ln -s /usr/lib/vmware/icu "$pkgdir/etc/vmware/icu"
+ ln -s /usr/lib/vmware-ovftool/ovftool "$pkgdir/usr/bin/ovftool"
+ ln -s /usr/lib/vmware-vix/libvixAllProducts.so "$pkgdir/usr/lib/libvixAllProducts.so"
+
+
+ # Replace placeholder "variables" with real paths.
+
+ for file in \
+ gtk-3.0/gdk-pixbuf.loaders
+ do
+ sed -i 's,@@LIBCONF_DIR@@,/usr/lib/vmware/libconf,g' "$pkgdir/usr/lib/vmware/libconf/etc/$file"
+ done
+
+ sed -i 's,@@BINARY@@,/usr/bin/vmware,' "$pkgdir/usr/share/applications/vmware-workstation.desktop"
+ sed -i 's,@@BINARY@@,/usr/bin/vmplayer,' "$pkgdir/usr/share/applications/vmware-player.desktop"
+ sed -i 's,@@BINARY@@,/usr/bin/vmware-netcfg,' "$pkgdir/usr/share/applications/vmware-netcfg.desktop"
+
+ sed \
+ -e "s/@@VERSION@@/$vmware_installer_version/" \
+ -e "s,@@VMWARE_INSTALLER@@,/usr/lib/vmware-installer/$vmware_installer_version," \
+ -i "$pkgdir/etc/vmware-installer/bootstrap"
+
+
+ # Patch up the VMware kernel sources and configure DKMS.
+
+ dkms_dir="$pkgdir/usr/src/$pkgname-$_pkgver"
+
+ install -Dm 644 "$srcdir/Makefile" "$dkms_dir/Makefile"
+ install -Dm 644 "$srcdir/dkms.conf.in" "$dkms_dir/dkms.conf"
+
+ sed \
+ -e "s/@PKGNAME@/$pkgname/g" \
+ -e "s/@PKGVER@/$_pkgver/g" \
+ -i "$dkms_dir/dkms.conf"
+
+ for module in vmmon vmnet; do
+ tar -xf "vmware-vmx/lib/modules/source/$module.tar" -C "$dkms_dir"
+ msg "Patching $module module for DKMS"
+ patch -p2 --read-only=ignore --directory="$dkms_dir/$module-only" < "$srcdir/$module.patch"
+ done
+
+ rm -r "$pkgdir/usr/lib/vmware/modules/source"
+
+if [ -n "$_enable_macOS_guests" ]; then
+ msg "Patching VMware to enable macOS guest support"
+ python3 "$srcdir/unlocker.py" > /dev/null
+
+ for isoimage in ${_fusion_isoimages[@]}
+ do
+ install -Dm 644 "$srcdir/fusion-isoimages/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso"
+ done
+
+ msg "Patching EFI firmwares to disable macOS server checking"
+ _efi_arch=(32 64)
+ for arch in ${_efi_arch[@]}
+ do
+ uefipatch "$pkgdir/usr/lib/vmware/roms/EFI${arch}.ROM" "$srcdir/efi-patches.txt" -o "$pkgdir/usr/lib/vmware/roms/EFI${arch}.ROM" > /dev/null
+ done
+fi
+
+ _create_database_file
+
+ # Define some environment variables for VMware and remove the tests about kernel modules
+ install -Dm 644 "$srcdir/vmware-environment.sh" "$pkgdir/etc/conf.d/vmware"
+ for program in vmware vmplayer vmware-tray; do
+ sed -e '/export PRODUCT_NAME/asource /etc/conf.d/vmware' \
+ -e 's/if "$BINDIR"\/vmware-modconfig --appname=.*/if true ||/' \
+ -i "$pkgdir/usr/bin/$program"
+ done
+
+ # Add StartupWMClass attribute to desktop files
+ sed -i '/^StartupNotify=.*/a StartupWMClass=vmware' "$pkgdir/usr/share/applications/vmware-workstation.desktop"
+ sed -i '/^StartupNotify=.*/a StartupWMClass=vmplayer' "$pkgdir/usr/share/applications/vmware-player.desktop"
+ sed -i '/^StartupNotify=.*/a StartupWMClass=vmware-netcfg' "$pkgdir/usr/share/applications/vmware-netcfg.desktop"
+}
diff --git a/config b/config
new file mode 100644
index 000000000000..8bc745cccf9d
--- /dev/null
+++ b/config
@@ -0,0 +1,21 @@
+.encoding = "UTF-8"
+product.name = "VMware Workstation"
+product.version = "16.2.4"
+product.buildNumber = "20089737"
+workstation.product.version = "16.2.4"
+player.product.version = "16.2.4"
+vix.config.version = "1"
+bindir = "/usr/bin"
+libdir = "/usr/lib/vmware"
+vix.libdir = "/usr/lib/vmware-vix"
+initscriptdir = "/usr/lib/systemd/scripts"
+vmware.fullpath = "/usr/bin/vmware"
+authd.fullpath = "/usr/bin/vmware-authd"
+gksu.rootMethod = "su"
+NETWORKING = "yes"
+installerDefaults.autoSoftwareUpdateEnabled = "no"
+installerDefaults.dataCollectionEnabled = "no"
+installerDefaults.componentDownloadEnabled = "no"
+installerDefaults.transferVersion = "1"
+acceptOVFEULA = "yes"
+acceptEULA = "yes"
diff --git a/configure-initscript.sh b/configure-initscript.sh
new file mode 100755
index 000000000000..8fe7eb16ea73
--- /dev/null
+++ b/configure-initscript.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+action="$1" # add, remove, or status
+serviceName="$2"
+startLevel="$3"
+stopLevel="$4"
+
+# Notes:
+# This package does not need a vmware service to make VMware usable, so this script says that vmware service is always started.
+# vmware-workstation-server service is named vmware-hostd in this package.
+
+#echo $serviceName && exit # DEBUG
+
+addService() {
+ if [ "$serviceName" != "vmware" ]; then
+ systemctl start $serviceName.service
+ systemctl enable $serviceName.service
+ fi
+}
+
+removeService() {
+ if [ "$serviceName" != "vmware" ]; then
+ systemctl stop $serviceName.service
+ systemctl disable $serviceName.service
+ fi
+}
+
+# Check to see whether a program is set to start on boot.
+checkService() {
+ if [ "$serviceName" = "vmware" ]; then
+ retval=0
+ else
+ systemctl is-active $serviceName.service > /dev/null
+ retval=$?
+ fi
+
+ if [ "$retval" = "0" ]; then
+ echo 'on'
+ exit 5
+ else
+ echo 'off'
+ exit 6
+ fi
+}
+
+usage() {
+ echo "Syntax for this script is as follows:"
+ echo ""
+ echo " $0 <action> <serviceName>"
+ echo ""
+ echo " action - add or remove"
+ echo " serviceName - The name of the service"
+ echo ""
+ echo ""
+ echo " $0 status <serviceName>"
+ echo " serviceName - The name of the service"
+ echo ""
+}
+
+
+
+case $action in
+ add)
+ # Don't allow any empty arguments for add
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ]; then
+ usage
+ exit 1
+ fi
+ addService
+ ;;
+ remove)
+ # Don't allow any empty arguments for remove
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ]; then
+ usage
+ exit 1
+ fi
+ removeService
+ ;;
+ status)
+ # We only need the serviceName to check status
+ if [ "$1" = "" ] || [ "$2" = "" ]; then
+ usage
+ exit 1
+ fi
+ checkService
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/dkms.conf.in b/dkms.conf.in
new file mode 100644
index 000000000000..5c7adc58ecde
--- /dev/null
+++ b/dkms.conf.in
@@ -0,0 +1,15 @@
+# Linux DKMS config script for the VMware guest kernel modules
+
+PACKAGE_NAME="@PKGNAME@"
+PACKAGE_VERSION="@PKGVER@"
+MAKE="make KVERSION=$kernelver SRCDIR=/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION"
+CLEAN="make clean"
+AUTOINSTALL="YES"
+
+BUILT_MODULE_NAME[0]="vmmon"
+BUILT_MODULE_LOCATION[0]='vmmon-only'
+DEST_MODULE_LOCATION[0]="/kernel/drivers/misc"
+
+BUILT_MODULE_NAME[1]="vmnet"
+BUILT_MODULE_LOCATION[1]='vmnet-only'
+DEST_MODULE_LOCATION[1]="/kernel/drivers/net"
diff --git a/efi-patches.txt b/efi-patches.txt
new file mode 100644
index 000000000000..6451d1db0315
--- /dev/null
+++ b/efi-patches.txt
@@ -0,0 +1,25 @@
+# Patch string format
+# FileGuid SectionType PatchType:FindPatternOrOffset:ReplacePattern
+# Please ensure that the latest symbol in patch string is space
+
+# Possible section types:
+# PE32 image 10
+# Position-independent code 11
+# TE Image 12
+# DXE Dependency 13
+# Version information 14
+# User interface string 15
+# 16-bit code 16
+# Guided freeform 18
+# Raw data 19
+# PEI Dependency 1B
+# SMM Dependency 1C
+# Please do not try another section types, it can make the resulting image broken
+
+# Possible patch types:
+# P - pattern-based, first parameter is a pattern to find, second - a pattern to replace
+# O - offset-based, first parameter is hexadecimal offset, second - a pattern to replace
+# Patterns can have . as "any possible value" symbol
+
+# VMware remove macOS Server check ServerVersion.plist -> SystemVersion.plist
+961578FE-B6B7-44C3-AF35-6BC705CD3B3F 10 P:530065007200760065007200560065007200730069006F006E002E0070006C00690073007400:530079007300740065006D00560065007200730069006F006E002E0070006C00690073007400
diff --git a/unlocker.py b/unlocker.py
new file mode 100644
index 000000000000..8ac86cb92951
--- /dev/null
+++ b/unlocker.py
@@ -0,0 +1,387 @@
+#!/usr/bin/env python3
+"""
+vSMC Header Structure
+Offset Length Struct Type Description
+----------------------------------------
+0x00/00 0x08/08 Q ptr Offset to key table
+0x08/08 0x04/4 I int Number of private keys
+0x0C/12 0x04/4 I int Number of public keys
+
+vSMC Key Data Structure
+Offset Length Struct Type Description
+----------------------------------------
+0x00/00 0x04/04 4s int Key name (byte reversed e.g. #KEY is YEK#)
+0x04/04 0x01/01 B byte Length of returned data
+0x05/05 0x04/04 4s int Data type (byte reversed e.g. ui32 is 23iu)
+0x09/09 0x01/01 B byte Flag R/W
+0x0A/10 0x06/06 6x byte Padding
+0x10/16 0x08/08 Q ptr Internal VMware routine
+0x18/24 0x30/48 48B byte Data
+"""
+
+import codecs
+import os
+import re
+import struct
+import sys
+
+if sys.version_info < (3, 6):
+ sys.stderr.write('You need Python 3.6 or later\n')
+ sys.exit(1)
+
+# Setup imports depending on whether IronPython or CPython
+if sys.platform in ('cli', 'win32'):
+ # noinspection PyUnresolvedReferences
+ from winreg import *
+
+
+def bytetohex(data):
+ return ''.join('{:02X} '.format(c) for c in data)
+
+
+def joinpath(folder, filename):
+ return os.path.join(folder, filename)
+
+
+def printkey(i, offset, smc_key, smc_data):
+ print(str(i + 1).zfill(3)
+ + ' ' + hex(offset)
+ + ' ' + smc_key[0][::-1].decode('UTF-8')
+ + ' ' + str(smc_key[1]).zfill(2)
+ + ' ' + smc_key[2][::-1].replace(b'\x00', b' ').decode('UTF-8')
+ + ' ' + '{0:#0{1}x}'.format(smc_key[3], 4)
+ + ' ' + hex(smc_key[4])
+ + ' ' + bytetohex(smc_data))
+
+
+def set_bit(value, bit):
+ return value | (1 << bit)
+
+
+def clear_bit(value, bit):
+ return value & ~(1 << bit)
+
+
+def test_bit(value, bit):
+ return value & bit
+
+
+E_CLASS64 = 2
+E_SHT_RELA = 4
+
+
+# noinspection PyUnusedLocal
+def patchelf(f, oldoffset, newoffset):
+ f.seek(0)
+ magic = f.read(4)
+ if not magic == b'\x7fELF':
+ raise Exception('Magic number does not match')
+
+ ei_class = struct.unpack('=B', f.read(1))[0]
+ if ei_class != E_CLASS64:
+ raise Exception('Not 64bit elf header: ' + ei_class)
+
+ f.seek(40)
+ e_shoff = struct.unpack('=Q', f.read(8))[0]
+ f.seek(58)
+ e_shentsize = struct.unpack('=H', f.read(2))[0]
+ e_shnum = struct.unpack('=H', f.read(2))[0]
+ e_shstrndx = struct.unpack('=H', f.read(2))[0]
+
+ print('e_shoff: 0x{:x} e_shentsize: 0x{:x} e_shnum:0x{:x} e_shstrndx:0x{:x}'.format(e_shoff, e_shentsize,
+ e_shnum, e_shstrndx))
+
+ for i in range(0, e_shnum):
+ f.seek(e_shoff + i * e_shentsize)
+ e_sh = struct.unpack('=LLQQQQLLQQ', f.read(e_shentsize))
+ e_sh_name = e_sh[0]
+ e_sh_type = e_sh[1]
+ e_sh_offset = e_sh[4]
+ e_sh_size = e_sh[5]
+ e_sh_entsize = e_sh[9]
+ if e_sh_type == E_SHT_RELA:
+ e_sh_nument = int(e_sh_size / e_sh_entsize)
+ print('RELA at 0x{:x} with {:d} entries'.format(e_sh_offset, e_sh_nument))
+ for j in range(0, e_sh_nument):
+ f.seek(e_sh_offset + e_sh_entsize * j)
+ rela = struct.unpack('=QQq', f.read(e_sh_entsize))
+ r_offset = rela[0]
+ r_info = rela[1]
+ r_addend = rela[2]
+ if r_addend == oldoffset:
+ r_addend = newoffset
+ f.seek(e_sh_offset + e_sh_entsize * j)
+ f.write(struct.pack('=QQq', r_offset, r_info, r_addend))
+ print('Relocation modified at: ' + hex(e_sh_offset + e_sh_entsize * j))
+
+
+def patchkeys(f, key):
+ # Setup struct pack string
+ key_pack = '=4sB4sB6xQ'
+ smc_old_memptr = 0
+ smc_new_memptr = 0
+
+ # Do Until OSK1 read
+ i = 0
+ while True:
+
+ # Read key into struct str and data byte str
+ offset = key + (i * 72)
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+
+ # Reset pointer to beginning of key entry
+ f.seek(offset)
+
+ if smc_key[0] == b'SKL+':
+ # Use the +LKS data routine for OSK0/1
+ smc_new_memptr = smc_key[4]
+ print('+LKS Key: ')
+ printkey(i, offset, smc_key, smc_data)
+
+ elif smc_key[0] == b'0KSO':
+ # Write new data routine pointer from +LKS
+ print('OSK0 Key Before:')
+ printkey(i, offset, smc_key, smc_data)
+ smc_old_memptr = smc_key[4]
+ f.seek(offset)
+ f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr))
+ f.flush()
+
+ # Write new data for key
+ f.seek(offset + 24)
+ smc_new_data = codecs.encode('bheuneqjbexolgurfrjbeqfthneqrqcy', 'rot_13')
+ f.write(smc_new_data.encode('UTF-8'))
+ f.flush()
+
+ # Re-read and print key
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+ print('OSK0 Key After:')
+ printkey(i, offset, smc_key, smc_data)
+
+ elif smc_key[0] == b'1KSO':
+ # Write new data routine pointer from +LKS
+ print('OSK1 Key Before:')
+ printkey(i, offset, smc_key, smc_data)
+ smc_old_memptr = smc_key[4]
+ f.seek(offset)
+ f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr))
+ f.flush()
+
+ # Write new data for key
+ f.seek(offset + 24)
+ smc_new_data = codecs.encode('rnfrqbagfgrny(p)NccyrPbzchgreVap', 'rot_13')
+ f.write(smc_new_data.encode('UTF-8'))
+ f.flush()
+
+ # Re-read and print key
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+ print('OSK1 Key After:')
+ printkey(i, offset, smc_key, smc_data)
+
+ # Finished so get out of loop
+ break
+
+ # elif smc_key[0] == b'WPPK':
+ # # Set the old SMC password as an addtional marker that vmx has been patched
+ # # This has no functional value except for checking status
+ # print('KPPW Key Before:')
+ # printkey(i, offset, smc_key, smc_data)
+ # f.seek(offset + 24)
+ # f.write('SpecialisRevelio'.encode('UTF-8'))
+ #
+ # # Re-read and print key
+ # f.seek(offset)
+ # smc_key = struct.unpack(key_pack, f.read(24))
+ # smc_data = f.read(smc_key[1])
+ # print('KPPW Key After:')
+ # printkey(i, offset, smc_key, smc_data)
+
+ else:
+ pass
+
+ i += 1
+ return smc_old_memptr, smc_new_memptr
+
+
+def patchsmc(name, sharedobj):
+ with open(name, 'r+b') as f:
+
+ smc_old_memptr = 0
+ smc_new_memptr = 0
+
+ # Read file into string variable
+ vmx = f.read()
+
+ print('File: ' + name + '\n')
+
+ # Setup hex string for vSMC headers
+ # These are the private and public key counts
+ smc_header_v0 = b'\xF2\x00\x00\x00\xF0\x00\x00\x00'
+ smc_header_v1 = b'\xB4\x01\x00\x00\xB0\x01\x00\x00'
+
+ # Setup hex string for #KEY key
+ key_key = b'\x59\x45\x4B\x23\x04\x32\x33\x69\x75'
+
+ # Setup hex string for $Adr key
+ adr_key = b'\x72\x64\x41\x24\x04\x32\x33\x69\x75'
+
+ # Find the vSMC headers
+ smc_header_v0_offset = vmx.find(smc_header_v0) - 8
+ smc_header_v1_offset = vmx.find(smc_header_v1) - 8
+
+ # Find '#KEY' keys
+ smc_key0 = vmx.find(key_key)
+ smc_key1 = vmx.rfind(key_key)
+
+ # Find '$Adr' key table
+ smc_adr = vmx.find(adr_key)
+
+ # Print vSMC0 tables and keys
+ print('appleSMCTableV0 (smc.version = "0")')
+ print('appleSMCTableV0 Address : ' + hex(smc_header_v0_offset))
+ print('appleSMCTableV0 Private Key #: 0xF2/242')
+ print('appleSMCTableV0 Public Key #: 0xF0/240')
+
+ if (smc_adr - smc_key0) != 72:
+ print('appleSMCTableV0 Table : ' + hex(smc_key0))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0)
+ elif (smc_adr - smc_key1) != 72:
+ print('appleSMCTableV0 Table : ' + hex(smc_key1))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1)
+
+ print()
+
+ # Print vSMC1 tables and keys
+ print('appleSMCTableV1 (smc.version = "1")')
+ print('appleSMCTableV1 Address : ' + hex(smc_header_v1_offset))
+ print('appleSMCTableV1 Private Key #: 0x01B4/436')
+ print('appleSMCTableV1 Public Key #: 0x01B0/432')
+
+ if (smc_adr - smc_key0) == 72:
+ print('appleSMCTableV1 Table : ' + hex(smc_key0))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0)
+ elif (smc_adr - smc_key1) == 72:
+ print('appleSMCTableV1 Table : ' + hex(smc_key1))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1)
+
+ print()
+
+ # Find matching RELA record in .rela.dyn in ESXi ELF files
+ # This is temporary code until proper ELF parsing written
+ if sharedobj:
+ print('Modifying RELA records from: ' + hex(smc_old_memptr) + ' to ' + hex(smc_new_memptr))
+ patchelf(f, smc_old_memptr, smc_new_memptr)
+
+ # Tidy up
+ f.flush()
+ f.close()
+
+
+def patchbase(name):
+ # Patch file
+ print('GOS Patching: ' + name)
+ f = open(name, 'r+b')
+
+ # Entry to search for in GOS table
+ # Should work for Workstation 12-15...
+ darwin = re.compile(
+ b'\x10\x00\x00\x00[\x10|\x20]\x00\x00\x00[\x01|\x02]\x00\x00\x00\x00\x00\x00\x00'
+ b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+
+ # Read file into string variable
+ base = f.read()
+
+ # Loop through each entry and set top bit
+ # 0xBE --> 0xBF (WKS 12/13)
+ # 0x3E --> 0x3F (WKS 14+)
+ for m in darwin.finditer(base):
+ offset = m.start()
+ f.seek(offset + 32)
+ flag = ord(f.read(1))
+ flag = set_bit(flag, 0)
+ # flag = chr(flag)
+ f.seek(offset + 32)
+ f.write(bytes([flag]))
+ print('GOS Patched flag @: ' + hex(offset))
+
+ # Tidy up
+ f.flush()
+ f.close()
+ print('GOS Patched: ' + name)
+
+
+def patchvmkctl(name):
+ # Patch file
+ print('smcPresent Patching: ' + name)
+ f = open(name, 'r+b')
+
+ # Read file into string variable
+ vmkctl = f.read()
+ applesmc = vmkctl.find(b'applesmc')
+ f.seek(applesmc)
+ f.write(b'vmkernel')
+
+ # Tidy up
+ f.flush()
+ f.close()
+ print('smcPresent Patched: ' + name)
+
+
+# noinspection PyUnresolvedReferences
+def main():
+ # Work around absent Platform module on VMkernel
+ if os.name == 'nt' or os.name == 'cli':
+ osname = 'windows'
+ else:
+ osname = os.uname()[0].lower()
+
+ # vmwarebase = ''
+ vmx_so = False
+
+ # Setup default paths
+ if osname == 'linux':
+ # TODO: Dynamically find Linux installation
+ # Path the install is stored in /etc/vmware/config
+ # libdir = "/usr/lib/vmware"
+ vmx_path = '/usr/lib/vmware/bin/'
+ vmx = joinpath(vmx_path, 'vmware-vmx')
+ vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug')
+ vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats')
+ vmx_so = True
+ if os.path.isfile('/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so'):
+ vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so'
+ else:
+ vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so.0/libvmwarebase.so.0'
+
+ elif osname == 'windows':
+ reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
+ key = OpenKey(reg, r'SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation')
+ vmwarebase_path = QueryValueEx(key, 'InstallPath')[0]
+ vmx_path = QueryValueEx(key, 'InstallPath64')[0]
+ vmx = joinpath(vmx_path, 'vmware-vmx.exe')
+ vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug.exe')
+ vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats.exe')
+ vmwarebase = joinpath(vmwarebase_path, 'vmwarebase.dll')
+
+ else:
+ print('Unknown Operating System: ' + osname)
+ return
+
+ # Patch the vmx executables skipping stats version for Player
+ patchsmc(vmx, vmx_so)
+ patchsmc(vmx_debug, vmx_so)
+ if os.path.isfile(vmx_stats):
+ patchsmc(vmx_stats, vmx_so)
+
+ # Patch vmwarebase for Workstation and Player
+ patchbase(vmwarebase)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/vmmon.patch b/vmmon.patch
new file mode 100644
index 000000000000..1e7493f7bfcf
--- /dev/null
+++ b/vmmon.patch
@@ -0,0 +1,57 @@
+--- a/vmmon/Makefile
++++ b/vmmon/Makefile
+@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
+ endif
+
+
++ifdef KVERSION
++VM_UNAME = $(KVERSION)
++else
+ VM_UNAME = $(shell uname -r)
++endif
+
+ # Header directory for the running kernel
+ ifdef LINUXINCLUDE
+--- a/vmmon/include/vm_assert.h
++++ b/vmmon/include/vm_assert.h
+@@ -40,7 +40,11 @@
+
+ // XXX not necessary except some places include vm_assert.h improperly
+ #include "vm_basic_types.h"
++
++/* No stdarg.h on Linux kernels 5.15+ */
++#ifndef KBUILD_MODNAME
+ #include <stdarg.h>
++#endif
+
+ #ifdef __cplusplus
+ extern "C" {
+--- a/vmmon/include/vm_basic_defs.h
++++ b/vmmon/include/vm_basic_defs.h
+@@ -50,7 +50,10 @@
+ * References:
+ * C90 7.17, C99 7.19, C11 7.19
+ */
+-#if !defined(VMKERNEL)
++/* Use linux/stddef.h when building Linux kernel modules. */
++#ifdef KBUILD_MODNAME
++# include <linux/stddef.h>
++#elif !defined(VMKERNEL)
+ # include <stddef.h>
+ #else
+ /*
+--- a/vmmon/linux/hostif.c
++++ b/vmmon/linux/hostif.c
+@@ -2356,7 +2332,11 @@
+ int ret;
+
+ r = APICR_TO_ADDR(r, APICR_VERSION);
+-#ifdef HAVE_GET_KERNEL_NOFAULT
++#if defined(HAVE_GET_KERNEL_NOFAULT) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
++ /*
++ * Exists from 5.10, first indicated by HAVE_GET_KERNEL_NOFAULT,
++ * and from post-5.17 just existing everywhere.
++ */
+ ret = get_kernel_nofault(dummy, (void *)r);
+ #else
+ {
diff --git a/vmnet.patch b/vmnet.patch
new file mode 100644
index 000000000000..e0c694824efe
--- /dev/null
+++ b/vmnet.patch
@@ -0,0 +1,220 @@
+--- a/vmnet/Makefile
++++ b/vmnet/Makefile
+@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
+ endif
+
+
++ifdef KVERSION
++VM_UNAME = $(KVERSION)
++else
+ VM_UNAME = $(shell uname -r)
++endif
+
+ # Header directory for the running kernel
+ ifdef LINUXINCLUDE
+--- a/vmnet/bridge.c
++++ b/vmnet/bridge.c
+@@ -684,14 +684,11 @@
+ }
+ spin_unlock_irqrestore(&bridge->historyLock, flags);
+
+- /*
+- * We used to cli() before calling netif_rx() here. It was probably
+- * unneeded (as we never did it in netif.c, and the code worked). In
+- * any case, now that we are using netif_rx_ni(), we should certainly
+- * not do it, or netif_rx_ni() will deadlock on the cli() lock --hpreg
+- */
+-
+- netif_rx_ni(clone);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
++ netif_rx_ni(clone);
++#else
++ netif_rx(clone);
++#endif
+ # if LOGLEVEL >= 4
+ do_gettimeofday(&vnetTime);
+ # endif
+--- a/vmnet/netif.c
++++ b/vmnet/netif.c
+@@ -253,7 +253,11 @@
+
+ memset(&netIf->stats, 0, sizeof netIf->stats);
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
+ memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
++#else
++ eth_hw_addr_set(dev, netIf->port.paddr);
++#endif
+
+ if (register_netdev(dev) != 0) {
+ LOG(0, (KERN_NOTICE "%s: could not register network device\n",
+@@ -345,7 +349,11 @@
+ /* send to the host interface */
+ skb->dev = netIf->dev;
+ skb->protocol = eth_type_trans(skb, netIf->dev);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+ netif_rx_ni(skb);
++#else
++ netif_rx(skb);
++#endif
+ netIf->stats.rx_packets++;
+
+ return;
+@@ -532,7 +540,11 @@
+ return -EINVAL;
+ }
+ memcpy(netIf->port.paddr, addr->sa_data, dev->addr_len);
+- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
++ memcpy(dev->dev_addr, netIf->port.paddr, dev->addr_len);
++#else
++ eth_hw_addr_set(dev, netIf->port.paddr);
++#endif
+ return 0;
+ }
+
+--- a/vmnet/smac.c
++++ b/vmnet/smac.c
+@@ -4116,7 +4116,7 @@
+
+ void SMACINT
+ SMAC_SetMac(SMACState *state, // IN: state to update
+- uint8 *mac) // IN: pointer to host adapter's MAC
++ const uint8 *mac) // IN: pointer to host adapter's MAC
+ {
+ VNETKdPrintCall(("SMAC_SetMac"));
+ ASSERT(state);
+--- a/vmnet/smac.h
++++ b/vmnet/smac.h
+@@ -72,7 +72,7 @@
+ void SMACINT
+ SMAC_InitState(struct SMACState **ptr); // IN: state to alloc/init
+ void SMACINT
+-SMAC_SetMac(struct SMACState *state, uint8 *mac); // IN: state, and host MAC
++SMAC_SetMac(struct SMACState *state, const uint8 *mac); // IN: state, and host MAC
+ void SMACINT
+ SMAC_CleanupState(struct SMACState **ptr); // IN: state to cleanup/dealloc
+
+--- a/vmnet/userif.c
++++ b/vmnet/userif.c
+@@ -522,6 +522,50 @@
+ /*
+ *----------------------------------------------------------------------
+ *
++ * VNetCsumAndCopyToUser --
++ *
++ * Checksum data and copy them to userspace.
++ *
++ * Results:
++ * folded checksum (non-zero value) on success,
++ * err set to 0 on success, negative errno on failure.
++ *
++ * Side effects:
++ * Data copied to the buffer.
++ *
++ *----------------------------------------------------------------------
++ */
++
++static unsigned int
++VNetCsumAndCopyToUser(const void *src, // IN: Source
++ void *dst, // IN: Destination
++ int len, // IN: Bytes to copy
++ int *err) // OUT: Error code
++{
++ unsigned int csum;
++
++#if COMPAT_LINUX_VERSION_CHECK_LT(5, 10, 0)
++ csum = csum_and_copy_to_user(src, dst, len, 0, err);
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
++ csum = csum_and_copy_to_user(src, dst, len);
++ *err = (csum == 0) ? -EFAULT : 0;
++#else
++ if (!user_access_begin(dst, len)) {
++ *err = -EFAULT;
++ csum = 0;
++ } else {
++ *err = 0;
++ csum = csum_partial_copy_nocheck(src, dst, len);
++ user_access_end();
++ }
++#endif
++ return csum;
++}
++
++
++/*
++ *----------------------------------------------------------------------
++ *
+ * VNetCsumCopyDatagram --
+ *
+ * Copy part of datagram to userspace doing checksum at same time.
+@@ -561,12 +605,7 @@
+ return -EINVAL;
+ }
+
+-#if COMPAT_LINUX_VERSION_CHECK_LT(5, 10, 0)
+- csum = csum_and_copy_to_user(skb->data + offset, curr, len, 0, &err);
+-#else
+- csum = csum_and_copy_to_user(skb->data + offset, curr, len);
+- err = (csum == 0) ? -EFAULT : 0;
+-#endif
++ csum = VNetCsumAndCopyToUser(skb->data + offset, curr, len, &err);
+ if (err) {
+ return err;
+ }
+@@ -580,14 +619,8 @@
+ const void *vaddr;
+
+ vaddr = kmap(skb_frag_page(frag));
+-#if COMPAT_LINUX_VERSION_CHECK_LT(5, 10, 0)
+- tmpCsum = csum_and_copy_to_user(vaddr + skb_frag_off(frag),
+- curr, skb_frag_size(frag), 0, &err);
+-#else
+- tmpCsum = csum_and_copy_to_user(vaddr + skb_frag_off(frag),
+- curr, skb_frag_size(frag));
+- err = (tmpCsum == 0) ? -EFAULT : 0;
+-#endif
++ tmpCsum = VNetCsumAndCopyToUser(vaddr + skb_frag_off(frag),
++ curr, skb_frag_size(frag), &err);
+ kunmap(skb_frag_page(frag));
+
+ if (err) {
+# Fixing VMWare Player on Linux when using DHCP addresses: https://www.nikhef.nl/~janjust/vmnet/
+@@ -998,6 +998,9 @@
+ userIf = (VNetUserIF *)port->jack.private;
+ hubJack = port->jack.peer;
+
++ /* never send link down events */
++ if (!linkUp) return 0;
++
+ if (port->jack.state == FALSE || hubJack == NULL) {
+ return -EINVAL;
+ }
+--- a/vmnet/vm_assert.h
++++ b/vmnet/vm_assert.h
+@@ -40,7 +40,11 @@
+
+ // XXX not necessary except some places include vm_assert.h improperly
+ #include "vm_basic_types.h"
++
++/* No stdarg.h on Linux kernels 5.15+ */
++#ifndef KBUILD_MODNAME
+ #include <stdarg.h>
++#endif
+
+ #ifdef __cplusplus
+ extern "C" {
+--- a/vmnet/vm_basic_defs.h
++++ b/vmnet/vm_basic_defs.h
+@@ -50,7 +50,10 @@
+ * References:
+ * C90 7.17, C99 7.19, C11 7.19
+ */
+-#if !defined(VMKERNEL)
++/* Use linux/stddef.h when building Linux kernel modules. */
++#ifdef KBUILD_MODNAME
++# include <linux/stddef.h>
++#elif !defined(VMKERNEL)
+ # include <stddef.h>
+ #else
+ /*
diff --git a/vmware-bootstrap b/vmware-bootstrap
new file mode 100644
index 000000000000..981b82191cca
--- /dev/null
+++ b/vmware-bootstrap
@@ -0,0 +1,11 @@
+PREFIX="/usr"
+BINDIR="/usr/bin"
+SBINDIR="/usr/sbin"
+LIBDIR="/usr/lib"
+DATADIR="/usr/share"
+SYSCONFDIR="/etc"
+DOCDIR="/usr/share/doc"
+MANDIR="/usr/share/man"
+INCLUDEDIR="/usr/include"
+INITDIR=""
+INITSCRIPTDIR="/usr/lib/systemd/scripts"
diff --git a/vmware-environment.sh b/vmware-environment.sh
new file mode 100644
index 000000000000..b4bee50db4df
--- /dev/null
+++ b/vmware-environment.sh
@@ -0,0 +1,2 @@
+# Uncomment the line below if you have a problem of incompatible libraries
+#export VMWARE_USE_SHIPPED_LIBS=yes
diff --git a/vmware-networks-configuration.service b/vmware-networks-configuration.service
new file mode 100644
index 000000000000..0d86867f955e
--- /dev/null
+++ b/vmware-networks-configuration.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=VMware Networks Configuration Generation
+ConditionPathExists=!/etc/vmware/networking
+
+[Service]
+UMask=0077
+ExecStart=/usr/bin/vmware-networks --postinstall vmware-player,0,1
+Type=oneshot
+RemainAfterExit=yes
diff --git a/vmware-networks.path b/vmware-networks.path
new file mode 100644
index 000000000000..fb53ff4ba642
--- /dev/null
+++ b/vmware-networks.path
@@ -0,0 +1,8 @@
+[Unit]
+Description=Monitor to Load-On-Demand the VMware Networks service
+
+[Path]
+PathExistsGlob=/var/run/vmware/*/*
+
+[Install]
+WantedBy=paths.target
diff --git a/vmware-networks.service b/vmware-networks.service
new file mode 100644
index 000000000000..7d520a28a88d
--- /dev/null
+++ b/vmware-networks.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=VMware Networks
+Wants=vmware-networks-configuration.service
+After=vmware-networks-configuration.service
+
+[Service]
+Type=forking
+ExecStartPre=-/sbin/modprobe vmnet
+ExecStart=/usr/bin/vmware-networks --start
+ExecStop=/usr/bin/vmware-networks --stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vmware-usbarbitrator.path b/vmware-usbarbitrator.path
new file mode 100644
index 000000000000..e56473635d8b
--- /dev/null
+++ b/vmware-usbarbitrator.path
@@ -0,0 +1,8 @@
+[Unit]
+Description=Monitor to Load-On-Demand the VMware USB Arbitrator
+
+[Path]
+PathExistsGlob=/var/run/vmware/*/*
+
+[Install]
+WantedBy=paths.target
diff --git a/vmware-usbarbitrator.service b/vmware-usbarbitrator.service
new file mode 100644
index 000000000000..fd1d9cac8034
--- /dev/null
+++ b/vmware-usbarbitrator.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=VMware USB Arbitrator
+
+[Service]
+ExecStart=/usr/lib/vmware/bin/vmware-usbarbitrator -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vmware-vix-bootstrap b/vmware-vix-bootstrap
new file mode 100644
index 000000000000..425074de832d
--- /dev/null
+++ b/vmware-vix-bootstrap
@@ -0,0 +1,2 @@
+BINDIR="/usr/bin"
+
diff --git a/vmware-workstation.install b/vmware-workstation.install
new file mode 100644
index 000000000000..8e58daa8703e
--- /dev/null
+++ b/vmware-workstation.install
@@ -0,0 +1,29 @@
+post_install() {
+ cat << EOF
+
+==> Before using VMware, you need to reboot or load vmw_vmci and vmmon kernel modules (in a terminal on root: modprobe -a vmw_vmci vmmon)
+==> You may also need to enable some of the following services:
+- vmware-networks: to have network access inside VMs
+- vmware-usbarbitrator: to connect USB devices inside VMs
+These services can be activated during boot by enabling .service units or only when a VM is started by enabling .path units.
+
+EOF
+}
+
+post_upgrade() {
+ if (( $(vercmp "$2" "16.1.2-2") < 0 )); then
+ cat << EOF
+
+Now VMware services can be activated only when a VM is started by enabling .path units instead of .service units.
+
+EOF
+ fi
+}
+
+post_remove() {
+ cat << EOF
+
+==> To remove VMware settings, delete /etc/vmware and /etc/vmware-installer directories.
+
+EOF
+}