7 May 2008

Compile VMwareTools on Linux kernel 2.6.22

To compile the vmhgfs VMwareTools on Linux kernel 2.6.22, it is needed to patch the source code, like explained there, from a tar.gz installation.
The same fix works from rpm installation, although the VMwareTools source code directory may be different (/usr/lib/vmware-tools/modules/source for me):
- move to /usr/lib/vmware-tools/modules/source/
- untar vmhgfs.tar and backup it
- then follow the same instructions:
"Now edit vmhgfs/driver.c and change lines 44 and 45 from
#define INODE_SET_II_P(inode, info) do { (inode)->u.generic_ip = (info); } while (0)
#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)->u.generic_ip)
to
#define INODE_SET_II_P(inode, info) do { (inode)->i_private = (info); } while (0)
#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)->i_private)

Also, remove line 763: inode->i_blksize = HGFS_BLOCKSIZE;
"
- create a new vmhgfs.tar with patched source code
- the compilation can now be fully performed -> launch /usr/bin/vmware-config-tools.pl again

2 comments:

  1. Thanks. Here are the errors I got after following your instructions:

    Using 2.6.x kernel build system.
    make: Entering directory `/tmp/vmware-config1/vmhgfs-only'
    make -C /usr/src/linux/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
    make[1]: Entering directory `/usr/src/linux-headers-2.6.22-14-generic'
    CC [M] /tmp/vmware-config1/vmhgfs-only/cpName.o
    CC [M] /tmp/vmware-config1/vmhgfs-only/cpNameLinux.o
    CC [M] /tmp/vmware-config1/vmhgfs-only/dev.o
    CC [M] /tmp/vmware-config1/vmhgfs-only/driver.o
    /tmp/vmware-config1/vmhgfs-only/driver.c:4249: warning: initialization from incompatible pointer type
    /tmp/vmware-config1/vmhgfs-only/driver.c: In function 'HgfsGetSb':
    /tmp/vmware-config1/vmhgfs-only/driver.c:4458: error: too few arguments to function 'get_sb_nodev'
    /tmp/vmware-config1/vmhgfs-only/driver.c: At top level:
    /tmp/vmware-config1/vmhgfs-only/driver.c:4504: warning: initialization from incompatible pointer type
    make[2]: *** [/tmp/vmware-config1/vmhgfs-only/driver.o] Error 1
    make[1]: *** [_module_/tmp/vmware-config1/vmhgfs-only] Error 2
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-14-generic'
    make: *** [vmhgfs.ko] Error 2
    make: Leaving directory `/tmp/vmware-config1/vmhgfs-only'
    Unable to build the vmhgfs module.

    ReplyDelete
  2. What is your vmwareTools version ?
    Under which GNU/Linux distribution ?

    ReplyDelete

Thank you for your visit, let's share your point of view: