Comment 6 for bug 1311870

Revision history for this message
Fantu (fantonifabio) wrote :

These are details for build custom pvgrub2 image I did:

aptitude install autogen libdevmapper-dev libfuse-dev unifont # some are optionals but useful (other requirements if I am not mistaken are included in the preparation of xen and qemu from source)
git clone git://git.sv.gnu.org/grub.git
./autogen.sh
./configure --target=x86_64 --with-platform=xen
make
mkdir -p boot/grub/
cat > boot/grub/grub.cfg <<'EOF'
insmod lvm
insmod ext2
insmod part_msdos
insmod part_gpt
insmod btrfs
insmod xzio

insmod regexp
for dev in (*); do
    # $device: parenthesis removed from $dev
    regexp -s device '\((.*)\)' $dev
    set root=$device
    for file in /boot/vmlinuz-* /boot/linux-*; do
        if test -f $file; then
            set saved_root=$root
        fi
    done
done
set root=$saved_root

if test -f /boot/grub2/grub.cfg ; then
    configfile /boot/grub2/grub.cfg
elif test -f /boot/grub/grub.cfg ; then
    configfile /boot/grub/grub.cfg
fi
EOF
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -o pvgrub2.xen -O x86_64-xen -d grub-core/ boot/grub/grub.cfg
mv pvgrub2.xen /boot

To use it simply set the pvgrub2.xen in kernel parameter of domU's xl cfg.
Note: it works only with domUs that have grub2, old domUs with grub1 must use pygrub instead