grub2 windows版安装

一、BIOS方式,grub2安装

查看磁盘情况

E:\grub-2.02-for-windows>wmic diskdrive list brief
Caption DeviceID Model Partitions Size
INTEL SSDSCKKF256H6L \\.\PHYSICALDRIVE0 INTEL SSDSCKKF256H6L
SanDisk Ultra USB Device \\.\PHYSICALDRIVE1 SanDisk Ultra USB Device

grub2 mbr安装

E:\grub-2.02-for-windows>grub-install.exe --target=i386-pc \\.\PHYSICALDRIVE1
Installing for i386-pc platform.
Installation finished. No error reported.

二、UEFI方式,grub2安装

grub2 UEFI安装

1、给Sandisk Ultra U盘在末段分一个 FAT32 格式的分区,并且改变分区类型为:

0xEF Partition with an EFI file system  【可能需要】

2、导入EFI目录到U盘ESP分区的根目录,导入grub程序文件到U盘ESP分区的boot目录。

C:\WINDOWS\system32>f:

D:\>cd grub-2.02-for-windows

D:\grub-2.02-for-windows>grub-install.exe --target=x86_64-efi --efi-directory=d: --boot-directory=d:\boot --bootloader-id=boot --modules="part_msdos fat normal"
Installing for x86_64-efi platform.
Installation finished. No error reported.

把D盘替换成U盘ESP分区实际盘符

3、把ESP分区下\EFI\boot\目录下的grubx64.efi文件改名为bootx64.efi

4、编写grub.cfg配置文件,复制对应的ESP分区下\boot\grub目录下

set timeout=300

#set prefix=(${root})/boot/Grub/

menuentry "BIOS Windows Boot Manager" {
echo "BIOS Windows Boot Manager"
#set root=(hd0,msdos1)
insmod ntldr
ntldr (hd0,msdos1)/boot/bootmgr
}

menuentry "BIOS Install CentOS71511"{
echo "BIOS Install CentOS71511 Minimal"
set root=(hd0,msdos1)
linux /isolinux/vmlinuz inst.stage2=hd:LABEL=ULTRA:/ quiet
initrd /isolinux/initrd.img
}

menuentry "BIOS Install CentOS71511 ks"{
echo "BIOS Install CentOS71511 Minimal ks"
set root=(hd0,msdos1)
linux /isolinux/vmlinuz inst.stage2=hd:LABEL=ULTRA:/ inst.ks=hd:LABEL=ULTRA:/isolinux/ks.cfg quiet
initrd /isolinux/initrd.img
}

menuentry " "{
configfile
}

menuentry "EFI Windows Boot Manager" {
echo "EFI Windows Boot Manager"
#search --file ($root)/efi/Microsoft/boot/bootmgfw.efi --set=root
terminal_output console
chainloader (hd0,msdos1)/efi/Microsoft/boot/bootmgfw.efi
}

menuentry 'EFI Install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
echo "EFI Install CentOS71511 Minimal"
set root=(hd0,msdos1)
linux /isolinux/vmlinuz inst.stage2=hd:LABEL=ULTRA:/ quiet
initrd /isolinux/initrd.img

}

menuentry " "{
configfile
}

menuentry "DiskGenuis Tool"{
set root='(hd0,msdos1)'
linux16 /boot/Grub/memdisk
initrd16 /PE/imgs/DG_x64.img
}

menuentry "Maxdos Toolbox"{
set root='(hd0,msdos1)'
linux16 /boot/Grub/memdisk
initrd16 /PE/imgs/maxdos9.img
}

menuentry 'Reboot' --class reboot {
echo 'Rebooting ...'
reboot
}

menuentry 'Shutdown' --class halt {
echo 'Shutdown ...'
halt
}

上一篇:JSP内置对象详解及示例


下一篇:AI学习吧-REDIS-常识