summaryrefslogtreecommitdiffstats
path: root/remote/modules/vmware
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/vmware')
-rw-r--r--remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch11
-rw-r--r--remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch34
-rw-r--r--remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch123
-rw-r--r--remote/modules/vmware/vmware.build63
4 files changed, 216 insertions, 15 deletions
diff --git a/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch
new file mode 100644
index 00000000..89b3a7c6
--- /dev/null
+++ b/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch
@@ -0,0 +1,11 @@
+--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200
++++ b/linux/control.c 2014-02-14 15:54:59.895201379 +0100
+@@ -293,7 +293,7 @@
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ __putname(name);
+
+ return retval;
+ }
diff --git a/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch
new file mode 100644
index 00000000..e54317f9
--- /dev/null
+++ b/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch
@@ -0,0 +1,34 @@
+--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200
++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100
+@@ -208,17 +208,18 @@
+ VMBlockSetProcEntryOwner(controlProcMountpoint);
+
+ /* Create /proc/fs/vmblock/dev */
+- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+ VMBLOCK_CONTROL_MODE,
+- controlProcDirEntry);
+- if (!controlProcEntry) {
++ controlProcDirEntry);*/
++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps);
++ if (controlProcEntry == NULL) {
+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
+ remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
+ return -EINVAL;
+ }
+
+- controlProcEntry->proc_fops = &ControlFileOps;
++ /*controlProcEntry->proc_fops = &ControlFileOps;*/
+ return 0;
+ }
+
+@@ -293,7 +294,7 @@
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ __putname(name);
+
+ return retval;
+ }
diff --git a/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch
new file mode 100644
index 00000000..dedb2646
--- /dev/null
+++ b/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch
@@ -0,0 +1,123 @@
+--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200
++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100
+@@ -208,17 +208,18 @@
+ VMBlockSetProcEntryOwner(controlProcMountpoint);
+
+ /* Create /proc/fs/vmblock/dev */
+- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+ VMBLOCK_CONTROL_MODE,
+- controlProcDirEntry);
+- if (!controlProcEntry) {
++ controlProcDirEntry);*/
++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps);
++ if (controlProcEntry == NULL) {
+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
+ remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL);
+ return -EINVAL;
+ }
+
+- controlProcEntry->proc_fops = &ControlFileOps;
++ /*controlProcEntry->proc_fops = &ControlFileOps;*/
+ return 0;
+ }
+
+@@ -293,7 +294,7 @@
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ __putname(name);
+
+ return retval;
+ }
+--- a/linux/file.c 2013-10-18 19:56:11.000000000 +0200
++++ b/linux/file.c 2014-02-14 16:20:21.455236098 +0100
+@@ -38,46 +38,6 @@
+ typedef ino_t inode_num_t;
+ #endif
+
+-/* Specifically for our filldir_t callback */
+-typedef struct FilldirInfo {
+- filldir_t filldir;
+- void *dirent;
+-} FilldirInfo;
+-
+-
+-/*
+- *----------------------------------------------------------------------------
+- *
+- * Filldir --
+- *
+- * Callback function for readdir that we use in place of the one provided.
+- * This allows us to specify that each dentry is a symlink, but pass through
+- * everything else to the original filldir function.
+- *
+- * Results:
+- * Original filldir's return value.
+- *
+- * Side effects:
+- * Directory information gets copied to user's buffer.
+- *
+- *----------------------------------------------------------------------------
+- */
+-
+-static int
+-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir
+- const char *name, // IN: Dirent name
+- int namelen, // IN: len of dirent's name
+- loff_t offset, // IN: Offset
+- inode_num_t ino, // IN: Inode number of dirent
+- unsigned int d_type) // IN: Type of file
+-{
+- FilldirInfo *info = buf;
+-
+- /* Specify DT_LNK regardless */
+- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
+-}
+-
+-
+ /* File operations */
+
+ /*
+@@ -166,11 +126,10 @@
+
+ static int
+ FileOpReaddir(struct file *file, // IN
+- void *dirent, // IN
+- filldir_t filldir) // IN
++ struct dir_context *ctx) // IN
+ {
+ int ret;
+- FilldirInfo info;
++
+ struct file *actualFile;
+
+ if (!file) {
+@@ -184,12 +143,10 @@
+ return -EINVAL;
+ }
+
+- info.filldir = filldir;
+- info.dirent = dirent;
+-
+- actualFile->f_pos = file->f_pos;
+- ret = vfs_readdir(actualFile, Filldir, &info);
+- file->f_pos = actualFile->f_pos;
++ /* Ricky Wong Yung Fei:
++ * Manipulation of pos is now handled internally by iterate_dir().
++ */
++ ret = iterate_dir(actualFile, ctx);
+
+ return ret;
+ }
+@@ -237,7 +194,7 @@
+
+
+ struct file_operations RootFileOps = {
+- .readdir = FileOpReaddir,
++ .iterate = FileOpReaddir,
+ .open = FileOpOpen,
+ .release = FileOpRelease,
+ };
diff --git a/remote/modules/vmware/vmware.build b/remote/modules/vmware/vmware.build
index 2ff6e895..16ee4c77 100644
--- a/remote/modules/vmware/vmware.build
+++ b/remote/modules/vmware/vmware.build
@@ -136,24 +136,46 @@ EOF
ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig"
ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig-console"
- [ ! -e "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" ] && perror "Could not find uts release!!!"
- local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')"
- pinfo "Patching vmblock.tar"
+ # See what we need to patch
cd "$MODULE_BUILD_DIR/usr/lib/vmware/modules/source" || perror "cd failed."
- tar xf "vmblock.tar" || perror "untar of vmblock.tar failed."
- for sourcefile in $(grep -l -r -E '\sputname' "vmblock-only/"); do
- sed -r -i 's/\sputname/__putname/g' "$sourcefile" || perror "sed of $sourcefile failed."
+ 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
- tar cf "vmblock.tar" "vmblock-only/" || perror "repacking of vmblock.tar failed."
- cd -
-
+ cd "$MODULE_DIR" || perror "wat."
+ #
+ # Then, compile
pinfo "KOMPILIERE VMWARE KERNEL MODULE"
for MOD in vsock vmblock vmmon vmnet vmci; do
pinfo "Kompiliere $MOD"
- [ -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko"
- "$VMWARE_MODCONFIG" --console --build-mod -k "$UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD"
- [ ! -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG"
- done
+ [ -s "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko"
+ "$VMWARE_MODCONFIG" --console --build-mod -k "$SYS_UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD"
+ [ ! -s "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG"
+ done
cd -
@@ -163,8 +185,19 @@ EOF
}
function copy_modules() {
- local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')"
mkdir -p "$TARGET_BUILD_DIR/lib/modules/vmware/"
- cp "/lib/modules/$UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!"
+ cp "/lib/modules/$SYS_UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!"
+}
+
+function 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
}