kernel-xen.sh: This script builds the Linux Kernel for the Xen Hypervisor.

To run this scipt you will need the rebased OpenSUSE Xen kernel patches:
http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.34-6.tar.bz2
(md5sum: afb08178200fa34fd24c4d9d03174102)

Since the patches are for 2.6.34.7 kernel, you can get it from here:
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.7.tar.bz2
(md5sum: 8964e26120e84844998a673464a980ea)

The configuration files included here are based on Slackware 2.6.33.4 configs.
For 32bit systems, SMP based config was used. You may run "make menuconfig"
before compiling a Xen kernel by passing the "MENUCONFIG=yes" to the scipt.

Another variable worth mentioning here is "BOOTLOADER=", wich can be used to
select how kernel is packed. Valid options are "lilo" and "grub".

By default, a "huge" kernel config is chosen, but you may opt for the generic
kernel by passing the "KERNEL=generic" variable to the script. In this case,
you will need to make an ad-hoc initrd after installing this package.
For example:

# depmod 2.6.34.7-xen
# mkinitrd -c -k 2.6.34.7-xen -f ext4 -r /dev/sda1 -m ext4 -o /boot/initrd-xen.gz

For details on initrd, read /boot/README.initrd, for hints run:
/usr/share/mkinitrd/mkinitrd_command_generator.sh script and read the Xen
User Manual and the README file that comes with the Xen package.

Originaly, booting a Xen kernel with LILO bootloader is not supported, so GRUB
has to be used. Since some of us still preffer LILO over GRUB, there is a way
to accomplish this with mbootpack. Basicly mbootpack takes Linux kernel, initrd
and Xen VMM, and packages them up as a single file that looks like a bzImage
Linux kernel. For example this is how mbootpack works:

# cd /boot
# gzip -d -c /boot/xen-4.1.2.gz > /boot/xen-4.1.2
# gzip -d -c /boot/initrd-xen.gz > /boot/initrd-xen
# mbootpack -o /boot/vmlinuz-2.6.34.7-xen -m /usr/src/linux-2.6.34.7-xen/vmlinux \
    -m /boot/initrd-xen /boot/xen-4.1.2

After a new kernel image is created, add something like the folowing to lilo.conf:

image = /boot/vmlinuz-xen
  root = /dev/sda1
  label = XenLinux
  append="dom0_mem=256M -- nomodeset"
  read-only

Note: everything before "--" is passed to Xen, and everything after "--" is
passed to the Linux kernel.

If for some reason LILO is not good enough, you can always use GRUB.
GRUB may be installed from Slackware's extra repository. The GRUB package
is not available from the Slackware x86_64 distribution, but the source
and a SlackBuild may be found in its extra/source repository.

grubconfig that comes with Slackware's GRUB package may give a starting point
to configure GRUB. Moreover, the Xen User Manual and its README file installed
with the Xen package include details on which parameters to include in the GRUB
configuration file. For example, include these lines in /boot/grub/menu.lst:

title Slackware XenLinux 13.37
         root (hd0,0)
         kernel /boot/xen.gz dom0_mem=262144 console=vga
         module /boot/vmlinuz-xen root=/dev/sda1 ro console=tty0 nomodeset
         module /boot/initrd-xen.gz

Additional notes about bootloaders:
  A dom0_mem parameter is critical for a 32bit Slackware install.
  You only need the initrd if you install a generic kernel.

Aditional notes on framebuffer problems:
  If your dom0 kernel crashes or freezes at boot, either with an automatic
  reboot or with the blank screen, here are some things to try:
  - Specify an out of range number to "fbcon" to disable FB altogether,
    for an example append fbcon=map:9 to the Linux kernel.
    (To see a list of available devices in your system: cat /proc/fb)
  - Blacklist FB module from loading, this one requires a bit of
    digging arround in dmesg/lsmod to find out wich module is loading.
  - Disable FB device in question or simply set CONFIG_FB=n in kernel config.
  - Replace the VGA card? :^)
