[U-Boot-Users] How to use tftp to book kernel image and mount remote root fs

Jerry Van Baren
2008-05-14T03:52:32Z

Steven Woody wrote:
> On Wed, May 14, 2008 at 10:05 AM, Jerry Van Baren <gvb.uboot@gmail.com> wrote:
>> Steven Woody wrote:
>>> On Tue, May 13, 2008 at 2:07 PM, Wolfgang Denk <wd@denx.de> wrote:
>>>> Dear Steven,
>>>>
>>>> in message <ed4892840805121852t46d4c4d0rd52a9eb129121f7b@mail.gmail.com>
>>>> you wrote:
>>>>> Q1:
>>>>>
>>>>> Both 5.9.5.1 (
>>> http://www.denx.de/wiki/view/DULG/UBootCmdGroupDownload#Section_5.9.5.1.
>>>>> ) and 5.9.5.6 (
>>>>> http://www.denx.de/wiki/view/DULG/UBootCmdGroupDownload#Section_5.9.5.6.
>>>>> ) talk about booting image via network, but there are only few lines
>>>>> of description about these commands. I don't know which one I should
>>>>> use, tftpboot or bootp? And, for each one, what's the requirement on
>>>> That depends on what you want to do. Do you understand the differecne
>>>> between TFTP and BOOTP (resp. DHCP) protocols?
>>> I understand tftp and bootp as a function of current DHCP, but I don't
>>> know how tftp and bootp is related. Would you suggest me something to
>>> read? Thank you.
>> Bootp is a boot protocol that allows a system to query a server to figure
>> out what IP it is assigned and what executable file to load (typically via
>> TFTP). DHCP is the successor to bootp.
>>
>> TFTP is a file transfer protocol that allows a system to load its executable
>> (typically) file from the server.
>>
>> <http://www.linuxjournal.com/article/5465> (ignore RARP, it is deprecated).
>>
>> HTH,
>> gvb
>>
>
> Thank you Jerry, I now understand TFTP and BOOTP should on a same
> host, the 'filename' parameter in dhcpd.conf specified the boot image
> file which can be download via tftp by u-boot. And, nfs server can be
> on another server, the 'next-server' parameter in dhcpd.conf specified
> the ip address of the nfs server.

Next-server is where u-boot will go to with tftp to get the executable
file. Usually you don't use this, but it depends on how you have your
network and servers configured.

You can download an executable via NFS, but (if I understand correctly),
bootp/DHCP doesn't know how to specify to get the linux image over
NFS... it is a separate "nfs" command which you can run manually or in a
script. In other words, saying "bootp/DHCP" and "NFS" in the same
sentence doesn't make sense.

My usage of nfs has only been via linux, in which case linux is running
and bootp/dhcp are a fading memory (DHCP provides the IP lease and
little else when linux is in control).

> But one thing I am not clear: the u-boot's bootargs variable uses
> nfsroot=${serverip}:${rootpath}
> are the 'serverip' and 'rootpath' set by querying BOOT server in
> u-boot's bootp stage? if so, serverip should equals to the next-server

serverip env variable can be set by you to specify to u-boot who to get
the information from, or it can be provided by your DHCP (/bootp?)
server. It depends on your DHCP server's capabilities and configuration.

Ref: <http://www.denx.de/wiki/DULG/UBootEnvVariables> (scroll all the
way to the bottom of the page).

> parameter in dhcpd.conf, and rootpath should equal to root-path
> parameter in dhcpd.conf. You see, in u-boot, it is rootpath, but in
> dhcpd.conf, it is root-path, is there a typo in the u-boot manual?

You are challenging the limits of my knowledge. :-/ I'm sure it isn't
a typo and I'm too tired right now to improve my knowledge by grepping
the code. :-( I believe the env variable rootpath is set to what the
DHCP server provides as the root-path option.

> And, in the u-boot manual, I see, the `filename' parameter in
> dhcpd.conf is something like /tftproot/uImage, but I think it should
> be /uImage, because the /tftproot should be the root path of tftp
> server, to the client, the path name should be /uImage, am I right?

Whether you need /tftproot or not depends on how you've configured your
tftp server. You can configure your tftp server to change its root
directory (-s option) or not. If you use -s /tftproot, you don't want
the /tftproot. If you don't use -s, you need to specify the full path.

Hint: Use tftp on a "normal" linux system (preferably not your server)
to verify you have the right path and permissions and can download the
file from your server. You can try different combinations faster that way.

> Thank you very much.
>
>
> $rootpath, was this variable set by querying BOOTP server?

Best regards,
gvb