Using U-Boot with DHCP, TFTP, NFS root

2,854 views
Skip to first unread message

Simon Glass

unread,
Feb 16, 2011, 4:59:46 PM2/16/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

You can find an early version of the documentation for this here:

https://sites.google.com/a/chromium.org/dev/network-based-development

The CL for enabling this in U-Boot is:

http://codereview.chromium.org/6480056/

With this you should be able to:

- Get an IP address in U-Boot via DHCP
- TFTP the kernel from your machine
- Boot it with NFS root

Any problems please follow up here.

Regards,
Simon

Sunil Nagpal

unread,
Feb 16, 2011, 6:01:01 PM2/16/11
to Chromium OS dev
Thanks, I'll let you know how it goes.

-Sunil

Simon Glass

unread,
Feb 22, 2011, 6:31:02 PM2/22/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

Actually the CL has landed so you can just use ToT (repo sync!) Yes
you need to understand the U-Boot vars. Please let me know if docs
need work on that side.

Regards,
Simon

On Tue, Feb 22, 2011 at 3:25 PM, Sunil Nagpal <suniln...@gmail.com> wrote:
> Hi Simon,
>
> How do you suggest I apply the CL? I'm kind of confused about that. I
> have my DHCP server and TFTP servers set up, that's pretty simple.
> It's just the U-Boot Environment Variables/U-Boot Boot Flow steps that
> I'm kind of confused on before I can test the whole thing.
>
> Btw, I'm using a nightly build/image rather than my own, which
> shouldn't be a problem (I did that for NFS Boot before).
>
> Thanks for your help again.
>
> -Sunil

> --
> Chromium OS Developers mailing list: chromiu...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
>

Sunil Nagpal

unread,
Feb 22, 2011, 6:52:36 PM2/22/11
to Chromium OS dev
Are the environment variables described in the two sections I
mentioned necessary to set as they were with regular NFS Boot on each
boot sequence, or should they be loaded somewhere else?

On Feb 22, 3:31 pm, Simon Glass <s...@chromium.org> wrote:
> Hi Sunil,
>
> Actually the CL has landed so you can just use ToT (repo sync!) Yes
> you need to understand the U-Boot vars. Please let me know if docs
> need work on that side.
>
> Regards,
> Simon
>
> > Chromium OS Developers mailing list: chromium-os-...@chromium.org

Sunil Nagpal

unread,
Feb 22, 2011, 6:25:20 PM2/22/11
to Chromium OS dev
Hi Simon,

How do you suggest I apply the CL? I'm kind of confused about that. I
have my DHCP server and TFTP servers set up, that's pretty simple.
It's just the U-Boot Environment Variables/U-Boot Boot Flow steps that
I'm kind of confused on before I can test the whole thing.

Btw, I'm using a nightly build/image rather than my own, which
shouldn't be a problem (I did that for NFS Boot before).

Thanks for your help again.

-Sunil

On Feb 16, 3:01 pm, Sunil Nagpal <sunilnagpa...@gmail.com> wrote:

Simon Glass

unread,
Feb 22, 2011, 7:05:10 PM2/22/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

You should set them and then use 'saveenv' to save them. Then when you
reboot they will still be there.

Regards,
Simon

> Chromium OS Developers mailing list: chromiu...@chromium.org

Sunil Nagpal

unread,
Feb 22, 2011, 6:28:58 PM2/22/11
to Chromium OS dev
Hi Simon,

How do you suggest I apply the CL? I'm kind of confused about that. I
have my DHCP server and TFTP servers set up, that's pretty simple.
It's just the U-Boot Environment Variables/U-Boot Boot Flow steps that
I'm kind of confused on before I can test the whole thing.

Btw, I'm using a nightly build/image rather than my own, which
shouldn't be a problem (I did that for NFS Boot before).

Thanks for your help again.

-Sunil

On Feb 16, 3:01 pm, Sunil Nagpal <sunilnagpa...@gmail.com> wrote:

Sunil Nagpal

unread,
Feb 23, 2011, 2:34:55 PM2/23/11
to Chromium OS dev
Hi Simon,

I am still confused on what I should set my env variables to. I will
provide you with my previous env variables for NFS Boot and my DHCP/
TFTP Server information, and hopefully you'll be able to help.

My NFS Boot env args were:

CrOS> setenv myargs setenv bootargs mem=384M@0M nvmem=128M@384M
mem=512M@512M video=tegrafb console=ttyS0,115200n8
usbcore.old_scheme_first=1 tegraboot=nand ${lp0_vec} tegrap
earlyprintk root=/dev/nfs nfsroot=172.17.149.151:/export/nfsroot
ip=dhcp rw rootwait

