Subject: Re: dual-booting a WinXP box?
To: None <port-i386@NetBSD.org>
From: Aidan Kehoe <kehoea@parhasard.net>
List: port-i386
Date: 01/30/2004 22:16:17
 Ar an 30ú lá de mí 1, scríobh David Laight :

 > On Fri, Jan 30, 2004 at 09:49:14AM +0000, Aidan Kehoe wrote:
 > 
 > > It should break this, yeah?
 > 
 > Do you mean you want it to break?

No, I mean, I get the impression that if I were to install the new boot
code, I wouldn't be able to boot off the hard disk, and I'm interested to
know if that's really the case.

 > I'm not exactly sure how you are booting that anyway?

Umm ... before I updated the system and moved to UFS2, just after that big
UFS2 data-loss issue, the normal boot code (between the start of c and the
current start of b) loaded a kernel from the then FFS1 wd0a. For a while
after that, it was a matter of GRUB and kernel --type=netbsd for /netbsd on
wd0h, but a more recent update to GRUB broke its support for our kernel
format, IIRC.

I haven't been booting NetBSD from the hard disk since then. The bootable
i386 1.6.1 CDROM still lets me type "boot hd0h:netbsd" . *shrug* I don't
boot that often, and the weekends to go fix these things have been in
relatively short supply of late. 

 > I suspect you have copied the bootstrap code into the sectors between
 > the beginning of 'c' (netbsd mbr partition) and the start of 'b' (swap).

I believe it's there, yes. However, some Linux firewall-on-a-CDROM distro
trashed my MBR and the NTFS (active) partition about six months ago[1], and
since the re-install Windows XP has had the MBR to itself, even though I
haven't booted it in a couple of months now. So, the bootstrap code hasn't
been accessible in a while.

Yes, I keep both my partition table and disklabel around on paper. 

 > There is (and has always been) a restriction that the boot code be in
 > the netbsd partition at the start of the mbr boot partition.
 >
 > So to make that bootable you would need to make the mbr partition start
 > at the beginning of either 'a' or 'h' (leaving the swap in a different
 > mbr partition).

Could I make a tiny NetBSD partition at the start of the current NetBSD mbr
boot partition, and install it there? 

Alternatively, I could go and fix GRUB to understand our kernel format
again. Sergey Matveychuk's patches for UFS2 support seem together enough for
me. And go back to the CDROM when I need to pass arguments to the kernel. 

 > I've just had a thought that the pbr boot code could look in the 2nd sector
 > of the mbr partition for a netbsd disklabel if it fails to find a filesystem
 > at offset 0 (normal) or 64 (raid) and try partition 'a' instead.
 > The kernel writes the netbsd disklabel to the start of all netbsd mbr (type
 > 169) partitions, so it is likely to be correct.  disklabel(8) doesn't and
 > changing it is too hard until the disklabel -B has been killed.

Hmm, interesting. 

-- 
I don't care if it rains or freezes/'Long as I got my Plastic Jesus
Riding on the dashboard of my car.

[1] Disadvantages of asking for confirmation too much in software; people
end up not taking the warnings seriously. This thing was really into
confirmations until it came to schlepping a filesystem willy-nilly onto the
disk. I'm slightly uncomfortable at the Zsh's (comparatively) recent
tendency to ask for confirmation at "rm *" for similar reasons, and turn it
off when I take the time to configure it.