无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 13104|回复: 5
打印 上一主题 下一主题

GRUB2怎样安装到U盘启动。并支持UEFI。

[复制链接]
跳转到指定楼层
1#
发表于 2013-3-3 10:47:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
推荐
发表于 2013-3-4 21:48:01 | 只看该作者
不行,目前grub2引导,BIOS 和uefi 不能并存
回复

使用道具 举报

3#
发表于 2013-3-6 15:06:19 | 只看该作者

回复 #1 2012zhaoping 的帖子

[strike]UEFI貌似只支持GPT类型下启动。[/strike]先把U盘用转换成GPT模式,然后安装GRUB2。
在linux下相对容易点。可以参考wiki。
[script]alert(test)[/script]

来自arch wiki 但是中文版没有下面内容
  1. https://wiki.archlinux.org/index.php/Grub2#Hardware-Specific_UEFI_Examples
复制代码

下载包
For 64-bit aka x86_64 UEFI firmware:
# pacman -S grub-efi-x86_64
For 32-bit aka i386 UEFI firmware:
# pacman -S grub-efi-i386

Install grub-uefi boot files
Install to UEFI System Partition

Note: The below commands assume you are using grub-efi-x86_64 (for grub-efi-i386 replace x86_64 with i386 in the below commands).
Note: To do this, you need to boot using UEFI and not the BIOS. If you booted by just copying the ISO file to the USB drive, you will need to follow this guide or grub-install will show errors.
这里需要挂着U盘,同时建立boot分区,所以相对的命令代码的目录需要适当改变eg:# mkdir -p /boot/efi 变为 /mnt/boot/efi(假设挂载到mnt)
The UEFI system partition will need to be mounted at /boot/efi/ for the GRUB(2) install script to detect it:
# mkdir -p /boot/efi
# mount -t vfat /dev/sdXY /boot/efi

Install GRUB UEFI application to /boot/efi/EFI/arch_grub and its modules to /boot/grub/x86_64-efi (recommended) using:
# modprobe dm-mod
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug
# mkdir -p /boot/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Note: Without --target or --directory option, grub-install cannot determine for which firmware grub(2) is being installed. In such cases grub-install will show source_dir doesn't exist. Please specify --target or --directory message.

If you want to install grub(2) modules and grub.cfg at the directory /boot/efi/EFI/grub and the grubx64.efi application at /boot/efi/EFI/arch_grub (ie. all the grub(2) uefi files inside the UEFISYS partition itself) use:
# modprobe dm-mod
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --boot-directory=/boot/efi/EFI --recheck --debug
# mkdir -p /boot/efi/EFI/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/efi/EFI/grub/locale/en.mo
The --efi-directory option mentions the mountpoint of UEFI SYSTEM PARTITION , --bootloader-id mentions the name of the directory used to store the grubx64.efi file and --boot-directory mentions the directory wherein the actual modules will be installed (and into which grub.cfg should be created).
The actual paths are:
<efi-directory>/<EFI or efi>/<bootloader-id>/grubx64.efi
<boot-directory>/grub/x86_64-efi/<all modules, grub.efi, core.efi, grub.cfg>
Note: the --bootloader-id option does not change <boot-directory>/grub, i.e. you cannot install the modules to <boot-directory>/<bootloader-id>, the path is hard-coded to be <boot-directory>/grub.
In --efi-directory=/boot/efi --boot-directory=/boot/efi/EFI --bootloader-id=grub:
<efi-directory>/<EFI or efi>/<bootloader-id> == <boot-directory>/grub == /boot/efi/EFI/grub
In --efi-directory=/boot/efi --boot-directory=/boot/efi/EFI --bootloader-id=arch_grub:
<efi-directory>/<EFI or efi>/<bootloader-id> == /boot/efi/EFI/arch_grub
<boot-directory>/grub == /boot/efi/EFI/grub
In --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=arch_grub:
<efi-directory>/<EFI or efi>/<bootloader-id> == /boot/efi/EFI/arch_grub
<boot-directory>/grub == /boot/grub
In --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=grub:
<efi-directory>/<EFI or efi>/<bootloader-id> == /boot/efi/EFI/grub
<boot-directory>/grub == /boot/grub
The <efi-directory>/<EFI or efi>/<bootloader-id>/grubx64.efi is an exact copy of <boot-directory>/grub/x86_64-efi/core.efi.
Note: In GRUB 2.00, the grub-install option --efi-directory replaces --root-directory and the latter is deprecated.
Note: The options --efi-directory and --bootloader-id are specific to GRUB(2) UEFI.
In all the cases the UEFI SYSTEM PARTITION should be mounted for grub-install to install grubx64.efi in it, which will be launched by the firmware (using the efibootmgr created boot entry in non-Mac systems).
If you notice carefully, there is no <device_path> option (Eg: /dev/sda) at the end of the grub-install command unlike the case of setting up GRUB(2) for BIOS systems. Any <device_path> provided will be ignored by the install script as UEFI bootloaders do not use MBR or Partition boot sectors at all.
You may now be able to UEFI boot your system by creating a grub.cfg file by following #Generate GRUB2 UEFI Config file and #Create GRUB2 entry in the Firmware Boot Manager.

