diff options
Diffstat (limited to 'remote/modules/vmware')
| -rw-r--r-- | remote/modules/vmware/module.build | 56 | ||||
| -rw-r--r-- | remote/modules/vmware/patches/vmnet__3.13-9.9__1.0-100.0.patch | 27 |
2 files changed, 81 insertions, 2 deletions
diff --git a/remote/modules/vmware/module.build b/remote/modules/vmware/module.build index 98ee2b8d..4d08c5c5 100644 --- a/remote/modules/vmware/module.build +++ b/remote/modules/vmware/module.build @@ -31,14 +31,54 @@ build() { # sanity check to see if KERNEL_HEADERS_PATH is set and exists [ -z "${KERNEL_HEADERS_PATH}" -o ! -e "${KERNEL_HEADERS_PATH}" ] && perror "KERNEL_HEADERS_PATH ('"${KERNEL_HEADERS_PATH}"') not found. Was the kernel module built?" + # build in two steps, to be able to use mltk function while patching modules pinfo "Installing vmware per chroot..." chroot_run "${MODULE_BUILD_DIR}" <<-EOF - # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot $DELETE_FILES yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required + EOF + # check if we need to patch modules + cd "${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source" \ + || perror "Could not cd to '${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source'" + + local KMOD SHORT PATCH MIN_KERN MAX_KERN + for KMOD in *.tar; do + SHORT="${KMOD%%.tar}" + [ -e ".${SHORT}.patched" ] && continue + for PATCH in $(find "${MODULE_DIR}/patches/" -name "${SHORT}__*__*.patch"); do + parse_patch_name "$PATCH" + [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" + if version_lt "$SYS_KERNEL" "$MIN_KERN" || version_gt "$SYS_KERNEL" "$MAX_KERN"; then + pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)" + continue # Not suitable for our kernel + fi + pinfo "Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)" + [ ! -d "${SHORT}-only" ] && tar xf "$KMOD" + [ ! -d "${SHORT}-only" ] && perror "untar of $KMOD failed." + cd "${SHORT}-only" || perror "Where is ${SHORT}-only?" + if ! patch -p1 < "$PATCH"; then + cd .. + rm -rf -- "${SHORT}-only" + perror "Applying $PATCH failed." + fi + cd .. + done + if [ -d "${SHORT}-only" ]; then + tar cf "$KMOD" "${SHORT}-only/" || perror "repacking of $KMOD failed." + rm -rf -- "${SHORT}-only" + touch ".${SHORT}.patched" + fi + done + cd "${MODULE_DIR}" || perror "Could not cd to '${MODULE_DIR}'" + + # now build modules inside the chroot + chroot_run "${MODULE_BUILD_DIR}" <<-EOF + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmnet $(which gcc) "${KERNEL_HEADERS_PATH}/include" vmplayer vmnet + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmmon $(which gcc) "${KERNEL_HEADERS_PATH}/include" vmplayer vmmon - # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot EOF # cleanup unneeded files @@ -63,3 +103,15 @@ post_copy() { cp "${MODULE_BUILD_DIR}/lib/modules/$SYS_UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!" } +parse_patch_name() { + [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count." + local PATCH="$1" + MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__[0-9\.]+-([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MAX_KERN" == /* ]] && MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN= + [[ "$MAX_KERN" == /* ]] && MAX_KERN= + # TODO: Parse min and max vmplayer/workstation version +} + diff --git a/remote/modules/vmware/patches/vmnet__3.13-9.9__1.0-100.0.patch b/remote/modules/vmware/patches/vmnet__3.13-9.9__1.0-100.0.patch new file mode 100644 index 00000000..54607506 --- /dev/null +++ b/remote/modules/vmware/patches/vmnet__3.13-9.9__1.0-100.0.patch @@ -0,0 +1,27 @@ +--- a/filter.c 2014-04-17 05:30:43.497846349 -0700 ++++ b/filter.c 2014-04-17 05:30:41.445846394 -0700 +@@ -203,7 +203,11 @@ + #endif + + static unsigned int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + VNetFilterHookFn(unsigned int hooknum, // IN: ++#else ++VNetFilterHookFn(const struct nf_hook_ops *ops, // IN: ++#endif + #ifdef VMW_NFHOOK_USES_SKB + struct sk_buff *skb, // IN: + #else +@@ -252,7 +256,11 @@ + + /* When the host transmits, hooknum is VMW_NF_INET_POST_ROUTING. */ + /* When the host receives, hooknum is VMW_NF_INET_LOCAL_IN. */ +- transmit = (hooknum == VMW_NF_INET_POST_ROUTING); ++ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) ++ transmit = (hooknum == VMW_NF_INET_POST_ROUTING); ++ #else ++ transmit = (ops->hooknum == VMW_NF_INET_POST_ROUTING); ++ #endif + + packetHeader = compat_skb_network_header(skb); + ip = (struct iphdr*)packetHeader; |
