【转】【Grub2】UEFI添加grub2引导
准备材料:
下载grub-2.02-for-windows.zip
第一步:
将grub-2.02-for-windows.zip解压至d盘根目录。以管理员身份运行cmd。
输入以下指令将当前路径切换至grub-2.02-for-windows文件夹下。
cd /d d:\grub-2.02-for-windows
第二步:
输入以下指令查看grub-mkimage.exe的参数
grub-mkimage.exe –help
输出以下结果:
d:\grub-2.02-for-windows>grub-mkimage.exe –help
Usage: grub-mkimage.exe [OPTION…] [OPTION]… [MODULES]
Make a bootable image of GRUB.
-c, –config=FILE embed FILE as an early config(此文件存储一些设置变量)
-C, –compression=(xz|none|auto)
choose the compression to use for core image(选择内核的压缩模式)
-d, –directory=DIR use images and modules under DIR
[default=d:\grub-2.02-for-windows/](指定模块的路径,i386-efi,x86_64.efi,i386-pc等文件夹)
-k, –pubkey=FILE embed FILE as public key for signature checking(嵌入一个文件作为签名检查的公共密钥)
-m, –memdisk=FILE embed FILE as a memdisk image(嵌入文件作为一个内存镜像)。Implies `-p (memdisk)/boot/grub’ and overrides
any prefix supplied previously, but the prefix itself can be overridden by later options(当加载内存镜像时,应用/boot/grub作为优先查找路径,并覆盖所有的以前提供的预配置文件,但是预配置文件可以被后边的选项重写)
-n, –note add NOTE segment for CHRP IEEE1275(为CHRP IEEE1275添加备注)
-o, –output=FILE output a generated image to FILE [default=stdout](设置输出文件的名称)
-O, –format=FORMAT generate an image in FORMAT
available formats: i386-coreboot, i386-multiboot,
i386-pc, i386-pc-pxe, i386-pc-eltorito, i386-efi,
i386-ieee1275, i386-qemu, x86_64-efi, i386-xen,
x86_64-xen, mipsel-yeeloong-flash,
mipsel-fuloong2f-flash, mipsel-loongson-elf,
powerpc-ieee1275, sparc64-ieee1275-raw,
sparc64-ieee1275-cdcore, sparc64-ieee1275-aout,
ia64-efi, mips-arc, mipsel-arc,
mipsel-qemu_mips-elf, mips-qemu_mips-flash,
mipsel-qemu_mips-flash, mips-qemu_mips-elf,
arm-uboot, arm-efi, arm64-efi(设置输出文件的格式)
-p, –prefix=DIR set prefix directory(设置预先查找配置文件的路径)
-v, –verbose print verbose messages.
-?, –help give this help list
–usage give a short usage message
-V, –version print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Report bugs to bug-grub@gnu.org.
第三步:
在grub-2.02-for-windows当前目录下新建一个配置文件,对应grub-mkimage.exe -c,–config=file。
32位的配置文件我们命名为i386-efi.cfg,文本内容:
search.file /EFI/grub/ia32.cfg root (查找的配置文件名称为ia32.cfg,路径在/EFI/grub路径下)
set prefix=( root)/EFI/grub(设置/EFI/grub为prefix目录)configfile( r o o t ) / E F I / g r u b ( 设 置 / E F I / g r u b 为 p r e f i x 目 录 ) c o n f i g f i l e (
root)/EFI/grub/ia32.cfg (设置配置文件的路径及名称)
64为的配置文件我们命名为x86_64-eif.cfg,文本内容:
search.file /EFI/grub/x64.cfg root
set prefix=( root)/EFI/grubconfigfile( r o o t ) / E F I / g r u b c o n f i g f i l e (
root)/EFI/grub/x64.cfg
后边会使用i386-efi.cfg和x86_64-eif.cfg代替file名称。
第四步:
32位的运行以下命令:
grub-mkimage.exe -d i386-efi -c i386-efi.cfg -p /EFI/grub -o bootia32.efi -O i386-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true
grub-mkimage.exe
-d i386-efi (指定路径)
-c i386-efi.cfg (指定配置文件)
-p /EFI/grub (指定预配置文件路径)
-o grubia32.efi (生成文件的名称)
-O i386-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true(集成的模块)
64位的运行以下命令:
grub-mkimage.exe -d x86_64-efi -c x86_64-efi.cfg -p /EFI/grub -o bootx64.efi -O x86_64-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true
grub-mkimage.exe
-d x86_64-efi
-c x86_64-efi.cfg
-p /EFI/grub
-o bootx64.efi
-O x86_64-efi part_gpt part_msdos disk fat exfat ext2 ntfs xfs appleldr hfs iso9660 normal search_fs_file configfile linux linux16 chain loopback echo efi_gop efi_uga video_bochs video_cirrus file gfxmenu gfxterm gfxterm_background gfxterm_menu halt reboot help jpeg ls png true
运行完成后当前目录下将生成以下文件:
32位的:grubia32.efi
64位的:grubx64.efi
第五步:
从windows原生系统镜像内复制bootmgr.efi文件至/EFI所在磁盘的根目录下,并将生成的bootia32.efi、bootx64.efi复制到/EFI/boot文件夹内,其他文件夹复制到/EFI/grub文件夹内。
32位的,需新建ia32.cfg配置文件,与生成过程中i386-efi.cfg文件内定义的名称相同:
i386-efi
locale
themes
fonts
64位的,需新建x64.cfg配置文件,与生成过程中x86_64-efi.cfg文件内定义的名称相同:
i386-efi
locale
themes
fonts
其中locale、themes和fonts文件夹,32位和64位可以共用。
文件结构图:
bootmgr.efi
/EFI
├───boot
│ bootia32.efi
│ bootx64.efi
│
└───grub
│ ia32.cfg
│ x64.cfg
│
├───i386-efi
│ acpi.mod
│ ……..
│
├───fonts
│ unicode.pf2
│
├───locale
│ ├───ast
│ ├───……
│ └───zh_TW
│ grub.mo
│
├───themes
│ └───starfield
│ blob_w.png
│ boot_menu_c.png
│ ………
│ theme.txt
│
└───x86_64-efi
acpi.mod
第六步:
UEFI文件调用顺序:
1、启动后首先查找FAT、FAT16、FAT32分区,读取分区根目录下bootmgr.eft,将控制权限移交给/EFI/boot目录下的bootia32.efi或bootx64.efi。
2、bootia32.efi和bootx64.efi文件内部已经编译了配置文件ia32.cfg和x64.cfg的路径,会到/EFI/grub文件夹路径下调用ia32.cfg和x64.cfg。
3、ia32.cfg和x64.cfg文件内可以编辑内容,定义菜单、加载模块、设置样式、设置主题。
4、如果通过set theme=$prefix/themes/starfield/theme.txt设置过主题样式,则会调用theme.txt,输出主题。
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xinlan3618/article/details/79862667
【转】【Grub2】UEFI添加grub2引导相关推荐
- 【Grub2】制作UEFI版本Grub2引导
可以直接下载以下操作的所有文件:https://download.csdn.net/download/u010875635/10655981 本来不想设置积分,无奈最低只能设置1分,大家见谅.没有积分 ...
- 【Grub2】BIOS添加Grub2引导(Windows下操作)
电脑上安装的系统是Windows10,BIOS+MBR,想利用Grub2安装CentOS,和RemixOS三个操作系统. 为了实现硬盘安装CentOS,需要用到Grub2. 第一步.Grub2下载,文 ...
- 双系统如何在Centos7中添加GRUB2启动项
GRUB2是Centos7的默认引导加载程序.它可以轻松地加载所有的Linux发行版和其他操作系统.它提供一个菜单显示所有的操作系统.GRUB2具有高级特性以及一些基本特性,使其在所有Linux上都有 ...
- bootice添加黑苹果引导_Clover 引导多系统一点经验。
前提: 多系统都是建立在 Clover 能够识别多种系统引导的基础上实现的.Clover 的源码归属于 Intel, Apple, Oracle, Chameleon, rEFIt and Xom.其 ...
- centos7添加win10引导项及修改启动顺序
安装 1.先安装win10系统,然后将用系统自带的磁盘管理工具划出准备装centos系统的空间,不需要格式化. 2.然后安装centos,选择free空间容量的那块磁盘,进行安装. 引导 安装完cen ...
- bcdedit添加linux引导,Linux_利用Bcdedit创建Linux系统引导,Bcdedit在Windows Vista中的一个命 - phpStudy...
利用Bcdedit创建Linux系统引导 Bcdedit在Windows Vista中的一个命令行工具,用于建立和重新配置bootloader,无须再使用boot.ini文件.下面我们来谈谈如何用bc ...
- MacBook Air 2014 安装NVME硬盘并纯UEFI安装和引导Win7
前言: 本文是关于在苹果笔记本上安装NVME固态硬盘.纯UEFI安装及引导win7的实践,供电脑爱好者参考. 手里有一台MacBook Air(MBA) 2014,256G,跟现在的笔记本比较,性能肯 ...
- bcdedit添加linux引导,利用Bcdedit创建Linux系统引导
Bcdedit在Windows Vista中的一个命令行工具,用于建立和重新配置bootloader,无须再使用boot.ini文件.下面我们来谈谈如何用bcdedit引导Linux. 1.概述 之前 ...
- UEFI和传统引导的区别有哪些
背景 前两天装机时,用U盘启动进行安装系统时,发现还原ghost系统后怎么也进入不了windows10开机界面,一直显示: 在U盘中去使用引导修复,也失败了,后来重新将系统盘进行分区,变成MBR格式, ...
最新文章
- Android 保存崩溃日志到本地目录下
- 零基础入门学习Python,这13个Python惯用小技巧一定要收藏
- 三星android pro,够大才能爽 三星Galaxy Note Pro评测
- ubuntu 如何正确的更换更新源
- 没有bug队——加贝——Python 41,42
- 虚拟机win2012安装
- 长文预警-超详细的熊猫烧香病毒分析_00
- Kafka常见面试题
- Mysql 省市县乡 地址分割
- 目标检测单阶段、双阶段检测框部分学习总结
- 九度OJ—题目1066:字符串排序
- 塑料回收标志相关知识
- T1 mapping的用途
- 第二十九篇:故障处理流程
- TreeMap实现原理 红黑树
- php酒店入住时间怎么算,宾馆早上6点入住怎么算?正规宾馆上午八点开房应该到什么时间算一天...
- 计算机考试答题设计用例图,学生网上考试系统的设计与实现
- 单页应用SEO解决方案
- Mac 安装BurpSuite2021.6
- Linux安装一揽子解决方案
热门文章
- Linux C++服务器项目——网络编程2(三次握手、四次挥手、IO多路复用)
- Dart中类的静态方法,继承,重写父类方法
- 导入和导出功能用例设计
- 扫一扫vin码就能识别车架号的OCR技术
- CodeForces 985E Pencils and Boxes
- win10 10586 正式版安装sql2000(笔记)
- 我想给他拿给他拿台计算机的英文,NO-BOOK 傻瓜机英语口语中级版The machine can do the work of ten men.这机器...
- selenium---判断元素是否可见
- Coprime AtCoder Beginner Contest 215
- Apache Atlas管理Hive元数据