Build Xen Kernel (no pae)

Because I found numerous pages and list questions about “How to build a non PAE Debian XEN Kernel?“, I will try myself in English to explain my solution to whom it might concern.

It will probably concern other people who do not go along well - like me - with the idea of a DomU with the ability to load and unload the whole kernel tree build as modules.

I stick by the rule for Servers, “Keep the kernel as small as possible.“ and install a second generic kernel to provide an easy way to change the Hardware when needed.

Reasons

I have a Via Epia mainboard and therefore I can not use a PAE enabled kernel. There are a number of other people having the same problem. Since the newest Debian Etch Kernel Version 2.6.18-4 the developer do not longer provide a non PAE Kernel for XEN.

The problem is that this is mentioned nowhere, neither in the package nor anywhere else. That is why some of us spending a lot of time - for me about 10h - to figure that out and to find a work around. The Debian kernel developer seem to stick by the words, “We can't provide too many Kernel versions.“, or even worse “Who needs a XEN Kernel without PAE anyway“. I am sorry that I can not quote them any more but on my search I didn't know about writing this How-to. So I laughed bitterly and went on.

The search for a solution

I tried many things.

Getting the old kernel

The easiest way to solve this problem would be to install the old kernel Version 2.6.18-3. Asking your favourite search engine provided me only hits to site talking about this version but not providing it.

Maybe some of you have more luck but there still is the pain to use an old Version with possible security holes.

apt-get source

The best way to build your own modified version of a program is to get the sources, modify the make rules and hit debian/rules.

Doesn't work this way for this one!

Oho… I tried this for a long time encouraged by finding theses very informative sites

Using these commands mostly inspired by the last URL

apt-get source linux-2.6
apt-get install build-essential
apt-get build-dep linux-2.6
cd linux-2.6-*
debian/rules debian/build debian/stamps
make -f debian/rules.gen setup-i386-xen-686

terminal

I did not edit the .config file or any other config* file. He said it wouldn't work. I read the debian/rules.gen file and searched for the keyword binary-arch-i386-xen-686 he used to compile and found his problem.

       $(MAKE) -f debian/rules.real binary-arch-flavour MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686-bigmem' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386-pae' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='-4' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'

debian/rules.gen -- about line 600+

The system used by the developer is very nice and handy. They are „loading“ numerous configuration files KCONFIG= starting by the most generic common to all Debian kernel versions and ten getting more and more specific.

Now you can see why Phillip did not succeed.

My solution was to edit the i386/config.686-bigmem to i386/config.686 because bigmem was causing the problem. Theses changes did what I wanted but the compilation did not finish.

binary-arch-i386-xen-686-real:
#       $(MAKE) -f debian/rules.real binary-arch-flavour MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686-bigmem' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386-pae' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='-4' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
#       $(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='-pxen-linux-system-2.6.18-4-xen-686' MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686-bigmem' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386-pae' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='-4' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
#       $(MAKE) -f debian/rules.real build MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686-bigmem' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386-pae' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='-4' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
        $(MAKE) -f debian/rules.real binary-arch-flavour MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
        $(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='-pxen-linux-system-2.6.18-4-xen-686' MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
build-i386-xen-686-real:
        $(MAKE) -f debian/rules.real build MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
setup-i386-xen-686-real:
#       $(MAKE) -f debian/rules.real setup-flavour MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686-bigmem' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386-pae' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'
        $(MAKE) -f debian/rules.real setup-flavour MAJOR='2.6' FLAVOUR='686' KCONFIG='config i386/config i386/xen/config _xen/config i386/config.686' LOCALVERSION_HEADERS='-xen' SUBARCH='xen' UPSTREAMVERSION='2.6.18' INITRD_CMD='mkinitramfs-kpkg' MODULES='True' XEN_VERSIONS='3.0.3-1-i386' SOURCEVERSION='2.6.18.dfsg.1-12etch2' VERSION='2.6.18' KERNEL_HEADER_DIRS='i386' KERNEL_ARCH='i386' ABINAME='-4' TYPE='plain-xen' LOCALVERSION='-xen-686' ARCH='i386' COMPILER='gcc-4.1'

My changes to debian/rules.gen

I think still think that this would have been the best way but I ran into the ABI problem! Maybe someone has some ideas solving it.

make[2]: Leaving directory `/usr/src/linux-2.6-2.6.18.dfsg.1/debian/build/build-i386-xen-686'
python2.4 debian/bin/abicheck.py debian/build/build-i386-xen-686 i386 xen 686
ABI has changed!  Refusing to continue.
 
Added symbols:
gs_block_til_ready                               module: drivers/char/generic_serial
gs_chars_in_buffer                               module: drivers/char/generic_serial
gs_close                                         module: drivers/char/generic_serial
gs_flush_buffer                                  module: drivers/char/generic_serial
gs_flush_chars                                   module: drivers/char/generic_serial
gs_getserial                                     module: drivers/char/generic_serial
gs_got_break                                     module: drivers/char/generic_serial
gs_hangup                                        module: drivers/char/generic_serial
gs_init_port                                     module: drivers/char/generic_serial
gs_put_char                                      module: drivers/char/generic_serial
gs_set_termios                                   module: drivers/char/generic_serial
gs_setserial                                     module: drivers/char/generic_serial
gs_start                                         module: drivers/char/generic_serial
gs_stop                                          module: drivers/char/generic_serial
gs_write                                         module: drivers/char/generic_serial
gs_write_room                                    module: drivers/char/generic_serial
 
Changed symbols:
DAC1064_global_init                              version: 0xdcf9cb8c -> 0x5197d1d6
DAC1064_global_restore                           version: 0xaf6c7fe5 -> 0x72927ce6
DoC2k_init                                       version: 0x7332e934 -> 0xe3150db5
 
[... and so on]
 
zl10353_attach                                   version: 0x5703ab73 -> 0xa3246e38
zl10353_write                                    version: 0x1107cef5 -> 0xdd145ee3
zone_table                                       version: 0xdc0fc19b -> 0x4d84bf7a
make[1]: *** [debian/stamps/build-i386-xen-686-plain-xen] Fehler 1
make[1]: Leaving directory `/usr/src/linux-2.6-2.6.18.dfsg.1'
make: *** [binary-arch-i386-xen-686-real] Fehler 2

ABI error

I tried to override the ABI check but it did not work.

apt-get install linux-source

That was the way I happily build kernels for many years. Since newer times I mostly stick to the huge Debian kernel. Mostly because I got lazy ;)

This package does not seem to provide the real Debian kernel. I never knew that so I never build the right kernels…

Anyway, loading the „here is our patch to the vanilla kernel“ package linux-patch-debian-2.6.18 I tried configure it with XEN. It didn't work either using the standard way.

Build from scratch

Nice idea but no way. You can read on other how-to's that I did it many times successfully but since XEN gets provided by Debian and Ubuntu - for both I had my problems1) - I want to use it and more important I want the comfort.

The solution

I almost gave up and thought about how to secure my home server system through other mechanisms, I found an older bookmark I had about some XEN problems with Debian. Actually it was / is a bug found times before the final release of Debian Etch concerning the ability to patch the Debian linux-source* package with the Debian linux-patch-debian-2.6.18 package.

Following the work around I finally managed to build a Debian XEN kernel without PAE.

Install packages

aptitude install linux-patch-debian-2.6.18 linux-source-2.6.18 kernel-package libncurses-dev

Install packages

:!: Don't forget a compiler.

Apply patch work around

Do not use the program cat like described in the bugfix. All $ variables get replaced by the shell.

mkdir /usr/src/kernel-patches/all/2.6.18/xen/

create directory - don't know why

#!/bin/sh
 
echo "Applying debian patch with xen parts"
 
if [ -z "$KPKG_ARCH" ]; then
  KPKG_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
fi
 
/usr/src/kernel-patches/all/2.6.18/apply/debian --arch $KPKG_ARCH --subarch xen

/usr/src/kernel-patches/all/2.6.18/apply/xen

#!/bin/sh
set -e
 
upstream="2.6.18"
exec "/usr/src/kernel-patches/all/$upstream/apply/debian" "$upstream-4"

/usr/src/kernel-patches/all/2.6.18/unpatch/xen

chmod a+x /usr/src/kernel-patches/all/2.6.18/apply/xen /usr/src/kernel-patches/all/2.6.18/unpatch/xen

make them executable

Configure and build

cd /usr/src
tar xjf linux-source-2.6.18.tar.bz
cd linux-source-2.6.18
make-kpkg --added-patches xen --initrd --revision 2.6.18-4 --append-to-version -c-xen-nopae-686 --config menuconfig configure kernel_image

