sys/boot/boot0/boot0.S - r186598

Warner Losh imp at bsdimp.com
Mon Jan 10 19:09:48 UTC 2011


On 01/10/2011 02:27, Daniel Braniss wrote:
>> This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
>> --------------enig0AE178BF2380C8CAA3249E0C
>> Content-Type: text/plain; charset=ISO-8859-1
>> Content-Transfer-Encoding: quoted-printable
>>
>> On 09/01/2011 04:38, Daniel Braniss wrote:
>>>> There was a post on the embedded list that suggested this work around:=
>>>>      echo 'a 2' | fdisk -f /dev/stdin ad0
>>>>      boot0cfg -s 2 ad0
>>>>
>>>> There are 2 issues with this:
>>>> 1) It can't be done without setting kern.geom.debugflags to 0x10.
>>>> 2) It resulted in most/all commands resulting in the error message
>>>> "Device not configured" including the second command and 'shutdown -r =
>> now=3D
>>>> '.
>>>>
>>>> Both of which leave this really work around fairly broken.
>>> the problem is that boot0cfg -s does NOT update the boot block, it fail=
>> s!
>>> the work around is:
>>> 	boot0cfg -s -t n dev
>>> then
>>> 	gpart set -a active -i n dev
>>>
>>> danny
>>>
>> Hi Danny,
>>
>> The bug does not seem to be in boot0cfg as:
>>
>> 1) It succeeds to write the new configuration to the boot block every
>> time i have tried.
>> 2) It does not touch the partition table at all only the mbr, so it was
>> never designed to change the active partition.
> arguable, since it used to work.
>
>> If this is not a bug in boot0 then its a bug in the man pages for
>> boot0cfg as it does make reference to having to change the active slice
>> to make this work.
> the problem is not as simple as it looks, and I don't have all the answers, but after spendig much time on this, it seems that not all BIOSes behave
> in a 'standard way' :-)

It isn't a bug in boot0.  The patch you pointed to was introduced to not 
wear out flash parts that boot a lot.

boot0cfg likely is the wrong tool for this job, even if it used to work 
and kinda had the functionality you wanted.  It's unlikely to be fixed, 
since there's no maintainer in the tree and it uses interfaces that are 
no longer supported.

The right tool for the job is gpart.  Sadly, the man page doesn't 
mention this at all.  Fortunately, the source is easy to read.  Someone 
should fix that disconnect :0.

gpart set -a active -i 1 ada0

will do the trick.

The reason that boot0 used to do the right thing is that it would always 
force writing the active partition on every boot.  Now it only writes it 
if it is a change from the default.  It might be argued that the proper 
behavior is update it only if it actually changed from last time (which 
means the first time it would write the flag automatically).  I'm on the 
fence on this one, but am open to reasoned arguments.

Warner


> 	danny
>
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
>
>



More information about the freebsd-hackers mailing list