Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 2015 14:15:41 +0300
From:      Daniel Braniss <danny@cs.huji.ac.il>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: netboot configuration [was: Re: NFS Root with Raspberry Pi (nfs_diskless: no interface)]
Message-ID:  <33EFE756-B428-4A72-B3C5-0E764FA8ACC6@cs.huji.ac.il>
In-Reply-To: <1443276119.1224.382.camel@freebsd.org>
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> <CFAAFAE2-F0B2-431B-93C6-61D66464B7FD@cs.huji.ac.il> <1443105426.1224.272.camel@freebsd.org> <20150924163658.GC32257@gmail.com> <560438C5.3090404@selasky.org> <1443142468.1224.322.camel@freebsd.org> <FE458AF3-A9EE-46B1-89E3-1FB82E413E17@cs.huji.ac.il> <1443209159.1224.361.camel@freebsd.org> <12C96F79-2D70-408D-AD4C-F06F6B909AD3@cs.huji.ac.il> <1443276119.1224.382.camel@freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]

> On 26 Sep 2015, at 17:01, Ian Lepore <ian@FreeBSD.org> wrote:
> 
> On Sat, 2015-09-26 at 15:38 +0300, Daniel Braniss wrote:
>>> On Sep 25, 2015, at 10:25 PM, Ian Lepore <ian@FreeBSD.org> wrote:
>>> 
>>> On Fri, 2015-09-25 at 11:37 +0300, Daniel Braniss wrote:
>>>>> On 25 Sep 2015, at 03:54, Ian Lepore <ian@FreeBSD.org> wrote:
>>>>> 
>>>>> 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:
>>>>>> 
>>> [...stuff about problems netbooting...]
>>>> 
>>>> hi Ian,
>>>> can you help me here?
>>>> I need the magics to get ubldr to boot from the net,
>>>> i’m using an image built via crochet. 
>>>> 
>>>> cheers,
>>>> 	danny
>>> 
>>> I've been struggling with how to set up a new default u-boot environment
>>> in our ports to make netbooting easier.  The problem is that there are
>>> as many ways to netboot as there are different people wanting to do it.
>>> What I've been doing for years is loading both ubldr and the kernel from
>>> nfs, by configuring my dhcp server to provide all the info needed (board
>>> ip and netmask, server ip, ubldr file to load, and nfs root path), all
>>> based on the mac address of the board.  I've learned that doesn't work
>>> well for most people who don't have easy control over their dhcp server.
>>> 
>>> To try to keep this relatively simple, I'm going to assume that what
>>> most folks want to do is:
>>> 
>>>     * Load ubldr from the sdcard that has u-boot on it (not from nfs).
>>>     * Make ubldr load the freebsd kernel from nfs.
>>>     * Use an nfs root filesystem.
>>> 
>>> So I'm assuming you've got an nfs server already serving up the root
>>> filesystem (I'm not going to detail configuring that here).  That
>>> filesystem must contain an /etc/fstab that includes the ip:/rootpath
>>> entry for the root filesystem.  In other words, even though the software
>>> must already know the ip:/rootpath to find the fstab file, the file
>>> still must contain a root path entry.  (I find this annoying.)
>>> 
>>> Now on the u-boot side you need to add a few lines to the uEnv.txt file
>>> on the FAT partition (create the file there if it doesn't already
>>> exist).  You can configure a static IP address or get the IP from dhcp:
>>> 
>>> For static IP (On RPi only, add one line: UserPreboot=usb start)
>>> 
>>>       loaderdev=net
>>>       rootpath=192.168.0.240:/wand
>>>       ipaddr=192.168.0.233
>>>       netmask=255.255.255.0
>>> 
>>> 
>>> For DHCP (On RPi only, last line is: UserPreboot=usb start && dhcp)
>>> 
>>>       loaderdev=net
>>>       rootpath=192.168.0.240:/wand
>>>       autoload=no
>>>       UserPreboot=dhcp
>>> 
>>> BTW, you may notice a Netboot command in the standard u-boot env.  Do
>>> NOT set bootcmd=run Netboot, that would make u-boot try to load ubldr
>>> over the network, which requires running a tftp server.
>>> 
>>> — Ian
>> 
>> thanks! 
>> it almost worked :-)
>> - UserPreboot didn’t work, probably because I have the wrong u-boot?
>> stoping the boot, then typing
>> 	usb start
>> 	boot
>> at the U-Boot> prompt saved the day!
>> 
>> - if instead of boot I type dhcp, it tries to tftp u-boot, but I can’t figure out
>>  how to start it :-(
>> 
>> in any case, great!
>> now it would be nice if we pull resources and get this diskless stuff cleaned up
>> 
>> danny
>> 
>> 
> 
> I just committed the diskless fix, r288265.  It should only be needed
> for RPi and other systems with a usb-based NIC that initializes late in
> the boot process.
tested, and it works.

> 
> All the u-boot ports have the UserPreboot hook in their env.  Are you
> using an old copy of crochet?  (Hmmm, or has crochet never been updated
> to use the u-boot ports/packages for all the boards?)
> 
I compiled the u-boot-rpi from ports,
the good news:
	it understands UserPreboot
the bad news:
	the nfs boot gets stuck after a while.

after much trial and error, this is what I do:
	hit a key to enter U-Boot
then type:
	setenv loaderdev net
	boot

attaching the console:

[-- Attachment #2 --]
U-Boot> v     

U-Boot 2013.01-rc1 (Sep 26 2015 - 09:44:35)
arm-none-eabi-gcc (FreeBSD Ports Collection for armnoneeabi) 4.9.2
GNU ld (GNU Binutils) 2.25
U-Boot> printenv
Fatboot=env exists loaderdev || env set loaderdev ${fatdev}; env exists UserFatboot && run UserFatboot; echo Booting from: ${fatdev} ${bootfile}; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf; 
Netboot=env exists ethact || usb start; env exists loaderdev || env set loaderdev net; env exists UserNetboot && run UserNetboot; dhcp ${loadaddr} ${bootfile} && bootelf; 
Preboot=fdt addr 0x100; env exists bootfile || bootfile=ubldr; env exists uenv_file || uenv_file=uEnv.txt; env exists SetupFatdev && run SetupFatdev; env exists SetupUenv && run SetupUenv; env exists UserPreboot && run UserPreboot; 
SetupFatdev=env exists fatdev || fatdev='mmc 0'; 
SetupUenv=fatload ${fatdev} ${loadaddr} ${uenv_file} && env import -t ${loadaddr} ${filesize}; 
UserPreboot=usb start
arch=arm
baudrate=115200
board=rpi_b
board_name=rpi_b
bootcmd=run Fatboot
bootdelay=3
bootscript=fdt addr 0x100;bootelf 0x2000000
cpu=arm1176
ethact=sms0
fdtaddr=100
filesize=0x9c
loadaddr=0x02000000
loadbootscript=fatload mmc 0 0x2000000 ubldr
preboot=run Preboot
soc=bcm2835
stderr=serial,lcd
stdin=serial
stdout=serial,lcd
usbethaddr=b8:27:eb:7e:f3:9c
vendor=raspberrypi

Environment size: 1201/16380 bytes
U-Boot> show
HUSH_VERSION=0.01
bootfile=ubldr
uenv_file=uEnv.txt
fatdev=mmc 0
U-Boot> printenv
Fatboot=env exists loaderdev || env set loaderdev ${fatdev}; env exists UserFatboot && run UserFatboot; echo Booting from: ${fatdev} ${bootfile}; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf; 
Netboot=env exists ethact || usb start; env exists loaderdev || env set loaderdev net; env exists UserNetboot && run UserNetboot; dhcp ${loadaddr} ${bootfile} && bootelf; 
Preboot=fdt addr 0x100; env exists bootfile || bootfile=ubldr; env exists uenv_file || uenv_file=uEnv.txt; env exists SetupFatdev && run SetupFatdev; env exists SetupUenv && run SetupUenv; env exists UserPreboot && run UserPreboot; 
SetupFatdev=env exists fatdev || fatdev='mmc 0'; 
SetupUenv=fatload ${fatdev} ${loadaddr} ${uenv_file} && env import -t ${loadaddr} ${filesize}; 
UserPreboot=usb start
arch=arm
baudrate=115200
board=rpi_b
board_name=rpi_b
bootcmd=run Fatboot
bootdelay=3
bootscript=fdt addr 0x100;bootelf 0x2000000
cpu=arm1176
ethact=sms0
fdtaddr=100
filesize=0x9c
loadaddr=0x02000000
loadbootscript=fatload mmc 0 0x2000000 ubldr
preboot=run Preboot
soc=bcm2835
stderr=serial,lcd
stdin=serial
stdout=serial,lcd
usbethaddr=b8:27:eb:7e:f3:9c
vendor=raspberrypi

Environment size: 1201/16380 bytes
U-Boot> setenv loaderdev net
U-Boot> boot
Booting from: mmc 0 ubldr
reading ubldr
266046 bytes read in 69558 ms (2.9 KiB/s)
## Starting application at 0x01000094 ...
Consoles: U-Boot console  
Compatible U-Boot API signature found @1db682a8

FreeBSD/armv6 U-Boot loader, Revision 1.2
(danny@rnd, Fri Sep 25 12:02:55 IDT 2015)

DRAM: 480MB
Number of U-Boot devices: 2
U-Boot env: loaderdev='net'
Found U-Boot device: disk
Found U-Boot device: net
Waiting for Ethernet connection... done.
/boot/kernel/kernel data=0x6d07e4+0xe781c /

[-- Attachment #3 --]

> Do you want it to load ubldr via tftp instead of from the sdcard?
not sure what i want :-), with traditional pxe capable bioses, the boot/dhcp
has 2 stages, first if vendor id is set to PXEClient it sets filename to pxeboot,
then pxeboot sets vendor id to FreeBSD, and a whole bunch of other stuff
is provided, like root-path, etc.

in the case of rpi, if dhcp does not provide a filename, it goes an tries
to tftp load a nnnnnnn.img!

so, for RPI, we don’t need the PXE stuff that deals with the net driver,
but would be nice (and i’m looking into it) to set the vendor id stuff,
but I’m stuck in first base.

> That's an option, but ubldr doesn't change very often so just using the
> one on the sdcard should be good enough.
> 
> If you want u-boot to get an IP address via dhcp without trying to tftp
> an image, do "setenv autoload no" before the dhcp command.
> 
> -- Ian
> 

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33EFE756-B428-4A72-B3C5-0E764FA8ACC6>