Created
February 9, 2011 22:19
-
-
Save zed9h/819438 to your computer and use it in GitHub Desktop.
Fix to the vmplayer 3.1.3 to work with vanilla linux kernel 2.6.37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR=/usr/lib/vmware/modules/source | |
BKP=backup-$(date +%Y%m%d-%H%M%S) | |
cd $DIR || exit | |
ls *tar | xargs -n1 tar xf || exit | |
patch --batch --force -p1 <<'EOF' | |
diff -r -U5 orig//vmci-only/include/compat_semaphore.h patched//vmci-only/include/compat_semaphore.h | |
--- orig//vmci-only/include/compat_semaphore.h 2010-11-11 18:02:54.000000000 -0200 | |
+++ patched//vmci-only/include/compat_semaphore.h 2011-02-09 18:37:46.833736668 -0200 | |
@@ -26,11 +26,11 @@ | |
#else | |
# include <linux/semaphore.h> | |
#endif | |
-#if defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) | |
+#if (defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) | |
/* | |
* The -rt patch series changes the name of semaphore/mutex initialization | |
* routines (across the entire kernel). Probably to identify locations that | |
* need to be audited for spinlock vs. true semaphore. We always assumed | |
* true semaphore, so just apply the rename. | |
@@ -39,11 +39,11 @@ | |
*/ | |
#ifndef DECLARE_MUTEX | |
#define DECLARE_MUTEX(_m) DEFINE_SEMAPHORE(_m) | |
#endif | |
#ifndef init_MUTEX | |
- #define init_MUTEX(_m) semaphore_init(_m) | |
+ #define init_MUTEX(_m) sema_init(_m,1) | |
#endif | |
#endif | |
/* | |
* The init_MUTEX_LOCKED() API appeared in 2.2.18, and is also in | |
diff -r -U5 orig//vmmon-only/linux/driver.c patched//vmmon-only/linux/driver.c | |
--- orig//vmmon-only/linux/driver.c 2010-11-11 18:02:51.000000000 -0200 | |
+++ patched//vmmon-only/linux/driver.c 2011-02-09 18:38:12.877070001 -0200 | |
@@ -143,11 +143,11 @@ | |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) | |
#define VMW_NOPAGE_2624 | |
#endif | |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && \ | |
(defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)) | |
-# define kernel_locked_by_current() kernel_locked() | |
+# define kernel_locked_by_current() (current->lock_depth >= 0) | |
#else | |
# define kernel_locked_by_current() 0 | |
#endif | |
#define VMMON_UNKNOWN_SWAP_SIZE -1ULL | |
@@ -168,10 +168,11 @@ | |
static int LinuxDriver_Open(struct inode *inode, struct file *filp); | |
static int LinuxDriver_Ioctl(struct inode *inode, struct file *filp, | |
u_int iocmd, unsigned long ioarg); | |
#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL) | |
+#define VMW_HAVE_UNLOCKED_IOCTL | |
static long LinuxDriver_UnlockedIoctl(struct file *filp, | |
u_int iocmd, unsigned long ioarg); | |
#endif | |
static int LinuxDriver_Close(struct inode *inode, struct file *filp); | |
diff -r -U5 orig//vmnet-only/compat_semaphore.h patched//vmnet-only/compat_semaphore.h | |
--- orig//vmnet-only/compat_semaphore.h 2010-11-11 18:02:53.000000000 -0200 | |
+++ patched//vmnet-only/compat_semaphore.h 2011-02-09 18:38:12.913736668 -0200 | |
@@ -26,11 +26,11 @@ | |
#else | |
# include <linux/semaphore.h> | |
#endif | |
-#if defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) | |
+#if (defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) | |
/* | |
* The -rt patch series changes the name of semaphore/mutex initialization | |
* routines (across the entire kernel). Probably to identify locations that | |
* need to be audited for spinlock vs. true semaphore. We always assumed | |
* true semaphore, so just apply the rename. | |
@@ -39,11 +39,11 @@ | |
*/ | |
#ifndef DECLARE_MUTEX | |
#define DECLARE_MUTEX(_m) DEFINE_SEMAPHORE(_m) | |
#endif | |
#ifndef init_MUTEX | |
- #define init_MUTEX(_m) semaphore_init(_m) | |
+ #define init_MUTEX(_m) sema_init(_m,1) | |
#endif | |
#endif | |
/* | |
* The init_MUTEX_LOCKED() API appeared in 2.2.18, and is also in | |
diff -r -U5 orig//vsock-only/shared/compat_semaphore.h patched//vsock-only/shared/compat_semaphore.h | |
--- orig//vsock-only/shared/compat_semaphore.h 2010-11-11 16:04:44.000000000 -0200 | |
+++ patched//vsock-only/shared/compat_semaphore.h 2011-02-09 18:38:11.240403334 -0200 | |
@@ -26,11 +26,11 @@ | |
#else | |
# include <linux/semaphore.h> | |
#endif | |
-#if defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) | |
+#if (defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) | |
/* | |
* The -rt patch series changes the name of semaphore/mutex initialization | |
* routines (across the entire kernel). Probably to identify locations that | |
* need to be audited for spinlock vs. true semaphore. We always assumed | |
* true semaphore, so just apply the rename. | |
@@ -39,11 +39,11 @@ | |
*/ | |
#ifndef DECLARE_MUTEX | |
#define DECLARE_MUTEX(_m) DEFINE_SEMAPHORE(_m) | |
#endif | |
#ifndef init_MUTEX | |
- #define init_MUTEX(_m) semaphore_init(_m) | |
+ #define init_MUTEX(_m) sema_init(_m,1) | |
#endif | |
#endif | |
/* | |
* The init_MUTEX_LOCKED() API appeared in 2.2.18, and is also in | |
EOF | |
if [ $? -ne 0 ]; then | |
find *-only/ -iname '*.rej' -exec cat {} \; | |
echo | |
echo "Patching FAILED! Keeping original tar files" | |
rm -rf *-only/ | |
echo | |
exit 1 | |
fi | |
echo | |
echo "Success! Updating tar files:" | |
mkdir $BKP || exit | |
cp -av *.tar $BKP || exit | |
ls -d *.tar | sed 's:\.tar::' | xargs -n1 -i123 tar cf 123.tar 123-only | |
rm -rf *-only/ | |
echo "Done. Now telling vmware to rebuild all modules: " | |
echo | |
echo "# vmware-modconfig --console --install-all" | |
echo | |
vmware-modconfig --console --install-all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment