Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2012 11:42:19 +0100
From:      rank1seeker@gmail.com
To:        "Dieter BSD" <dieterbsd@engineer.com>, hackers@freebsd.org
Subject:   Re: NetBSD's boot select MBR
Message-ID:  <20121214.104219.547.1@DOMY-PC>
In-Reply-To: <20121213221145.310760@gmx.com>
References:  <20121213221145.310760@gmx.com>

index | next in thread | previous in thread | raw e-mail

> > > So I use NetBSD's MBR for disks I want

> > > to boot from.

> >

> > Can I have a CMD sequence?

> >

> > First would be ...

> > # fetch ...

> 

> Read NetBSD's fdisk(8) and mbr(8).

> 

> The MBR is only 512 bytes, and must contain the code and data.

> This is very limiting, so there are multiple versions depending

> on which features you need. IIRC, /usr/mdec/mbr_bootsel is the one I use.

> You can specify a label (up to 7 characters) for each bootable partition

> ("slice" in FreeBSD-speak). When the system executes the MBR code,

> it presents a menu with these labels. You can type '1' for the first

> partition/slice, '2' for the second, and so on. You can also type a

> function key to run the MBR of a different disk. The disk numbering

> can be rather insane, so it must be using the bios disk numbering. If

> you don't type anything it times out and boots the active partition/slice.

> 

> Sadly, the FreeBSD bootstrap insists on booting the partition/slice

> marked active in the MBR. (The MBR code should look at the active

> bit, the later bootstraps should not.) So if you want to have

> multiple FreeBSD versions, it works best to put each on its own disk.

> 

> The last time I used fdisk, large disks triggered a bug where some

> variable overflowed, giving negative numbers. Hopefully this is fixed

> by now. FreeBSD's fdisk also had some bug, so I had great fun

> handcrafting a MBR.

> 

> It's been a long time since I installed NetBSD from scratch, (I usually

> just unpack the tar files, run installboot, and edit some config files.)

> I assume you can just boot a CD and get a shell, and experiment with

> fdisk on a scratch disk without actually installing NetBSD.

> To avoid a disaster, do something like

> dd if=$DISK of=/boot/MBR_backup bs=512 count=1 ; sync

> beforehand, in case you accidently mess up your boot drive.

> 

> man pages:

> http://netbsd.gw.com/cgi-bin/man-cgi?++NetBSD-current

> 

> isos:

> http://www.netbsd.org/mirrors/

> for example:

> ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/amd64cd-5.2.iso

> or

> ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/i386cd-5.2.iso





MBR supports max of 4 slices/partitions.



Looing at:

http://netbsd.gw.com/cgi-bin/man-cgi?mbr++NetBSD-6.0



The '/usr/mdec/mbr_bootsel', which you've mentioned, is equivalent to FreeBSD's '/boot/boot0', which is tuned via 'boot0cfg' util.

It will also show menu, to choose from, a slice to boot or another drive  OR => 'F6' to choose PXE boot.

If nothing has been selected, it will simply boot an active slice.

So I see FreeBSD's, as superior (additionally supports PXE) => 8.0 onward ...



I don't use fdisk at all. Gpart is here ...

;)



Additionally ..., when I said '# fetch ...', I meant to get only 1 file, from ftp pub, which is installed into MBR ('/usr/mdec/mbr_$SOMETHING')

Then I would use FreeBSD's:

# gpart bootcode -b $path_to_netbsd_mbr_code ...



But this won't happen, as I thought NetBSD's had a MBR code, which could be told via a tool, from fully booted and running FreeBSD:

"Active slice is 2, but please, boot slice 4 at a next boot".

After that, I would '# reboot' and without any menu, slice 4 would be booted, for that one time, instaed of an active slice 2.



Am I missing something?

Thanks in advance.





Domagoj Smolčić






help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121214.104219.547.1>