VirtualPC

How to install MS VirtualServer/MS VirtualPC Addons on Gentoo Linux
Download Virtual Machine Additions for linux from and install it on VirtualServer/VirtualPC host.

Inside your Gentoo Linux guest machine install rpm2targz for convert rpm additions package.

Convert rpm additions package

Install packages

and build modules

Now you need to modify runscript for Gentoo


 * Edit /etc/init.d/vmadd as follows.

kdir=/lib/modules/`uname -r` dev=/dev/vmadd modname=vmadd module=$kdir/misc/$modname prepapp=/usr/sbin/vmadd-prepare-module dll=/usr/sbin/vmadd.dll file="" test -f $module.o && file=$module.o  test -f $module.ko && file=$module.ko  test -z "$file" && { eerror "kernel module not found" exit 1 } running { lsmod | grep -q vmadd[^_-] } start { ebegin "Starting VM additions " running || { rm -f $dev || { eerror "cannot remove $dev" exit 1 }        modprobe $modname || { eerror "modprobe $modname failed" exit 1 }        }         if [ ! -c $dev ]; then maj=`sed -n 's;\([0-9]\+\) VMAdditions;\1;p' /proc/devices` test -z $maj && { rmmod $modname eerror "cannot locate device major" exit 1 }        mknod $dev c $maj 0 || { rmmod $modname eerror "cannot create device $dev with major $maj" exit 1 }        fi         test -x $prepapp && { $prepapp $dll || { rmmod $modname eerror "cannot prepare module" exit 1 }        }         return 0 } stop { ebegin "Stopping VM additions " if running; then rmmod $modname || eerror "cannot unload module $modname" rm -f $dev || eerror "cannot unlink $dev" fi        return 0 }
 * 1) !/sbin/runscript
 * 2) @file
 * 3) Microsoft Virtual Machine Additions for Linux
 * 4) Provides:       vmadd
 * 5) Description:    VM additions kernel module


 * Edit /etc/init.d/vmadd-heartbeat as follows.

PIDFILE="/var/run/heartbeat" BINARY=/usr/sbin/vmadd-heartbeatd running { lsmod | grep -q vmadd[^_-] }  depend { vmadd } start { ebegin "Starting VM additions service heartbeat" start-stop-daemon --start --exec $BINARY \ --pidfile $PIDFILE RETVAL=$? test $RETVAL -eq 0 && touch $PIDFILE eend $? } stop { ebegin "Stopping VM additions service heartbeat" start-stop-daemon --stop --exec $BINARY \ pidfile $PIDFILE eend $? }
 * 1) !/sbin/runscript
 * 2) Microsoft Virtual Machine Additions for Linux
 * 3) Provides:       vmadd-heartbeat
 * 4) Required-Start: vmadd
 * 5) Required-Stop:  vmadd
 * 6) Description:    VM additions service heartbeat


 * Edit /etc/init.d/vmadd-shutdown as follows.

PIDFILE="/var/run/shutdown" BINARY=/usr/sbin/vmadd-shutdownd running { lsmod | grep -q vmadd[^_-] }  depend { vmadd } start { ebegin "Starting VM additions service shutdown" start-stop-daemon --start --exec $BINARY \ --pidfile $PIDFILE RETVAL=$? test $RETVAL -eq 0 && touch $PIDFILE eend $? } stop { ebegin "Stopping VM additions service shutdown" start-stop-daemon --stop --exec $BINARY \ --pidfile $PIDFILE eend $? }
 * 1) !/sbin/runscript
 * 2) Microsoft Virtual Machine Additions for Linux
 * 3) Provides:       vmadd-shutdown
 * 4) Required-Start: vmadd
 * 5) Required-Stop:  vmadd
 * 6) Description:    VM additions service shutdown


 * Edit /etc/init.d/vmadd-timesync as follows.

PIDFILE="/var/run/timesync" BINARY=/usr/sbin/vmadd-timesyncd running { lsmod | grep -q vmadd[^_-] } depend { vmadd } start { ebegin "Starting VM additions service timesync " start-stop-daemon --start --exec $BINARY \ --pidfile $PIDFILE RETVAL=$? test $RETVAL -eq 0 && touch $PIDFILE eend $? } stop { ebegin "Stopping VM additions service timesync" start-stop-daemon --stop --exec $BINARY \ --pidfile $PIDFILE eend $? }
 * 1) !/sbin/runscript
 * 2) Microsoft Virtual Machine Additions for Linux
 * 3) Provides:       vmadd-timesync
 * 4) Required-Start: vmadd
 * 5) Required-Stop:  vmadd
 * 6) Description:    VM additions service timesync

Now you are ready for start Linux Additions

If you are running on VirtualServer You may also want this (do not use it on VirtualPC)

Error Messages
In case you get the folowing error message:

make[2]: *** [/lib/modules/vmadd/module/vpc-mod.o] Error 1 make[1]: *** [_module_/lib/modules/vmadd/module] Error 2 make[1]: Leaving directory `/usr/src/kernels/2.6.27.7-134.fc10.i686' make: *** [vmadd-build-module] Error 2 make: Leaving directory `/lib/modules/vmadd/module' Could not build kernel module

You need to patch vpc-mod.c and vpc-utils.c

vpc-mod.c Add #include , before the following source === Patched version ===
 * 1) include 
 * 2) include 
 * 3) include 
 * 1) include 
 * 2) include 
 * 3) include 
 * 4) include 

vpc-utils.c line 105: "ebx", "ecx", "edx", "esi", "edi", "ebp" delete the ending "ebp" including the "," before

Compiling the modules on 2.6.31 and higher kernels
The patches above are required. The makefile that comes with vmadd does not work, but it can be altered to work (from The Linux Kernel Module Programming Guide):

Makefile:

KVERSION ?= $(shell name -r) KDIR    ?= /lib/modules/$(KVERSION)/build OUTDIR  ?= /lib/modules/$(KVERSION)/misc obj-m += vmadd.o vmadd-objs := vpc-mod.o vpc-utils.o all: make -C $(KDIR) M=$(PWD) modules clean: make -C $(KDIR) M=$(PWD) clean install: vmadd.ko        mkdir -p $(OUTDIR) install -m 0400 -o 0 -g 0 vmadd.ko $(OUTDIR)
 * 1) Makefile altered for 2.6 kernels

Remember to use tabs after the all, clean and install rules.