From owner-freebsd-arm@freebsd.org Fri Sep 25 08:37:48 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CF50A08927 for ; Fri, 25 Sep 2015 08:37:48 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 500D415FF; Fri, 25 Sep 2015 08:37:46 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from chamsa.cs.huji.ac.il ([132.65.80.19]) by kabab.cs.huji.ac.il with esmtp id 1ZfOVg-000AKz-1r; Fri, 25 Sep 2015 11:37:40 +0300 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: NFS Root with Raspberry Pi (nfs_diskless: no interface) From: Daniel Braniss In-Reply-To: <1443142468.1224.322.camel@freebsd.org> Date: Fri, 25 Sep 2015 11:37:39 +0300 Cc: Hans Petter Selasky , freebsd-arm@freebsd.org, Rick Macklem Message-Id: References: <20150922052522.GA62140@gmail.com> <00C49FEB-E8EF-4469-85E2-0F901215CD11@cs.huji.ac.il> <20150923050414.GB43653@gmail.com> <91AAC64E-4C38-47AA-8910-48F7654A7524@cs.huji.ac.il> <20150923174445.GE43653@gmail.com> <1443105426.1224.272.camel@freebsd.org> <20150924163658.GC32257@gmail.com> <560438C5.3090404@selasky.org> <1443142468.1224.322.camel@freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.2104) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Sep 2015 08:37:48 -0000 > On 25 Sep 2015, at 03:54, Ian Lepore wrote: >=20 > On Thu, 2015-09-24 at 19:54 +0200, Hans Petter Selasky wrote: >> On 09/24/15 18:36, Randy Westlund wrote: >>> On Thu, Sep 24, 2015 at 08:37:06AM -0600, Ian Lepore wrote: >>=20 >>>>> [orig problem description: basically nfsroot without BOOTP fails] >>=20 >>>> Try setting boot.netif.name=3D"ue0" in loader.conf. I've never = tried >>>> that, but in looking at the code, there's some chance it could = work. :) >>>>=20 >>>> What I do is put these options into my RPi kernel config: >>>>=20 >>>> options BOOTP >>>> options BOOTP_NFSROOT >>>> options BOOTP_NFSV3 >>>> options BOOTP_WIRED_TO=3Due0 >>>>=20 >>>> But this requires configuring a bootp or dhcp server to provide the >>>> info. It should be possible to netboot without using BOOTP. >>>>=20 >>>> -- Ian >>>=20 >>> No luck with boot.netif.name. >>>=20 >>> I'm using the kernel that comes in the FreeBSD RPI-B disk image. Is >>> there a way to see what it was built with? I tried running strings = on >>> the kernel, but I'm not sure what to look for. Otherwise I guess = I'll >>> build one myself. >>>=20 >>> Randy >>>=20 >>=20 >> Hi, >>=20 >> The problem is that the code in: >>=20 >> sys/nfs/bootp_subr.c: SYSINIT(bootp_rootconf, SI_SUB_ROOT_CONF,=20 >> SI_ORDER_FIRST, bootpc_init, NULL); >>=20 >> doesn't wait for the USB ethernet device to be enumerated. Only the=20= >> vfs_mountroot() code which is running from the init-process does so. >>=20 >> Not sure what the best way to solve this is. Try putting: >>=20 >> pause("W", hz * 4); >>=20 >> Into the beginning of the "bootpc_init()" function. >>=20 >> --HPS >=20 > I had time to look into this today. The bootpc_init() routine *does* > wait for an interface to appear. The problem in this case is that = BOOTP > isn't involved, and the nfs_setup_diskless() routine doesn't have a > similar wait loop for slow interfaces. The attached patch adds it, = and > with it I can nfsmount root on my RPi without using the BOOTP_foo > options I listed above. >=20 > Rick, does this patch look okay to you? If no objections, I'll commit > this asap. >=20 > -- Ian >=20 > Index: sys/nfs/nfs_diskless.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/nfs/nfs_diskless.c (revision 288203) > +++ sys/nfs/nfs_diskless.c (working copy) > @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); > #include > #include >=20 > +#define IFACE_TIMEOUT_SECS 10 /* Timeout for interface to = appear. */ > + > static int inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa); > static int hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa); > static int decode_nfshandle(char *ev, u_char *fh, int maxfh); > @@ -170,6 +172,7 @@ nfs_setup_diskless(void) > char *cp; > int cnt, fhlen, is_nfsv3; > uint32_t len; > + time_t timeout_at; >=20 > if (nfs_diskless_valid !=3D 0) > return; > @@ -214,6 +217,8 @@ nfs_setup_diskless(void) > return; > } > ifa =3D NULL; > + timeout_at =3D time_uptime + IFACE_TIMEOUT_SECS; > +retry: > CURVNET_SET(TD_TO_VNET(curthread)); > IFNET_RLOCK(); > TAILQ_FOREACH(ifp, &V_ifnet, if_link) { > @@ -234,6 +239,10 @@ nfs_setup_diskless(void) > } > IFNET_RUNLOCK(); > CURVNET_RESTORE(); > + if (time_uptime < timeout_at) { > + pause("nfssdl", hz / 5); > + goto retry; > + } > printf("nfs_diskless: no interface\n"); > return; /* no matching interface */ > match_done: > _______________________________________________ hi Ian, can you help me here? I need the magics to get ubldr to boot from the net, i=E2=80=99m using an image built via crochet.=20 cheers, danny