U盘安装Grub2 EFI引导WinPE
安装 Grub2 到U盘
Windows下运行:
grub-install --boot-directory=E: --recheck --target=i386-pc \\.\PHYSICALDRIVE1 --removable
grub-install --boot-directory=E: --efi-directory=E: --recheck --target=i386-efi --removable
grub-install --boot-directory=E: --efi-directory=E: --recheck --target=x86_64-efi --removable
其中E
改为你的盘符(一定要是FAT32 因为EFI分区只支持FAT32或FAT16)
其中\\.\PHYSICALDRIVE1
改为命令
wmic diskdrive list brief
输出的您的U盘对应编号
用Qemu或VMWare测试启动成功
在 /boot/grub2
下创建文件 grub.cfg
,参考 这个 配置
我的grub.cfg
如下:
#加载字体需要的模块
insmod font; #insmod 加载一个模块
insmod gfxterm;
insmod jpeg;
insmod png;
insmod all_video;
# insmod vbe;
#-----加载中文界面---------
#加载字体
loadfont unicode;
set gfxmode=auto;
set gfxpayload=keep;
set gfxterm_font=unicode;
terminal_output gfxterm;
#设置语言
set locale_dir=$prefix/locale;
set lang=zh_CN;
#设置主题文件路径
#注:$prefix 为 grub 所在目录(即 X:/grub/)
#poly-light 修改为你下载的主题的文件夹名字
set theme=$prefix/themes/monterey-grub-theme/theme.txt;
background_image $prefix/themes/monterey-grub-theme/background.png
# background_image $prefix/themes/msi.jpg
#---------菜单项-----------
menuentry "[1]正常启动(Windows)" --hotkey=1 { #--hotkey=某个按键 :设置快捷键
if [ 'pc' == $grub_platform ] ; then
if search --file --set /bootmgr ; then
chainloader +1
elif search --file --set /ntldr ; then
chainloader +1
fi
elif [ 'efi' == $grub_platform ] ; then
if search --file --set /EFI/Microsoft/Boot/bootmgfw.efi ; then
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
fi
fi
}
menuentry "[2]微PE" --hotkey=2 {
if [ 'pc' == $grub_platform ] ; then
insmod memdisk
linux16 $prefix/memdisk iso raw
initrd16 /iso/wepe.iso
elif [ 'efi' == $grub_platform ] ; then
chainloader /iso/wepe_efi/bootmgfw.efi
fi
}
menuentry "[3]GrubFM" --hotkey=3 {
if [ "${grub_platform}" = "pc" ]; then
linux /iso/grubfm/loadfm
initrd /iso/grubfm/grubfm.iso
else
if ["$grub_cpu" = "x86_64"]; then
chainloader /iso/grubfm/grubfm.efi
else
chainloader /iso/grubfm/grubfmia32.efi
fi
fi
}
menuentry "[4]Edgeless PE" --hotkey=4 {
if [ 'pc' == $grub_platform ] ; then
echo "Dosen't support Legacy"
elif [ 'efi' == $grub_platform ] ; then
chainloader /iso/Edgeless/bootmgfw.efi
fi
}
menuentry "重启" { reboot; }
menuentry "关机" { halt; }
修改PE(只支持EFI)
附件中下载pe_efi.zip
,解压放到一个文件夹中,再把PE的wim文件解压到该文件夹中,用BOOTICE修改BCD文件,添加菜单
menuentry "PE"{
if [ 'efi' == $grub_platform ] ; then
chainloader $pe_path/bootmgfw.efi
fi
}
若要Legacy下启动,用grub2fm
附件 密码:4jk0
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南