Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Oct 2004 11:18:56 +0200
From:      Stephan Fiebrandt <bsd@kuehlbox.de>
To:        bsdfsse <bsdfsse@optonline.net>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: vmware and 5.3BETA7
Message-ID:  <41723900.3020005@kuehlbox.de>
In-Reply-To: <4171BB15.3070608@optonline.net>
References:  <41718C83.6030009@kuehlbox.de> <4171BB15.3070608@optonline.net>

next in thread | previous in thread | raw e-mail | index | archive | help
bsdfsse wrote:

> I deinstalled vmware3 and tried to install vmware2 on 5.3-B7, and 
> received some error during the 'make install'.  The error was "mod_" 
> something and ended with "_ioctl", I think.

you need to apply two patches, that are already applied to ports/commit:

first:

--- vmware2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/emulators/vmware2/Makefile,v
retrieving revision 1.60
diff -u -r1.60 Makefile
--- Makefile	10 Jan 2004 07:18:54 -0000	1.60
+++ Makefile	22 Jun 2004 14:58:12 -0000
@@ -88,6 +88,12 @@
 PLIST_SUB+=	FREEBSD5=""
 .endif
 
+.if ${OSVERSION} >= 500104
+LINUXBASE_MAYBE=
+.else
+LINUXBASE_MAYBE= ${LINUXBASE}
+.endif 
+
 post-extract:
 .for m in ${MODULES}
 	${TAR} -xf ${WRKSRC}/lib/modules/source/${m}.tar -C ${WRKSRC}
@@ -122,10 +128,11 @@
 	cd ${WRKSRC}/vmmon-only/freebsd && ${TOUCH} bus_if.h device_if.h
 .if ${OSVERSION} >= 500019
 	${PERL} -i -pe 's,<machine/ioctl_fd\.h>,<sys/fdcio.h>,' \
-		${WRKSRC}/vmmon-only/freebsd/*.c \
-		${WRKSRC}/vmware-distrib/vmmon-only/freebsd/*.c
+		${WRKDIR}/vmmon-only/freebsd/*.c \
+		${WRKDIR}/vmware-distrib/vmmon-only/freebsd/*.c
 .endif
 	${CAT} ${FILESDIR}/kmoddeps.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
+	${CAT} ${FILESDIR}/Makefile_FreeBSD.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
 .if ${OSVERSION} >= 500038
 	${CAT} ${FILESDIR}/fo_ioctl.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
 .endif
@@ -135,6 +142,7 @@
 .endif
 .if ${OSVERSION} >= 500104
 	${CAT} ${FILESDIR}/cdevsw.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
+	${CAT} ${FILESDIR}/driver_c.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
 .endif
 .if ${OSVERSION} >= 500109 || ${OSVERSION} < 500000 && ${OSVERSION} >= 480102
 	${CAT} ${FILESDIR}/hostif_c.patch | (cd ${WRKSRC} && patch) > /dev/null 2>&1
@@ -151,7 +159,7 @@
 		${FILESDIR}/config > ${WRKDIR}/config
 
 	${SED} 	-e 's;@@PREFIX@@;${PREFIX};' \
-		-e 's;@@LINUXBASE@@;${LINUXBASE};' \
+		-e 's;@@LINUXBASE@@;$(LINUXBASE_MAYBE);' \
 		-e 's;@@NETWORKING@@;${VMNET_NETWORKING};' \
 		-e 's;@@BRIDGED@@;${VMNET_BRIDGED};' \
 		-e 's;@@BRIDGE_INTF@@;${VMNET_BRIDGED_INTERFACE};' \
Index: files/cdevsw.patch
===================================================================
RCS file: /home/ncvs/ports/emulators/vmware2/files/cdevsw.patch,v
retrieving revision 1.1
diff -u -r1.1 cdevsw.patch
--- files/cdevsw.patch	10 Apr 2003 12:29:07 -0000	1.1
+++ files/cdevsw.patch	22 Jun 2004 14:58:12 -0000
@@ -1,10 +1,14 @@
 --- vmmon-only/freebsd/driver.c_original	Wed Mar  5 19:22:35 2003
 +++ vmmon-only/freebsd/driver.c	Wed Mar  5 19:22:44 2003
-@@ -155,6 +155,14 @@
+@@ -155,6 +155,18 @@
  
  /* static struct cdevsw vmmon_cdevsw = { */
  static struct cdevsw vmmon_cdevsw = {
 +#if __FreeBSD_version >= 500104
++#if __FreeBSD_version >= 502103
++	.d_version = D_VERSION,
++	.d_flags = D_NEEDGIANT,
++#endif
 +	.d_open =	FreeBSD_Driver_Open,
 +	.d_close =	FreeBSD_Driver_Close,
 +	.d_ioctl =	FreeBSD_Driver_Ioctl,
@@ -54,11 +58,15 @@
  }
 --- vmnet-only/freebsd/vmnet.c_original	Wed Mar  5 19:21:51 2003
 +++ vmnet-only/freebsd/vmnet.c	Wed Mar  5 19:22:00 2003
