From nick@van-laarhoven.org  Thu Jan 25 22:49:12 2007
Return-Path: <nick@van-laarhoven.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id D7AA816A402
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 25 Jan 2007 22:49:12 +0000 (UTC)
	(envelope-from nick@van-laarhoven.org)
Received: from bali.sjc.webweaving.org (bali.sjc.webweaving.org [216.218.185.16])
	by mx1.freebsd.org (Postfix) with ESMTP id C583113C461
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 25 Jan 2007 22:49:12 +0000 (UTC)
	(envelope-from nick@van-laarhoven.org)
Received: from van-laarhoven.org (ap-zvhz-13f05.adsl.wanadoo.nl [81.69.93.5])
	(authenticated bits=0)
	by bali.sjc.webweaving.org (8.12.11/8.12.11) with ESMTP id l0PMn67V071762
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 25 Jan 2007 14:49:07 -0800 (PST)
	(envelope-from nick@van-laarhoven.org)
Received: (nullmailer pid 1724 invoked by uid 1001);
	Thu, 25 Jan 2007 22:22:09 -0000
Message-Id: <1169763729.049588.1723.nullmailer@van-laarhoven.org>
Date: Thu, 25 Jan 2007 23:22:09 +0100
From: nick@anywi.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: boot0cfg -s 2 does not work if noupdate is set.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         108355
>Category:       kern
>Synopsis:       boot0cfg -s 2 does not work if noupdate is set.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 25 22:50:11 GMT 2007
>Closed-Date:    Tue Feb 20 23:17:18 GMT 2007
>Last-Modified:  Tue Feb 20 23:17:18 GMT 2007
>Originator:     Nick Hibma
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
AnyWi Technologies
>Environment:
System: FreeBSD hind.van-laarhoven.org 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #5: Wed Jan 17 18:49:39 CET 2007 root@:/usr/src/sys/i386/compile/HIND i386

File: boot0.S           Status: Up-to-date

Working revision:    1.14.2.1
Repository revision: 1.14.2.1        /home/ncvs/src/sys/boot/i386/boot0/boot0.S,v
Sticky Tag:          RELENG_6 (branch: 1.14.2)
Sticky Date:         (none)
Sticky Options:      (none)
>Description:
When 'update' is set through boot0cfg you can select the default slice through
boot0cfg -s. However, if you use the following command to initialise your boot0
no matter what you select you always get the slice that was selected during
initialisation of the boot0 sector.

	boot0cfg -B -b /boot/boot0 -s 2 -m 3 -o noupdate,packet ad0

You can now NOT select slice 1 as the boot partition with

	boot0cfg -s 1 ad0

as if the missing update action makes boot0.S forget the value read from _OPT.
Instead you get the following (second slice is booted but boot0cfg is selected):

mount ; boot0cfg -v ad0
/dev/ad0s2a on / (ufs, local, read-only)
devfs on /dev (devfs, local)
/dev/md0 on /etc (ufs, local)
/dev/md1 on /var (ufs, local)
#   flag     start chs   type       end chs       offset         size
1   0x00      0:  1: 1   0xa5    477: 15:32           32       244704
2   0x80    478:  1: 1   0xa5    955: 15:32       244768       244704
3   0x00    956:  0: 1   0xa5    959: 15:32       489472         2048

version=1.0  drive=0x80  mask=0x3  ticks=182
options=packet,noupdate,nosetdrv
default_selection=F1 (Slice 1)

>How-To-Repeat:

On a spare machine:

        boot0cfg -B -b /boot/boot0 -s 2 -m 3 -o noupdate,packet ad0
	boot0cfg -s 1 ad0
	reboot
	# notice how it still boots from the second slice, not the selected one.
	
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Fri Jan 26 06:44:21 UTC 2007 
State-Changed-Why:  
I asked for feedback on how this was done (whether the 
ad0 drive was being used or not at the time of writing 
and I believe that even a read-only mount means using the 
disk. Asked what happends when you boot from CD and try 
the change). 


Responsible-Changed-From-To: freebsd-bugs->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Fri Jan 26 06:44:21 UTC 2007 
Responsible-Changed-Why:  
Grab the PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108355 
State-Changed-From-To: feedback->closed 
State-Changed-By: n_hibma 
State-Changed-When: Tue Feb 20 23:15:13 UTC 2007 
State-Changed-Why:  
This is weird. This was perfectly reproducable on the Soekrii we use, but not 
an HP machine. Perhaps this is a BIOS issue. I'll reopen if this becomes an 
issue again. For now I've just left it at 'update'. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108355 
>Unformatted:
