From owner-freebsd-current@FreeBSD.ORG Thu Jan 31 15:25:42 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 D5385D30 for ; Thu, 31 Jan 2013 15:25:42 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.net.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC0DDD7 for ; Thu, 31 Jan 2013 15:25:42 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqAEAL2LClGDaFvO/2dsb2JhbABFhki4a3OCHgEBAQMBAQEBICsgCwUWGAICDRkCKQEJJgYIBwQBHASHagYMrzmSY4Eji36CWIETA4hkin+CL4EcjzCDFYFRNQ X-IronPort-AV: E=Sophos;i="4.84,577,1355115600"; d="scan'208";a="11749121" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu.net.uoguelph.ca with ESMTP; 31 Jan 2013 10:25:40 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 0BDDEB3F45; Thu, 31 Jan 2013 10:25:41 -0500 (EST) Date: Thu, 31 Jan 2013 10:25:41 -0500 (EST) From: Rick Macklem To: Lars Eggert Message-ID: <1435656219.2547176.1359645941027.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.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: Craig Rodrigues , 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: Thu, 31 Jan 2013 15:25:42 -0000 Lars Eggert wrote: > Hi, > > On Jan 30, 2013, at 22:43, Craig Rodrigues > wrote: > > What you need to do is, before the FreeBSD kernel boots, your > > loader needs to export some environment variables. This will trigger > > the various behaviors in the FreeBSD mount code. > > the loader can export some environment variables (this is how I get > the serial console working.) > > > So as I suggested before, you should continue with: > > > > (1) Have /usr/home/elars/dst/etc/fstab with: > > # Options Dump Pass > > 10.11.12.13:/usr/home/elars/dst/ / nfs ro 0 0 > > Done. > > > (2) From your loader, you need to export this environment variable, > > so > > that the kernel can get it with getenv(). You need at least: > > > > vfs.root.mountfrom=nfs:10.11.12.13:/usr/home/elars/dst > > Done. > > > Now, there are some other environment variables you need to export > > from the > > loader. > > > > boot.netif.ip > > boot.netif.netmask > > boot.netif.gateway > > boot.nfsroot.server > > boot.nfsroot.path > > Done. I also ripped out all the BOOTP* options from the kernel. > Here is the complete list of environment variables from the comment in sys/nfs/nfs_diskless.c: * The loader is expected to export the following environment variables: 149 * 150 * boot.netif.name name of boot interface 151 * boot.netif.ip IP address on boot interface 152 * boot.netif.netmask netmask on boot interface 153 * boot.netif.gateway default gateway (optional) 154 * boot.netif.hwaddr hardware address of boot interface 155 * boot.nfsroot.server IP address of root filesystem server 156 * boot.nfsroot.path path of the root filesystem on server 157 * boot.nfsroot.nfshandle NFS handle for root filesystem on server 158 * boot.nfsroot.nfshandlelen and length of this handle (for NFSv3 only) 159 * boot.nfsroot.options NFS options for the root filesystem Note that boot.nfsroot.nfshandle and boot.nfsroot.nfshandlelen are not easy to get. pxeboot does a Mount RPC against the NFS server to get them. (Probably the easiest way to find out what they are is to capture packets while doing a mount of the same path and then looking at the capture via wireshark.) For this method to work, you have to specify "options NFS_BOOT", but not the BOOTP* ones for the kernel. > However, this still fails: > > Trying to mount root from nfs:10.11.12.13:/usr/home/elars/dst []... > mountroot: waiting for device 10.11.12.13:/usr/home/elars/dst ... > Mounting from nfs:10.11.12.13:/usr/home/elars/dst failed with error > 19. > > Loader variables: > vfs.root.mountfrom=nfs:10.11.12.13:/usr/home/elars/dst > As far as I can see, the current code does not know how to turn this into a root file handle via a Mount RPC. I think a non-trivial patch to sys/nfs/bootp_subr.c would be required. As such, the only other way to make it work is to use "options NFS_ROOT" and specify the root file handle in the environment variables, as above. (If I recall correctly, the root file handle is specified as a string of hex digits, but look in the code in sys/nfs/nfs_diskless.c to confirm this.) rick > Manual root filesystem specification: > : [options] > Mount using filesystem > and with the specified (optional) option list. > > eg. ufs:/dev/da0s1a > zfs:tank > cd9660:/dev/acd0 ro > (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /) > > ? List valid disk boot devices > . Yield 1 second (for background tasks) > Abort manual input > > mountroot> > > I did a tcpdump and no traffic shows up on the correct interface > (em4). I guess I need to set yet another loader environment variable > to indicate which interface I'd like to use. Looking at the source, I > only see boot.netif.name, but setting that to em4 doesn't help either. > > Any further ideas? > > 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"