Vista下多重启动如何制作(有中文对照)
这是由Spacesurfer网友写的教程,为尊重原著,我把原帖转过来。
并在原文下作了简单的翻译,源代码部分不做翻译
Spacesurfer
Good news for people who use Grub loader for multi-booting to various Microsoft OSes, including the new Windows Vista, and Linux. I’ve modified an old trick I’ve used to load Grub on system startup with Windows XP as the main OS. See the post at 911cd.net Multi-boot WinXP and other OSes with Grub for this method.
对使用Grub的人来说确实是好消息,那就是可以用它来制作多重启动包括微软的各种操作系统,当然也包括最新发布的Vista和Linux。在XP系统下我通过“欺骗”手段已经做了一个多启动,具体请参考911cd.net下的贴Multi-boot WinXP and other OSes with Grub。
Background
背景
For those of you not familiar with Grub, here’s some background information on its benefits. Why use Grub instead of Windows XP boot menu or Vista boot menu? There are several reasons.
对那些不太熟悉GRUB的同志请看下面的介绍,为什么要用Grub代替XP或者Vista的启动菜单?理由如下:
- First, you can’t boot non-Microsoft OSes with XP/Vista boot menu. Grub loads Vista, XP, 2000, 98, Linux, BartPE on HDD or CD etc. I’m guessing you can also load WinPE 2.0 from HDD but haven’t tried it yet.
- 首先,XP/Vista启动菜单不能启动非微软操作系统。Grub能支持硬盘或者光盘上的 Vista,xp,2000,98,linix,BartPE等。同样也支持WinPe2.0(目前尚还未测试)。
- Second, you can’t boot other devices, namely floppy and CD/DVD drive, from XP or Vista menu. Grub can boot floppy, bootable CD/DVD (even if your BIOS does not support it), and floppy images from its menu.
- 第二,XP/Vista菜单不支持其他设备的启动。而Grub能启动软盘,可启动光盘(即使BIOS不支持该启动),软盘镜像文件。
- Third, it’s backward compatible but not forward compatible; meaning, XP can load Windows 2000, 98, and other legacy OSes but not Vista. Vista can load previous ones but not future ones.
- 第三,Grub向下兼容;意思是指,XP能加载2000,98,和其他操作系统,但不能加载Vista。而Vista能加载前面的操作系统,但不支持以后的操作系统。
- Fourth, Grub does not modify the MBR or PBR. It requires no patching or hex-editing. It simply requires renaming a couple of files, which I’ll explain next why renaming is required.
- 第四,Grub不修改MBR或者PBR。它不需要其他补丁和16进制编辑器。它要做的事情仅仅是该动一组文件名,请看后面的介绍。
为什么要改名?
My objective was to load Grub loader first—before XP boot menu (and now before Vista boot menu). In order to fulfill this objective, renaming two files is necessary.
我们的目的是在XP启动(现在是Vista)前加载Grub。为完成这项工作,我们有必要改动2个文件名。
You can add Grub loader to boot.ini so that you can get an option to load Grub in the XP boot menu. However, if you want Grub to load before XP boot menu, you’ll have to rename two files. First, you have to rename ntldr (the XP loader) as ntldrxp and grldr (Grub loader) as ntldr. Basically, you are disguising Grub loader as the XP loader. So, the system thinks it is loading XP but it is loading Grub. Then, you can create an entry in menu.lst to load XP with the following lines:
XP下你可以修改BOOT.INI文件来加载Grub。但是,加入你想在XP启动前加载Grub,你需要下面2个步骤,1.把ntldr改名为ntldrXP,2.把grldr改为NTLDR。现在你的目的达到了,系统加载NTLDR而事实上是加载了Grub。通过编辑menu.lst文件,你可以顺利地启动XP,参考下面的代码:
CODE
title Microsoft Windows XP SP2 Pro (Find and Load)
find --set-root /ntldrxp
chainloader /ntldrxp
If you had edited boot.ini to load Grub from there, and then made Grub load automatically, then you would not be able to boot XP because of a circular reference. Why the circular reference? Because system loads ntldr, which reads boot.ini and loads grldr automatically (without an XP menu). Then, from Grub, you would choose to boot XP. However, ntldr will look for boot.ini and load Grub again automatically. It doesn’t matter if you rename ntldr to ntldrxp. Ntldrxp will also look for boot.ini and you get a circular reference. Therefore, renaming both ntldr and grldr files solves the problem.
尽量避免循环调用。
Booting Vista with Grub
用Grub启动Vista
So, with Windows Vista, is it still possible to get Grub to load before Vista boot menu? And can you boot Vista with a Grub entry? Both are yes!!
既然XP能启动,那在Vista下是不是也可以这样通过Grub来加载Vista呢,回答是肯定的,没问题!
I thought since Vista’s boot process had been modified, it would not be possible. But the same trick works with Vista as with XP. Let’s look at the differences between Vista and XP boot process before I explain how to get a Grub menu before the Vista menu.
刚开始想,Vista启动过程完全已经不同,启动好像不大可能。而事实上,欺骗XP的方法也可以用在Vista上。先让我们比较下Vista和XP启动过程。
For XP, the MBR looks for and loads ntldr. Ntldr then read from boot.ini. If it finds two or more entries in boot.ini, then it will present a menu option for the entries (unless you set to boot an item automatically). That’s the process. (I’ve read that ntldr serves two functions: bootmanager and bootloader. As bootmanager, it presents a menu for XP and other OSes. As bootloader it itself can boot XP.)
对XP系统,MBR找到NTLDR,NTLDR读取BOOT.INI。如果在BOOT.INI文件中存在多个入口,系统将显示选择菜单。NTLDR提供了2个功能,一是启动管理器,二是启动XP本身。
For Vista, the MBR looks for and loads bootmgr. You can say bootmgr has replaced ntldr. However, bootmgr serves only one function—as a bootmanager. Bootmgr refers to a file called bcd (probably short for boot configuration data). You can say bcd is like boot.ini. It contains the menu entries for Vista’s boot menu. There’s a third file called winload.exe that actually loads Vista—this is the bootloader for Vista。
对Vista,MBR先找到并加载BOOTMGR。可以说,BOOTMGR代替了NTLDR。但是BOOTMGR仅仅提供了一个功能-启动管理器。BOOTMGR指向一个叫BCD(可能是boot configuration data缩写)。我们可以把BCD当作BOOT.INI。它包含了Vista的启动菜单。还存在第三个文件Winload.exe,这个才是真正的Vista加载器。
So, for our purposes, we need to replace bootmgr with grldr to get a Grub menu before the Vista menu. Then, we need to create an entry in menu.lst for booting Vista, XP, other OSes, and other devices. Finally, now for the instructions.
我们的目的是在Vista启动前替换掉BOOTMGR,当然是用GRLDR。然后建立一个menu.lst来启动Vista,XP,其他的操作系统和其他设备。下面介绍怎么做。
Requirements
几样必备的东西
1.
grldr, the file that loads Grub loader. You can find it at http://grub4dos.jot.com/WikiHome. Download the zip file and extract files to get grldr.
2.
WinImage or any other floppy image creator
3.
Floppy drive and a floppy
4.
A system that is currently dual-booting XP and Vista
Backup System
备份系统
First step is to backup your system with System Restore or Vista’s backup program just in case things go haywire (if you follow directions correctly, it shouldn’t). I don’t use system restore but you may want to. If you are comfortable, you can skip this step. Don’t blame me if things go wrong.
The worst that can happen with these simple instructions is you lose the ability to boot to either Vista or XP. If you create a Vista boot floppy in the next step, then you should be able to recover. If something worse than this happens, you did something beyond these instructions.
Create Vista Boot Floppy
Now, make a Vista boot floppy. Follow the instructions: http://www.msfn.org/board/index.php?showtopic=95092. I advise you not to skip this step. It will not only help you now, but also if in the future you can’t load Vista or XP, it will come in handy.
Note: you can create a Vista-only boot floppy, XP-only boot floppy, or Vista/XP dual-boot floppy by modifying your boot options in Vista. If you want a Vista-only boot floppy, modify your boot options to boot Vista automatically (without a timeout). If XP-only, boot XP automatically. If you want dual-boot, specify a timeout before loading your default choice. The changes you make are reflected in the bcd file. Therefore, all files will be same on these floppies except the bcd file. For the purpose of these instructions, you’re better off creating a Vista/XP dual-boot floppy so you can boot to either one.
Rename bootmgr
改名BOOTMGR
After creating a boot floppy, boot into XP. Give yourself permission to modify bootmgr. You may have to take ownership. (I took ownership of the file and then modified permissions. I now realize maybe that was not necessary. Not sure.) Rename bootmgr as bootmgrv.
启动XP把BOOTMGR改名为BOOTMGRV。
Rename grldr
改名GRLDR
Rename grldr as bootmgr. Just like in XP, we’re going to fool the system into thinking it is loading Vista, but it is loading Grub loader. Then, copy bootmgr (grldr in disguise) to where the Vista's real bootmgr was, usually in the root folder of your active primary partition.
把GRLDR改名为BOOTMGR。象前面介绍的欺骗XP系统一样,让系统以为在启动Vista,事实上我们启动的是Grub。然后把由GRLDR改名而来的BOOTMGR复制到原BOOTMGR所在的目录。
Create Vista Entry in Menu.lst
建立menu.lst构造Vista入口
Guess what. Just like how ntldrxp was able to boot XP, bootmgrv can also boot Vista from Grub menu. Create the following entries in menu.lst. The # indicates comments. Take a look at the comments if you are not familiar with menu.lst.
就象如何用NTLDRXP引导XP一样,BOOTMGRV照样通过使用Grub菜单来启动Vista。建立menu.lst文件如下,对于不熟悉Grub的参考下面的注释,#部分是注释。
CODE
# Sets colors, timeout before default selected and default value
color black/cyan yellow/cyan
timeout 5
default 0
# Boot Vista by finding and loading bootmgrv
title Microsoft Windows Vista
find --set-root /bootmgrv
chainloader /bootmgrv
# Boot XP by finding and loading ntldr
title Microsoft Windows XP
find --set-root /ntldr
chainloader /ntldr
# Boot BartPE by finding setupldr.bin
title BartPE with XPE 1.0.4 (from HDD)
find --set-root /minint/setupldr.bin
chainloader /minint/setupldr.bin
# Boot BartPE from USB HDD by swap method; note your USB HDD number may be
# different. I have two internal HDD’s ((hd0) and (hd1)), making my USB HDD
# (hd2). Therefore, I have to swap (hd0) with (hd2).
title Boot BartPE from USB HDD
map (hd2) (hd0)
map (hd0) (hd2)
chainloader (hd0)+1
# Boot whatever is in CD/DVD drive, even if your BIOS does not support
# booting from CD/DVD drive. You need a file called sbootmgr.dsk.
# It’s a very small SBM disk image. Search for it.
title Boot CD using Smart Boot Manager
find --set-root /sbootmgr.dsk
map --mem /sbootmgr.dsk (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
# Example of how to boot a floppy image by finding and loading the image file
# This is much faster than booting from the actual floppy.
title Boot Ghost 2003 (ghost.img)
find --set-root /ghost.img
map --mem /ghost.img (fd0)
map --hook
chainloader (fd0)+1
# Boot whatever is in the floppy drive
title Floppy on (fd0)
chainloader (fd0)+1
rootnoverify (fd0)
Note, we do not need to rename ntldr as ntldrxp in this case. You can also add Linux and other OSes supported by Grub. I don’t use Linux. You can search for instruction on the net.
备注,现在我们不再需要把NTLDR改成NTRLDRXP。你还可以把Grub支持的其他操作系统加到菜单里面。
Reboot
重新启动
Voila! Reboot and you should see Grub menu with your boot menu options!
完成,重新启动你的机器,你就看到Grub菜单出现在你的选项里面了。
附(其它收集):
vista增加grub引导
vista的话 比较麻烦一点,启动文件也跟xp有所不同 1 根目录必须有以下三个文件:grldr grldr.mbr menu.lst 都可以从下载的grub for dos找到,其中menu.lst还要自己增加我上面说过的启动项 2 修改vista的启动菜单 进入vista的dos窗口,输入以下命令 bcdedit /create /d "GRUB for DOS Menu" /application bootsector 然后你会看到结果显示 The entry {05d33150-3fde-11dc-a457-00021cf82fb0} was successfully created 中间一大串就是启动项ID,简称id,每台电脑都不一样,要自己记住,替换以下命令的id 然后逐一输入以下三句命令
bcdedit /set {id} device boot bcdedit /set {id} path \grldr.mbr
bcdedit /displayorder {id} /addlast
重启电脑就可以看到Vista的启动菜单有 grub for dos menu的选项, 选择它应该就可以进入menu.lst设置的菜单
我用grub启动vista 没有这么麻烦
我的vista是设置第二个主分区为引导分区 安装到第二个主分区
第一个主分区是XP 可以引导grub
menu.lst 里面添加
title 引导第一硬盘第二主分区的vista
root (hd0,1)
chainloader +1
就可以直接启动vista了 前提是vista的盘要有vista的引导记录