This is a common question about booting PC-BSD and other OS, usually Windows.
I would like to share my configuration with grub.
First, I think you shall read the manual by GNU. It‘s very comprehensible.
My situation is PC-BSD on one hard disk and Windows XP on another hard disk.
The BIOS sets up the hard disk carrying PC-BSD has boot priority. But the hard disk with Windows XP is with lower IDE index.
So, I will use the grub on PC-BSD to boot Windows XP as well.
The grub is automatically installed and started after installation of PC-BSD.
The entries for PC-BSD is automatically configured as well.
So, I just need to add some custom config in the /boot/grub/custom.cfg
grub, in fact, reads /boot/grub/grub.cfg only, but you shall not update this file in most cases. The contents in custom.cfg is executed in grub.cfg in fact.
1 ### BEGIN /usr/local/etc/grub.d/41_custom ### 2 if [ -f ${config_directory}/custom.cfg ]; then 3 source ${config_directory}/custom.cfg 4 elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then 5 source $prefix/custom.cfg; 6 fi 7 ### END /usr/local/etc/grub.d/41_custom ###
In the custom.cfg, I added the following lines only.
1 # Start Windows XP Submenu 2 submenu "Windows XP" { 3 #insmod chain 4 insmod ntfs 5 set root=(hd0,1) 6 chainloader +1 7 exit 8 }
Lines starting with "#" are comments.
The line #2 is to add a sub-menu, which will be line with sub-menu for PC-BSD.
The insmod command is to load grub modules. According to the manual, chain and ntfs shall be loaded. But I found Windows can not boot if I loaded chain. I did not why. So, I simply comment it out.
Since my Windows is on the lower hard disk, the first partition, (hd0,1) is set as root for Windows.
The line #6 is the key for Windows booting. Because grub cannot boot Windows directly, chainloader means to request boot loader of Windows to boot itself.
The line #7 is not found in manual. But I found it‘s necessary to boot the Windows. I found it during interactive trials.
So, that‘s all you need to configure for grub to load PC-BSD plus Windows XP. It shall be also appliable for grub configuration on other OS, e.g. Linux.
Use grub to load PC-BSD and Windows XP,布布扣,bubuko.com
Use grub to load PC-BSD and Windows XP
原文:http://www.cnblogs.com/jieyuan-shen/p/3643880.html