| 3、管理员身份打开CMD(很重要) 4、输入CD /D C:\GRUB-2.02-FOR-WINDOWS 5、I386安装 grub-install.exe --boot-directory=G:\ --target=i386-pc //./PHYSICALDRIVE2 注意盘符,改成自己的。PHYSICALDRIVE2中的“2”就是第二步查到的磁盘号。 6、UEFI 64为安装(注意下面的盘符,改成自己的) grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=x86_64-efi 7、UEFI32位安装(I386安装) grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=i386-efi 同样是注意盘符,改成自己的。 |
| #本人GRUB.CFG的例子: # DO NOT EDIT THIS FILE # # It is automatically generated by grub2-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then load_env fi if [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=true else set default="0" fi if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi export menuentry_id_option if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then font=unicode else font="${prefix}/fonts/unicode.pf2" fi if loadfont $font ; then #set gfxmode=1024x768x32,1024x768x24,1024x768x16,1024x768,auto #set gfxpayload=keep loadfont /grub/fonts/dejavu-bold-16.pf2 loadfont /gurb/fonts/dejavu-bold-14.pf2 set gfxmode=auto load_video insmod gfxterm insmod png terminal_output gfxterm #set color_normal=light-gray/black #set color_highlight=white/black #background_image -m stretch $prefix/themes/taylor swift1.jpg fi if [ x$feature_timeout_style= xy ] ; then set timeout_style=menu set timeout=3 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=3 fi set color_normal=light-gray/black set color_highlight=white/black if [ -e /grub/themes/starfield/usetheme.TXT ]; then # binary_syslinux modifies the theme file to point to the correct # background picture set theme=/grub/themes/starfield/theme.txt insmod jpeg else set menu_color_normal=cyan/blue set menu_color_highlight=white/blue fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/10_linux ### ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_custom ### if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ### menuentry "正常启动win10" { set root=(hd0,msdos1) chainloader +1 } #set root=(hd0,msdos1) 这一句,表示将指针交给HD0,即0号物理盘;msdos1表示微软分区格式(FAT,NTFS)中的第1个分区。[用DiskGenius可以很清楚看到这些参数。] #set root=(hd0,msdos1) 也可以写成set root=(hd0,2)[这里假定第1个分区是EXT格式,第2个分区是FAT格式] [set root=(hd0,2)表示直接指定第2个物理分区] menuentry "Restart(重启)" { reboot } menuentry "Power Off(关机)" { halt } menuentry "引导 KUBUNTU Linux系统" { set root=(hd1,4) chainloader +1 } menuentry "WinPE" { set root=(hd0,3) #直接指出第3块分区;(分区号是从1号开始算的)。 linux16 $prefix/i386-pc/MEMDISK iso raw #这里调用 MEMDISK来虚拟磁盘。 #$prefix是指本启动盘的根目录 echo "正在启动WinPE,请耐心等待...." initrd16 /nst/winPE.iso } menuentry "DiskGenius_PE" { set root=(hd0,msdos1) linux16 $prefix/i386-pc/MEMDISK iso raw echo "正在启动DiskGenius_PE,请耐心等待...." initrd16 /nst/DiskGenius_PE.iso } |
| 注意事项: 1.安装GRUB的分区必须事先格式化为FAT文件系统,不能为NTFS文件系统。 2.GRUB.CFG配置文件必须放入\grub文件夹中。 3.grub\i386-pc文件夹中,默认有memdisk.mod;如果需要用虚拟盘,则必须还要有memdisk(没有扩展名的,默认没有,需另外从网上下载: https://www.syslinux.org/old/download.php,在压缩包/bios/memdisk/即可以找到memdisk)。 并将memdisk拷贝到grub\i386-pc文件夹中。 需要说明的是:memdisk.mod(有扩展名) 和 memdisk(没有扩展名)不是同一个文件! memdisk的用法例子:menuentry "DiskGenius_PE" { set root=(hd0,msdos3) #从哪个物理盘启动,哪个物理盘就变成0号盘。所以hd0表示指针指向自身这个物理盘。msdos1这项,表示微软系统盘(物理盘中其它系统格式的 #分区不列入计算范围)的第3个分区。 也可以直接指出第几个分区(去掉msdos,只保留数字;这种表达就是全部系统格式的分区都包含在内)。 #注意,分区号是从1号开始的,而物理盘号是从0号开始的! linux16 $prefix/i386-pc/MEMDISK iso raw echo "正在启动DiskGenius_PE,请耐心等待...." initrd16 /nst/DiskGenius_PE.iso #memdisk限制,DiskGenius_PE.iso文件的大小不能超过2GB. 因为memdisk有容量限制,并且启动比较慢。所以最好的方法是在磁盘中另外分一个区,再将WINPE释放到此分区中,然后再用grub2指向并启动此WINPE分区。 |
| 启动gpt分区中efi的WINPE: 由于GRUB2不能在UEFI模式下对ISO文件进行仿真,那么我们应该如何在UEFI模式下引导WindowsPE呢?答案是必须使用WIM格式的WindowsPE。 具体说来就是首先用GRUB2链式加载微软的"bootmgfw.efi"引导管理器,然后再由"bootmgfw.efi"根据BCD文件的指引去启动WindowsPE。 第一步,从PE中提取"WEPE64.WIM"与"WEPE.SDI"(BOOT.SDI)文件。 第二步,从Win10原版安装光盘中提取"bootmgfw.efi"文件([sources/install.wim]/Windows/Boot/EFI/bootmgfw.efi)。 第三步,将提取的三个文件放置到一个FAT32或NTFS磁盘分区上,这里假定放到'(hd0,gpt3)/winpe/'目录中。 第五步,将BCD文件同样放置到'(hd0,gpt3)/winpe/'目录中。 最后,在'grub.cfg'中加入如下菜单项: menuentry 'UEFI Windows PE Boot Manager' { chainloader (hd0,gpt3)/winpe/bootmgfw.efi } |