Grub2 – How to Convert Grub Entry to Grub2 Entry

grub2

So here's the thing.
I have two partition in my netbook (plus swap):

/dev/sda4 with Ubuntu 10.4
/dev/sda5 with Centos 5.5

I use Ubuntu obviously. Centos is there because I need to run some test on that distro. The problem is Centos uses Grub and Ubuntu uses Grub2.

This is /boot/grub/menu.lst from Centos:

default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz

    title CentOS (2.6.18-194.17.4.el5xen)
            root (hd0,4)
            kernel /boot/xen.gz-2.6.18-194.17.4.el5
            module /boot/vmlinuz-2.6.18-194.17.4.el5xen ro root=LABEL=/1 rhgb quiet
            module /boot/initrd-2.6.18-194.17.4.el5xen.img
    title CentOS (2.6.18-194.el5xen)
            root (hd0,4)
            kernel /boot/xen.gz-2.6.18-194.el5
            module /boot/vmlinuz-2.6.18-194.el5xen ro root=LABEL=/1 rhgb quiet
            module /boot/initrd-2.6.18-194.el5xen.img

The /boot/grub/grub.cfg from Ubuntu:

menuentry "CentOS release 5.5 (Final) (on /dev/sda5)" {
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set 66daaf1a-53b0-4e12-96f3-db01d52e12d1
        linux /boot/vmlinuz-2.6.18-194.17.4.el5xen root=/dev/sda5
}
menuentry "CentOS release 5.5 (Final) (on /dev/sda5)" {
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set 66daaf1a-53b0-4e12-96f3-db01d52e12d1
        linux /boot/vmlinuz-2.6.18-194.el5xen root=/dev/sda5
}

This was generated running update-grub2 and grub-install under Ubuntu.
It's not working. It gives me something like bad magic number.

How can I convert the grub1 entry in a grub2 shape?

Best Answer

Ok so since I was unable to find specific information on a proper conversion of grub1 for Centos5.5 that's what I did.

menuentry "CentOS release 5.5 (Final) (on /dev/sda5)" {
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set 66daaf1a-53b0-4e12-96f3-db01d52e12d1
        drivemap -s (hd0) ${root}
        chainloader +1
}

Basically I chainloaded grub1 loader inside grub2 loader.

Related Question