LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Set up Windows as boot option in Grub2 (http://www.linuxquestions.org/questions/slackware-14/set-up-windows-as-boot-option-in-grub2-4175426079/)

arubin 09-07-2012 02:23 AM

Set up Windows as boot option in Grub2
 
I have an UEFI/GPT system with Grub2 booting Slackware on sda and UEFI/GPT booting Windows on sdb.

I want to add Windows to the gub list as it was not added automatically.

I have seen this

Quote:

(Find the UUID of the FAT32 filesystem in the UEFI SYSTEM PARTITION where the Windows UEFI Bootloader files reside. For example, if Windows bootmgfw.efi exists at /boot/efi/efi/Microsoft/Boot/bootmgfw.efi (ignore the upper-lower case differences since that is immaterial in FAT fs):
# grub-probe --target=fs_uuid /boot/efi/efi/Microsoft/Boot/bootmgfw.efi
1ce5-7f28
Then, add this code to grub.cfg to chainload Windows x86_64 (Vista SP1+, 7 or 8) installed in UEFI-GPT mode :
menuentry "Windows x86_64 UEFI-GPT" {
search --fs-uuid --no-floppy --set=root 1ce5-7f28
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
So I tried mounting the small FAT partition containing efi/Microsoft/Boot/bootmgfw.efi and
managed to get out a code. But this would not boot and I had an error - unrecognised code.

I have also seen this

Quote:

Chainload Microsoft Windows x86_64 UEFI-GPT Find the UUID of the FAT32 filesystem in the UEFI SYSTEM PARTITION where the Windows UEFI Bootloader files reside. For example, if Windows bootmgfw.efi exists at /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi (ignore the upper-lower case differences since that is immaterial in FAT filesystem):

# grub-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
1ce5-7f28
# grub-probe --target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
--hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1
Then, add this code to /boot/grub/grub.cfg OR /boot/efi/EFI/grub/grub.cfg to chainload Windows x86_64 (Vista SP1+, 7 or 8) installed in UEFI-GPT mode:

menuentry "Microsoft Windows x86_64 UEFI-GPT" {
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 1ce5-7f28
chainloader /efi/Microsoft/Boot/bootmgfw.efi
}
but grub-probe did not like the instruction # grub-probe --target=hints_string

Any ideas?

TIA

Snark1994 09-07-2012 07:21 AM

The best way is to use the files in '/etc/grub.d':

Code:

[joshua:/etc/grub.d]$ ls
00_header  10_linux  20_linux_xen  20_memtest86+  30_os-prober  40_windows  41_custom  README
[joshua:/etc/grub.d]$ cat 40_windows
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Microsoft Windows 7 BIOS-MBR" {
    insmod part_msdos
    insmod ntfs
    insmod search_fs_uuid
    insmod ntldr   
    search --fs-uuid --no-floppy --set=root F060B0DA60B0A92C
    ntldr /bootmgr
}

Where "F060B0DA60B0A92C" is the UUID of my windows partition.

You then just run 'sudo grub-mkconfig -o /boot/grub/grub.cfg' and it generates a grub.cfg for you.

http://en.gentoo-wiki.com/wiki/Grub2..._Windows_Entry and https://wiki.archlinux.org/index.php...tiboot_in_BIOS both cover the issue, though I think Arch uses a newer version (because it says you don't have to chainload, like in my config, whereas gentoo doesn't say that).

Hope this helps,


All times are GMT -5. The time now is 02:42 AM.