(bios) stage and that bootloader stage when we have a nice lilo/grub prompt.

to enable it in kernel, say “yes” in Processor type and features->kexec system call (EXPERIMENTAL)

make and install your kernel.

we will need also a userspace tool called kexec. at the moment of writing, it is not available as package for debian sarge, but is for etch; the sources can be built and installed without any problems, so i don’t see any problems in downloading it from let’s say http://packages.debian.org/testing/source/kexec-tools; i tested them even with slackware and everything worked perfectly.

to boot with kexec we need first to load a kernel image in memory:

kexec -l kernel-image –append=”command-line-options”
kexec -l /boot/bzImage- –append=”root=/dev/hda2″
and then to execute the reboot:
kexec -e

the problem is that here we oversimplify things: we do not term and kill processes, we do not umount filesystems. to make everything to work properly, we just modify /etc/init.d/reboot to look like this:

#! /bin/sh
# reboot Execute the reboot command.
# Version: @(#)reboot 2.75 22-Jun-1998 miquels@cistron.nl


echo -n “Rebooting… ”
#reboot -d -f -i

/usr/local/sbin/kexec -l /boot/bzImage- –append=”root=/dev/hda2″
#/usr/local/sbin/kexec -l /boot/bzImage- –append=”root=/dev/hda2″
#/usr/local/sbin/kexec -l /boot/bzImage- –append=”root=/dev/hda2″

/usr/local/sbin/kexec -e
at this moment we have kexec basically working.