Boot grub2 stage2 directly from windows bootmgr with grub4dos stage1

There is problem which has been puzzled me for long time. When the grub2 root is on 2nd disk, the stage2 is not directly bootable from grub4dos stage1, but can be chain loaded from grub4dos as a linux kernel. The same problem happens to burg as well.

It turns out the stage2 file only has the relative path from root if you use grub-install script. So all you have to do is to embed a absolute path in prefix. Here is the brief step to make a direct bootable stage2.

grub-mkimage --output=/boot/grub/core.img --prefix=(hd1,2)/boot/grub \
         biosdisk part_msdos ext2
cat /boot/grub/lnxboot.img /boot/grub/core.img > g2ldr

Now copy g2ldr to your windows’ partition. Make a grub4dos stage1 file

grubinst.exe -o -b=g2ldr g2ldr.mbr

You can find grubinst.exe from grub4dos website.

Add it to windows bootmgr with bcdedit

bcdedit /create /d Linux /application BOOTSECTOR
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \g2ldr.mbr
bcdedit /displayorder {ID} /addlast
  • http://www.linuxquestions.org/questions/linux-software-2/grub-config-on-another-disk-877912/page2.html#post4346785 GRUB config on another disk – Page 2

    [...] to be based on to detect more drives. This blogger describes how to load GRUB2 level 2 from G4D. GRUB2 Level 2 from G4D Level 1. 3. If you’re using Vista or 7, use BCDEDIT to add G4D to Windows boot menu. This site describes how [...]

  • 민준 김

    grub-mkimage –output=/boot/grub/core.img –prefix=(hd1,2)/boot/grub biosdisk part_msdos ext2
    If I command grub-mkimage, the result is
    bash: syntax error near unexpected token `(‘
    Can you help me?
    Thanks.

  • Helper

    Try grub-mkimage –output=/boot/grub/core.img –prefix=(hd1,2)/boot/grub biosdisk part_msdos ext2

  • http://m91610464.myid.net/ 민준 김

    Thank you, helper.
    But that command also have error.
    If I command –output=/boot/grub/core.img –prefix=(hd0,7)/boot/grub biosdisk part_msdos ext2
    The result is
    Target format not specified (use the -O option).

    Thanks.

    I think add ‘-O i386-pc’ is good. What is target format of that command?

  • http://bertrand.belguise.net/blog/articles/2012/dualboot-vista-linux-sur-un-deuxieme-disque/ Ecoute le viel homme délirer » dualboot vista-linux sur un deuxième disque

    [...] La solution m’est venue de l’article boot grub2 stage2 directly from windows with grub4dos stage1 [...]