How to install GRUB bootloader without installing Linux?

I have Windows 7 installed on the system and I want to create a separate WinPe bootable partition which system can fallback when things go wrong.

Now Windows 7 does give this option and I might also edit the BCD store to make changes in the boot menu of Windows 7, or I could use EasyBCD. I don't want to use these options as I need to customize hiding/unhiding of partitions at the time of booting etc. I search and found GRUB; it might be the tool I am looking for.

I want to use GRUB loader without any version of Linux installed on the system. Can someone guide me on how I can install the GRUB on the hard disk MBR and configure the boot menu? I searched Internet and mostly I came across commands which search the GRUB on the hard disk (because of an existing Linux installation) and then try to repair it. In my case there is no Linux at all.

I have Ubuntu 9.10 bootable CD/ OpenSUSE 11.2 liveCD and installation disc. Can I use them to install GRUB on my system?


Solution 1:

I used GRUB4DOS for installing the GRUB Loader from within windows. I followed these steps.

  1. Downloaded the Grubinst 1.0.1 from http://sourceforge.net/projects/grub4dos/files/

  2. Double click on grubinst_gui.exe in admistrator mode.

  3. It will list the harddisks in the disk category. Select the disk where you want to install GRUB.

  4. Click the refresh button near the Part List and select "whole disk" option.

  5. In the Options section select(tick mark) the option:

    a: Dont search floppy drive

    b: Timeout value of 2-5. Can be changed later in menu.lst

  6. Select the option to "install".

  7. Now copy the files named "grldr" in the C: drive. Dont put it in some folder as it would require changes in the configuration. Grub4Dos will look into each partition for this file.

  8. Now you need to configure the boot menu. Menu options are stored in menu.lst file. You have to create that file and save it along the glrdr.

Sample Menu.lst file. You can write the contents in the notepad and save it as menu.lst.

timeout 2

default 0

title Microsoft Windows XP
rootnoverify (hd0,0)
chainloader //ntldr 

title Microsoft Windows Vista/7
rootnoverify (hd0,1)
chainloader /bootmgr

Here the first primary partition is of Windows XP and second one is of Vista/7 which uses bootmgr as bootloader. These entries will vary based on the installation of OS. This is just an example.

Solution 2:

Both GRuB 1 and GRUB4DOS can be installed without GNU/Linux.

GRuB 1:

  1. Make sure you mave "/boot/grub/*" files (mainly "stage2") in some partition accessible from GRuB 1. (vfat, ext*, reiserfs)
  2. Boot some grub 1 (from floppy, from cdrom).
  3. root (hd0,X) setup (hd0)

GRUB4DOS:

  1. Make sure you have "/GRLDR" somewhere (on vfat, ext*, reisers, NTFS).
  2. bootlace.com your_drive from DOS, Windows or some Linux. (You can do bootlace in Windows (not sure about Windows 7) by copying first N sectors of hard drive to a file, applying bootlace to that file and copying sectors back to drive).

You can also use some virtual machine (qemu, VirtualBox, VMWare) to run little linux and set up any grub in sane way and test if it works fine before rebooting.