My DHCP server settings are:

subnet 172.17.148.0 netmask 255.255.252.0 {
range 172.17.148.1 172.17.151.254;
option routers 172.17.148.1;
}

host seaboard {
hardware ethernet 00:23:7d:09:80:0e;
fixed-address seboard0;
}

My TFTP server settings are:

TFTP_USERNAME="nvidia"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-v"

Also, I have the kernel symlinked into /tftboot with the name "uImage-
kernel".

I understand all of the NFS Root steps, as I did that for NFS Boot,
but I am unsure what environment variables to set and how to make it
all work together. I really appreciate the help.

-Sunil

Simon Glass

unread,
Feb 23, 2011, 8:12:59 PM2/23/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

I would encourage you to add a few more details to this. On the web
page it talks of adding these variables:

setenv serverip 172.22.73.60
setenv tftpserverip 172.22.73.60
setenv nfsserverip 172.22.73.60
setenv board seaboard
setenv serial# 26
setenv user earnest
saveenv

Are you doing this?

If you are setting myargs, I guess you are not following the
documented flow. This is fine, but it might be easier if you did.

Also check you are using the latest U-Boot as the network stuff only
landed last week. If you type 'defaultenv' you should see quite a few
things, like:

bootcmd=usb start; if test ${ethact} != ""; then run dhcp_boot ; fi ;
run keynfs_boot ; run usb_boot ; run mmc_boot
bootdelay=2
baudrate=115200
ipaddr=10.0.0.2
serverip=10.0.0.1
rootpath="/export/nfsroot-${user}-${board}-${serial#}"
bootfile=uImage
loadaddr=0x40C000
console=ttyS0,115200n8
cros_bootfile=/boot/vmlinux.uimg
user=user
board=arm
serial#=1
tftppath=/tftpboot/uImage
tftpserverip=10.0.0.1
nfsserverip=10.0.0.1
mmcdev=0
regen_all=setenv common_bootargs console=${console} ${platform_extras}
noinitrd; setenv bootargs ${common_bootargs} ${extra_bootargs}
${bootdev_bootargs}
regen_net_bootargs=setenv bootdev_bootargs dev=/dev/nfs4 rw
nfsroot=${nfsserverip}:${rootpath} ip=dhcp; run regen_all
dhcp_setup=setenv tftppath
/tftpboot/uImage-${user}-${board}-${serial#}; setenv rootpath
/export/nfsroot-${user}-${board}-${serial#}; setenv autoload n; run
regen_net_bootargs
dhcp_boot=run dhcp_setup; bootp; tftpboot ${loadaddr}
${tftpserverip}:${tftppath}; bootm ${loadaddr}
keynfs_setup=setenv rootpath
/export/nfsroot-${user}-${board}-${serial#}; run regen_net_bootargs
keynfs_boot=run keynfs_setup; ext2load usb 0:1 ${loadaddr} uImage;
bootm ${loadaddr}
usb_setup=setenv bootdev_bootargs root=/dev/sda3; run regen_all
usb_boot=run usb_setup; ext2load usb 0:3 ${loadaddr} ${cros_bootfile};
bootm ${loadaddr}
mmc_setup=mmc init ${mmcdev}; setenv bootdev_bootargs
root=/dev/mmcblk0p5; run regen_all
mmc_boot=run mmc_setup; ext2load mmc ${mmcdev}:3 ${loadaddr}
${cros_bootfile}; bootm ${loadaddr}
stdin=serial
stdout=serial,lcd
stderr=serial,lcd
platform_extras=lp0_vec=0x2000@0x1C406000
kcrashmem=0x100000@0x02000000 mem=384M@0M nvmem=128M@384M
mem=512M@512M
ethact=sms0

Please can you be more specific about your question, and perhaps
include a console dump of what is wrong, and what you expect. You
should be able to follow along with the console trace at the end of
the web page.

https://sites.google.com/a/chromium.org/dev/network-based-development

Regards,
Simon

Sunil Nagpal

unread,
Feb 24, 2011, 1:26:58 PM2/24/11
to Chromium OS dev
When I do defaultenv I don't see anything, but when I do printenv to
see my set variables I don't see the same setup you have...I don't
think I have the most recent U-Boot although I synced to TOT
before...maybe I did it before.

Can I apply the patch using git-cl as described here:http://
www.chromium.org/developers/contributing-code#TOC-Instructions-for-Reviewer:-Checking

In which directory should I apply this patch?

Also, I am not setting myargs, I am trying to follow the steps in the
u-boot/bootflow steps. I only provided my boot args from regular NFS
Boot in case it helped you help me.

-Sunil

On Feb 23, 5:12 pm, Simon Glass <s...@chromium.org> wrote:
> Hi Sunil,
>
> > Chromium OS Developers mailing list: chromium-os-...@chromium.org

Sunil Nagpal

unread,
Feb 24, 2011, 1:36:13 PM2/24/11
to Chromium OS dev
I'm going to try a cros_workon for uboot-next and then do the emerges
and see if I can get U-Boot updated that way...

On Feb 24, 10:26 am, Sunil Nagpal <sunilnagpa...@gmail.com> wrote:
> When I do defaultenv I don't see anything, but when I do printenv to
> see my set variables I don't see the same setup you have...I don't
> think I have the most recent U-Boot although I synced to TOT
> before...maybe I did it before.
>
> Can I apply the patch using git-cl as described here:http://www.chromium.org/developers/contributing-code#TOC-Instructions-for-Re...

Sunil Nagpal

unread,
Feb 24, 2011, 2:28:21 PM2/24/11
to Chromium OS dev
Ok, got the new U-Boot and verified with 'printenv' that I get the
default args you posted above...now going to work through the rest of
it. Thanks, I'll let you know if problems arise.

On Feb 24, 10:36 am, Sunil Nagpal <sunilnagpa...@gmail.com> wrote:
> I'm going to try a cros_workon for uboot-next and then do the emerges
> and see if I can get U-Boot updated that way...
>
> On Feb 24, 10:26 am, Sunil Nagpal <sunilnagpa...@gmail.com> wrote:
>
> > When I do defaultenv I don't see anything, but when I do printenv to
> > see my set variables I don't see the same setup you have...I don't
> > think I have the most recent U-Boot although I synced to TOT
> > before...maybe I did it before.
>
> > Can I apply the patch using git-cl as described here:http://www.chromium.org/developers/contributing-code#TOC-Instructions......

Simon Glass

unread,
Feb 24, 2011, 2:44:53 PM2/24/11
to Sunil Nagpal, Chromium OS dev
OK that sounds better. Yes only the new U-Boot supports booting from a
USB network adapter and has the right environment variables to make it
easy - Simon

> Chromium OS Developers mailing list: chromiu...@chromium.org

Sunil Nagpal

unread,
Feb 24, 2011, 4:47:26 PM2/24/11
to Chromium OS dev
So when I try to do usb start, it gives me:

"scanning bus for devices...2 USB Device(s) found
scanning bus for storage devices...0 Storage Device(s) found
scanning bus for ethernet devices...0 Ethernet Device(s) found"

...the fact that it has no storage devices is fine. I don't have a USB
in because I'm going to get the kernel and rootfs over the servers. I
do, however, have my usb/ethernet connected to the seaboard and it
tells me I have 0 Ethernet devices...?

On Feb 24, 11:44 am, Simon Glass <s...@chromium.org> wrote:
> OK that sounds better. Yes only the new U-Boot supports booting from a
> USB network adapter and has the right environment variables to make it
> easy - Simon
>

Simon Glass

unread,
Feb 24, 2011, 4:55:25 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Hi,

Try putting it in a Linux box (or Seaboard if you like) and typing
lsusb. I have added information about the ones we support to the web
page.

Supported USB Ethernet Adapters / USB Ethernet Dongles
Only the ASIX AX88772 chip is supported at present. The following
supported adapters are shown as {vendor, device}. Type lsusb with the
adapter attached to see the vendor and device numbers for your
adapter.

{ 0x05ac, 0x1402 }, /* Apple USB Ethernet Adapter */
{ 0x07d1, 0x3c05 }, /* D-Link DUB-E100 H/W Ver B1 */
{ 0x0b95, 0x772a }, /* Cables-to-Go USB Ethernet Adapter */
{ 0x0b95, 0x7720 }, /* Trendnet TU2-ET100 V3.0R */
{ 0x0b95, 0x1720 }, /* SMC */
{ 0x0db0, 0xa877 }, /* MSI - ASIX 88772a */
{ 0x13b1, 0x0018 }, /* Linksys 200M v2.1 */
{ 0x1557, 0x7720 }, /* 0Q0 cable ethernet */
{ 0x2001, 0x3c05 }, /* DLink DUB-E100 H/W Ver B1 Alternate */

Regards,
Simon

> Chromium OS Developers mailing list: chromiu...@chromium.org

Sunil Nagpal

unread,
Feb 24, 2011, 4:58:26 PM2/24/11
to Chromium OS dev
OK I realized that the USB/Ethernet adapter I was using didn't have
drivers built into U-Boot but I've found another one that
works...resolved that problem and continuing on...

Sunil Nagpal

unread,
Feb 24, 2011, 5:09:36 PM2/24/11
to Chromium OS dev
Ok, getting close. Next error I have is

CrOS> bootp
Waiting for Ethernet connection... done.
BOOTP broadcast 1
DHCP client bound to address 172.17.151.160 Using asx0 device TFTP
from server 172.17.150.240; our IP address is 172.17.151.160 Filename
'uImage'.
Load address: 0x40c000
Loading: *
TFTP error: 'Only absolute filenames allowed' (2) Not retrying...

...working through it...

Sunil Nagpal

unread,
Feb 24, 2011, 5:23:33 PM2/24/11
to Chromium OS dev
Ok, fixed that...but now it says TFTP error: 'File not found'...trying
to work through this one too. I know I'm posting at every step but it
makes it easier for you to help me. Thanks.
> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 5:21:34 PM2/24/11
to Sunil Nagpal, Chromium OS dev
You have probably figured this out, but basically your tftp server
requires / at the start of the filename. Or you can use the -s flag in
/etc/default/tftpd-hpa:

--secure, -s
Change root directory on startup. This means the remote host
does not need to pass along the directory as part of the trans‐
fer, and may add security. When --secure is specified, exactly
one directory should be specified on the command line. The use
of this option is recommended for security as well as compati‐
bility with some boot ROMs which cannot be easily made to
include a directory name in its request.

> Chromium OS Developers mailing list: chromiu...@chromium.org

Sunil Nagpal

unread,
Feb 24, 2011, 5:29:30 PM2/24/11
to Chromium OS dev
For some reason it's looking for filename "uImage-nvidia-seaboard-26"
rather than "/tftpboot/uImage-nvidia-seaboard-26" even though my
tftppath=/tftpboot/uImage-nvidia-seaboard-26
> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 5:33:12 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

Yes, also check the logs on your workstation:

sudo tail -f /var/log/daemon.log

Also check that your dhcp_boot is ok:

CrOS> print dhcp_boot


dhcp_boot=run dhcp_setup; bootp; tftpboot ${loadaddr}
${tftpserverip}:${tftppath}; bootm ${loadaddr}

Regards,
Simon

> --
> Chromium OS Developers mailing list: chromiu...@chromium.org


> View archives, change email options, or unsubscribe:

> http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
>

Sunil Nagpal

unread,
Feb 24, 2011, 6:14:50 PM2/24/11
to Chromium OS dev
Is there a firewall built into the TFTP Server? When I run tftboot it
starts to load the image and then says "Loading: T T T T T T T
T...retry count exceeded, starting again" and then it restarts and
repeats.
> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 6:22:56 PM2/24/11
to Sunil Nagpal, Chromium OS dev
No firewall. Maybe tcpdump will help? Or looking at daemon.log again? - Simon

> --
> Chromium OS Developers mailing list: chromiu...@chromium.org


> View archives, change email options, or unsubscribe:

> http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
>

Simon Glass

unread,
Feb 24, 2011, 6:46:04 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Hi,

It might be easier if you just used the scripts I set up.

Either:

boot

or:

usb start
run dhcp_boot

should do it.

Is 172.17.150.240 the address of your tftp server, or just the dhcp
server? The scripts set 'autoload' to n to avoid bootp doing this.

Regards,
Simon

On Thu, Feb 24, 2011 at 3:34 PM, Sunil Nagpal <suniln...@gmail.com> wrote:
> I feel like I'm setting up something wrong with the ip addresses. I looked
> at tcpdump and daemon.log but both spit out tons of stuff that doesn't help
> me, at least I don't think so. Is there something specific I should look
> for?

Sunil Nagpal

unread,
Feb 24, 2011, 6:58:15 PM2/24/11
to Chromium OS dev
I'm confused about the addresses...my eth0 address is 172.17.150.240.
I assumed this was my tftp server and dhcp server ip as well?

On Feb 24, 3:22 pm, Simon Glass <s...@chromium.org> wrote:
> No firewall. Maybe tcpdump will help? Or looking at daemon.log again? - Simon
>
> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 7:05:50 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

172.17.150.240 right?

sudo tftpdump -i eth0 port tftp

should show you traffic - perhaps add -vvv

Also you server is 172.17.151.160 - is that on the same subnet? If
not, do you have the gatewayip set?

Regards,
Simon

Sunil Nagpal

unread,
Feb 24, 2011, 7:06:38 PM2/24/11
to Chromium OS dev
When I run dhcp_boot I get the following:

CrOS> run dhcp_boot
Waiting for Ethernet connection... done.
BOOTP broadcast 1
DHCP client bound to address 172.17.149.179
Waiting for Ethernet connection... done.
Using asx0 device
TFTP from server 172.17.150.240; our IP address is 172.17.149.179
Filename '/tftpboot/uImage-nvidia-seaboard-26'.
Load address: 0x40c000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
Wrong Image Format for bootm command
ERROR: can't get kernel image!
> ...
>
> read more »

Sunil Nagpal

unread,
Feb 24, 2011, 7:11:29 PM2/24/11
to Chromium OS dev
I tried tftpdump for tftp and that didn't work, but when I try tcpdump
for tftp I get no traffic.
> ...
>
> read more »

Sunil Nagpal

unread,
Feb 24, 2011, 7:18:27 PM2/24/11
to Chromium OS dev
When I run dhcp_boot I get this on tcpdump:

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size
96 bytes
16:17:21.181504 IP (tos 0x0, ttl 255, id 5, offset 0, flags [DF],
proto UDP (17), length 95)
dhcp-172-17-149-175.nvidia.com.3085 >
dhcp-172-17-150-240.nvidia.com.tftp: [no cksum] 67 RRQ "/tftpboot/
uImage-nvidia-seaboard-26" octet time

But with dhcp_boot I get:

CrOS> run dhcp_boot
Waiting for Ethernet connection... done.
BOOTP broadcast 1
DHCP client bound to address 172.17.149.175
Waiting for Ethernet connection... done.
Using asx0 device
TFTP from server 172.17.150.240; our IP address is 172.17.149.175
Filename '/tftpboot/uImage-nvidia-seaboard-26'.
Load address: 0x40c000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
Wrong Image Format for bootm command
ERROR: can't get kernel image!


> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 7:27:35 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Looks like the file doesn't exist on your server :-) What do you see
in the server logs?

Also please:

cat /etc/default/tftpd-hpa
dpkg -l tftpd-hpa
ls -l /tftpboot/uImage-nvidia-seaboard-26

Sunil Nagpal

unread,
Feb 24, 2011, 7:30:05 PM2/24/11
to Chromium OS dev
nvidia@nvidia-laptop:~$ cat /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa

TFTP_USERNAME="nvidia"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-s"

nvidia@nvidia-laptop:~$ dpkg -l tftpd-hpa
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/
Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name
Version Description
+++-===================================-
===================================-
======================================================================================
ii tftpd-hpa
5.0-11ubuntu2.1 HPA's tftp server

nvidia@nvidia-laptop:~$ ls -l /tftpboot/uImage-nvidia-seaboard-26
lrwxrwxrwx 1 root root 104 2011-02-24 11:52 /tftpboot/uImage-nvidia-
seaboard-26 -> /home/nvidia/chromiumos/chromiumos.git/src/build/images/
tegra2_seaboard/latest/nfsroot/boot/vmlinux.uimg
> ...
>
> read more »

Sunil Nagpal

unread,
Feb 24, 2011, 7:34:24 PM2/24/11
to Chromium OS dev
And which log should I check/where is it?
> ...
>
> read more »

Simon Glass

unread,
Feb 24, 2011, 7:37:17 PM2/24/11
to Sunil Nagpal, Chromium OS dev
Hi Sunil,

You really need to be a little more methodical about this. You have
missed out the 'Then edit /etc/default/tftpd-hpa like this' step.

man tftpd
...


--secure, -s
Change root directory on startup. This means the remote host
does not need to pass along the directory as part of the trans‐
fer, and may add security. When --secure is specified, exactly
one directory should be specified on the command line. The use
of this option is recommended for security as well as compati‐
bility with some boot ROMs which cannot be easily made to
include a directory name in its request.

sudo tail -f /var/log/daemon.log

should show what is happening, but basically you have missed a step.
Perhaps just run through the tftp server setup from the start - it is
only a a few instructions. The -s flag changes the behavior of tftpd.

Regards,
Simon

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages