commit ca56de4987b8d2f6bc7cf49c11da56a8650f91c2 Author: ytshih Date: Thu Jul 10 08:02:01 2025 +0800 Initial commit diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..1e4c979 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,96 @@ +pkgbase = vmware-workstation + pkgdesc = The industry standard for running multiple operating systems as virtual machines on a single Linux PC. + pkgver = 17.6.3 + pkgrel = 9 + url = https://www.vmware.com/products/workstation-for-linux.html + install = vmware-workstation.install + arch = x86_64 + license = custom + makedepends = sqlite + makedepends = python + makedepends = 7zip + makedepends = uefitool + depends = dkms + depends = fuse2 + depends = gtkmm3 + depends = libcanberra + depends = libaio + depends = pcsclite + depends = hicolor-icon-theme + depends = libxcrypt-compat + depends = libxml2-legacy + depends = gtk3 + depends = gcr + optdepends = linux-headers: build modules against Arch kernel + provides = vmware-ovftool + conflicts = vmware-modules-dkms + conflicts = vmware-ovftool + conflicts = vmware-patch + conflicts = vmware-systemd-services + options = !strip + options = emptydirs + options = !debug + backup = etc/vmware/config + backup = etc/conf.d/vmware + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.6.3/24583834/linux/core/VMware-Workstation-17.6.3-24583834.x86_64.bundle.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-linux-12.4.0-23259341.x86_64.component.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-linuxPreGlibc25-12.4.0-23259341.x86_64.component.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-netware-12.4.0-23259341.x86_64.component.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-solaris-12.4.0-23259341.x86_64.component.tar + source = vmware-tools-windows-12.5.0-24276846-17.6.3.x86_64.component.tar::https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.6.3/24583834/linux/packages/vmware-tools-windows-12.5.0-24276846.x86_64.component.tar + source = vmware-tools-windows-x86-12.5.0-24276846-17.6.3.x86_64.component.tar::https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.6.3/24583834/linux/packages/vmware-tools-windows-x86-12.5.0-24276846.x86_64.component.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-winPre2k-12.4.0-23259341.x86_64.component.tar + source = https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/17.5.2/23775571/linux/packages/vmware-tools-winPreVista-12.4.0-23259341.x86_64.component.tar + source = winVistaSP1.iso::https://packages-prod.broadcom.com/tools/frozen/windows/WindowsToolsVista/SP1/windows.iso + source = winVistaSP2.iso::https://packages-prod.broadcom.com/tools/frozen/windows/WindowsToolsVista/SP2/windows.iso + 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 + source = linux6_15.patch + source = https://packages-prod.broadcom.com/tools/frozen/darwin/darwin.iso + source = https://packages-prod.broadcom.com/tools/frozen/darwin/darwinPre15.iso + source = unlocker.py + source = efi-patches.txt + sha256sums = 4f3b643068bbd6e4c864e1b434cfef080faa18382b988d012dc4738094a73e74 + sha256sums = d862be0d12796134b40e5ffc7534a5e6161b8898355fe32ca8f705a3806cbfe4 + sha256sums = d79f79f17e5f37399046d16be3967e0cff3c9474e2cb6ea3f2c3ebea3ff68cea + sha256sums = 4643fff3ed4f8af5a56a1c4c2084fa7327d78e58ee9b0687b98390a4b4a1ac14 + sha256sums = 196c842f758b813afb202b0db2d09d457fccafac212ca41ef3277dfe9ceaf9ec + sha256sums = 81b63fd7f3a7f9f7b24cddb8712a592b4b3c9f269338a8897c55146c9766a18b + sha256sums = 5078060e520cf1491d1585d9b85a311bfcde1da080fc527512840d44040eb137 + sha256sums = d4e9884f5f11cef4e261023d895eba5b57a8a80623bff0de8b3f1c47154b2a11 + sha256sums = 20abd21da43ac31741f8bb26db1ae7d8f4ef4c5082c9a2cc3ae5da494f1b9529 + sha256sums = 3b8f9d6e43f5d1dff0576cb93d008c14e0434d7233872f6c63988513d2bda5d1 + sha256sums = 8f1cc3181055891b98672f715e0ca7bbe4018960eae945d7a4b9f640c44c3d79 + sha256sums = 12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e + sha256sums = da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141 + sha256sums = ac81b0470feebba36482fbb2a9f641fef98924711bf761c0e6fdec67178194de + sha256sums = 48d203450db426e8780f3696a2cf85ee08db004e93f8aca50a9aa24129b1e839 + sha256sums = b94959a11b28e51b541321be0588190eb10825e9ff55cbd16eb01483a839a69f + sha256sums = 9b4fbe0ba83f761a2eb9ecd05d48428f8b0a5b3abd8404ccbd928408e682f02b + sha256sums = c0a5aea785db06921fb350d36d5e0fd9a14f5eee0c835686ec6fea1af8c92245 + sha256sums = d7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d + sha256sums = 16a73931894a65d43da489ff25d07647c0ecddf60d443b103bceca63504910fe + sha256sums = fe1b1be8297f4170406f97dd1f8b385d911faf45afe19cbc0c26b8092b3ddf8d + sha256sums = 7ba8cbdb1981a9a714b4068e651cc7a20ab358dddf6cab68519d9f324ea800b3 + sha256sums = 273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac + sha256sums = 32ae0ba7836c2212b819e3e7ec3f96667c1ac6d5083003eab1e794f0c032f640 + sha256sums = 74453f184ff57390ea0696144f0fc767cc875635595c964d5d5e7924a01c82d8 + sha256sums = 2411268a37a2aac03ea1e8b38e2da3fc31a232161f92cad824d98d9873b2586d + sha256sums = e0c96286f376b30e2c2362bd991709f0f6bc6ebd911be4056a58da8698c49236 + sha256sums = ef33fc5d152fd9db27cac0b1f21160226dfa5e5b7a501ffa25818682f3b4aaa0 + sha256sums = 8a61e03d0edbbf60c1c84a43aa87a6e950f82d2c71b968888f019345c2f684f3 + sha256sums = 392c1effcdec516000e9f8ffc97f2586524d8953d3e7d6f2c5f93f2acd809d91 + +pkgname = vmware-workstation diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..7d58868 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,13 @@ +name: Build package +on: [push] + +jobs: + build-package: + runs-on: pkgbuilder + env: + steps: + - name: Build and push package + uses: https://gitea.konchin.com/action/archbuild@main + with: + minio-accesskey: ${{ secrets.MINIO_ACCESSKEY }} + minio-secretkey: ${{ secrets.MINIO_SECRETKEY }} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f025add --- /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 0000000..968002e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,451 @@ +# Maintainer: Julian Xhokaxhiu +# Contributor: Jean-Marc Lenoir +# Contributor: Maxwell Pray a.k.a. Synthead + +# 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-workstation +pkgver=17.6.3 +_buildver=24583834 +_pkgver=${pkgver}_${_buildver} +pkgrel=9 +_tools_version=12.5.0-24276846 +_legacy_ver=17.5.2 +_legacy_buildver=23775571 +_legacy_tools_version=12.4.0_23259341 +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-modules-dkms + vmware-ovftool + vmware-patch + vmware-systemd-services +) +provides=( + vmware-ovftool +) +depends=( + dkms + fuse2 + gtkmm3 + libcanberra + libaio + pcsclite + hicolor-icon-theme + libxcrypt-compat # needed for ovftool + libxml2-legacy # needed for vmrun + # 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' +) + +DLAGENTS=("https::/usr/bin/curl -fLC - --connect-to softwareupdate-prod.broadcom.com:443:softwareupdate-prod.broadcom.com.cdn.cloudflare.net:443 --retry 3 --retry-delay 3 -o %o %u") + +source=( + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${pkgver}/${_buildver}/linux/core/VMware-Workstation-${_pkgver/_/-}.${CARCH}.bundle.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-linux-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-linuxPreGlibc25-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-netware-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-solaris-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + "vmware-tools-windows-${_tools_version/_/-}-${pkgver}.${CARCH}.component.tar::https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${pkgver}/${_buildver}/linux/packages/vmware-tools-windows-${_tools_version/_/-}.${CARCH}.component.tar" + "vmware-tools-windows-x86-${_tools_version/_/-}-${pkgver}.${CARCH}.component.tar::https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${pkgver}/${_buildver}/linux/packages/vmware-tools-windows-x86-${_tools_version/_/-}.${CARCH}.component.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-winPre2k-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + "https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/ws/${_legacy_ver}/${_legacy_buildver}/linux/packages/vmware-tools-winPreVista-${_legacy_tools_version/_/-}.${CARCH}.component.tar" + + "winVistaSP1.iso::https://packages-prod.broadcom.com/tools/frozen/windows/WindowsToolsVista/SP1/windows.iso" + "winVistaSP2.iso::https://packages-prod.broadcom.com/tools/frozen/windows/WindowsToolsVista/SP2/windows.iso" + + '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' + 'linux6_15.patch' +) +sha256sums=('4f3b643068bbd6e4c864e1b434cfef080faa18382b988d012dc4738094a73e74' + 'd862be0d12796134b40e5ffc7534a5e6161b8898355fe32ca8f705a3806cbfe4' + 'd79f79f17e5f37399046d16be3967e0cff3c9474e2cb6ea3f2c3ebea3ff68cea' + '4643fff3ed4f8af5a56a1c4c2084fa7327d78e58ee9b0687b98390a4b4a1ac14' + '196c842f758b813afb202b0db2d09d457fccafac212ca41ef3277dfe9ceaf9ec' + '81b63fd7f3a7f9f7b24cddb8712a592b4b3c9f269338a8897c55146c9766a18b' + '5078060e520cf1491d1585d9b85a311bfcde1da080fc527512840d44040eb137' + 'd4e9884f5f11cef4e261023d895eba5b57a8a80623bff0de8b3f1c47154b2a11' + '20abd21da43ac31741f8bb26db1ae7d8f4ef4c5082c9a2cc3ae5da494f1b9529' + '3b8f9d6e43f5d1dff0576cb93d008c14e0434d7233872f6c63988513d2bda5d1' + '8f1cc3181055891b98672f715e0ca7bbe4018960eae945d7a4b9f640c44c3d79' + '12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e' + 'da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141' + 'ac81b0470feebba36482fbb2a9f641fef98924711bf761c0e6fdec67178194de' + '48d203450db426e8780f3696a2cf85ee08db004e93f8aca50a9aa24129b1e839' + 'b94959a11b28e51b541321be0588190eb10825e9ff55cbd16eb01483a839a69f' + '9b4fbe0ba83f761a2eb9ecd05d48428f8b0a5b3abd8404ccbd928408e682f02b' + 'c0a5aea785db06921fb350d36d5e0fd9a14f5eee0c835686ec6fea1af8c92245' + 'd7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d' + '16a73931894a65d43da489ff25d07647c0ecddf60d443b103bceca63504910fe' + 'fe1b1be8297f4170406f97dd1f8b385d911faf45afe19cbc0c26b8092b3ddf8d' + '7ba8cbdb1981a9a714b4068e651cc7a20ab358dddf6cab68519d9f324ea800b3' + '273d4357599a3e54259c78cc49054fef8ecfd2c2eda35cbcde3a53a62777a5ac' + '32ae0ba7836c2212b819e3e7ec3f96667c1ac6d5083003eab1e794f0c032f640' + '74453f184ff57390ea0696144f0fc767cc875635595c964d5d5e7924a01c82d8' + '2411268a37a2aac03ea1e8b38e2da3fc31a232161f92cad824d98d9873b2586d') +options=(!strip emptydirs !debug) + +if [ -z "$_remove_vmware_keymaps_dependency" ]; then +depends+=( + vmware-keymaps +) +fi + + +_isoimages=(linux linuxPreGlibc25 netware solaris windows windows-x86 winPre2k winPreVista) + +if [ -n "$_enable_macOS_guests" ]; then + +_vmware_fusion_ver=13.5.2 +_vmware_fusion_buildver=23775688 +_vmware_fusion_ver_full=${_vmware_fusion_ver}_${_vmware_fusion_buildver} +# List of VMware Fusion versions: https://softwareupdate-prod.broadcom.com/cds/vmw-desktop/fusion/index.html + +makedepends+=( + python + 7zip + uefitool +) + +source+=( + "https://packages-prod.broadcom.com/tools/frozen/darwin/darwin.iso" + "https://packages-prod.broadcom.com/tools/frozen/darwin/darwinPre15.iso" + "unlocker.py" + "efi-patches.txt" +) + +sha256sums+=( + 'e0c96286f376b30e2c2362bd991709f0f6bc6ebd911be4056a58da8698c49236' + 'ef33fc5d152fd9db27cac0b1f21160226dfa5e5b7a501ffa25818682f3b4aaa0' + '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 "(?<=)[^<]+") + 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-${_pkgver/_/-}.${CARCH}.bundle")" \ + --install-component "vmware-tools-linux-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-linuxPreGlibc25-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-netware-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-solaris-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-windows-${_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-windows-x86-${_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-winPre2k-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --install-component "vmware-tools-winPreVista-${_legacy_tools_version/_/-}.${CARCH}.component" \ + --extract "$extracted_dir" + +if [ -n "$_enable_macOS_guests" ]; then + 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 "(?<=)[^<]+") + + # Make directories and copy files. + + mkdir -p \ + "$pkgdir/etc"/{pam.d,modprobe.d,vmware} \ + "$pkgdir/usr"/{share,bin} \ + "$pkgdir/usr/include/vmware-vix" \ + "$pkgdir/usr/lib"/{vmware/setup,vmware-vix,vmware-ovftool,vmware-installer/"$vmware_installer_version",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-Workstation1700/lib/Workstation-17.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-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 + + # Add Windows Vista SP1 and SP2 ISO images + install -Dm 644 "$srcdir/winVistaSP1.iso" "$pkgdir/usr/lib/vmware/isoimages/winVistaSP1.iso" + install -Dm 644 "$srcdir/winVistaSP2.iso" "$pkgdir/usr/lib/vmware/isoimages/winVistaSP2.iso" + + 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/vmware-vix/setup"/* + + 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 + patch -p1 --read-only=ignore --directory="$dkms_dir/" < "$srcdir/linux6_15.patch" + + 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/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso" + done + + msg "Patching EFI firmwares to disable macOS server checking" + _efi_arch=("32" "64" "20-32" "20-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 0000000..45ea49d --- /dev/null +++ b/config @@ -0,0 +1,21 @@ +.encoding = "UTF-8" +product.name = "VMware Player" +product.version = "17.0.0" +product.buildNumber = "20800274" +workstation.product.version = "17.0.0" +player.product.version = "17.0.0" +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 0000000..8fe7eb1 --- /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 " + echo "" + echo " action - add or remove" + echo " serviceName - The name of the service" + echo "" + echo "" + echo " $0 status " + 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 0000000..97df31c --- /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=true +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 0000000..6451d1d --- /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/linux6_15.patch b/linux6_15.patch new file mode 100644 index 0000000..3955c96 --- /dev/null +++ b/linux6_15.patch @@ -0,0 +1,32 @@ +--- a/vmmon-only/linux/driver.c ++++ b/vmmon-only/linux/driver.c +@@ -346,7 +346,7 @@ + + Log("Module %s: unloaded\n", vmmon_miscdev.name); + +- del_timer_sync(&tscTimer); ++ timer_delete_sync(&tscTimer); + + Vmx86_CleanupHVIOBitmap(); + Task_Terminate(); +--- a/vmmon-only/linux/hostif.c ++++ b/vmmon-only/linux/hostif.c +@@ -1995,7 +1995,7 @@ + void + HostIF_CleanupUptime(void) + { +- del_timer_sync(&uptimeState.timer); ++ timer_delete_sync(&uptimeState.timer); + } + + +--- a/vmmon-only/Makefile.kernel ++++ b/vmmon-only/Makefile.kernel +@@ -21,7 +21,7 @@ + CC_OPTS += -DVMMON -DVMCORE + + INCLUDE := -I$(SRCROOT)/include -I$(SRCROOT)/include/x86 -I$(SRCROOT)/common -I$(SRCROOT)/linux +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++ccflags-y := $(CC_OPTS) $(INCLUDE) + + obj-m += $(DRIVER).o \ No newline at end of file diff --git a/unlocker.py b/unlocker.py new file mode 100644 index 0000000..8ac86cb --- /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 0000000..7ab2588 --- /dev/null +++ b/vmmon.patch @@ -0,0 +1,26 @@ +--- a/vmmon/Makefile ++++ b/vmmon/Makefile +@@ -43,7 +43,11 @@ + endif + + ++ifdef KVERSION ++VM_UNAME = $(KVERSION) ++else + VM_UNAME = $(shell uname -r) ++endif + + # Header directory for the running kernel + ifdef LINUXINCLUDE +Fix from https://communities.vmware.com/t5/VMware-Workstation-Pro/Workstation-17-5-0-vmware-clk-spinning-on-CPU-when-Linux-VMs-are/m-p/2996282 +--- a/vmmon-only/linux/hostif.c ++++ b/vmmon-only/linux/hostif.c +@@ -3351,7 +3351,7 @@ + * threads running in the monitor on all physical CPUs. + */ + +- if (rate > MIN_RATE) { ++ if (false) { + if (!linuxState.fastClockThread) { + struct task_struct *rtcTask; + diff --git a/vmnet.patch b/vmnet.patch new file mode 100644 index 0000000..59b9aca --- /dev/null +++ b/vmnet.patch @@ -0,0 +1,71 @@ +--- a/vmnet/Makefile ++++ b/vmnet/Makefile +@@ -43,7 +43,11 @@ + endif + + ++ifdef KVERSION ++VM_UNAME = $(KVERSION) ++else + VM_UNAME = $(shell uname -r) ++endif + + # Header directory for the running kernel + ifdef LINUXINCLUDE +--- a/vmnet/driver.c ++++ b/vmnet/driver.c +@@ -268,7 +268,7 @@ + /* + *---------------------------------------------------------------------- + * +- * init_module -- ++ * LinuxDriverInit -- + * + * linux module entry point. Called by /sbin/insmod command. + * Initializes module and Registers this driver for a +@@ -285,7 +285,7 @@ + */ + + int +-init_module(void) ++LinuxDriverInit(void) + { + int retval; + +@@ -347,7 +347,7 @@ + /* + *---------------------------------------------------------------------- + * +- * cleanup_module -- ++ * LinuxDriverExit -- + * + * Called by /sbin/rmmod. Unregisters this driver for a + * vnet major #, and deinitializes the modules. The 64-bit +@@ -364,7 +364,7 @@ + */ + + void +-cleanup_module(void) ++LinuxDriverExit(void) + { + unregister_chrdev(VNET_MAJOR_NUMBER, "vmnet"); + VNetProtoUnregister(); +@@ -1659,3 +1659,5 @@ + * by default (i.e., neither mkinitrd nor modprobe will accept it). + */ + MODULE_INFO(supported, "external"); ++module_init(LinuxDriverInit); ++module_exit(LinuxDriverExit); +--- a/vmnet/userif.c ++++ b/vmnet/userif.c +Fixing VMWare Player on Linux when using DHCP addresses: https://www.nikhef.nl/~janjust/vmnet/ +@@ -1030,6 +1030,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; + } diff --git a/vmware-bootstrap b/vmware-bootstrap new file mode 100644 index 0000000..981b821 --- /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 0000000..b4bee50 --- /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 0000000..0d86867 --- /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 0000000..fb53ff4 --- /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 0000000..7d520a2 --- /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 0000000..e564736 --- /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 0000000..fd1d9ca --- /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 0000000..425074d --- /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 0000000..0fd6c47 --- /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 completely clean VMware installation, you may have to manually delete /etc/vmware, /etc/vmware-installer and /usr/lib/vmware-installer directories if they still exist. + +EOF +}