-@@ -103,6 +103,16 @@
+@@ -103,6 +103,20 @@
  static int vmnet_modeevent(module_t mod, int cmd, void *arg);
  
  static struct cdevsw vmnet_cdevsw = {
 +#if __FreeBSD_version >= 500104
++#if __FreeBSD_version >= 502103
++ 	.d_version = D_VERSION,
++	.d_flags = D_NEEDGIANT,
++#endif
 +	.d_open = 	vmnet_open,
 +	.d_close = 	vmnet_close,
 +	.d_read = 	vmnet_read,
Index: files/patch-bd
===================================================================
RCS file: /home/ncvs/ports/emulators/vmware2/files/patch-bd,v
retrieving revision 1.2
diff -u -r1.2 patch-bd
--- files/patch-bd	22 Sep 2000 16:55:01 -0000	1.2
+++ files/patch-bd	22 Jun 2004 14:58:12 -0000
@@ -1,5 +1,5 @@
---- vmmon-only/freebsd/driver.c.orig	Thu Jun 29 21:06:18 2000
-+++ vmmon-only/freebsd/driver.c	Sat Sep 23 01:41:34 2000
+--- vmmon-only/freebsd/driver.c.orig Sat Apr 10 16:52:28 2004
++++ vmmon-only/freebsd/driver.c Sat Apr 10 16:54:39 2004
 @@ -73,6 +73,24 @@
  #include "private.h"
  #endif
@@ -25,3 +25,13 @@
  #ifdef SUPPORT_PASSTHROUGH
  #include "passthrough.h"	// _driver_ version of passthrough.h 
  #endif
+@@ -256,7 +274,9 @@
+ 
+ #include <machine/md_var.h>
+ #include <machine/segments.h>
++#if __FreeBSD_version < 501114
+ #include <i386/isa/intr_machdep.h>
++#endif
+ 
+ static int
+ vmmon_modeevent(module_t mod, int cmd, void *arg)
Index: files/patch-be
===================================================================
RCS file: /home/ncvs/ports/emulators/vmware2/files/patch-be,v
retrieving revision 1.3
diff -u -r1.3 patch-be
--- files/patch-be	18 Oct 2002 16:33:02 -0000	1.3
+++ files/patch-be	22 Jun 2004 14:58:12 -0000
@@ -1,5 +1,5 @@
---- vmmon-only/freebsd/hostif.c.orig	Mon Sep  2 19:19:50 2002
-+++ vmmon-only/freebsd/hostif.c	Mon Sep  2 19:30:03 2002
+--- vmmon-only/freebsd/hostif.c.orig Sat Apr 10 16:52:23 2004
++++ vmmon-only/freebsd/hostif.c Sat Apr 10 16:54:17 2004
 @@ -55,7 +55,11 @@
  
  #include <vm/vm.h>
@@ -57,7 +57,33 @@
    	return 0;
  }
   
-@@ -1066,10 +1098,33 @@
+@@ -1006,8 +1038,12 @@
+ HostIF_APIC_Base(VMDriver *vm, Bool setVMPtr)
+ {
+ #if defined(SMP)
++#if __FreeBSD_version < 501114
+    return cpu_apic_address;
++#else
++   return 0; /* XXX */
++#endif
+ #else
+    return 0;
+ #endif
+ }
+@@ -1035,8 +1070,12 @@
+ HostIF_IOAPIC_Base(VMDriver *vm)
+ {
+ #if defined(SMP)
++#if __FreeBSD_version < 501114
+    return io_apic_address[0]; /* XXX How about another APIC's */
+ #else
++   return 0; /* XXX */
++#endif
++#else
+    return 0;
+ #endif
+ }
+@@ -1066,10 +1105,33 @@
          return NULL;
    }
    paddr = vtophys(addr);
