VirtualPC

From Gentoo Linux Wiki

Jump to: navigation, search
Please format this article according to the Style Guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article.

Reason(s):

  • add headings
  • use wiki syntax and templates
Fix me: Information in this article was not verified. Please actualise this information by checking its integrity.

Virtualization TOC


Virtual pc.png
  • MS VirtualPC addons

[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.

emerge --ask rpm2targz

Convert rpm additions package

rpm2targz vmadd-kernel-module-RHEL-2.0-1.i386.rpm
rpm2targz vmadd-heartbeat-2.0-1.i386.rpm
rpm2targz vmadd-shutdown-2.0-1.i386.rpm
rpm2targz vmadd-timesync-2.0-1.i386.rpm

Install packages

tar zxvf /root/vmadd-kernel-module-RHEL-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-heartbeat-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-shutdown-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-timesync-2.0-1.i386.tar.gz

and build modules

cd lib/modules/vmadd/module/
make
make vmadd-install-module
depmod

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

rc-update add vmadd-timesync default rc-update add vmadd-shutdown default

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

rc-update add vmadd-heartbeat default

[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
make
make vmadd-install-module
depmod
Personal tools