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

Kernel configuration files included here are based on generic Slackware config
files. For 32bit systems, SMP config was used. To run "make menuconfig" before
compiling Xen kernel, use:

  MENUCONFIG=yes ./kernel-xen.sh

Originally, booting Xen kernel with LILO bootloader is not supported, and GRUB
has to be used. With mbootpack this has changed, and LILO can be used as well.
Basically, mbootpack takes Linux kernel, initrd and Xen VMM, and packages them
up into a file that looks like a bzImage Linux kernel. This script will select
LILO by default, changing to GRUB is easy:

  BOOTLOADER=grub ./kernel-xen.sh

Slackware generic kernel requires initrd image, this script assumes root is on
/dev/sda2 and filesystem is ext4, changes are made with:

  ROOTMOD=ext3 ROOTFS=ext3 ROOTDEV=/dev/sda5 ./kernel-xen.sh

When using LILO bootloader, this is what the lilo.conf should have:

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

Everything on the left side of "--" is passed to Xen kernel, and what's on the
right, goes to Linux kernel.

When using GRUB, /boot/grub/menu.lst should have these:

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

Booting Xen on a native EFI system is also an option, but the only clean
solution at this time requires a modified binutils package. More experienced
user can add "x86_64-pep" to the list of enabled targets and build/replace
binutils on their system. Subsequently, building Xen will now also create a
Xen EFI binary.

To make things a bit easier, a copy of Xen EFI binary can be found here:

  http://slackware.hr/~mario/xen/xen-4.13.1.efi.gz

If an automatic boot to Xen kernel is desired, the binary should be renamed and
copied to the following location: /boot/efi/EFI/BOOT/bootx64.efi
Downloaded binary should be unpacked first, and the config file should be
present in the same directory (same file name, minus the suffix).
For example: "xen.cfg" or "bootx64.cfg", and its contents:

  [global]
  default=xen

  [xen]
  options=dom0_mem=min:512M,max:512M,512M
  kernel=vmlinuz-xen root=/dev/sda2 ro console=tty0 nomodeset
  ramdisk=initrd-xen.gz

There are some other EFI bootloaders, for example ELILO comes with the support
for VMM images, but their x86 support is lacking. GRUB2 apparently supports
only the chainloader method; however, the stock Slackware version is too old
for this task. rEFInd should work, but the Xen EFI method was satisfactory to
the author :-)

Troubleshooting dom0 crashes, freezes, blank screen and such:

  * Use /proc/fb to find an out of range device id, for example this can be
    added to Linux kernel: fbcon=map:9
  * Look in dmesg/lsmod for potential framebuffer devices to blacklist
  * Compile Linux kernel with CONFIG_FB=n
  * Use another VGA card :-)
