From owner-freebsd-hackers@FreeBSD.ORG Mon May 2 14:36:33 2011 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 6CDB9106566B; Mon, 2 May 2011 14:36:33 +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 436668FC1A; Mon, 2 May 2011 14:36:33 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EED9F46B23; Mon, 2 May 2011 10:36:32 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6D0608A027; Mon, 2 May 2011 10:36:32 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 2 May 2011 09:26:52 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <20110429.160309.656.1@DEV> <4DBC3D63.6020508@FreeBSD.org> In-Reply-To: <4DBC3D63.6020508@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201105020926.53164.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 02 May 2011 10:36:32 -0400 (EDT) Cc: Alexander Motin Subject: Re: Look of boot2, on HDD 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: Mon, 02 May 2011 14:36:33 -0000 On Saturday, April 30, 2011 12:48:35 pm Alexander Motin wrote: > Garrett Cooper wrote: > > 2011/4/29 : > >> /boot/boot2 STAGE 2 bootstrap file > >> Understands the FreeBSD file system enough, to find files on it, and can provide a simple interface to choose the kernel or loader to run. > >> > >> Once sys is fully booted, HDD is 'ada0'. > >> However, STAGE 2, sees it, as a 'ad4', at boot process, which is same seen, by booted sys, when I turn off AHCI. > >> > >> So, here is the riddle ... > >> On fully booted sys, how do I query STAGE 2, to tell me, how it'll see, my 'ada0' HDD? > > > > This is a very interesting catch: > > > > /usr/src/sys/boot/pc98/boot2/boot2.c:static const char *const > > dev_nm[NDEV] = {"ad", "da", "fd"}; > > /usr/src/sys/boot/i386/boot2/boot2.c:static const char *const > > dev_nm[NDEV] = {"ad", "da", "fd"}; > > > > It probably will be a no-op soon because of some of the > > compatibility changes Alex made, but still a potential point of > > confusion nonetheless. > > Pardon my ignorance, but could somebody shed some light for me on this > list of names? Why much more sophisticated loader(8) operates disks as > diak0/1/..., while boot2 tries to mimic something he has no any idea > about, using very limited information from random sources? Does this > names important for anything? They are no longer important. Before /boot/loader existed, boot2 passed the root device to the kernel via 'bootdev'. It basically handled floppies (fdX for BIOS devices < 0x80) and hard drives (devices starting at 0x80, either ATA (wdX) or SCSI (sdX)). I think the user could hint what the root device was via /boot.config similar to 'vfs.mountroot' in loader.conf. Due to CAM (in 3.x) and sos's new ATA (in 4.x), wd and sd were renamed to 'ad' and 'da'. At this point however, it is mostly archaic. boot2 still passes info in bootdev that the loader uses, but all the loader cares about is the BIOS device number partition/slice information on that device. I would be happy for boot2 to be changed to use the same naming scheme that /boot/loader uses (diskX), but it's fairly low priority. -- John Baldwin