Compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit

I am compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit
GCC is 4.3.3 and some issues with new compiler’s optimization.

This is on-going memo… I have compiled the kernel but it seems not compatible with Ubuntu 9.04.
So, I switched the xen kernel version supported by debian team.

References:

(1) http://www.infohit.net/blog/post/running-xen-on-ubuntu-intrepid-and-jaunty.html
(2) http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-05/msg01854.html
(3) http://www.comptechdoc.org/os/linux/usersguide/linux_ugkernel.html
(4) http://bderzhavets.wordpress.com/2009/01/03/setup-xen-330-ubuntu-intrepid-server-dom0-via-build-xen-kernel-based-on-httpxenbitsxensourcecomextlinux-2627-xenhg/

Errors:

(1) undefined reference to `__udivdi3′
arch/x86/kernel/built-in.o: In function `timer_interrupt’:
/usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c:465: undefined reference to `__udivdi3′
make: *** [.tmp_vmlinux1] Error 1
root@ubunzzo:/usr/src/linux-2.6.29.2-xen# vi /usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c

My attempt after reading reference (2) was successful, I inserted the asm(“”:”+r”(delta)) to the timer_interrupt function at the while scope at line number around 500.

        /* System-wide jiffy work. */
        if (delta >= NS_PER_TICK) {
                do_div(delta, NS_PER_TICK);
                processed_system_time += delta * NS_PER_TICK;
                while (delta > HZ) {

                        asm("":"+r"(delta));

                        do_timer(HZ);
                        delta -= HZ;
                }
                do_timer(delta);
        }

* This works because this asm fools gcc compiler not to use optimization.
I guess do_timer internally uses do_div macro?

I found the same kind of fix in linux kernel here

The AT&T assembly format still looks confusing…

About these ads

3 Responses to “Compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit”

  1. tapas Says:

    Where do I need to edit this file as you are saying I am not clear on this part.

  2. tapas Says:

    Ok I got it

  3. Brittny Heidt Says:

    Hello, Nice publish. I desire everyone would pay such awareness of their organize just like you do. I came acros your blog on yahoo when you are evaluating a compartment. I’m sorry for my poor englisch, i’m throughout the netherlands. Best regards over the netherlands!


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: