[PLUG] vmware-2.x with 2.4.x kernel

Steve Bonds 1s7k8uhcd001 at sneakemail.com
Fri Sep 6 19:48:04 UTC 2002


On Fri, 6 Sep 2002, Rich Shepard rshepard at appl-ecosys.com wrote:

>   Is anyone here running vmware-2.x with a 2.4.x kernel? I'm wondering if I
> must upgrade to vmware-3.x just to have it run with the 2.4.19 kernel. I
> certainly don't need the USB, XP and other "features" to run my two, legacy
> apps now and then.

Rich:

Here's the patch vs. the current version of the VMWare module sources
found at http://www.vmware.com/download/modules/modules_ws.html#204.

You also need to have the linux kernel source installed.  There is
probably a way to work around this requirement, but since I almost always
have the source there anyhow, I didn't spend any time figuring out how.

Getting to the source can be tricky.  Untar/gzip the
"VMwareKernelModules-2.0.4-1401.tar.gz" file and look in
vmware-modules/lib/modules/source/ for three tar files.

Untar those three files and they'll create the directories:

vmmon-only
vmnet-only
vmppuser-only

Copy the patch below into your current directory (one level above those 
three new directories) and apply it.

For example:
$ patch -p0 < vmware-patch

Hand-patch the Makefiles to fix the line:

HEADER_DIR = /lib/modules/2.4.9-21/build/include/

to match the proper location for your kernel revision.

Run "make" in the three directories to test that everything is working OK.  
I get lots of warnings like:

warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.

I plan to ignore these until it breaks.  ;-)

After the "make" works, do a "make clean".

Now, we need to overwrite those tar files.  Just re-tar the appropriate
directory into the tar file of the correct name.  Locate those same tar
files on your system (usually /usr/lib/vmware, but I don't have a VMWare
2.0.4 system here to double check with) and copy these newly tarred files
over the top of them.  The "vmware-config.pl" script is hardcoded to
always use these files when installing kernel modules, so they have to
keep the same names.

Once you've installed the tar files, run "vmware-config" and let it build
the modules.  Hope they work.  ;-)

  -- Steve

PS: This patch was based on work done by someone else I found about two
years ago via Google.  I have no idea who it was now and have since added
my own changes.

----- THE PATCH -----
Index: vmmon-only/Makefile
===================================================================
RCS file: /tmp/vmmon-only/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/Makefile	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/Makefile	6 Sep 2002 19:11:45 -0000	1.2
@@ -15,7 +15,7 @@
 #SUPPORT_SMP=1
 
 # Header directory for the running kernel
-HEADER_DIR = /usr/src/linux/include
+HEADER_DIR = /lib/modules/2.4.9-21/build/include/
 
 ####
 #### TOPDIR _must_ be a relative path.
Index: vmmon-only/common/hostif.h
===================================================================
RCS file: /tmp/vmmon-only/common/hostif.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/common/hostif.h	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/common/hostif.h	6 Sep 2002 19:11:45 -0000	1.2
@@ -32,10 +32,10 @@
 
 #ifdef KERNEL_2_1
 # include "vm_types.h"
-# undef PAGE_SIZE
-# undef PAGE_MASK
-# undef PAGE_OFFSET
-# undef APIC_ID_MASK
+//# undef PAGE_SIZE
+//# undef PAGE_MASK
+//# undef PAGE_OFFSET
+//# undef APIC_ID_MASK
 # include <asm/page.h>
 # ifndef __PAGE_OFFSET
 #  error __PAGE_OFFSET not defined
Index: vmmon-only/common/task.c
===================================================================
RCS file: /tmp/vmmon-only/common/task.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/common/task.c	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/common/task.c	6 Sep 2002 19:11:45 -0000	1.2
@@ -134,7 +134,7 @@
 #define APICR_LVT1       0x36
 #define APIC_LVT_MASK            0x10000
 #define APIC_LVT_DELVMODE_NMI    0x400
-#define APIC_LVT_MASKED(_lvt)    (_lvt & APIC_LVT_MASK)
+#define APIC_LVT_MASKED_VMWARE(_lvt)    (_lvt & APIC_LVT_MASK)
 #define APIC_LVT_DELVMODE(_lvt)  (_lvt & 0x700)
 #define APIC_LINT0_REG(_apic)    (_apic[APICR_LVT0][0])
 #define APIC_LINT1_REG(_apic) 	 (_apic[APICR_LVT1][0])
