From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 23 14:34:14 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87EB0106564A; Thu, 23 Feb 2012 14:34:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5B5B98FC14; Thu, 23 Feb 2012 14:34:14 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 1384846B17; Thu, 23 Feb 2012 09:34:14 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7E574B974; Thu, 23 Feb 2012 09:34:13 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 23 Feb 2012 08:02:04 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <20120217.074355.853.1@DOMY-PC> In-Reply-To: <20120217.074355.853.1@DOMY-PC> MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1250" Content-Transfer-Encoding: 7bit Message-Id: <201202230802.05083.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Feb 2012 09:34:13 -0500 (EST) Cc: rank1seeker@gmail.com, Roman Divacky Subject: Re: BUG: 9.0 stage 2 boot (/boot/boot) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 14:34:14 -0000 On Friday, February 17, 2012 2:43:55 am rank1seeker@gmail.com wrote: > Anyway, after upgrading to 9.0, my USB stick, when created, started to hang at stage 2 boot. > I have a custom setup, where BSD label 'a', has a content of /boot/* > So when 'a' is being hit by stage 2 boot, there is boot.config waiting for it. > After it reads it and displays it's content, it echos 'No' and hangs. > > I stare at it and can't believe as boot.config's information is correct! > I hit '?' and it list all files in 'a'. > Then I simply RE-type what is displayed on screen (content of boot.config -> path to loader) > And loader kicks in! > > I do this a few times more and EACH time I have to RE-type correct info! > Tested on other machine, same thing. > > However, this same custom layout works for HDD's, but NOT for USB stick. > > I've extracted binary installs of 8.2 and 9.0 R: > MD5 (8_boot) = adb1e84e96bd434e51cafaaa0ef22584 > MD5 (9_boot) = 40f3f6403ebd5e131259d1336b4b50ad > > Then: > # gpart bootcode -b 8_boot da0s2 > And sudenly that USB stick boots, without ANY other change! > Just an "old" stage 2 boot code, from R8 was enough. Looks like it is thinking that 'kname' is empty. Ah, I think Roman broke this in 219186: @@ -474,11 +461,7 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - if ((i = ep - arg)) { - if ((size_t)i >= sizeof(kname)) - return -1; - memcpy(kname, arg, i + 1); - } + kname = arg; } arg = p; } Before it only set kname if it wasn't an empty string. Now it always sets kname. Try this change: Index: boot2.c =================================================================== --- boot2.c (revision 231983) +++ boot2.c (working copy) @@ -457,7 +457,8 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - kname = arg; + if (*arg != '\0') + kname = arg; } arg = p; } -- John Baldwin