Pre-installed Windows 7 then installed ubuntu 12.04 using live CD.
Ubuntu did not boot so used boot-repair to fix this problem but it did not work.
Now it directly boots to BIOS.
To restore it follow the steps below.
To Reinstall Grub:
To add boot-repair to the repository
To update your repository
To install boot-repair