@@ -146,13 +146,13 @@
    if (vm->hostAPIC) {
       reg = APIC_LINT0_REG(vm->hostAPIC);
       if ((APIC_LVT_DELVMODE(reg) == APIC_LVT_DELVMODE_NMI) &&
-	  (! APIC_LVT_MASKED(reg))) {
+	  (! APIC_LVT_MASKED_VMWARE(reg))) {
 	 APIC_LINT0_REG(vm->hostAPIC) = reg | APIC_LVT_MASK;
 	 *lint0NMI = TRUE;
       }
       reg = APIC_LINT1_REG(vm->hostAPIC);
       if ((APIC_LVT_DELVMODE(reg) == APIC_LVT_DELVMODE_NMI) &&
-	  (! APIC_LVT_MASKED(reg))) {
+	  (! APIC_LVT_MASKED_VMWARE(reg))) {
 	 APIC_LINT1_REG(vm->hostAPIC) = reg | APIC_LVT_MASK;
 	 *lint1NMI = TRUE;
       }
Index: vmmon-only/include/vm_types.h
===================================================================
RCS file: /tmp/vmmon-only/include/vm_types.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/include/vm_types.h	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/include/vm_types.h	6 Sep 2002 19:11:45 -0000	1.2
@@ -16,6 +16,7 @@
 #define _VM_TYPES_H_
 
 #include "vm_basic_types.h"
+#include <asm/page.h>
 
 #define EXTERN        extern
 /*
Index: vmmon-only/include/x86.h
===================================================================
RCS file: /tmp/vmmon-only/include/x86.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/include/x86.h	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/include/x86.h	6 Sep 2002 19:11:45 -0000	1.2
@@ -8,7 +8,7 @@
 #define _X86_H_
 
 #include "vm_types.h"
-
+#include <asm/apicdef.h>
 
 #define SIZE_8BIT  1
 #define SIZE_16BIT 2
Index: vmmon-only/linux/driver.c
===================================================================
RCS file: /tmp/vmmon-only/linux/driver.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmmon-only/linux/driver.c	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmmon-only/linux/driver.c	6 Sep 2002 19:11:45 -0000	1.2
@@ -929,7 +929,7 @@
 	  current->fsuid == current->uid &&
           current->egid == current->gid &&
 	  current->fsgid == current->gid) {
-	 current->dumpable = 1;
+	 current->mm->dumpable = 1;
       }
       break;
 
Index: vmnet-only/Makefile
===================================================================
RCS file: /tmp/vmnet-only/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmnet-only/Makefile	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmnet-only/Makefile	6 Sep 2002 19:22:21 -0000	1.2
@@ -22,7 +22,7 @@
 #SUPPORT_SMP=1
 
 # Header directory for the running kernel
-HEADER_DIR = /usr/src/linux/include
+HEADER_DIR = /lib/modules/2.4.9-21/build/include/
 
 ifdef SUPPORT_SMP
 DRIVERNAME = $(DRIVER)-smp-$(shell uname -r)
Index: vmppuser-only/Makefile
===================================================================
RCS file: /tmp/vmppuser-only/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmppuser-only/Makefile	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmppuser-only/Makefile	6 Sep 2002 19:22:21 -0000	1.2
@@ -21,7 +21,7 @@
 #SUPPORT_SMP=1
 
 # Header directory for the running kernel
-HEADER_DIR = /usr/src/linux/include
+HEADER_DIR = /lib/modules/2.4.9-21/build/include/
 
 ifdef SUPPORT_SMP
 DRIVERNAME = $(DRIVER)-smp-$(shell uname -r)
Index: vmppuser-only/ppdev.c
===================================================================
RCS file: /tmp/vmppuser-only/ppdev.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vmppuser-only/ppdev.c	6 Sep 2002 19:00:11 -0000	1.1.1.1
+++ vmppuser-only/ppdev.c	6 Sep 2002 19:22:21 -0000	1.2
@@ -64,8 +64,8 @@
 #define CHRDEV "ppuser"
 #endif
 
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
+#ifndef _min
+#define _min(a,b) ((a) < (b) ? (a) : (b))
 #endif
 
 struct pp_struct {
@@ -123,12 +123,12 @@
 		return -EINVAL;
 	}
 
-	kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL);
+	kbuffer = kmalloc (_min (count, PP_BUFFER_SIZE), GFP_KERNEL);
 	if (!kbuffer)
 		return -ENOMEM;
 
 	while (bytes_read < count) {
-		ssize_t need = min(count - bytes_read, PP_BUFFER_SIZE);
+		ssize_t need = _min(count - bytes_read, PP_BUFFER_SIZE);
 
 		got = parport_read (pp->pdev->port, kbuffer, need);
 
@@ -177,12 +177,12 @@
 		return -EINVAL;
 	}
 
-	kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL);
+	kbuffer = kmalloc (_min (count, PP_BUFFER_SIZE), GFP_KERNEL);
 	if (!kbuffer)
 		return -ENOMEM;
 
 	while (bytes_written < count) {
-		ssize_t n = min(count - bytes_written, PP_BUFFER_SIZE);
+		ssize_t n = _min(count - bytes_written, PP_BUFFER_SIZE);
 
 		if (copy_from_user (kbuffer, buf + bytes_written, n)) {
 			bytes_written = -EFAULT;
@@ -650,16 +650,13 @@
 }
 
 static struct file_operations pp_fops = {
-	pp_lseek,
-	pp_read,
-	pp_write,
-	NULL,	/* pp_readdir */
-	pp_poll,
-	pp_ioctl,
-	NULL,	/* pp_mmap */
-	pp_open,
-	NULL,   /* pp_flush */
-	pp_release
+	llseek: pp_lseek,
+	read: pp_read,
+	write: pp_write,
+	poll: pp_poll,
+	ioctl: pp_ioctl,
+	open: pp_open,
+	release: pp_release,
 };
 
 /* FIXME: Check __attribute__((unused)) with gcc-2.7.2 */
-----------






More information about the PLUG mailing list