Subject: Re: strange bootmenu entries
To: None <port-i386@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 06/07/2004 18:35:34
On Mon, Jun 07, 2004 at 12:29:31PM +0200, Jukka Salmi wrote:
> David Laight --> port-i386 (2004-06-04 17:34:13 +0100):
> [...]
> > Clearly fdisk could do some validation on the 'printability' of the menu
> > strings.
> [...]
> 
> That would trap some more cases, but e.g. the bootmenu entry of my MBR
> partition 0 contains a printable, NULL terminated string ("Error") which
> was written by GRUB...

That depends on how hard you look - All 4 fields need to be valid strings,
and (I think) the unused parts are set to 0 by current versions of fdisk.

> True, but those 50% are 100% correct ;-) I.e. if MBR_BS_ACTIVE is not set
> the menu entries should never be printed, right?

But that doesn't get rid of enough of the error cases.

> Should I send-pr the patch?

I'll sort something out.

> What I don't understand: why does the normal boot code have MBR_BS_MAGIC
> set at MBR_BS_MAGIC_OFFSET?
> 
> $ hexdump -s 444 -n 2 /usr/mdec/mbr         
> 00001bc b5e1                                   

Because there is space, and it makes life a whole lot easier in all the
mbr editing code.

In actual fact, the main difference between the 'normal' mbr code and
the 'bootsel' mbr code is that the former has longer error messages.
If you remove all the menu strings, the bootsel code will boot the
active partitioon.

	David

-- 
David Laight: david@l8s.co.uk