PV Linux Drivers

Copyright 2015 by Assured Information Security, Inc. Created by Ross Philipson <philipsonr@ainfosec.com>. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

The PV Linux Drivers (aka the Linux tools) are located at https://github.com/OpenXT/pv-linux-drivers

They are built by the build scripts as both Debian and RPM packages.

They can be found in the build output directory and on the iso in the "debian" and "rpms" directories, that can be used at repositories by the package managers.

Since they are kernel modules, they are distributed as DKMS packages that get compiled against the kernel(s) that the guest is using.

Development

To work on the PV Linux Drivers, just clone them in a guest and use simple make operations.

For example, to work on the vusb driver in a Debian Jessie 64 bits guests:

$ sudo apt-get install git build-essential linux-headers-amd64  # or linux-headers-`uname -r` on Ubuntu
$ git clone https://github.com/OpenXT/pv-linux-drivers.git
$ cd pv-linux-drivers/openxt-vusb    # Then make the desired modifications
$ make                               # Build
$ sudo make install                  # (optional) Install
$ sudo modprobe openxt-vusb          # Load the module to test it

Previous method

The Linux PV drivers for OpenXT are a DKMS package that is built/rebuilt on in the Linux guest.

DKMS Manually for Development

It is possible to do development work on the Linux PV driver sources directly on in a guest VM with just the Github repository here:

https://github.com/OpenXT/pv-linux-drivers

Or with your own forked repository (and branch). Simply clone your repository in the guest. Then install these packages:

$ sudo apt-get install git vim dkms

This repository contains sub-directories, each of which is a DKMS package. The DKMS script is going to expect the DKMS sources to be in a predefined place. For our purposes, let's use the v4v DKMS package (it will be obvious what would have to be done for the others). DKMS will expect the sources for it to be here for version 1.0:

/usr/src/openxt-pv-v4v-dkms-1.0

The simplest thing is to link this to the sources in your repo:

$ sudo ln -fs /home/somebody/pv-linux-drivers.git/xc-v4v /usr/src/openxt-pv-v4v-dkms-1.0

Then switch to the directory where the DKMS install script is:

$ cd /home/somebody/pv-linux-drivers.git/v4v/dkms

And run:

$ sudo ./postinst

To just rebuild the kernel module, go to the sources directory itself and run make. The module can then be directly copied directly to this location (and loaded with modprobe):

/lib/modules/<kernel-ver>/update/dkms

If you want to remove your package at a later point (e.g. to re-install it), you can use this and then rerun the postinst script after your changes are done:

$ sudo dkms remove -m openxt-pv-v4v-dkms -v 1.0 -k <kernel-ver>

As noted, doing a make in the pv-linux-drivers.git sources directories will make a local copy of the binaries in that location. The postinst script is driving DKMS under the covers. During the (re-)install, DKMS makes a copy of the sources under /var/lib/dkms/openxt-pv-v4v-dkms for v4v in this case and this is where the modules that end up in/lib/modules/<kernel-ver>/update/dkms are actually built and installed from.

If the VM in question does not have a actual tools package installed and you want XT to think they are (which is needed in some cases), you can update the VM config to say it has tools. Log in to dom0 and use the nr command to elevate permissions. Then do something like:

$ xec-vm -n <my-vm-name> set pv-addons true

$ xec-vm -n <my-vm-name> set pv-addons-version "14.0.0.1"

Driver Installation

This section comes from the OpenXT documentation but it presented here for convenience. A couple of things to note (and that need to be added to future docs):

  1. Make sure you do an apt-get update before you start the install.
  2. Make sure the xctools cd is not mounted with noexecute.

Note Do not install the OpenXT Tools on Linux using dpkg directly, nor by double-clicking on the package via the graphical desktop. Note that for this procedure:

  • an internet connection is required
  • the script must be executed as root
  • the script will download 100 MB of kernel source files in order to build a new Linux graphics driver

1 At a command line shell on the VM, change users to become the superuser:

sudo su

2 Display the available drives with the command and Observe the name of the optical drive with the OpenXT Tools; it will be something like /media/Optical-tools-<version number>.

df -k

3 Change to the linux directory on the optical drive with the OpenXT Tools package:

cd /media/OpenXT-tools-<version number>/linux

4 Run the install.sh script:

./install.sh

5 Reboot the VM.

Note The UIVM for OpenXT will show the tools as installed, but a reboot is required to properly complete the Tools installation.