Differences between revisions 2 and 3
Revision 2 as of 2012-04-27 18:11:27
Size: 2128
Editor: www-cache3
Comment:
Revision 3 as of 2012-04-30 07:36:45
Size: 2180
Editor: bbb
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= How to share liblitmus with the virtual machine = = How to share liblitmus with a virtual machine =
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.
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.
To make the userspace libraries of LITMUS^RT^ (liblitmus) available to the virtual machine in kvm , it is convenient to set up an NFS-server on the host to synchronize the libraries automatically.
I used a Debian system for my setup, but it should be easy to adapt the following instructions to other Linux distributions. On both the host and the client, `/var/nfs` will be the shared directory.
Line 13: Line 13:
Enter into /etc/exports: Enter into `/etc/exports`:
Line 17: Line 17:
Where ''1000'' is the userid for your user name. (View ''/etc/passwd'' for example) Where ''1000'' is the userid for your user name. (View `/etc/passwd` for example)
Line 19: Line 19:
Still on the host we need to make sure that the NFS directory is shared and that you have access to it: Still on the host, we need to make sure that the NFS directory is shared and that your user account has access to it:
Line 22: Line 22:
usermod -aG nogroup your_username usermod -aG nogroup $USER
Line 25: Line 25:
Again you should substitute ''your_username'' with the right name. Again, you should substitute `$USER` with the right name.
Line 27: Line 27:
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. To make the virtual machine able to use the network and NFS, we need to ensure that the desired features are enabled in the kernel configuration.
Line 32: Line 32:
and for nfs: and for NFS:
Line 35: Line 35:
then "make menuconfig" automatically adds: then `make menuconfig` automatically adds:
Line 45: Line 45:
Now you should start kvm with the following command to enable network connection (view also [[VirtualMachineImages|How to start kvm]]) : Now you should start `kvm` with the following command to enable network connection (view also [[VirtualMachineImages|How to start kvm]]) :
Line 55: Line 55:
And we want to automatically mount the new network directory. Add therefore to /etc/fstab: And we want to automatically mount the new network directory. Add the following entry to `/etc/fstab`:

How to share liblitmus with a virtual machine

To make the userspace libraries of LITMUSRT (liblitmus) available to the virtual machine in kvm , it is convenient to set up an NFS-server on the host to synchronize the libraries automatically. I used a Debian system for my setup, but it should be easy to adapt the following instructions to other Linux distributions. On both the host and the client, /var/nfs will be the shared directory.

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 your user account has access to it:

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

Again, you should substitute $USER with the right name.

To make the virtual machine able to use the network and NFS, we need to ensure that the desired features are enabled in the kernel configuration. 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 the following entry 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)