Subject: Re: strange bootmenu entries
To: None <port-i386@netbsd.org>
From: Jukka Salmi <jukka-netbsd@2004.salmi.ch>
List: port-i386
Date: 06/05/2004 12:53:54
--1UWUbFP1cBYEclgG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
David Laight --> port-i386 (2004-06-04 17:34:13 +0100):
> On Thu, May 27, 2004 at 11:38:38PM +0200, Jukka Salmi wrote:
> > Hello,
> >
> > on a -current system I was using the normal boot code from /usr/mdec/mbr.
> > Now I installed the GRUB boot loader (grub-0.94nb1 from pkgsrc); since
> > then fdisk shows strange bootmenu entries:
> ...
> > 1: NetBSD (sysid 169)
> > bootmenu: ?\016?\020?<
> > start 80325, size 14683410 (7170 MB, Cyls 5-919)
> ...
> > As a workaround I zeroed MBR_BS_MAGIC on wd0. But after the next fdisk /
> > GRUB install the problem will be back again...
>
> Well, fdisk uses the MBR_BS_MAGIC number (just before the ptn table) to
> decide whether the bootcode is the netbsd one.
>
> When you install grub, it seems that it overwrites part of the netbsd
> bootmenu table - but not the magic number.
> Clearly fdisk could do some validation on the 'printability' of the menu
> strings.
> Maybe it would have been better if MBR_BS_MAGIC had been placed at the
> start of the bootsel info - but I'm not moving it again!
What about checking if the bootselector is active before printing bootmenu
entries (see attached patch)? Would make sense AFAICT.
Cheers, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
--1UWUbFP1cBYEclgG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fdisk.diff"
--- fdisk.c.orig 2004-05-21 21:44:47.000000000 +0200
+++ fdisk.c 2004-06-05 12:45:58.000000000 +0200
@@ -748,6 +748,7 @@
printf("%s (sysid %d)\n", get_type(partp->mbrp_type), partp->mbrp_type);
#ifdef BOOTSEL
if (le16toh(boot->mbr_bootsel_magic) == MBR_BS_MAGIC &&
+ boot->mbr_bootsel.mbrbs_flags & MBR_BS_ACTIVE &&
boot->mbr_bootsel.mbrbs_nametab[part][0])
printf("%*s bootmenu: %s\n", indent, "",
boot->mbr_bootsel.mbrbs_nametab[part]);
--1UWUbFP1cBYEclgG--