Xen port
From ReactOS
For those not familiar with Xen, here's the homepage
The Xen port of ReactOS is taking place in the SVN xen branch at svn://svn.reactos.org/branches/xen. At the moment, it will only compile under Linux, not under Windows, 'cause we need an ELF executable as boot image for the guest OS. For the moment, that's not a big issue, since you need Linux as your dom0 OS anyway.
You can build ReactOS for both Xen 2.0 (xen-2.0, xen-testing) and Xen 3.0 (xen-unstable). You have to indicate your build target by setting the XEN variable in reactos/config. For Xen 3, you need to #define CONFIG_XEN_BLKDEV_GRANT in reactos/include/xen3/rosxen.h if your xen0 Linux kernel was compiled with CONFIG_XEN_BLKDEV_GRANT. If your xen0 Linux kernel was compiled without that option, you should remove the #define from reactos/include/xen3/rosxen.h. An easy way to see how your Linux kernel was compiled is to check if /proc/xen/grant exists. If it does, #define CONFIG_XEN_BLKDEV_GRANT.
So, how do you setup and run ReactOS under Xen? First of all, it doesn't really run at the moment. The ReactOS bootloader, FreeLoader, can be loaded and will actually start to execute, but that's about it. Still, if you're interested in playing along, you need to set up a Xen environment. You also need to set up a ReactOS build environment. Checkout svn://svn.reactos.com/branches/xen/reactos. Set the target Xen version in reactos/config. Build ReactOS. This will give you a lot of stuff which doesn't work yet, but it will also produce an ELF version of FreeLdr, in reactos/boot/freeldr/freeldr/freeldr.elf. Move that file to the /boot directory of your dom0.
Next, you need to setup a disk image for ReactOS to use. This can be a real disk, a disk partition, or a file. We're going to use a file here. Create it using:
mkdir /xen
cd /xen
dd if=/dev/zero of=ros.img bs=1k seek=51199 count=1
mkfs.vfat ros.img
This should create an 50Mb image file /xen/ros.img, formatted as FAT.
On the image file, create a freeldr.ini file. First you need to mount the image file:
mkdir /xen/mnt
mount -o loop /xen/ros.img /xen/mnt
After it is mounted, create /xen/mnt/freeldr.ini with the following contents:
[FREELOADER] DefaultOS=ReactOS [Display] TitleText=ReactOS Boot Manager StatusBarColor=Cyan StatusBarTextColor=Black BackdropTextColor=White BackdropColor=Blue BackdropFillStyle=Medium TitleBoxTextColor=White TitleBoxColor=Red MessageBoxTextColor=White MessageBoxColor=Blue MenuTextColor=White MenuColor=Blue TextColor=Yellow SelectedTextColor=Black SelectedColor=Gray SpecialEffects=No [Operating Systems] ReactOS="ReactOS" ReactOS_Debug="ReactOS (Debug)" [ReactOS] BootType=ReactOS SystemPath=multi(0)disk(0)rdisk(0)\ReactOS [ReactOS_Debug] BootType=ReactOS SystemPath=multi(0)disk(0)rdisk(0)\ReactOS Options=/DEBUGPORT=SCREEN /NOGUIBOOT
Unmount the image file:
umount /xen/mnt
Next, create a /etc/xen/ReactOS file with the following contents:
kernel ="/boot/freeldr.elf" memory = 32 name = "ReactOS" disk = ['file:/xen/ros.img,sda1,w']
Start a new guest using: "xm create ReactOS -c". This will create the guest VM and start executing FreeLdr in it. FreeLdr should show its boot menu:
You should be able to use the "up" and "down" cursor keys to walk through the menu items. Pressing "Enter" will select a menu item. This will load the kernel plus associated files and start executing the kernel. Since the kernel is not Xen-aware yet, it will immediately crash. Looking at the console, you'll see it go all-black (that's one of the final actions carried out by FreeLdr) and then nothing happens. A "xm list" will reveal that the domain crashed.
If you have questions, comments or suggestions please email me at gvg@reactos.com or drop me (GvG) a note on IRC.
Ge van Geldorp.
Port progress log:
2005/06/02 ReactOS domain builder submitted to Xen
2005/05/20 FreeLdrs job is complete, kernel starts executing (but crashes immediately)
2005/05/16 Full screen output, console input
2005/04/14 Disk input
2005/04/13 Basic event handling
2005/04/05 Added exception handling
2005/04/01 Added support for Xen 2.0
2005/03/30 Memory management for FreeLdr completed
2005/03/24 Start of port