untar and go...

Now remove the Highmem set to 64 GB changing it to off. Than hit exit and save your changes. After a very long time the package is ready to install.

Maybe someone can explain how to build a package like linux-modules-2.6.18-4-xen-686.

Conclusion

It is somehow understandable that the Debian developers are not able to provide too many kernels. But they need to keep the package information up to date and need to mention that their XEN does only run with PAE capable CPUs.

It would be nice of them to provide a mall quick-and-dirty how-to about this, what I did here, since they decided no to deliver non-PAE XEN kernel any more.

I is a shame and I myself struggle a bit about my loved Debian that such a bug dose not get fixed.

I hope I could help some people out there and would appreciate some help about the two open questions.

1) for Debian described here, for Ubuntu edgy the well known „you can only start one DomU otherwise your system crashes“ bug

Diskussion

Stefan BauerStefan Bauer, 2007/07/22 19:37

you made my day and prevent me for wasting a day of research on this problem.

thanks dude.

Stefan BauerStefan Bauer, 2007/07/22 19:41

you made my day and prevent me for wasting a day of research on this problem.

thanks dude.

JoshJosh, 2007/09/08 12:04

If you get the next error

black:/usr/src/linux-source-2.6.18# make-kpkg –added-patches xen –initrd –revision 2.6.18-4 –append-to-version -c-xen-nopae-686 –config menuconfig configure kernel_image I note you are using a hyphen in the revision number. Please ensure that the upstream and debian revision numbers are policy compliant enough that dpkg and shall not choke on them at the end of the compile exec make -f /usr/share/kernel-package/ruleset/minimal.mk debian DEBIAN_REVISION=2.6.18-4 APPEND_TO_VERSION=-c-xen-nopae-686 KPKG_SELECTED_PATCHES=”xen” INITRD=YES /usr/share/kernel-package/ruleset/minimal.mk:53: No .config file found /usr/share/kernel-package/ruleset/minimal.mk:98: *** Please create a .config file. Alto. Failed to create a ./debian directory: No existe el fichero o el directorio at /usr/bin/make-kpkg line 1096.

You can try black:/usr/src/linux-source-2.6.18#make menuconfig

and then black:/usr/src/linux-source-2.6.18# make-kpkg –added-patches xen –initrd –revision 2.6.18-4 –append-to-version -c-xen-nopae-686 –config menuconfig configure kernel_image

Jens GreifenhagenJens Greifenhagen, 2007/10/12 14:54

Hi,

on this Site: http://debiananwenderhandbuch.de/kernelbauen.html I found the target “modules”. This should build the modules Package. Just append modules to your make-kpkg line. (It is still building the packages...)

Thanks for the research and help!

Greetings Jens

Andrei WarkentinAndrei Warkentin, 2008/01/19 22:13

Danke sehr! This was an excruciatingly annoying problem that you thankfully found a solution to. I wasted a lot of time trying to figure this out, mostly due to the 1001 ways of building a kernel from Debian sources.

Uli SchleeUli Schlee, 2008/12/23 16:12

Hi!

Ich kämpfe immer noch mit dem Erzeugen des Kernels auf meinem Epia EK8000. Ich habe mir die config* aus dem /boot-verzeichnis der Standardinstallation ins /usr/src/linux-source-2.6.18-Verzeichnis als .config kopiert. Dann das Kompilieren gestartet (zuerst noch ein .debian-Verzeichnis erstellt).

Läuft alles durch. Aber nach dem dpkg -i linux-image…..deb fehlt der Eintrag in Grub.

Also per Hand nachgetragen. Kernel bootet, hat aber keine XEN-eigenschaften. Hätte ich mit menuconfig einen XEN-Prozessor eintragen müssen? Dann wird nämlich der Unerpunkt XEN zugänglich. Wie muss die .config-Datei aussehen?

Danke für die Hilfe

Gruß Uli.

Geben Sie Ihren Kommentar ein (Wiki-Syntax ist zugelassen):
Wenn Sie die Buchstaben auf dem Bild nicht lesen können, laden Sie diese .wav Datei herunter, um sie vorgelesen zu bekommen.
computer/howtos/buildxenkernelnopae_howto.txt · Zuletzt geändert: 2007/06/27 12:10 von corren
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0