Booting 2nd(!) FreeBSD installation sitting on same disk
Andre Albsmeier
Andre.Albsmeier at siemens.com
Mon Nov 5 06:31:38 UTC 2012
On Sat, 03-Nov-2012 at 23:34:48 +0100, jb wrote:
> Andre Albsmeier <Andre.Albsmeier <at> siemens.com> writes:
>
> > ...
> > However, when pressing F3, the system of slice 2(!) is
> > loaded. This is due to the fact that boot1 always loads
> > the first active FreeBSD slice ;-(.
> > ...
> > Is there no chance to actually honour the fact that F3 was
> > pressed and boot from slice 3 without updating the MBR before?
>
> I do not know the story of active slice in FreeBSD, but I know that neither
> Windows nor Linux require active partitions (in their jargon) to boot from any
> more.
If course FreeBSD doesn't rely on being started from an active
slice. Otherwise playing with currdev in loader wouldn't work.
It is just boot1 which causes the problem since it always searches
the MBR partition (slice) table for the first active FreeBSD slice
and if it doesn't find one it starts over again and searches for
any FreeBSD slice.
The problem is that boot1 doesn't get the information which F-key
was pressed in boot0 directly. It does only in case you allow a
write-back of the MBR using -o update with boot0cfg.
I made an ugly hack for this by patching boot1 code of slice 3
in a way that it actually searches for IN(!)active partitions in
its first pass:
--- sys/boot/i386/boot2/boot1.S.ORI 2012-09-23 22:07:16.000000000 +0200
+++ sys/boot/i386/boot2/boot1.S 2012-11-05 07:16:29.000000000 +0100
@@ -151,7 +151,11 @@
jne main.3 # No
jcxz main.5 # If second pass
testb $0x80,(%si) # Active?
+#ifdef AA_SKIP_ACTIVE_BSDSLICE
+ jz main.5 # No
+#else
jnz main.5 # Yes
+#endif
main.3: add $0x10,%si # Next entry
incb %dh # Partition
cmpb $0x1+PRT_NUM,%dh # In table?
Since this code only sits in boot1 of slice 3 it just applies to
slice 3.
The proper fix would be to pass the information about the key pressed
in boot0 to boot1 directly via registers of by whatever means...
-Andre
More information about the freebsd-questions
mailing list