Archive

Archive for December, 2009

Building a hyper-v enabled linux kernel

December 15th, 2009 2 comments

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

staging01

And include the hyper-v enabled drivers

staging02

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

Categories: Hyper-V, Linux Tags:

Linux kernel 2.6.32 en Hyper-V

December 14th, 2009 No comments

Om Hyper-V te gebruiker onder Linux is het noodzakelijk een nieuwe kernel te compileren. Het makkelijkste is om een kopie van de oude kernel config te gebruiken (http://aligunduz.org/articles/buildkernel.html) en de onderstaande onderdelen aan te zetten. De HV zou dan automatisch gedetecteerd moeten worden.

[Y] Microsoft Hyper-V client drivers (CONFIG_HYPERV)
[Y] Microsoft Hyper-V virtual storage driver (CONFIG_HYPERV_STORAGE)
[Y] Microsoft Hyper-V virtual block driver (CONFIG_HYPERV_BLOCK)
[Y] Microsoft Hyper-V virtual network driver (CONFIG_HYPERV_NET)

Categories: Hyper-V Tags:

Bash verder laten gaan na stoppen proces

December 8th, 2009 No comments

Handig stukje code voor bash om een script verder te laten gaan indien een proces stopt:

while true;
do
PROCESS=`ps -A | grep xbmc.bin`
if [ "$PROCESS" = "" ]
then
echo "xbmc no longer running"
break
fi
done

Categories: Linux Tags: