Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Aug 1998 23:54:46 -0500 (EST)
From:      bright@www.hotjobs.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/7688: need fix for how freebsd boots itself. 
Message-ID:  <199808200454.XAA00444@bright.fx.genx.net>

next in thread | raw e-mail | index | archive | help

>Number:         7688
>Category:       kern
>Synopsis:       FreeBSD will NOT boot itself if it's not the first BSD partition
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 19 21:00:00 PDT 1998
>Last-Modified:
>Originator:     Alfred Perlstein
>Organization:
HotJobs Inc.
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:
3.0-current i386

	WD disk as my master disk



	

>Description:

ok, here's the problem with booting off a second BSD partition:

the bootstrap has no notion of "where it was loaded from" it just blindly
picks the first BSD partition it finds to load the boot2 program or root
directory info.

a simple kludge would be to "brand" an area of this binary before it is
installed, or perhaps have the boot loader find out?  i'm unsure how to do
this right now. (PC intern is under a lotta stuff at home)

from file: /usr/src/sys/i386/boot/
"start.S" line 159 of 458

        /* find the first 386BSD partition */
        data32
        mov     $PARTSTART, %ebx
        data32
        mov     $NUMPART, %ecx
again:
        addr32
        movb    %es:4(%ebx), %al
        cmpb    $BSDPART, %al
        data32
        je      found
        data32
        add     $PARTSZ, %ebx
        data32
        loop    again
        data32
        mov     $enoboot, %esi
        data32
        jmp     err_stop

now here's where devfs comes in:

devfs probes the floppie to see if it is bootable, this isn't that great
and should have some flag to disable that as it sorta makes the machine
vulnerable to someone sticking a hacked PICObsd disk in (perhaps in a
public lab)                

also, devfs checks each partition in order, this is urm, basically
an inconvient way to find a root partition, again, can't something be
passed though the boot -> kernel -> devfs to tell it where it's actually
booting from?

right now an icky thing i think i'm going to try is to do this:

partition table:
partition 1 (win95) HEY! it's boss says i need to keep it :P
partition 3 (freebsd)
partition 2 (freebsd)

i'm going to fake the ordering by messing with start/stop addresses

one of the incentives to fix this problem (besideds the fact that it
irritates me a bit) is that someone my wish to have -current and -stable
on one box for development purposes.

my "fix" leaves me unable to boot from the true middle partition.
                                                                 
	

>How-To-Repeat:

simple: have a setup like so:

partition table:
	1-DOS
	2-DOS
	3-FreeBSD

change to:
	1-DOS
	2-FreeBSD (empty)
	3-FreeBSD (your old stuff)

cannot boot, only way to salvage is to make the 2nd partition non-BSD again.

>Fix:

	suggest that somehow the boot section see if it can ID itself where it was loaded from.

	brand the boot sector with a hint of which partition it came from.

	this info should be passed along through the kernel and made available to DEVFS to prevent "floppy disk machine hijacking" ie. sticking a bootable BSD diskette in a machine with the BIOS floppy boot turned off.
	ALSO this way you can have 2 seperate root partitions for stable & current perhaps.

	btw, this is a REAL zinger for a newbie and i think i spent one day ripping my hair out for hours when trying to do an install to a secondary disk on a machine about a year ago.

	thank you.
	Alfred.



	
	

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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