@@ -91,7 +117,7 @@
    return ka->kaddr;
  }
  
-@@ -1079,9 +1134,29 @@
+@@ -1079,9 +1141,29 @@
    if (ka->map==NULL)
  	  return 0;
  
Index: scripts/pre-install
===================================================================
RCS file: /home/ncvs/ports/emulators/vmware2/scripts/pre-install,v
retrieving revision 1.6
diff -u -r1.6 pre-install
--- scripts/pre-install	13 Apr 2003 09:55:44 -0000	1.6
+++ scripts/pre-install	22 Jun 2004 14:58:13 -0000
@@ -17,8 +17,11 @@
 ln -s ${linux_dev}/tty1 ${linux_dev}/tty0
 mknod ${linux_dev}/null c 2 2
 chmod 666 ${linux_dev}/null
-echo Creating vmnet1 node
-mknod /compat/linux/dev/vmnet1 c 149 ${VMNET1_MINOR}
+rm -f /compat/linux/dev/vmnet1
+if [ "$OSVERSION" -lt "500104" ]; then
+	echo Creating vmnet1 node
+	mknod /compat/linux/dev/vmnet1 c 149 ${VMNET1_MINOR}
+fi
 echo Creating $linux_dev/hd\?
 mknod ${linux_dev}/hda b 0 0x00010002
 mknod ${linux_dev}/hdb b 0 0x0001000a
--- vmware2.patch ends here ---

--- Makefile_FreeBSD.patch begins here ---
--- vmmon-only/Makefile.FreeBSD.orig	Tue Jun 22 16:52:23 2004
+++ vmmon-only/Makefile.FreeBSD	Tue Jun 22 16:51:58 2004
@@ -57,7 +59,9 @@
 
 device:
 	rm -f /compat/linux/dev/${DEVNAME}
+.if ${OSVERSION} > 500104
 	mknod /compat/linux/dev/${DEVNAME} c ${CDEV_MAJOR} 0
+.endif
 
 
 .include <bsd.kmod.mk>
--- Makefile_FreeBSD.patch ends here ---

