我想这样做是因为我想安装Windows 7,但我的BIOS菜单没有显示出来;它直接跳过到grub2菜单,但那是另外一个故事...有没有办法从grub2直接启动Windows 7的安装iso文件?
使用grub legacy或grub2引导实际的ISO文件无法成功,但对于较旧的Windows版本(例如XP),可以将ISO中的i386文件夹解压到USB闪存驱动器上,然后使用grub4dos调用引导加载程序:
title windows installer via setupldr.bin
find --set-root /i386/setupldr.bin
chainloader /i386/setupldr.bin
或者
title windows installer via /bootsect.bin
find --set-root /i386/setupldr.bin
chainloader /bootsect.bin
menuentry "Windows 7 (bootmgr)" --class windows --class os {
insmod part_msdos
insmod ntfs
insmod ntldr
### A: either use this line or the next one, but not both
set root='(hd0,msdos1)'
### B:
### search --no-floppy --set=root --fs-uuid ____INSERT_PARTITION_UUID_HERE___
ntldr ($root)/bootmgr
}
menuentry "Windows 7 installer" --class windows --class os {
insmod part_msdos
insmod ntfs
insmod ntldr
search --no-floppy --set=root --fs-uuid 0E239BC6-F960-3107-89CF-1C97F78BB46B
ntldr /bootmgr
}
menuentry "Boot Windoze" {
search -f "--set-root /Winblows.iso"
drivemap "/Winblows.iso" '(hd32)'
drivemap '--hook' ''
set root='(hd32)'
chainloader +1
}
但是Windows会对此感到困惑。
如果您至少有4GB的RAM,您可以选择将整个DVD ISO加载到memdisk中,并从该磁盘引导。要做到这一点,下载SysLinux并将memdisk
文件提取到您的boot
目录中。然后,您需要向Grub2添加类似于此的代码
menuentry "Boot Windoze" {
search -f "--set-root /Winblows.iso"
insmod memdisk
linux16 /boot/memdisk iso
initrd16 /Winblows.iso
}
然而,我不会测试这段代码,因为将3GB以上的数据放入RAM中是完全错误的(从理念的角度来看)。不,我真的想要你想要的东西,但最后我将Windows安装到了一个USB分区上,使用Windows 7 USB/DVD下载工具加载并链接到那个分区。很抱歉,我没有看到其他的方式。
sudo update-grub
并重新启动,就能看到特定的Windows引导菜单项,用于安装Windows。