Wednesday, February 17, 2010

Creating a custom boot entry in Grub2 in Ubuntu 9.10

I created a custom boot entry for RHEL 4.5 in grub2 in Ubuntu 9.10. here are the steps

1. Open "/etc/grub.d/40_custom" file and add the following contents and save the file.

#!/bin/sh

cat << EOF
        menuentry "Redhat Enterprise Linux 4.5" {
        linux (hd0,1)/vmlinuz-2.6.9-42.ELsmp root=LABEL=/1 ro rhgb quiet pci=nommconf
        initrd (hd0,1)/initrd-2.6.9-42.ELsmp.img
}
EOF

  •    You may have to pass different parameters to the kernel. Also, In grub2 partition start from (hd0,1) whereas in grub it start from (hd0,0)
  •    Make sure that in the parameter to the kernel root=LABEL=/<something>, <something> is the label of the root partition for the given OS.

2. Run the following command to generate the grub conf file

    $ sudo grub-mkconfig -o /boot/grub/grub.cfg

3. Restart the machine and you are done!
Post a Comment