grub2 has added support for xen paravirtualization. 32-bit support only works on more recent versions of xen (currently only on field and lefanu) while 64-bit support works everywhere.
The distributions available on /distros may have a config file available for grub2, but they have not been edited to be sane (for example, the search path for root includes a UUID.) You will need to regenerate the file using the tools for your distribution.
32-bit grub2 is available on the platforms that support it. On the ones that don't, switching from pv-grub to grub2 will force 64-bit mode and switching from 64-bit to 32-bit mode will force pv-grub.
Log into the management console. Select option 9 to switch between pv-grub and grub2.
If 32-bit grub2 is not available and "i386" is the current bootloader, you will see:
9. swap pvgrub/grub2 bootloaders currently "pv-grub" This will also switch from i386 to amd64. 0. exit
If 32-bit grub2 is available and "i386" is the current bootloader, you will see:
9. swap pvgrub/grub2 bootloaders currently "grub2" 0. exit
grub2 boots directly to your hard drive because the rescue image will not attempt to load any grub2 configuration files. To use the rescue image, either switch back to pv-grub or do the following at the grub2 prompt:
- type 'c' to enter a command line. You will see a screen like:
GNU GRUB version 2.02~beta2-9ubuntu1+prgmr1 Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions. ESC at any time exits. grub>
- Set root to be xvde
grub> set root='xen/xvde,msdos1'
- Load legacy configuration file for rescue image
grub> legacy_configfile /boot/grub/menu.lst
Compatible file systems
The following file systems have been explicitly tested:
The following are available but have not been tested:
Config file search paths
The following configuration file is compiled into the grub2 image:
insmod part_msdos insmod part_bsd insmod part_gpt for part in msdos1 gpt1 bsd1; do for maindir in boot/ /; do for subdir in grub grub2; do if [ -f "(xen/xvda,$part)/$maindir/$subdir/grub.cfg" ]; then set root=(xen/xvda,$part) configfile /$maindir/$subdir/grub.cfg fi done done done if [ -f "(xen/xvda,msdos1)/boot/grub/menu.lst" ] ; then set root=(xen/xvda,msdos1) legacy_configfile /boot/grub/menu.lst fi set root=(xen/xvde,msdos1) legacy_configfile /boot/grub/menu.lst
The nested for loop will search first in (xen/xvda,msdos1)/boot/grub/grub.conf, then (xen/xvda,msdos1)/boot/grub2/grub.conf, and so forth.
The base source code is pulled from ubuntu trusty. The following patches were applied:
- legacy_parse.patch - ignores root in legacy config files, probably not required
- xen-hd.patch - handles disks named 'hd<X>', pulled from this upstream commit
- xen-fix-dl-ref.patch - makes module reference code more like grub-core/loader/i386/linux.c, possibly not required
- xen-linux16.patch - maps linux16/initrd16 commands to linux/initrd, pulled from https://build.netitwork.net/package/view_file/FairWind:12.0/grub2/grub2-xen-linux16.patch
- xen-initrd-ctx-init.patch - keeps failures of initrd from crashing grub2, modeled off of this upstream commit
To generate the executables, I ran
grub-mkstandalone --compress=gz -O i386-xen -o grub2-x86_32.gz boot/grub/grub.cfg grub-mkstandalone --compress=gz -O x86_64-xen -o grub2-x86_64.gz boot/grub/grub.cfg