Tuesday, October 17, 2006

 

XP and Linux dual boot using NTLoader and Grub

1. my system
Two HD.
hda for Windows XP.
hdb for linux (centos)

sample grub.conf
. 生成grub的配置文件/boot/grub/grub.conf
menu.conf的内容如下:
######### beginning of menu.conf ####################
default=1
timeout=4
#splashimage=(hd0,3)/boot/grub/splash.xpm.gz # 想要漂亮的启动画面,去掉行首"#"
title Red Hat Linux (2.4.12)
root (hd0,3)
kernel /boot/vmlinuz-2.4.12 ro root=/dev/hda4
title Red Hat Linux (2.4.14)
root (hd0,3)
kernel /boot/vmlinuz-2.4.14 ro root=/dev/hda4
######### end of menu.conf ####################

3. 安装grub至Linux分区boot
将grub的stage1安装到/dev/hdb1的boot扇区(hd1,0). 过程如下:

/sbin/grub (运行grub)
grub> install (hd1,0)/grub/stage1 d (hd1,0) (hd1,0)/grub/stage2 p
(hd1,0)/boot/grub/menu.conf

(注意,上面"grub>"为grub的提示符,其后内容写在一行上.)

4. 取得grub的boot信息
过程如下:
dd if=/dev/hdb1 of=/grub.lnx bs=512 count=1

这样得到grub的引导信息,只要用NT Loader来加载它就行了.

5. 将上面得到的grub.lnx弄到Windows的C盘根目录下
可以先把grub.lnx弄得软盘上,然后启动windows,拷贝到C:\; 情况允许也可以直接
在Linux下拷贝到C:了. 我的C盘(即设备/dev/hda1)为FAT32, 可以直接从Linux下弄
过去了. 如下:

mount -t vfat /dev/hda1 /mnt/c
cp /grub.lnx /mnt/c
umount /mnt/c

6. 修改NT Loader的boot.ini
在其中加入一行: C:\grub.lnx="Redhat Linux - GRUB"
加入后boot.ini的内容如下:

[boot loader]
timeout=5
default=C:\boot.lnx
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\PNT40W="Windows xp
.00"
multi(0)disk(0)rdisk(0)partition(1)\PNT40W="Windows xp
.00

[VGA mode]" /basevideo /sos
C:\grub.lnx="Redhat Linux - GRUB"

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?