From owner-freebsd-current@FreeBSD.ORG Sun Jun 2 16:46:40 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 9D69C26C for ; Sun, 2 Jun 2013 16:46:40 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) by mx1.freebsd.org (Postfix) with ESMTP id 785BB1FB5 for ; Sun, 2 Jun 2013 16:46:40 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1UjBQQ-0005ni-HE; Sun, 02 Jun 2013 16:46:34 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r52GkUaA013294; Sun, 2 Jun 2013 10:46:30 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX181I1ZdiX8VEjqph2Nj9piA Subject: Re: mounting root from NFS via ROOTDEVNAME From: Ian Lepore To: Rick Macklem In-Reply-To: <30016244.120440.1370132931499.JavaMail.root@erie.cs.uoguelph.ca> References: <30016244.120440.1370132931499.JavaMail.root@erie.cs.uoguelph.ca> Content-Type: text/plain; charset="us-ascii" Date: Sun, 02 Jun 2013 10:46:30 -0600 Message-ID: <1370191590.1258.93.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Craig Rodrigues , freebsd-current , Lars Eggert 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: Sun, 02 Jun 2013 16:46:40 -0000 On Sat, 2013-06-01 at 20:28 -0400, Rick Macklem wrote: > Lars Eggert wrote: > > Hi, > > > > to conclude this thread, the patch below allows one to specify an nfs > > rootfs via the ROOTDEVNAME kernel option, which will be mounted when > > BOOTP does not return a root-path option. > > > > Lars > > > My only concern with this (mainly because I don't understand the rules > applied to boot alternatives well enough) is that a few arm configs have > both BOOTP, BOOTP_NFSROOT and ROOTDEVNAME specified, where ROOTDEVNAME > is set to "ufs:...". I don't think this patch will break them, since I > think they'll use NFS and ignore the ROOTDEVNAME, but I'm not completely > sure. Does someone else know how HL201 boots, for example? > > Lars, if you have a src commit, you can consider this reviewed by me. If > not, maybe Craig can review it and then I'll commit it. > > Thanks for doing this, rick > > > > > diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c > > index 2c57a91..972fb12 100644 > > --- a/sys/nfs/bootp_subr.c > > +++ b/sys/nfs/bootp_subr.c > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > > > #include "opt_bootp.h" > > #include "opt_nfs.h" > > +#include "opt_rootdevname.h" > > > > #include > > #include > > @@ -870,8 +871,20 @@ bootpc_call(struct bootpc_globalcontext *gctx, > > struct thread *td) > > rtimo = time_second + > > BOOTP_SETTLE_DELAY; > > printf(" (got root path)"); > > - } else > > + } else { > > printf(" (no root path)"); > > +#ifdef ROOTDEVNAME > > + /* > > + * If we'll mount rootfs from > > + * ROOTDEVNAME, we can accept > > + * offers without root paths. > > + */ > > + gotrootpath = 1; > > + rtimo = time_second + > > + BOOTP_SETTLE_DELAY; > > + printf(" (ROOTDEVNAME)"); > > +#endif > > + } > > printf("\n"); > > } > > } /* while secs */ > > @@ -1440,6 +1453,16 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, > > struct bootpc_ifcontext *ifctx, > > > > p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, > > TAG_ROOT); > > +#ifdef ROOTDEVNAME > > + /* > > + * If there was no root path in BOOTP, use the one in ROOTDEVNAME. > > + */ > > + if (p == NULL) { > > + p = strdup(ROOTDEVNAME, M_TEMP); > > + if (strcmp(strsep(&p, ":"), "nfs") != 0) > > + panic("ROOTDEVNAME is not an NFS mount point"); > > + } > > +#endif > > if (p != NULL) { > > if (gctx->setrootfs != NULL) { > > printf("rootfs %s (ignored) ", p); > > I've seen several requests over the past year for an nfs ROOTDEVNAME along with BOOTP to work properly from ARM developers (myself included), so I don't think we should worry about breaking existing config that happens to be checked in but a) hasn't been tested by anyone for ages, and b) doesn't work anyway (ROOTDEVNAME just gets ignored). -- Ian