ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

U盘安装Grub2 EFI引导WinPE

2022-02-20 18:35:16  阅读:328  来源: 互联网

标签:set U盘 grub efi -- WinPE EFI iso insmod


安装Grub2

grub2下载

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测试启动成功

我的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

标签:set,U盘,grub,efi,--,WinPE,EFI,iso,insmod
来源: https://www.cnblogs.com/wsm25/p/15916071.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有