SoFunction
Updated on 2025-04-09

Detailed explanation of the compilation process of XenServer kernel module

Citrix provides DDK (Driver Development Kit) to support the construction of custom kernel modules or hardware drivers in XenServer. DDK is an OVA format virtual machine image that includes development tools such as kernel header files and compilers.

The following describes the steps to build a kernel module using DDK.

First, download the corresponding version of DDK from the official website, and select 6.5 here:/10106/XenServer-6.5.

Upload the downloaded ISO file to the XenServer host

Mount ISO

mkdir /mnt/tmp
mount <path_to_DDK>/ /mnt/tmp -o loop


Create a virtual machine using DDK image

xe vm-import filename=/mnt/tmp/
xe vm-import The command will use this image to create a virtual machine,and output the virtual machine'sUUID,like:

[root@xenserver-iryatlxz ~]# xe vm-import filename=/mnt/tmp/ddk/
69a2356e-5f7f-0fd8-a609-234a28b59fc5

Next, find the network UUID associated with eth0. First list all networks:

xe network-list

The output is as follows:

uuid ( RO)        : e0f9ba3d-f27b-7380-413a-0491db9e0ec4
     name-label ( RW): Pool-wide network associated with eth1
  name-description ( RW):
       bridge ( RO): xenbr1


uuid ( RO)        : 46fb28dd-4c35-5755-160b-f6389e09c54a
     name-label ( RW): Pool-wide network associated with eth0
  name-description ( RW):
       bridge ( RO): xenbr0


uuid ( RO)        : 0ecf8369-5469-1327-2195-f3cc28a1b3bd
     name-label ( RW): Host internal management network
  name-description ( RW): Network on which guests will be assigned a private link-local IP address which can be used to talk XenAPI
       bridge ( RO): xenapi

Find the network UUID associated with eth0 from it, as:

46fb28dd-4c35-5755-160b-f6389e09c54a

Create a virtual interface using the network UUID and virtual machine UUID obtained above:

xe vif-create network-uuid=46fb28dd-4c35-5755-160b-f6389e09c54a  vm-uuid=69a2356e-5f7f-0fd8-a609-234a28b59fc5 device=0

Start the virtual machine

xe vm-start uuid=69a2356e-5f7f-0fd8-a609-234a28b59fc5

You can use the XenCenter console to access the DDK virtual machine, or you can use xenconsole to access it directly on the command line.

The steps to access using xenconsole are as follows:

Get domain ID

[root@xenserver-iryatlxz ~]# xe vm-list params=dom-id uuid=69a2356e-5f7f-0fd8-a609-234a28b59fc5 --minimal
14

Connect the virtual machine from console /usr/lib64/xen/bin/xenconsole 14

After logging in to the DDK VM, you can build a custom kernel module or hardware driver in the virtual machine. The kernel development package is located in /usr/src/kernels/3.10.0+2-x86_64/ .

When you need to exit, press CTRL-] to exit.