XenLinux kernel aka Suse under Xen 4.0.1 on top of Ubuntu 10.10 Desktop

Following post is a brief instruction of port xenified aka Suse kernel to Ubuntu 10.10 desktop , to support Dom0 under Xen 4.0.1. Vanilla gets patched via Andrew Lyon’s rebased patch set xen-patches-2.6.34-5.tar.bz2.
Kernel configuration is similar kernel-xen config on Suse’s 11.3 . Xen back-end,evtchn,gntdev divices get loaded via /etc/init.d/xend at startup. Xen 4.0.1 and Libvirt 0.8.3 installations are just the same as in [1].

# cd /usr/src/xenLinux/
# wget http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.34-5.tar.bz2

Untar linux- and apply patches.

# cd /usr/src/xenLinux/
# bzcat linux- | tar xf -
# mkdir -p xen-patches-2.6.34-5
# cd xen-patches-2.6.34-5
# bzcat ../xen-patches-2.6.34-5.tar.bz2 | tar xf -
# cd ../linux-

Run script

for P in `ls ../xen-patches-2.6.34-5/6*.patch1 | sort `
patch -p1 -s -i $P
if [ $? = 0 ]; then
echo $P applied
echo "Error processing "$P
exit 1

Build kernel :-

# make menuconfig
# make -j(x)(number_of_cores)
# make modules_install install
# mkinitramfs -o /boot/initrd.img-

Link to .config file

Update /etc/init.d/xend correspondently

