(OK) grub.cfg ------ used in U盘安装 RHEL/CentOS/Fedora
#################################################
#设置菜单的超时时间为5秒
set timeout=5
#每一满屏后暂停输出,以免信息太多一闪而过看不清
set pager=1
################################################
#默认启动第一个菜单项
set default=0
#如果第一个菜单项启动失败,转而启动第二个菜单项
set fallback=1
#################################################
#设置主题模式,支持的模式可以grub引导界面,输入e,进入命令行,输入videoinfo查看。
set gfxmode=1600x900x32,auto
#设置主题
set theme=$prefix/themes/starfield/theme.txt
#################################################
#指定翻译文件(*.mo)的目录,若未明确设置此目录,则无法显示中文界面。
set locale_dir=$prefix/locale
#将GRUB2设置为简体中文界面
set lang=zh_CN
#################################################
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}
function load_disk {
insmod part_gpt
insmod part_msdos
}
function load_filesystem {
insmod ext2
insmod ext3
insmod ext4
insmod ntfs
}
load_video
load_disk
load_filesystem
#################################################
#激活图形模式的输出终端
insmod gfxterm
terminal_output gfxterm
insmod gfxmenu
insmod png
loadfont $prefix/themes/starfield/dejavu_bold_14.pf2
export theme
#################################################
menuentry 'Windows 10' --class class --users admin --hotkey "w" --id windows {
search --file --set=root --no-floppy /bootmgr
chainloader +1
}
# OK, (hd0,msdos1) is exFAT
menuentry 'Fedora-Workstation-Live-x86_64-29-1.2 from USB disk' {
set root=(hd0,msdos1)
set isofile="/iso/Fedora-Workstation-Live-x86_64-29-1.2.iso"
loopback loop $isofile
# isoinfo -d -i Fedora-Workstation-Live-x86_64-29-1.2.iso
# linux (loop)/isolinux/vmlinuz iso-scan/filename=$isofile root=live:CDLABEL=Fedora-WS-Live-29-1-2 rootfstype=auto ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0 rd.debug
linux (loop)/isolinux/vmlinuz iso-scan/filename=$isofile root=live:CDLABEL=Fedora-WS-Live-29-1-2 rd.live.image
initrd (loop)/isolinux/initrd.img
}
# OK, (hd0,gpt6) is FAT32
menuentry 'Fedora-Workstation-Live-x86_64-29-1.2 from Hard Disk' {
# set root=(hd0,msdos1)
set root='(hd0,gpt6)'
set isofile="/iso/Fedora-Workstation-Live-x86_64-29-1.2.iso"
loopback loop $isofile
# isoinfo -d -i Fedora-Workstation-Live-x86_64-29-1.2.iso
# linux (loop)/isolinux/vmlinuz iso-scan/filename=$isofile root=live:CDLABEL=Fedora-WS-Live-29-1-2 rootfstype=auto ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0 rd.debug
linux (loop)/isolinux/vmlinuz iso-scan/filename=$isofile root=live:CDLABEL=Fedora-WS-Live-29-1-2 rd.live.image
initrd (loop)/isolinux/initrd.img
}
# OK, (hd0,msdos1) is exFAT
menuentry 'rhel-8.0-beta-1-x86_64-dvd from USB disk' {
set root=(hd0,msdos1)
set isofile="/iso/rhel-8.0-beta-1-x86_64-dvd.iso"
loopback loop $isofile
linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:/dev/sda10:$isofile
initrd (loop)/isolinux/initrd.img
}
# download syslinux-6.03.zip from
# https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/
# 解压,文件:syslinux-6.03/bios/memdisk/memdisk,rename MEMDISK
# FAIL
menuentry 'Windows7 32 ISO'{
set root='(hd0,msdos1)'
# set root='(hd0,gpt1)'
echo 'Loading Memdisk...'
insmod memdisk
linux16 /grub/i386-pc/MEMDISK iso raw
# linux16 /grub/x86_64-efi/MEMDISK iso raw
echo 'Loading ISO...'
initrd16 /iso/DEEP_GHOST_WIN7_SP1_X86_V2018_12.iso
}
# FAIL
menuentry 'Windows7 64 ISO'{
set root='(hd0,msdos1)'
# set root='(hd0,gpt1)'
echo 'Loading Memdisk...'
insmod memdisk
linux16 /grub/i386-pc/MEMDISK iso raw
# linux16 /grub/x86_64-efi/MEMDISK iso raw
echo 'Loading ISO...'
initrd16 /iso/DEEP_GHOST_WIN7_SP1_X64_V2018_12.iso
}
# FAIL
menuentry "Windows7 64 ISO - UEFI" --class windows --class os {
# set root='(hd0,msdos1)'
set root='(hd0,gpt6)'
# Insert modules needed in order to access the iso-file
#insmod part_gpt
#insmod part_msdos
#insmod ntfs
#insmod ext2
# Mount the iso image by addressing it with (partition)/path
set iso=/iso/DEEP_GHOST_WIN7_SP1_X64_V2018_12.iso
loopback loop ($root)$iso
# boot (chain-load) the image using the cdboot.efi file located
# on the win10-image
chainloader (loop)/efi/microsoft/boot/cdboot.efi
}
# FAIL
# menuentry 'Fedora (4.19.9-300.fc29.x86_64) 29 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted {
menuentry 'Fedora (4.19.9-300.fc29.x86_64) 29 (Workstation Edition)' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos9'
linux /vmlinuz-4.19.9-300.fc29.x86_64 root=/dev/sda9 ro rhgb quiet LANG=zh_CN.UTF-8
initrd /initramfs-4.19.9-300.fc29.x86_64.img
}