VMware Tools on FreeBSD 9.0

Problem

As of May 2012, VMware Tools that come with ESXi 5 don't work on FreeBSD 9. I found this article in which Jared Barneck reports that he just had to recompile vmmemctl and vmblock. The source code for both of these modules (and vmxnet/vmxnet3 as well) is included in vmware-freebsd-tools.tar.gz. However, you can compile neither vmxnet nor vmxnet3 without some minor modifications.
Make sure that you have at least the kernel source tree in /usr/src/sys.

Solution

  1. Download vmxnet.diff and vmxnet3.diff
  2. In the vSphere Client, select your FreeBSD virtual machine and (right-)click Guest->Install/Upgrade VMware Tools
  3. In your FreeBSD machine, run mount -t cd9660 /dev/cd0 /mnt and tar xzf /mnt/vmware-freebsd-tools.tar.gz
  4. cd vmware-tools-distrib/lib/modules/source/
  5. Untar vmblock.tar, vmmemctl.tar, vmxnet.tar, and vmxnet3.tar
  6. Now apply my patches:
    1. cd vmxnet-only
    2. patch -p1 < /tmp/vmxnet.diff
    3. cd ../vmxnet3-only
    4. patch -p1 < /tmp/vmxnet3.diff
  7. Change into vmblock-only and run make && make install
  8. Change into vmmemctl-only and run make && make install
  9. Change into vmxnet-only and run make && make install
  10. Change into vmxnet3-only and run make && make install
  11. Switch back to the top-level directory (vmware-tools-distrib) and run vmware-install.pl as usual
  12. Update /etc/rc.conf, e.g. change ifconfig_em0 to ifconfig_vmx3f0 (sic!) in case of vmxnet 3