case "$1" in
mkdir -p /var/lock/subsys
touch /var/lock/subsys/xend
[[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
[[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG
if (uname -r |grep ; then
modprobe evtchn
modprobe blktap
modprobe blkbk
modprobe xenblk
modprobe netbk
modprobe gntdev
modprobe usbbk
xend start

Build in Debian way is possible after applying hack from [2].

root@boris-System-P5Q3:/usr/src3/linux- patch -p0 < kernel.patch
patching file arch/x86/Makefile
Hunk #1 succeeded at 154 (offset -1 lines).
Hunk #2 succeeded at 179 (offset 2 lines).

Now build and install linux-image

aptitude install kernel-package fakeroot
export CONCURRENCY_LEVEL=(number_of_cores) +1
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-0.4-xen kernel-image kernel-headers
dpkg -i ../linux-image-

At this point we are done with kernel . Next : disable Network manager

# chkconfig network-manager off
# gedit /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Restart netwoking :-

# /etc/init.d/networking restart

Install required packages

apt-get install libcurl4-openssl-dev \
xserver-xorg-dev \
mercurial gitk \
build-essential \
libncurses5-dev \
uuid-dev gawk \
gettext texinfo bcc \
libncurses5-dev dpkg-dev debhelper \
iasl texinfo bridge-utils bison flex
apt-get build-dep xen-3.3

Extract Xen 4.0.1 archive :-

cd /usr/src
gunzip xen-4.0.1.tar.gz
tar -xvf xen-4.0.1.tar
cd xen-4.0.1

Apply following patch to xen-4.0.1 folder

--- .orig/tools/hotplug/Linux/xen-backend.rules 2010-10-05 14:08:56.436012895 +0400
+++ /tools/hotplug/Linux/xen-backend.rules 2010-10-05 11:48:38.694087211 +0400
@@ -9,3 +9,5 @@
KERNEL=="evtchn", NAME="xen/%k"
KERNEL=="blktap[0-9]*", NAME="xen/%k"
KERNEL=="pci_iomul", NAME="xen/%k"
+KERNEL=="gntdev", NAME="xen/%k"
+KERNELS=="xen", KERNEL=="xvd*", SUBSYSTEM=="block", OPTIONS+="last_rule"

At this point create grub2-fix.patch1 as raw content of http://xenbits.xensource.com/xen-unstable.hg?rev/6eaab8297681 Changeset 22238 pygrub: support grub2 “(hdX,msdosY)” partition syntax

patch -p1 -s -i ../grub2-fix.patch1
make xen
make tools
make install-xen
make install-tools PYTHON_PREFIX_ARG=

Set up xend,xendomains to run as services

update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20

Create new Grub Entry and reboot into Xen environment :-

menuentry "Xen 4.0.1 / Ubuntu 10.10 kernel" {
insmod ext2
set root='(hd1,9)'
multiboot (hd1,9)/xen.gz dummy=dummy dom0_mem=1024M
module (hd1,9)/vmlinuz- dummy=dummy root=/dev/sdb10 ro console=tty0
module (hd1,9)/initrd.img-

root@boris-System-P5Q3:~# xm info
host : boris-System-P5Q3
release :
version : #1 SMP Sun Oct 17 16:22:51 MSD 2010
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2833
hw_caps : bfebfbff:20100800:00000000:00000940:0408e3fd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 8190
free_memory : 7083
node_to_cpu : node0:0-3
node_to_memory : node0:7083
node_to_dma32_mem : node0:3259
max_node_id : 0
xen_major : 4
xen_minor : 0
xen_extra : .1
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline : dummy=dummy dom0_mem=1024M
cc_compiler : gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
cc_compile_by : root
cc_compile_domain :
cc_compile_date : Fri Oct 15 10:17:36 MSD 2010
xend_config_format : 4

root@boris-System-P5Q3:~# virsh version
Compiled against library: libvir 0.8.3
Using library: libvir 0.8.3
Using API: Xen 3.0.1
Running hypervisor: Xen 4.0.0

1. Set up Xen 4.0.1 & Libvirt 0.8.3 on top of Ubuntu 10.10 Desktop
2. http://lists.xensource.com/archives/html/xen-users/2010-09/msg00394.html


9 Responses to XenLinux kernel aka Suse under Xen 4.0.1 on top of Ubuntu 10.10 Desktop

  1. Dnyanesh says:

    # mkinitramfs -o /boot/initrd.img-

    after this step is it necessary to build kernel in debian way?
    we can not use vmlinuz & initrd image as xen kernel?

  2. Dnyanesh says:

    can i use provided .config file for building xen kernel on my PC.
    provided .config file is 64bit PC,but my PC is 32bit PC.
    whether it work for me..
    I had perform all the steps given above,but it doesn’t work for me.

  3. Dnyanesh says:

    today i reinstall this kernel using second method(debian way).
    All procedure made successfully,but after booting in xen kernel it stops at some line ,here it is:

    usb 2-1 : new low speed USB device using uhci_hcd and address 2

    when i installed it using first method it gives the same error

    whats the problem.
    I need xen-kernel to be installed perfectly,because i am making a project on xen.
    help me.
    thank you.

  4. Dnyanesh says:

    This is the small part of log file of my normal kernel:

    0.868400] alloc kstat_irqs on node -1
    [ 0.868416] r8169 0000:02:00.0: irq 42 for MSI/MSI-X
    [ 0.869084] r8169 0000:02:00.0: eth0: RTL8168b/8111b at 0xf805e000, 00:19:db:e3:c2:84, XID 18000000 IRQ 42
    [ 0.912702] usb 2-2: new low speed USB device using uhci_hcd and address 2
    [ 1.113701] usbcore: registered new interface driver hiddev
    [ 1.129086] input: PIXART USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/input/input3
    [ 1.129209] generic-usb 0003:093A:2500.0001: input,hidraw0: USB HID v1.10 Mouse [PIXART USB OPTICAL MOUSE] on usb-0000:00:1d.0-2/input0
    [ 1.129228] usbcore: registered new interface driver usbhid
    [ 1.129231] usbhid: USB HID core driver
    [ 1.602615] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
    [ 13.413957] Adding 1171452k swap on /dev/sda8. Priority:-1 extents:1 across:1171452k
    [ 13.505169] udev[358]: starting version 163
    [ 13.542754] lp: driver loaded but no devices found
    [ 13.559275] Linux agpgart interface v0.103
    [ 13.600504] intel_rng: FWH not detected

    after booting into xen-kernel it stops at line no [ 0.912702]
    further no movement is there.
    what is problem .
    help me

  5. Dnyanesh says:

    could you give me the linux-image*.deb file to me.
    I ma using ubuntu-10.10-i386,32-bit version

  6. This could be this blog’s greatest piece of writing I have ever seen…

  7. wire brushes says:

    You couldn’t be more precise!!!

  8. Cyber Tricks says:

    An all round well written blog!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: