mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-17 15:38:51 +09:00
![Wolfgang Denk](/assets/img/avatar_default.png)
A large number of boards incorrectly used getenv() in their board init code running before relocation. In some cases this caused U-Boot to hang when certain environment variables grew too long. Fix the code to use getenv_r(). Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: The LEOX team <team@leox.org> Cc: Michael Schwingen <michael@schwingen.org> Cc: Georg Schardt <schardt@team-ctech.de> Cc: Werner Pfister <Pfister_Werner@intercontrol.de> Cc: Dirk Eibach <eibach@gdsys.de> Cc: Peter De Schrijver <p2@mind.be> Cc: John Zhan <zhanz@sinovee.com> Cc: Rishi Bhattacharya <rishi@ti.com> Cc: Peter Tyser <ptyser@xes-inc.com>
63 lines
1.2 KiB
C
63 lines
1.2 KiB
C
/*
|
|
* ml2.c: U-Boot platform support for Xilinx ML2 board
|
|
*
|
|
* Copyright 2002 Mind NV
|
|
*
|
|
* http://www.mind.be/
|
|
*
|
|
* Author : Peter De Schrijver (p2@mind.be)
|
|
*
|
|
* Derived from : Other platform support files in this tree
|
|
*
|
|
* This software may be used and distributed according to the terms of
|
|
* the GNU General Public License (GPL) version 2, incorporated herein by
|
|
* reference. Drivers based on or derived from this code fall under the GPL
|
|
* and must retain the authorship, copyright and this license notice. This
|
|
* file is not a complete program and may only be used when the entire
|
|
* program is licensed under the GPL.
|
|
*
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/processor.h>
|
|
|
|
|
|
int board_early_init_f (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
int checkboard (void)
|
|
{
|
|
char buf[64];
|
|
int i;
|
|
int l = getenv_f("serial#", buf, sizeof(buf));
|
|
|
|
if (l < 0 || strncmp(buf, "ML2", 9)) {
|
|
printf ("### No HW ID - assuming ML2");
|
|
} else {
|
|
for (i = 0; i < l; i++) {
|
|
if (buf[i] == ' ')
|
|
break;
|
|
putc(buf[i]);
|
|
}
|
|
}
|
|
putc ('\n');
|
|
|
|
return (0);
|
|
}
|
|
|
|
|
|
phys_size_t initdram (int board_type)
|
|
{
|
|
return 32 * 1024 * 1024;
|
|
}
|
|
|
|
int testdram (void)
|
|
{
|
|
printf ("test: xxx MB - ok\n");
|
|
|
|
return (0);
|
|
}
|