如何通过 GRUB 从 UEFI 模式下的旧 MBR 分区启动 Windows 8?

Liv*_*eBT 7 uefi grub-efi windows-8

这个问题类似于Windows 8 (GRUB - error: can't find command drivemap) 上 UEFI 上Dual-boot Ubuntu 12.10答案,但 Windows 8 安装在旧分区驱动器上

需要执行哪些步骤才能在 UEFI 模式下启动安装而不转换为 GPT 或使用 DISM?

我知道通常不建议混合使用 UEFI 和传统引导,但它在某些设置中会很方便。

Liv*_*eBT 7

是的,可以在 UEFI 模式下启动 Windows 8,即使您将其安装在旧分区磁盘 (MS-DOS/MBR) 上。当然,您需要在另一个 GPT 分区磁盘上安装 UEFI 兼容的 GRUB。

  1. 在 Windows 中,通过运行以下命令将新的引导配置安装到 C: 卷

    bcdboot C:\Windows /s C: /f uefi
    
    Run Code Online (Sandbox Code Playgroud)

    在 UEFI 模式下引导时,这不仅会在其中创建新的引导配置,C:\EFI\还会在 NVRAM 中注册新的 UEFI 引导加载程序。您可以稍后efibootmgr在 Ubuntu 中删除该条目(有关说明,请参阅:How do I remove "Ubuntu" in the bios boot menu? (UEFI))。

    当然你也可以选择其他位置,不过这个方法应该是最简单的。有关更多详细信息,bcdboot请参阅相应的Microsoft Technet 文章

  2. 在 Ubuntu 中,通过将以下行添加到以下行来添加自定义 GRUB 菜单项/etc/grub.d/40_custom

    menuentry "Windows 8 (BCD-UEFI configuration on system drive /dev/sda2)" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        insmod search_fs_uuid
        insmod chain
    
        set root='hd0,msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  2ACC7043CC700B79
        else
          search --no-floppy --fs-uuid --set=root 2ACC7043CC700B79
        fi
    
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    }
    
    Run Code Online (Sandbox Code Playgroud)

    请注意,如果您的配置不同,您将需要编辑以下参数:

    • 此条目配置为从第msdos2一个硬盘驱动器(hd0ahci0)的第二个分区()引导。
    • 您还需要将文件系统 UUID ( 2ACC7043CC700B79)替换为您的。在此示例中,您可以运行sudo blkid /dev/sda2以获取 UUID 或启动 GParted。
    • 提醒:此示例处理具有旧分​​区表的驱动器。如果您的是 GPT,则替换msdosgpt.
  3. 最后运行sudo update-grub生成新的配置。

答案从https://askubuntu.com/q/377807/40581移过来,因为它在那里看起来不合适。