Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Feb 2012 15:41:48 +0100
From:      rank1seeker@gmail.com
To:        hackers@freebsd.org, "John Baldwin" <jhb@freebsd.org>, "Roman Divacky" <rdivacky@freebsd.org>
Subject:   Re: BUG: 9.0 stage 2 boot (/boot/boot)
Message-ID:  <20120225.144148.466.1@DOMY-PC>
In-Reply-To: <201202241531.11281.jhb@freebsd.org>
References:  <20120217.074355.853.1@DOMY-PC> <201202241223.45255.jhb@freebsd.org> <20120224.191152.168.2@DOMY-PC> <201202241531.11281.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message -----=0D=0AFrom: John Baldwin =
<jhb@freebsd.org>=0D=0ATo: rank1seeker@gmail.com=0D=0ACc: =
hackers@freebsd.org, "Roman Divacky" <rdivacky@freebsd.org>=0D=0ADate: =
Fri, 24 Feb 2012 15:31:11 -0500=0D=0ASubject: Re: BUG: 9.0 stage 2 boot =
(/boot/boot)=0D=0A=0D=0A> On Friday, February 24, 2012 2:11:52 pm =
rank1seeker@gmail.com wrote:=0D=0A> > ----- Original Message -----=0D=0A> =
> From: John Baldwin <jhb@freebsd.org>=0D=0A> > To: =
rank1seeker@gmail.com=0D=0A> > Cc: hackers@freebsd.org, "Roman Divacky" =
<rdivacky@freebsd.org>=0D=0A> > Date: Fri, 24 Feb 2012 12:23:45 =
-0500=0D=0A> > Subject: Re: BUG: 9.0 stage 2 boot (/boot/boot)=0D=0A> > =
=0D=0A> > > On Friday, February 24, 2012 9:05:54 am rank1seeker@gmail.com =
wrote:=0D=0A> > > > ----- Original Message -----=0D=0A> > > > From: John =
Baldwin <jhb@freebsd.org>=0D=0A> > > > To: =
freebsd-hackers@freebsd.org=0D=0A> > > > Cc: rank1seeker@gmail.com, Roman =
Divacky <rdivacky@freebsd.org>=0D=0A> > > > Date: Thu, 23 Feb 2012 =
08:02:04 -0500=0D=0A> > > > Subject: Re: BUG: 9.0 stage 2 boot =
(/boot/boot)=0D=0A> > > > =0D=0A> > > > > On Friday, February 17, 2012 =
2:43:55 am rank1seeker@gmail.com wrote:=0D=0A> > > > > > Anyway, after =
upgrading to 9.0, my USB stick, when created, started =0D=0A> to =0D=0A> =
> > hang =0D=0A> > > > > at stage 2 boot.=0D=0A> > > > > > I have a =
custom setup, where BSD label 'a', has a content of /boot/*=0D=0A> > > > =
> > So when 'a' is being hit by stage 2 boot, there is boot.config =
=0D=0A> waiting =0D=0A> > > for =0D=0A> > > > > it.=0D=0A> > > > > > =
After it reads it and displays it's content, it echos 'No' and =0D=0A> =
hangs.=0D=0A> > > > > > =0D=0A> > > > > > I stare at it and can't believe =
as boot.config's information is =0D=0A> correct!=0D=0A> > > > > > I hit =
'?' and it list all files in 'a'.=0D=0A> > > > > > Then I simply RE-type =
what is displayed on screen (content of =0D=0A> > > boot.config -> =
=0D=0A> > > > > path to loader)=0D=0A> > > > > > And loader kicks =
in!=0D=0A> > > > > > =0D=0A> > > > > > I do this a few times more and =
EACH time I have to RE-type correct =0D=0A> info!=0D=0A> > > > > > Tested =
on other machine, same thing.=0D=0A> > > > > > =0D=0A> > > > > > However, =
this same custom layout works for HDD's, but NOT for USB =0D=0A> =
stick.=0D=0A> > > > > > =0D=0A> > > > > > I've extracted binary installs =
of 8.2 and 9.0 R:=0D=0A> > > > > > MD5 (8_boot) =3D =
adb1e84e96bd434e51cafaaa0ef22584=0D=0A> > > > > > MD5 (9_boot) =3D =
40f3f6403ebd5e131259d1336b4b50ad=0D=0A> > > > > > =0D=0A> > > > > > =
Then:=0D=0A> > > > > > # gpart bootcode -b 8_boot da0s2=0D=0A> > > > > > =
And sudenly that USB stick boots, without ANY other change!=0D=0A> > > > =
> > Just an "old" stage 2 boot code, from R8 was enough.=0D=0A> > > > > =
=0D=0A> > > > > Looks like it is thinking that 'kname' is empty.  Ah, I =
think Roman =0D=0A> broke =0D=0A> > > this=0D=0A> > > > > in =
219186:=0D=0A> > > > > =0D=0A> > > > >  @@ -474,11 +461,7 @@ =
parse()=0D=0A> > > > >  			     ? DRV_HARD : 0) + drv;=0D=0A> > > > >  		=
dsk_meta =3D 0;=0D=0A> > > > >  	    }=0D=0A> > > > > -	    if ((i =3D ep =
- arg)) {=0D=0A> > > > > -		if ((size_t)i >=3D sizeof(kname))=0D=0A> > > =
> > -		    return -1;=0D=0A> > > > > -		memcpy(kname, arg, i + 1);=0D=0A> =
> > > > -	    }=0D=0A> > > > > +            kname =3D arg;=0D=0A> > > > > =
 	}=0D=0A> > > > >  	arg =3D p;=0D=0A> > > > >      }=0D=0A> > > > > =
=0D=0A> > > > > Before it only set kname if it wasn't an empty string.  =
Now it always =0D=0A> sets=0D=0A> > > > > kname.  Try this change:=0D=0A> =
> > > > =0D=0A> > > > > Index: boot2.c=0D=0A> > > > > =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A> =
> > > > --- boot2.c	(revision 231983)=0D=0A> > > > > +++ boot2.c	(working =
copy)=0D=0A> > > > > @@ -457,7 +457,8 @@ parse()=0D=0A> > > > >  			     =
? DRV_HARD : 0) + drv;=0D=0A> > > > >  		dsk_meta =3D 0;=0D=0A> > > > >  	=
    }=0D=0A> > > > > -            kname =3D arg;=0D=0A> > > > > +	    if =
(*arg !=3D '\0')=0D=0A> > > > > +		    kname =3D arg;=0D=0A> > > > >  	=
}=0D=0A> > > > >  	arg =3D p;=0D=0A> > > > >      }=0D=0A> > > > > =
=0D=0A> > > > > -- =0D=0A> > > > > John Baldwin=0D=0A> > > > > =0D=0A> > =
> > =0D=0A> > > > =0D=0A> > > > It still doesn't work!=0D=0A> > > > =
=0D=0A> > > > And please, next time attach patch in a file (unified =
format), so I =0D=0A> would  =0D=0A> > > have a less hassle (to avoid =
manuall patch application)=0D=0A> =0D=0A> Hmm, our mailing lists each =
attachments, so you are less likely to get the=0D=0A> patch that =
way.=0D=0A> =0D=0A> > > Do you still get 'No ' with no other message =
before it breaks?=0D=0A> > =0D=0A> > =0D=0A> > I get 'No ' with no other =
message before it HANGS waiting for manual input?=0D=0A> > Manual input =
makes it work.=0D=0A> > I simply RE-type outputed contest of boot.config =
file.=0D=0A> > =0D=0A> > =0D=0A> > > Can you show me the contents of your =
/boot.config file via hd?=0D=0A> > =0D=0A> > =0D=0A> > Both USB stick and =
HDD have a same boot.config file, contents:=0D=0A> > ---=0D=0A> > =
/loader=0D=0A> > ---=0D=0A> =0D=0A> Hmm, you didn't pass it to hd(1) like =
I asked.  Anyway, I hacked up a test=0D=0A> program to run the parse() =
routine from boot2.c and it DTRT.=0D=0A=0D=0A=0D=0A# hd =
boot.config=0D=0A00000000  2f 6c 6f 61 64 65 72 0a                        =
   |/loader.|=0D=0A00000008=0D=0A=0D=0A=0D=0A> Do you only see the "No " =
message?  Do you see the '/boot.config: /loader'=0D=0A> message?  (Do you =
have RBX_QUIET enabled perhaps? (-q))  Do you get the actual=0D=0A> boot2 =
prompt at all?=0D=0A=0D=0AI don't have RBX_QUIET enabled nor any other =
flags=0D=0A=0D=0ALet the pic tell a =
story:=0D=0Ahttp://www.starforce.biz/stage2boot.jpg=0D=0A=0D=0AIt is also =
valid for your latest patch=0D=0A=0D=0A=0D=0A> Hmm, I think the problem =
is that 'opts' has garbage instead of being=0D=0A> initialized to =
zero.=0D=0A> =0D=0A> Try this (also at =
www.freebsd.org/~jhb/patches/boot2_opts.patch):=0D=0A=0D=0A=0D=0APatch =
eliminates possible error, of manual "intervention"=0D=0AThat is, a =
perfectly valid patch being classified as invalid.=0D=0A=0D=0A=0D=0A> =
=0D=0A> Index: boot2.c=0D=0A> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D=0A> =
--- boot2.c	(revision 231983)=0D=0A> +++ boot2.c	(working copy)=0D=0A> @@ =
-224,6 +224,7 @@=0D=0A>      uint8_t autoboot;=0D=0A>      ino_t =
ino;=0D=0A>  =0D=0A> +    opts =3D 0;=0D=0A>      kname =3D NULL;=0D=0A>  =
    dmadat =3D (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - =
__base);=0D=0A>      v86.ctl =3D V86_FLAGS;=0D=0A> =0D=0A> =0D=0A> -- =
=0D=0A> John Baldwin=0D=0A> =0D=0A=0D=0A=0D=0ADomagoj Smol=E8i=E6



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