mayo 04, 2008

Gentoo VMwareTools shared folders

Para nucleos superiores a linux-2.6.22 el modulo para montar los "shared folders" no compila correctamente:

Using 2.6.x kernel build system.
make -C /lib/modules/2.6.24-gentoo-r4/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-2.6.24-gentoo-r4'
CC [M] /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/backdoor.o
CC [M] /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/backdoorGcc32.o
CC [M] /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/bdhandler.o
CC [M] /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/cpName.o
In file included from include/linux/string.h:11,
from /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/cpName.h:18,
from /usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/cpName.c:18:
include/linux/types.h:40: error: conflicting types for 'uintptr_t'
/usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/vm_basic_types.h:170: error: previous declaration of 'uintptr_t' was here
make[2]: *** [/usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only/cpName.o] Error 1
make[1]: *** [_module_/usr/src/vmware-tools-distrib/lib/modules/source/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.24-gentoo-r4'
make: *** [vmhgfs.ko] Error 2


La instalación se lo salta y luego no se pueden ver los directorios compartidos con el host en /mnt/hgfs/

Hay que parchear el fuente de VMwareTools-6.0.3-80004.tar.gz para ello:
tar zxvf VMware\ Tools/VMwareTools-6.0.3-80004.tar.gz
tar xvf ./vmware-tools-distrib/lib/modules/source/vmhgfs.tar
wget http://projects.tuxx-home.at/vmware/tools/6.0.3-80004/vmhgfs-6.0.3-80004-2.6.24.3.diff
patch -p0 < vmhgfs-6.0.3-80004-2.6.24.3.diff
tar cvf vmware-tools-distrib/lib/modules/source/vmhgfs.tar vmhgfs-only
cd vmware-tools-distrib/
perl vmware-install.pl


El contenido del diff por si falla el link:
--- vmhgfs-only.old/vm_basic_types.h        2008-03-04 02:45:54.000000000 +0100
+++ vmhgfs-only/vm_basic_types.h 2008-05-04 13:34:02.000000000 +0200
@@ -12,0 +13,10 @@
+/*
+ * Since we do some kernel version checks in here, make sure to include
+ * compat_version.h.
+ * is needed for uintptr on 2.6.24
+ *
+ * by Alexander Griesser , 2008-03-10
+ */
+#include "compat_version.h"
+#include
+
@@ -165,6 +175,15 @@
-# ifndef _STDINT_H
-# ifdef VM_I386
-# ifdef VM_X86_64
- typedef uint64 uintptr_t;
-# else
- typedef uint32 uintptr_t;
+/*
+ * Since we do some kernel version checks in here, make sure to include
+ * compat_version.h.
+ * is needed for uintptr on 2.6.24
+ *
+ * by Alexander Griesser , 2008-03-10
+ */
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+# ifndef _STDINT_H
+# ifdef VM_I386
+# ifdef VM_X86_64
+ typedef uint64 uintptr_t;
+# else
+ typedef uint32 uintptr_t;
+# endif
@@ -172 +190,0 @@
-# endif
@@ -174,2 +192,3 @@
-# ifdef VM_IA64
- typedef uint64 uintptr_t;
+# ifdef VM_IA64
+ typedef uint64 uintptr_t;
+# endif
@@ -273,2 +292,12 @@
-typedef uintptr_t VA;
-typedef uintptr_t VPN;
+/*
+ * Odd as it may seem, `typedef uintptr_t VA` doesn't work when uintptr_t is defined as
+ * unsigned long.
+ * If anyone is able to tell me why, please don't hesitate to contact me.
+ *
+ * NTL, as uintptr_t seems to be always "unsigned long" on 2.6.24+ I replaced it here
+ * to keep it simple.
+ *
+ * by Alexander Griesser , 2008-03-10
+ */
+typedef unsigned long VA;
+typedef unsigned long VPN;
@@ -309,2 +338,7 @@
-typedef uintptr_t LA;
-typedef uintptr_t LPN;
+/*
+ * See the comments in line 310 why typedef'ing uintptr_t doesn't work.
+ *
+ * by Alexander Griesser , 2008-03-10
+ */
+typedef unsigned long LA;
+typedef unsigned long LPN;


En el /etc/fstab debe andar una linea tal que:
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0

comentarios:

Martín Melado dijo...

Estaba teniendo problemas con la instalación del módulo de carpetas compartidas en Ubuntu JeOS y gracias a esta información lo he podido instalar correctamente.

Sólo un apunte: el link que indicas con el patch efectivamente dejó de funcionar, pero están todos aquí, incluso para otras versiones de VMWare: http://projects.tuxx-home.at/?id=vmware_updates