VirtualPC
From Gentoo Linux Wiki
| Please format this article according to the Style Guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article.
Reason(s):
|
| Fix me: Information in this article was not verified. Please actualise this information by checking its integrity. |
[edit] How to install MS VirtualServer/MS VirtualPC Addons on Gentoo Linux
Download Virtual Machine Additions for linux from [1] 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.
#!/sbin/runscript
# @file
# Microsoft Virtual Machine Additions for Linux
# Provides: vmadd
# Description: VM additions kernel module
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
}
- Edit /etc/init.d/vmadd-heartbeat as follows.
#!/sbin/runscript
# Microsoft Virtual Machine Additions for Linux
# Provides: vmadd-heartbeat
# Required-Start: vmadd
# Required-Stop: vmadd
# Description: VM additions service heartbeat
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 $?
}
- Edit /etc/init.d/vmadd-shutdown as follows.
#!/sbin/runscript
# Microsoft Virtual Machine Additions for Linux
# Provides: vmadd-shutdown
# Required-Start: vmadd
# Required-Stop: vmadd
# Description: VM additions service shutdown
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 $?
}
- Edit /etc/init.d/vmadd-timesync as follows.
#!/sbin/runscript
# Microsoft Virtual Machine Additions for Linux
# Provides: vmadd-timesync
# Required-Start: vmadd
# Required-Stop: vmadd
# Description: VM additions service timesync
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 $?
}
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)
[edit] 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 <linux/fs.h>, before the following source #include <linux/signal.h> #include <linux/sched.h> #include <linux/interrupt.h> === Patched version === #include <linux/fs.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/interrupt.h>
vpc-utils.c
line 105: "ebx", "ecx", "edx", "esi", "edi", "ebp" delete the ending "ebp" including the "," before
[edit] 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:
# Makefile altered for 2.6 kernels
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)
Remember to use tabs after the all, clean and install rules.
