Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12618 Discussions

download kernel into ram by u-boot

Altera_Forum
Honored Contributor II
1,655 Views

hello! 

I want to download the kernel to the sdram by u-boot. 

how can I use the tftp in u-boot? 

help me! 

thank you for all response!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
681 Views

Hi smalllight, 

 

> I want to download the kernel to the sdram by u-boot. 

 

First, create a u-boot image file with mkimage. 

 

> how can I use the tftp in u-boot? 

 

Try the u-boot command: 

 

==> help tftpboot 

 

The syntax is: tftpboot address fname 

 

Example: download the file "foo.img" to address 0x400 

 

==> tftpboot 400 foo.img 

 

Then to boot the kernel: 

 

==> bootm 400 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
681 Views

1. Could we use tftp sever in u-boot ? 

 

2. How to enable tftp server or tftp client ? Such as# define in <include>/<configs>/<board>.h, as we hasn&#39;t finish the net device(dm9000a) driver. We are still studying the source tree of u-boot and <u-boot>/readme. 

 

3. Maybe there are two ways to boot linux: 

 

(1) like smcnutt: use mkimage to compress the linux; tftp client down at proper SDRAM&#39;s address; bootm; 

 

(2) tftp down the vmlinux.bin to 0x0 of SDRAM, "jump 0x0"  

 

Let&#39;s verify them by ourselves, too. 

 

Thank you in advance.
0 Kudos
Altera_Forum
Honored Contributor II
681 Views

Hi mountain8848, 

 

> Could we use tftp sever in u-boot ? 

 

u-boot implements tftp client only. 

 

> How to enable tftp server or tftp client ? 

 

Enable the network commands in the CONFIG_COMMANDS macro by adding 

CFG_CMD_NET. 

 

> tftp down the vmlinux.bin to 0x0 of SDRAM, "jump 0x0"  

 

I do not recommend doing this ... in most configurations, you&#39;ll overwrite the 

exception trampoline, so you won&#39;t even finish the tftp download ... a timer 

interrupt will occur during the download and you&#39;ll jump to a bogus address. 

The best bet is to just use mkimage with a compressed kernel. Load the kernel 

somewhere high in sdram, then use bootm ... which will disable interrupts, 

decompress the kernel to its runtime address, then jump to the entry point. 

 

You can configure u-boot to tftpboot the kernel automatically at startup 

by setting the boot command environment variable. In fact, you can configure 

u-boot to load an execute a full script (hush parser) that does many things 

at startup. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
681 Views

Hi smcnutt, 

 

We finished the net device(dm9000a) driver in u-boot. And debuging tftpboot 

 

1.  

=>tftpboot 01500000 vmlinux.img  

// SDRAM base address: 0100 0000 

// SDRAM size : 0100 0000 (16MB) 

 

After succesfully download the vmlinux.img, U-boot can&#39;t return to "console" state(cannot get &#39;==>&#39;) ? We cannot type "bootm" command. 

 

2. 

in <u-boot>/net/net.c L:528 

Before switch (NetState) {...., We add  

printf(" T T T ");,  

the result is that the net speed is faster than before.  

We guess the reason is that: 

u-boot send a "request";printf() add a little delay to meet u-boot receive it properly, isn&#39;t it ? Ping command can&#39;t work without printf(" t t t ") Delay, neither. Dose any good idea to solve speed/delay problem.
0 Kudos
Altera_Forum
Honored Contributor II
681 Views

Hi mountain8848, 

 

Sounds like a timer configuration issue. Check your config file to make sure the 

timer macros are set correctly for your hardware configuration. Specifically, 

check: 

 

CFG_NIOS_TMRMS - the number of milliseconds per interrupt. 

CFG_NIOS_TMRCNT - define this if you want to change the timer count register (e.g. to 

slow down a high res timer). 

CFG_HZ - the timer frequency. 

 

In general, I recommend 10 msec or higher for the u-boot timer. There&#39;s usually 

no need for anything faster in a bootloader ;-) 

 

BTW: you can get a real rough estimate of your interrrupt period by simply using 

the u-boot &#39;irq&#39; command -- to view the number of interrupts over a period of time. 

It&#39;s handy for simple estimates -- like making sure you&#39;re not off by a factor of 10. 

 

Regards, 

--Scott
0 Kudos
Reply