[U-Boot-Users] NIOS port at Stratix DevKit: distinctions between bdi and env
Stephan Linz
linz at mazet.de
Tue Oct 28 10:18:07 CET 2003
Hi Scott,
Am Montag, 27. Oktober 2003 15:42 schrieb Scott McNutt:
> I'm glad to hear other Nios users are discovering u-boot :-)
> U-Boot and Nios is a great combination!
Yes, of course.
>
> > But now, I can't setup my network environment in expected way.
> > The u-boot environment vars "ethaddr", "iptable", "netmask", and
> > "serverip" are correct in flash, but bdinfo shows me the default
> > values (compiled in) -- Why ?
>
> Looks like I screwed up the call sequence in lib_nios/board.c ... the
> code is calling getenv("ethaddr") prior to env_init() -- must have been
> a late night ;-)
>
> The fields that depend on an initialized environment should be
> initialized _after_ calling the routines in init_sequence ... which
> includes env_init(). Try moving bi_ip_addr and bi_enetaddr
> below the init_sequence loop.
Yes, that's the solution to my problem. I've moved the setup stuff of
bi_enetaddr and bi_ip_addr far behind the whole init_sequence loop and the
relocation env_relocate(). I think and hope, that will be save enough for the
future development.
>
> I'm out-of-office so I can't work on a patch for a few days. If the
> changes work, please submit a patch to Wolfgang -- or we can
> work together off-line.
OK here is the patch (attechment). Wolfgang, could you put it into the CVS
repository?
Regards,
Stephan
--
Mit freundlichen Gruessen
Stephan Linz
======================================================================
Stephan Linz
Softwareentwicklung
MAZeT GmbH Email: mailto:linz at mazet.de
Göschwitzer Str. 32 Tel. : (3641) 2809-55
D-07745 Jena Fax : (3641) 2809-12
Besuchen Sie bitte unsere Web-Seiten: http://www.MAZeT.de
======================================================================
-------------- next part --------------
diff -Nru --exclude=CVS u-boot-20031024cvs/lib_nios/board.c u-boot-20031024cvs-bd_getenv_fix/lib_nios/board.c
--- u-boot-20031024cvs/lib_nios/board.c Mon Oct 20 01:22:12 2003
+++ u-boot-20031024cvs-bd_getenv_fix/lib_nios/board.c Mon Oct 27 18:00:31 2003
@@ -132,12 +132,6 @@
bd->bi_sramstart= CFG_SRAM_BASE;
bd->bi_sramsize = CFG_SRAM_SIZE;
bd->bi_baudrate = CONFIG_BAUDRATE;
- bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
- s = getenv ("ethaddr");
- for (i = 0; i < 6; ++i) {
- bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
- if (s) s = (*e) ? e + 1 : e;
- }
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr) () != 0) {
@@ -150,6 +144,13 @@
mem_malloc_init();
malloc_bin_reloc();
env_relocate();
+
+ bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
+ s = getenv ("ethaddr");
+ for (i = 0; i < 6; ++i) {
+ bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
+ if (s) s = (*e) ? e + 1 : e;
+ }
devices_init();
jumptable_init();
More information about the U-Boot
mailing list