[ 本帖最后由 2011monk 于 2013-3-6 17:37 编辑 ]
回复

使用道具 举报

4#
发表于 2013-3-6 15:28:31 | 只看该作者

回复 #1 2012zhaoping 的帖子

原帖由fujianabc 于 2011-4-16 16:42 发表 "http://bbs.wuyou.net/redirect.php?goto=findpost&pid=2206532&ptid=191704"

<b>7-3更新: UEFI方式启动mbr硬盘上已有的win7 x64</b>
今天试了一下,发现UEFI方式完全可以启动mbr硬盘上的win7,这样测试UEFI启动不需要在全盘格成GPT分区表了。
而且一个win7 x64系统可以同时用bios和uefi两种方式启动,对于已有的64位win7系统,进行以下操作就可以用uefi方式启动了,而且不影响bios方式启动
1. 在FAT16/32分区中建立efi\microsoft\boot文件夹,在其中放入这个bcd文件 bcd.rar (4.58 KB)
2. 用bcdedit更改这个bcd中{default}的device和osdevice的盘符为windows所在分区盘符
3. 把\Windows\Boot\EFI中的bootmgfw.efi放到Fat分区根目录中&lt;br /&gt;在启动时指定执行bootmgfw.efi或者在efi shell下直接执行bootmgfw.efi即可
uefi方式启动win7时,四个彩球没了,只有滚动条了...

因为个人对uefi了解很肤浅,所以不确定uefi-mbr可以启动,看了fujianabc大的帖子才确定。所以楼主最好多看fujianabc 大的帖子。

uefi可以启动mbr上的已存在win7 X64,但是不可以在uefi下mbr模式安装

地址
  1. http://bbs.itiankong.com/thread-211859-1-1.html
复制代码

宏基笔记本是32位Windows 7,因为是4G内存,所以想换用64位Windows 7,我用MSDN上下载的Windows 7 Ult刻录成光盘,在选择分区时出现以下提示“WINDOWS无法安装到这个磁盘。选中的磁盘中具有MBR分区表。在EFI系统上,windows只能安装到GPT磁盘”

[ 本帖最后由 2011monk 于 2013-3-6 16:17 编辑 ]
回复

使用道具 举报

5#
发表于 2013-3-6 16:09:44 | 只看该作者
原帖由 2011monk 于 2013-3-6 15:28 发表

因为个人对uefi了解很肤浅,所以不确定uefi-mbr可以启动,看了fujianabc大的帖子才确定。所以楼主最好多看fujianabc 大的帖子。

windows可以uefi+mbr/gpt启动,也可以bios+mbr启动,linux可以uefi/bios+mbr/gpt任意混排启动
回复

使用道具 举报

6#
发表于 2013-3-6 16:44:38 | 只看该作者

回复 #5 2012olly 的帖子

“windows可以uefi+mbr/gpt启动”

可以具体说明是64位还是32,是XP还是WIN7,是原生支持还是需要添加文件?学习一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-9-22 20:18

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表