Differences between revisions 1 and 2
Revision 1 as of 2012-04-27 18:10:01
Size: 2127
Editor: www-cache3
Comment:
Revision 2 as of 2012-04-27 18:11:27
Size: 2128
Editor: www-cache3
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
To make the libraries of LITMUS^RT (liblitmus) available to the virtual machine in kvm it is possible to set up a NFS-server on the host to synchronize the libraries automatically. To make the libraries of LITMUS^RT^ (liblitmus) available to the virtual machine in kvm it is possible to set up a NFS-server on the host to synchronize the libraries automatically.

How to share liblitmus with the virtual machine

To make the libraries of LITMUSRT (liblitmus) available to the virtual machine in kvm it is possible to set up a NFS-server on the host to synchronize the libraries automatically. I used a Debian system for my setup. But it should easily be adapted to other Linux distributions. On both the host and the client the shared directory will be /var/nfs.

First we install and configure nfs on the host:

apt-get install nfs-kernel-server nfs-common portmap
mkdir /var/nfs
chown nobody:nogroup /var/nfs/

Enter into /etc/exports:

/var/nfs        localhost(rw,sync,no_subtree_check,all_squash,insecure,anonuid=1000)

Where 1000 is the userid for your user name. (View /etc/passwd for example)

Still on the host we need to make sure that the NFS directory is shared and that you have access to it:

exportfs -a
usermod -aG nogroup your_username
chmod g+w /var/nfs

Again you should substitute your_username with the right name.

To make the virtual machine able to use the network and nfs we need to configure this in the kernel if the desired features are not yet configured. I had to add for internet connection:

  • CONFIG_NET_ETHERNET=y
  • CONFIG_NET_PCI=y
  • CONFIG_8139CP=y

and for nfs:

  • CONFIG_NETWORK_FILESYSTEMS=y
  • CONFIG_NFS_V4=y

then "make menuconfig" automatically adds:

  • CONFIG_NFS_FS=y
  • CONFIG_LOCKD=y
  • CONFIG_NFS_COMMON=y
  • CONFIG_SUNRPC=y
  • CONFIG_SUNRPC_GSS=y
  • CONFIG_RPCSEC_GSS_KRB5=y
  • CONFIG_KEYS=y
  • CONFIG_DNS_RESOLVER=y

Now you should start kvm with the following command to enable network connection (view also How to start kvm) :

kvm -smp 2 -m 512 -boot c -vga std -net nic -net user,hostfwd=tcp::10022-:22 -kernel path_to_kernel/arch/x86/boot/bzImage -append root=/dev/hda1 -hda kvm_image.img

On the client we also need some configurations:

mkdir /var/nfs

And we want to automatically mount the new network directory. Add therefore to /etc/fstab:

10.0.2.2:/var/nfs       /var/nfs        nfs     defaults 0 0

LiblitmusViaNFS (last edited 2012-04-30 07:36:45 by bbb)