Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2013 20:25:58 -0500 (EST)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Lars Eggert <lars@netapp.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: mounting root from NFS via ROOTDEVNAME
Message-ID:  <808229611.2447687.1359422758386.JavaMail.root@erie.cs.uoguelph.ca>
In-Reply-To: <D4D47BCFFE5A004F95D707546AC0D7E91F671642@SACEXCMBX01-PRD.hq.netapp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?808229611.2447687.1359422758386.JavaMail.root>