Subject: re: i386-current: how do I boot Windows off of my second disk.
To: None <netbsd-users@netbsd.org>
From: Brian Buhrow <buhrow@lothlorien.nfbcal.org>
List: netbsd-users
Date: 01/23/2006 01:28:43
	Hello.  Back in may of 2005, this topic came up when Hisashi tried to
install NetBSD on his system and get it to co-exist with Windows XP.  I
just ran into the exact same problem, and thought I'd post the solution
here, since it looks as though this thread never got resolved.

	the problem is that there is some confusion about where the Fn: diskn
message is coming from when you try to boot a system with the NetBSD boot
selector installed and it's also running Windows NT, 2000, or XP.  This
message is actually coming from a tiny program in the first sector of the
Windows partition, meaning if you see it, and you can still boot into
NetBSD, you've done everything correctly, and, further, the boot selector
code is working too.

	Here's the problem:  You can't use the NetBSD boot selector with Win
NT, 2000, or XP Pro.  (This might be true of XP Home as well, but I haven't
tested it.)

	the fix is outlined in the following steps.  Note that you may need to
take a few different steps if your setup differs from what I describe.  In
particular, if Windows is on an NTFS partition, you'll need to stuff the
first sector of your NetBSD partition off onto a floppy, thumb drive, or
some media which is also available to Windows.  You'll also have to do the
editing I describe under Windows with notepad, rather than your favorite
NetBSD editor.

1.  Install Windows as you normally would, partitioning your drive to leave
space for NetBSD, or, at least, a small NetBSD boot partittion.

2.  Install NetBSD, following the instructions given for an installation
which shares the disk with another OS.  Go ahead and install the boot
selector code as you normally would. (this insures you can do some test
boots with NetBSD before you add the complexity of a dual-boot setup.)

3.  After you've got the NetBSD side booting and running like you want,
boot it up, and login as root.  Then do something like:
#cd /tmp
#dd if=/dev/rwd0a of=nebboot.bin bs=512 count=1
(Note, you should replace /dev/rwd0a in the previous line with what ever
the raw device of the partition you're booting from is, i.e. /dev/wd1a or
/dev/sd0a.)

4.  Mount your Windows partition on a mount point, assuming you've stored
Windows in a FAT32 filesystem.

#mount -t msdos -o -l /dev/wd0e /mnt
(Again, replace /dev/wd0e with what ever your Windows partition is from
NetBSD's perspective.)

5.  Copy your new nebboot.bin file to /mnt

#cp -p /tmp/nebboot.bin /mnt

6.  Given the setup in step 4, there should now be a file called
/mnt/boot.ini.

7.  edit the boot.ini file and add a line that looks like:
c:\nebboot.bin="NetBSD"

If you're using the NetBSD editor, be sure to add a final control-m (^m) so
Windows doesn't get mad about reading it.
The new line can go at the end of the file.

8.  Run fdisk against the hard disk and make sure the Windows partition is
the active one.

9.  Shut down NetBSD.

10.  Boot your Windows cd, and go into system recovery mode.

11.  At the run prompt, or in the text window, run:
fixmbr

12.  Go ahead and let fixmbr fix your disk, even though it complains that
it is non-standard and that it might ruin everything on it.

13.  You're done.  Now, when you reboot, you should get the NT loader menu,
with Windows and NetBSD, where you can select which one to boot.

I hope this explanation helps someone else solve the problem more easily
than I did.
-Brian

P.S.  These instructions should work for all versions of NetBSD, including
1.6.x, 2.x, 3.x and -current.  (Should be good for pre-1.6, but my guess is
that those folks aren't going to be encoutering this problem because their
installations are in and working.)