1. 前提: 先装win7,再装fedora16并且把grub安装到linux的boot分区 (默认grub会安装到MBR,在安装时请修改此项)
2. download grub4dos-0.4.5c-2012-06-19
http://code.google.com/p/grub4dos-chenall/downloads/list
3. 解压缩grub4dos,把其中的:grldr, grldr.mbr, grub.exe 拷贝到C:\
4. 进入windows/system32目录,找到cmd, 点击鼠标右键,选择“以管理员身份运行”
5. 在cmd窗口运行
先将启动项备份: bcdedit /export C:\bootlist.bak
用这个命令还原: bcdedit /import C:\bootlist.bak
bcdedit /create /d "grub" /application bootsector #记录下此命令返回的ID号
bcdedit /set {id} device partition=c: #后面的{id}都是指前面记录下来的ID
bcdedit /set {id} path \grldr.mb
bcdedit /displayorder {id} /addlast
通过以上的命令就在BCD中添加一个名为"grub"的启动项菜单
6. 从fedora16的/boot/grub2/grub.cfg文件中获得,fedora16 /boot分区的UUID。 有以下几种方法:
1). 在win7上,下载linux_reader,
http://www.xnlinux.cn/thread-1755-1-1.html
安装后,可以在WIN7上查看linux的文件
2). 在grub下,运行 #假设/目录在/dev/sda7上
grub> cat (hd0,6)/etc/fstab
3). 在grub下,运行
grub> ls -l /dev/disk/by-uuid
7. 在C盘根目录下建立menu.lst文件
splashimage=(hd0,6)/splash/splash.xpm.gz
foreground 770077
background ffffff
default 1
timeout 3
title Windows 7
acpi
fallback 1
root (hd0,0)
chainloader /bootmgr
title Fedora 16 Linux
root (hd0,6) #注意这里的6,如果boot分区是第7块 /dev/sda7,那这里写 (hd0,6),因为grub是从0开始计数的
kernel /vmlinuz-3.1.0-7.fc16.x86_64root=UUID=436b2879-2a2d-4b5f-94cd-d765df6625f1 ro rd.md=0 rd.lvm=0 rd.dm=0
title cmd
commandline
title reboot
reboot
title shutdown
halt
完成后,就可以reboot了,可以看到首先出现的引导界面就是WIN7的BCD,有两个引导项,选择第二引导项也就是我们添加上去的“grub”,默认启动的就是FC16。