VMware Cloud Community
stateless
Contributor
Contributor

vmware-tools-config build modules for different kernel?

I'm running 2.6.24-22-server at the moment and ubuntu has just updated to 2.6.24-23-server.

Is it possible with vmware-tool-config or manually to pre-compile the vmware modules tools before rebooting? The appropiate kernel headers have been installed.

Tags (2)
Reply
0 Kudos
8 Replies
stateless
Contributor
Contributor

I figured I only need to compile the kernel modules. So, this small change to the Makefile for vmxnet and vmmemctl

-VM_UNAME ?= $(shell uname -r)
+VM_UNAME = $(shell uname -r)

then

nic@vpn:/tmp/src/vmmemctl-only$ VM_UNAME=2.6.24-23-server make
Using 2.6.x kernel build system.
make -C /lib/modules/2.6.24-23-server/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-23-server'
CC /tmp/src/vmmemctl-only/vmmemctl.mod.o
LD /tmp/src/vmmemctl-only/vmmemctl.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/src/vmmemctl-only/vmmemctl.mod.o
LD /tmp/src/vmmemctl-only/vmmemctl.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-23-server'
cp -f vmmemctl.ko ./../vmmemctl.o

The question then is about which file to use. I assume it should be vmmemctl.ko?

nic@vpn:/tmp/src/vmmemctl-only$ ls -l vmmemctl.o vmmemctl.ko ../vmmemctl.o
-rw-rr 1 nic nic 166627 2009-01-15 11:44 vmmemctl.ko
-rw-rr 1 nic nic 166627 2009-01-15 11:44 ../vmmemctl.o
-rw-rr 1 nic nic 141211 2009-01-15 11:44 vmmemctl.o

Once I've figure this out it is probably easy to script.

Reply
0 Kudos
nick_couchman
Immortal
Immortal

For 2.6 kernels, the .ko file is the one you want to use - it's the loadable module.

Also, I think you may have gotten the diff backwards - I imagine the original makefile has VM_UNAME= and you changed it to VM_UNAME?= ??

Reply
0 Kudos
stateless
Contributor
Contributor

Yeah, was a bit lazy with the diff. Add the "?" before the "=" means the enviromental variable set on the command line will override the Makefile file variable.

Any idea why vmware does this with .o files?

nic@vpn:~$ ls -l /lib/modules/2.6.24-21-server/misc/
total 2016
lrwxrwxrwx 1 root root 44 2008-10-29 11:59 vmblock.ko -> /lib/modules/2.6.24-21-server/misc/vmblock.o
-rw-rr 1 root root 604647 2008-10-29 11:59 vmblock.o
lrwxrwxrwx 1 root root 43 2008-10-29 11:58 vmhgfs.ko -> /lib/modules/2.6.24-21-server/misc/vmhgfs.o
-rw-rr 1 root root 1097016 2008-10-29 11:58 vmhgfs.o
lrwxrwxrwx 1 root root 45 2008-10-29 11:58 vmmemctl.ko -> /lib/modules/2.6.24-21-server/misc/vmmemctl.o
-rw-rr 1 root root 141467 2008-10-29 11:58 vmmemctl.o
lrwxrwxrwx 1 root root 43 2008-10-29 11:59 vmxnet.ko -> /lib/modules/2.6.24-21-server/misc/vmxnet.o
-rw-rr 1 root root 199429 2008-10-29 11:59 vmxnet.o

and

make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-23-server'
cp -f vmmemctl.ko ./../vmmemctl.o

Confuses matters.

Reply
0 Kudos
nick_couchman
Immortal
Immortal

Yeah, that's why I figured it was backward :-).

I guess the VMware module build just outputs the kernel modules to .o files and links the .ko files - could be some sort of backward-compatible trick they're using to make the build process work on both 2.4 and 2.6 kernels. Not really sure. So, I guess use the .o files...

stateless
Contributor
Contributor

You might be right with the 2.4 vs 2.6 aspect. Practically for 2.6 it is because of the following in /etc/init.d/vmware-tools in the load_modules function.

/sbin/insmod -s -f "/lib/modules/`uname -r`/misc/$1.o" >/dev/null 2>&1 || /sbin/insmod -s -f "$1" >/dev/null 2>&1 || exit 1

To get this to work 100% correctly so there is no need to run vmware-config-tools remotely. You probably need to edit the following as well:

nic@papp:/etc/vmware-tools$ grep CONFED locations
answer VMMEMCTL_CONFED yes
answer VMHGFS_CONFED no
answer VMXNET_CONFED yes
answer VMBLOCK_CONFED no
nic@papp:/etc/vmware-tools$ grep CONFED \.ko
grep: .ko: No such file or directory
nic@papp:/etc/vmware-tools$ grep \.ko locations
file /lib/modules/2.6.24-21-server/misc/vmmemctl.ko
file /lib/modules/2.6.24-21-server/misc/vmhgfs.ko
file /lib/modules/2.6.24-21-server/misc/vmxnet.ko
file /lib/modules/2.6.24-21-server/misc/vmblock.ko

/etc/init.d/vmware-tools seems to check the *_CONFED variables and a module load fails set /etc/vmware/not_configured.

It is probably possible to distribute the same /etc/vmware/locations file to similar vm nodes, if everything else is the same.

Reply
0 Kudos
stateless
Contributor
Contributor

Here is a basic script to do some of this:

mkdir /tmp/src
cd /tmp/src/
tar xf /usr/lib/vmware-tools/modules/source/vmmemctl.tar
tar xf /usr/lib/vmware-tools/modules/source/vmxnet.tar
cd vmxnet-only/
mv Makefile Makefile.orig && sed -e "s/VM_UNAME =/VM_UNAME ?=/" Makefile.orig > Makefile && VM_UNAME=2.6.24-23-server make
cd ../vmmemctl-only/
mv Makefile Makefile.orig && sed -e "s/VM_UNAME =/VM_UNAME ?=/" Makefile.orig > Makefile && VM_UNAME=2.6.24-23-server make
cd ..
sudo mkdir /lib/modules/2.6.24-23-server/misc/
sudo cp -v /.ko /lib/modules/2.6.24-23-server/misc/
cd /lib/modules/2.6.24-23-server/misc/
sudo bash
for i in *.ko; do ln -sf $i $(basename $i .ko).o; done
exit

Reply
0 Kudos
Dave_Mishchenko
Immortal
Immortal

Your post has been moved to the VI: Virtual Machine and Guest OS forum.

Dave Mishchenko

VMware Communities User Moderator

Reply
0 Kudos
agapelogos
Contributor
Contributor

I've attached another automated script for building vmware modules. This one gives you a list of kernels to choose from.

Reply
0 Kudos