Building a hyper-v enabled linux kernel
Here are the instructions for building a hyper-v enabled linux kernel. The system I’m using is Ubuntu 9.10.
First get all the essential packages:
sudo apt-get build-dep linux
Install some more build essentials:
sudo apt-get install libncurses5 libncurses5-dev
sudo apt-get install kernel-package
Next step is to download the latest kernel packages from: http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32/
Install them with the following commands:
sudo dpkg -i linux-headers-2.6.32-020632_2.6.32-020632_all.deb
sudo dpkg -i linux-image-2.6.32-020632-generic_2.6.32-020632_i386.deb
sudo dpkg -i linux-headers-2.6.32-020632-generic_2.6.32-020632_i386.deb
sudo dpkg -i linux-source-2.6.32_2.6.32-020632_all.deb
Update grub and reboot:
sudo update-grub
sudo reboot
Verify that you using the new kernel:
uname -a
Linux ubuntu 2.6.32-020632-generic #020632 SMP Thu Dec 3 10:58:45 UTC 2009 i686 GNU/Linux
Go the /usr/src/ and unzip the kernel source:
tar -jxf linux-source-2.6.32.tar.bz2
cd linux-source-2.6.32
Copy your current (old) kernel configuration file to the kernel source directory:
sudo cp -vi /boot/config-`uname -r` .config
Run the make menuconfig wizard
sudo make menuconfig
Enable the staging drivers

And include the hyper-v enabled drivers

Press ESC, ESC to return to the main menu’s and save the new configuration file!
Make clean and start building:
sudo make-kpkg clean
sudo fakeroot make-kpkg --initrd --append-to-version=-hyper-v kernel-image kernel-headers
You’ll find your kernel under /usr/src/
Install your kernel with: sudo dpkg -i *.deb
Update grub with: sudo update-grub
Reboot
After you’ve rebooted the system your modules are listed under: /lib/modules/2.6.32-hyper-v/kernel/drivers/staging/hv , to load them type:
sudo modprobe hv_vmbus
sudo modprobe hv_blkvsc
sudo modprobe hv_netvsc
sudo modprobe hv_storvsc
You could verify if the modules are loaded by using lsmod. Also check dmesg and /var/log/messages for any errors.
$ lsmod
Module Size Used by
hv_storvsc 21798 0
hv_netvsc 29396 0
hv_blkvsc 25207 0
hv_vmbus 43234 3 hv_storvsc,hv_netvsc,hv_blkvsc
lp 6868 0
psmouse 52658 0
iptable_filter 2199 0
serio_raw 3812 0
parport 31970 1 lp
i2c_piix4 8052 0
ip_tables 9157 1 iptable_filter
x_tables 13875 1 ip_tables
floppy 49858 0
tulip 43835 0
The following lines should be present in the /var/log/messages:
VMBUS_DRV: Vmbus initializing.... current log level 0x1f1f0006 (1f1f,6)
VMBUS: +++++++ Build Date=Dec 15 2009 06:23:59 +++++++
VMBUS: +++++++ Build Description=Version 2.0 +++++++
VMBUS: +++++++ Vmbus supported version = 13 +++++++
VMBUS: +++++++ Vmbus using SINT 2 +++++++
VMBUS: Windows hypervisor detected! Retrieving more info...
VMBUS: Vendor ID: Microsoft Hv
VMBUS: Interface ID: Hv#1
VMBUS: OS Build:6001-6.0-18-0.18016
VMBUS: Hypercall page VA=e1002000, PA=0x1f9e8000
VMBUS_DRV: irq 0x5 vector 0x35
VMBUS: SynIC version: 1
VMBUS: Vmbus connected!!
VMBUS_DRV: generating uevent - VMBUS_DEVICE_CLASS_GUID={c5295816-f63a-4d5f-8d1a4daf999ca185}
VMBUS: Channel offer notification - child relid 1 monitor id 0 allocated 1, type {32412632-86cb-44a2-9b5c50d1417354f5} instance {00000000-0000-8899-0000000000000000}
VMBUS: Channel offer notification - child relid 2 monitor id 1 allocated 1, type {32412632-86cb-44a2-9b5c50d1417354f5} instance {00000001-0000-8899-0000000000000000}
VMBUS_DRV: generating uevent - VMBUS_DEVICE_CLASS_GUID={32412632-86cb-44a2-9b5c50d1417354f5}
Precompiled kernels are here:
http://www.strengholt-online.nl/hyperv/linux-image-2.6.32-020632-hyper-v_i386.deb
http://www.strengholt-online.nl/hyperv/linux-headers-2.6.32-020632-hyper-v_i386.deb
Remark: The synthetic nic loaded by the hv_netvsc module is called seth0
nice guide. however what could be added is how to have them loaded upon each boot. I couldnt use your precompiled image as i use amd64. however it requires me to load each driver after each reboot.
Instead of making modules you could decide to integrade them into the kernel. Just open the .config with your texteditor. Search for the lines:
CONFIG_HYPERV=m
CONFIG_HYPERV_STORAGE=m
CONFIG_HYPERV_BLOCK=m
CONFIG_HYPERV_NET=m
Replace them with:
CONFIG_HYPERV=y
CONFIG_HYPERV_STORAGE=y
CONFIG_HYPERV_BLOCK=y
CONFIG_HYPERV_NET=y
To have modules loaded during boot. Open the /etc/modules.conf
Add lines like “alias hv_vmbus” to have the modules loaded.