diff options
3 files changed, 165 insertions, 0 deletions
diff --git a/app-emulation/vmware-modules/files/304-4.9-00-get_user_pages.patch b/app-emulation/vmware-modules/files/304-4.9-00-get_user_pages.patch new file mode 100644 index 0000000..9b7e0a4 --- /dev/null +++ b/app-emulation/vmware-modules/files/304-4.9-00-get_user_pages.patch @@ -0,0 +1,20 @@ +--- vmmon-only.bak/linux/hostif.c 2017-04-05 10:10:24.522070886 -0400 ++++ vmmon-only/linux/hostif.c 2017-04-05 10:13:35.871077701 -0400 +@@ -1171,12 +1171,16 @@ HostIFGetUserPages(void *uvAddr, + int retval; + + down_read(¤t->mm->mmap_sem); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++ retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) + retval = get_user_pages((unsigned long)uvAddr, + #else + retval = get_user_pages(current, current->mm, (unsigned long)uvAddr, + #endif + numPages, 0, 0, ppages, NULL); ++#endif + up_read(¤t->mm->mmap_sem); + + return retval != numPages; + diff --git a/app-emulation/vmware-modules/files/304-4.9-01-get_user_pages.patch b/app-emulation/vmware-modules/files/304-4.9-01-get_user_pages.patch new file mode 100644 index 0000000..0858beb --- /dev/null +++ b/app-emulation/vmware-modules/files/304-4.9-01-get_user_pages.patch @@ -0,0 +1,20 @@ +diff -rupN vmnet-only.bak/userif.c vmnet-only/userif.c +--- vmnet-only.bak/userif.c 2017-04-05 10:44:29.166143701 -0400 ++++ vmnet-only/userif.c 2017-04-05 10:45:46.443146453 -0400 +@@ -113,12 +113,16 @@ UserifLockPage(VA addr) // IN + int retval; + + down_read(¤t->mm->mmap_sem); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++ retval = get_user_pages(addr, 1, FOLL_WRITE, &page, NULL); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) + retval = get_user_pages(addr, + #else + retval = get_user_pages(current, current->mm, addr, + #endif + 1, 1, 0, &page, NULL); ++#endif + up_read(¤t->mm->mmap_sem); + + if (retval != 1) { diff --git a/app-emulation/vmware-modules/vmware-modules-304.4-r1.ebuild b/app-emulation/vmware-modules/vmware-modules-304.4-r1.ebuild new file mode 100644 index 0000000..d50aedc --- /dev/null +++ b/app-emulation/vmware-modules/vmware-modules-304.4-r1.ebuild @@ -0,0 +1,125 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit eutils flag-o-matic linux-info linux-mod user versionator udev + +PV_MAJOR=$(get_major_version) +PV_MINOR=$(get_version_component_range 2) + +DESCRIPTION="VMware kernel modules" +HOMEPAGE="http://www.vmware.com/" + +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ~amd64" +IUSE="pax_kernel +vmci +vsock" + +RDEPEND="" +DEPEND="${RDEPEND} + || ( =app-emulation/vmware-player-7.1.${PV_MINOR}* + =app-emulation/vmware-workstation-11.1.${PV_MINOR}* )" + +S=${WORKDIR} + +pkg_setup() { + CONFIG_CHECK="~HIGH_RES_TIMERS" + if kernel_is ge 2 6 37 && kernel_is lt 2 6 39; then + CONFIG_CHECK="${CONFIG_CHECK} BKL" + fi + if use vmci ; then + CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI" + else + CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI" + fi + if use vsock ; then + CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI_VSOCKETS" + else + CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI_VSOCKETS" + fi + + linux-info_pkg_setup + + linux-mod_pkg_setup + + VMWARE_GROUP=${VMWARE_GROUP:-vmware} + + VMWARE_MODULE_LIST_ALL="vmblock vmmon vmnet vmci vsock" + VMWARE_MODULE_LIST="vmblock vmmon vmnet" + use vmci && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmci" + use vsock && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vsock" + + VMWARE_MOD_DIR="${PN}-${PVR}" + + BUILD_TARGETS="auto-build KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}" + + enewgroup "${VMWARE_GROUP}" + filter-flags -mfpmath=sse + + for mod in ${VMWARE_MODULE_LIST}; do + MODULE_NAMES="${MODULE_NAMES} ${mod}(misc:${S}/${mod}-only)" + done +} + +src_unpack() { + cd "${S}" + for mod in ${VMWARE_MODULE_LIST_ALL}; do + tar -xf /opt/vmware/lib/vmware/modules/source/${mod}.tar + done +} + +src_prepare() { + epatch "${FILESDIR}/${PV_MAJOR}-makefile-kernel-dir.patch" + epatch "${FILESDIR}/${PV_MAJOR}-makefile-include.patch" + epatch "${FILESDIR}/${PV_MAJOR}-netdevice.patch" + use pax_kernel && epatch "${FILESDIR}/${PV_MAJOR}-hardened.patch" + epatch "${FILESDIR}/${PV_MAJOR}-apic.patch" + + kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-00-dentry.patch" + kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-01-inode.patch" + kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-02-control.patch" + kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.10-03-inline.patch" + kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.11-00-readdir.patch" + kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.11-01-filldir.patch" + kernel_is ge 3 15 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.15-00-vsock.patch" + kernel_is ge 3 18 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.18-00-version-redefined.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-00-compat-namei.patch" + #kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-01-dentry.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-02-vmblock-path.patch" + #kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-03-iovec.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-04-iovec.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-05-vmci_qpair.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-06-vsock.patch" + kernel_is ge 3 19 0 && epatch "${FILESDIR}/${PV_MAJOR}-3.19-07-vsock.patch" + kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-00-inode_op.patch" + kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-01-vmci_vmalloc.patch" + kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-02-vsock.patch" + kernel_is ge 4 2 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.2-03-vsock.patch" + kernel_is ge 4 3 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.3-00-misc_deregister.patch" + kernel_is ge 4 5 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.5-00-get_link.patch" + kernel_is ge 4 6 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.6-00-user-pages.patch" + kernel_is ge 4 7 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.7-00-trans_start.patch" + kernel_is ge 4 7 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.7-01-readlink_copy.patch" + kernel_is ge 4 8 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.8-00-nr_anon_mapped.patch" + kernel_is ge 4 9 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.9-00-get_user_pages.patch" + kernel_is ge 4 9 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.9-01-get_user_pages.patch" + + # Allow user patches so they can support RC kernels and whatever else + epatch_user +} + +src_install() { + linux-mod_src_install + local udevrules="${T}/60-vmware.rules" + cat > "${udevrules}" <<-EOF + KERNEL=="vmci", GROUP="vmware", MODE="660" + KERNEL=="vmw_vmci", GROUP="vmware", MODE="660" + KERNEL=="vmmon", GROUP="vmware", MODE="660" + KERNEL=="vsock", GROUP="vmware", MODE="660" + EOF + udev_dorules "${udevrules}" +} |