--- driver_c.patch begins here ---
--- vmmon-only/freebsd/driver.c.original Tue Jun 22 15:24:52 2004
+++ vmmon-only/freebsd/driver.c	Tue Jun 22 10:01:30 2004
@@ -157,8 +157,8 @@
 static struct cdevsw vmmon_cdevsw = {
 #if __FreeBSD_version >= 500104
 #if __FreeBSD_version >= 502103
-	.d_version = D_VERSION,
-	.d_flags = D_NEEDGIANT,
+ 	.d_version = D_VERSION,
+ 	.d_flags = D_NEEDGIANT,
 #endif
 	.d_open =	FreeBSD_Driver_Open,
 	.d_close =	FreeBSD_Driver_Close,
@@ -233,7 +233,7 @@
  *
  *----------------------------------------------------------------------
  */
-static dev_t vmmon_dev;
+static struct cdev * vmmon_dev;
 static int 
 init_module(void)
 {
@@ -359,7 +359,7 @@
  *----------------------------------------------------------------------
  */
 static int 
-FreeBSD_Driver_Open(dev_t dev, int oflag, int devtype, struct thread *td)
+FreeBSD_Driver_Open(struct cdev * dev, int oflag, int devtype, struct thread *td)
 {
    VMFreeBSD *vmFreeBSD;
    VMDriver *vm;
@@ -439,7 +439,7 @@
  */
 
 static int
-FreeBSD_Driver_Close(dev_t dev, int fflag, int devtype, struct thread *td)
+FreeBSD_Driver_Close(struct cdev * dev, int fflag, int devtype, struct thread *td)
 {
    VMFreeBSD *vmFreeBSD = (VMFreeBSD *) dev->si_drv1;
 
@@ -491,7 +491,7 @@
  */
 
 static int 
-FreeBSD_Driver_Poll(dev_t dev, int events, struct thread *td)
+FreeBSD_Driver_Poll(struct cdev * dev, int events, struct thread *td)
 {
    int revents = 0;
 
@@ -573,7 +573,7 @@
  *----------------------------------------------------------------------
  */
 static int 
-FreeBSD_Driver_Ioctl( dev_t dev, u_long cmd, caddr_t parg, int mode, 
+FreeBSD_Driver_Ioctl( struct cdev * dev, u_long cmd, caddr_t parg, int mode, 
 		      struct thread *td)
 {
    VMFreeBSD *vmFreeBSD = (VMFreeBSD *) dev->si_drv1;

--- driver_c.patch ends here ---


One more thing, my instructions seem to be too sparse:
 
 There are three files in this send-pr:
 
 1. vmware2.patch
   This patches the files that are there in the CVS repository:
   > cd /usr/ports/emulators/vmware2
   > patch < vmware2.patch
 2. Makefile_FreeBSD.patch
   New file, put this in the files directory
 3. driver_c.patch
   New file, put this in the files directory

 Now type 'make install clean' and it should work.

--------------------------------

With the above patch you get vmmon compiled, but it wount load. So apply 
the following patch also:


--- vmmon-only/freebsd/hostif.c~        Fri Sep 10 11:50:20 2004
+++ vmmon-only/freebsd/hostif.c Fri Sep 10 19:19:27 2004
@@ -1110,7 +1110,7 @@
   paddr = vtophys(addr);
 #if __FreeBSD_version >= 500038
   GIANT_REQUIRED;
-  ka->kaddr = kmem_alloc_pageable(kernel_map, PAGE_SIZE);
+  ka->kaddr = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
   ka->map = PHYS_TO_VM_PAGE(paddr);
   vm_page_lock_queues();
   vm_page_wire(ka->map);
@@ -1118,19 +1118,19 @@
   pmap_qenter(ka->kaddr, &ka->map, 1);
 #elif __FreeBSD_version >= 500021
   GIANT_REQUIRED;
-  ka->kaddr = kmem_alloc_pageable(kernel_map, PAGE_SIZE);
+  ka->kaddr = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
   ka->map = PHYS_TO_VM_PAGE(paddr);
   vm_page_wire(ka->map);
   pmap_kenter(ka->kaddr, paddr);
 #elif __FreeBSD_version >= 500013
   mtx_lock(&vm_mtx);
-  ka->kaddr = kmem_alloc_pageable(kernel_map, PAGE_SIZE);
+  ka->kaddr = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
   ka->map = PHYS_TO_VM_PAGE(paddr);
   vm_page_wire(ka->map);
   pmap_kenter(ka->kaddr, paddr);
   mtx_unlock(&vm_mtx);
 #else
-  ka->kaddr = kmem_alloc_pageable(kernel_map, PAGE_SIZE);
+  ka->kaddr = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
   ka->map = PHYS_TO_VM_PAGE(paddr);
   vm_page_wire(ka->map);
   pmap_kenter(ka->kaddr, paddr);
--- ../vmmon-only/freebsd/hostif.c~     Fri Sep 10 11:50:20 2004
+++ ../vmmon-only/freebsd/hostif.c      Fri Sep 10 19:19:27 2004
@@ -1066,7 +1066,7 @@
         return NULL;
   }
   paddr = vtophys(addr);
-  ka->kaddr = kmem_alloc_pageable(kernel_map, PAGE_SIZE);
+  ka->kaddr = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
   ka->map = PHYS_TO_VM_PAGE(paddr);
   vm_page_wire(ka->map);
   pmap_kenter(ka->kaddr, paddr);

----------------

As said, it is running here, but vmware2 and vmare3 do have the same 
strange effects after turning on... But vmware2 starts also with my HT 
SMP cpu's.
I got used to some new features of 5.x, so currently i am undesided, if 
i go back to 4.10 or will just install another mashine instead of my vm 
till it is "fixed". I anway just need a "stupid" linux distro to run for 
a linux only product.

Greetings,

Stephan Fiebrandt



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41723900.3020005>