From owner-freebsd-current@FreeBSD.ORG Tue Jan 29 01:26:05 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BB995985 for ; Tue, 29 Jan 2013 01:26:05 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 63233CD7 for ; Tue, 29 Jan 2013 01:26:05 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqEEANEkB1GDaFvO/2dsb2JhbABEFoYwuC1zgh4BAQEDAQEBASArIAsFFhgCAg0ZAikBCSYGCAcEARwEh2oGDK10kkeBI4t3gliBEwOIYYp+gi6BHI8sgxWBUTU X-IronPort-AV: E=Sophos;i="4.84,555,1355115600"; d="scan'208";a="14003137" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn.mail.uoguelph.ca with ESMTP; 28 Jan 2013 20:25:59 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 62EFFB4040; Mon, 28 Jan 2013 20:25:58 -0500 (EST) Date: Mon, 28 Jan 2013 20:25:58 -0500 (EST) From: Rick Macklem To: Lars Eggert Message-ID: <808229611.2447687.1359422758386.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: Subject: Re: mounting root from NFS via ROOTDEVNAME MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 01:26:05 -0000 Lars Eggert wrote: > Hi, > > I'm trying to netboot a system where the root device is specified in > the kernel via ROOTDEVNAME: > > options BOOTP > options BOOTP_NFSROOT > options BOOTP_NFSV3 > options BOOTP_COMPAT > options BOOTP_WIRED_TO=em4 > options ROOTDEVNAME=\"nfs:10.11.12.13:/usr/home/elars/dst\" > > I was under the assumption that specifying a ROOTDEVNAME in the kernel > config would override the "root-path" option in DHCP, or at least take > effect when "root-path" wasn't provided via DHCP, but that doesn't > seem to be the case. The system configures it's address correctly over > em4, but then enters a loop: > > em4: link state changed to UP > Received DHCP Offer packet on em4 from 0.0.0.0 (accepted) (no root > path) > Sending DHCP Request packet from interface em4 (XX:XX:XX:XX:XX:XX) > Received DHCP Ack packet on em4 from 0.0.0.0 (accepted) (no root path) > Received DHCP Ack packet on em4 from 0.0.0.0 (accepted) (no root path) > DHCP/BOOTP timeout for server 255.255.255.255 > Received DHCP Ack packet on em4 from 0.0.0.0 (accepted) (no root path) > DHCP/BOOTP timeout for server 255.255.255.255 > ... > > If I hand out a root path via DHCP the system boots fine, but the idea > here is to be able to boot different root devices without needing to > diddle dhcpd.conf. Can this be done? > Well, just to make it more interesting, there are 2 different ways an NFS root file system can be booted by the kernel. The other one can be configured by: - delete all options that start in BOOTP - add the "options NFS_ROOT" Now, the kernel will use information from a list of environment variables set by the loader, plus the values referenced to rootdevnames[0] and rootdevnames[1], if they are set. (The list of these environment variables is in a comment in sys/nfs/nfs_diskless.c and are normally set by pxeboot.) rootdevnames[0] gets set in nfs_diskless.c, but rootdevnames[1] does not. This source file has the magic for this way of doing it, as you might have guessed. I think rootdevnames[1] gets tried if rootdevnames[0] fails. You could try hacking sys/nfs/nfs_diskless.c and add a line to set rootdevnames[1] to ROOTDEVNAME, if it is defined. (#include "opt_rootdevname.h" so that it will be defined, if the option is specified.) I haven't tried this, but it might work? Btw, for the above to work, you need to use pxeboot and I think you'll need to have enough dhcpd setup so that it loads. (I'm not sure if option root-path is needed for pxeboot to get the loader going?) Short answer is, there may be a way to get this to work with a little source hacking, but it might be easier to just modify your dhcpd.conf;-) Btw, I use this document for how I set things up for the "options NFS_ROOT" version. http://people.freebsd.org/~rodrigc/pxe/freebsd_pxe.txt Good luck with it, rick ps: All BOOTP_NFSROOT does is tell the BOOTP version to use an NFS root and it will then expect the dhcp root-path option as you found out. > Thanks, > Lars > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe@freebsd.org"