diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 02cfe4584a0e3163a69b1933eff4f767f3f441e2..bd3c3eaf421f5161f50295202ecc0f56e8b71d94 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -46,14 +46,9 @@ typedef	struct	global_data {
 #endif
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
-#endif
-#if 0
-	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
-	unsigned long	bus_clk;
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	reset_status;	/* reset status register at boot */
 #endif
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -65,7 +60,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 
diff --git a/arch/avr32/include/asm/global_data.h b/arch/avr32/include/asm/global_data.h
index efbdda9ba4ca284c19596c8c3990e13062628912..521a6a2f6e1f2a78b81ac856e0bd68885e4f375d 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -46,6 +46,7 @@ typedef	struct	global_data {
 	void		*fb_base;	/* framebuffer address */
 #endif
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -57,7 +58,7 @@ typedef	struct	global_data {
 #define GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 #define GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted	 */
 #define GD_FLG_LOGINIT	0x00020		/* Log Buf has been initialized	 */
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	 */
 
 #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 
diff --git a/arch/blackfin/include/asm/global_data.h b/arch/blackfin/include/asm/global_data.h
index c7099e6dac0acbc660141e6b9af96350ca480b41..3cfd00e6655247a68fa5ed25feccc6d82d3e8d16 100644
--- a/arch/blackfin/include/asm/global_data.h
+++ b/arch/blackfin/include/asm/global_data.h
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2005-2007 Analog Devices Inc.
  *
- * (C) Copyright 2000-2004
+ * (C) Copyright 2000-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -53,7 +53,8 @@ typedef struct global_data {
 	unsigned long post_init_f_time;	/* When post_init_f started */
 #endif
 
-	void **jt;		/* jump table */
+	void	**jt;			/* jump table */
+	char	env_buf[32];		/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -65,7 +66,7 @@ typedef struct global_data {
 #define	GD_FLG_POSTFAIL	0x00008	/* Critical POST test failed     */
 #define	GD_FLG_POSTSTOP	0x00010	/* POST seqeunce aborted	 */
 #define	GD_FLG_LOGINIT	0x00020	/* Log Buf has been initialized	 */
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P3")
 
diff --git a/arch/i386/include/asm/global_data.h b/arch/i386/include/asm/global_data.h
index 3abbf1dba29b8c2157156bca6b2798a9116af44f..adf62915e431731e50e6498c3206c58109e32a0b 100644
--- a/arch/i386/include/asm/global_data.h
+++ b/arch/i386/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -46,6 +46,7 @@ typedef	struct {
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reset_status;	/* reset status register at boot */
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -57,7 +58,7 @@ typedef	struct {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 extern gd_t *gd;
 
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index 413c20002309bb0d995548c46ceecc7cc4498dc6..a8578d8a83e29c7bf3c7c70cc79985ab5d3bf1c2 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002 - 2003
+ * (C) Copyright 2002 - 2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -64,6 +64,7 @@ typedef	struct	global_data {
 	unsigned long	board_type;
 #endif
 	void		**jt;		/* Standalone app jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -75,7 +76,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #if 0
 extern gd_t *global_data;
diff --git a/arch/microblaze/include/asm/global_data.h b/arch/microblaze/include/asm/global_data.h
index ec7837f6b9edc385eeb7a65e0d11335a512ad267..c7c1472b2d6abe6525f607a719dc8aa0d17a16c6 100644
--- a/arch/microblaze/include/asm/global_data.h
+++ b/arch/microblaze/include/asm/global_data.h
@@ -43,6 +43,7 @@ typedef	struct	global_data {
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	fb_base;	/* base address of frame buffer */
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -54,7 +55,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 
diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index b2c4891151acd5f64fb16e5a15eb2a0950260586..994e7702e7dd215135b76c910ec898c8de26b917 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002-2003
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -46,6 +46,7 @@ typedef	struct	global_data {
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -57,7 +58,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted	 */
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buf has been initialized	 */
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 
diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h
index f1b348293ffe423397f48c0d8c7ad33838b39906..c292a527e4c4ce66f3818b4286f314064da53be5 100644
--- a/arch/nios2/include/asm/global_data.h
+++ b/arch/nios2/include/asm/global_data.h
@@ -37,6 +37,7 @@ typedef	struct	global_data {
 	unsigned long	post_init_f_time; /* When post_init_f started */
 #endif
 	void		**jt;		/* Standalone app jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /* flags */
@@ -46,7 +47,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("gp")
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index c854ce948860d525b982b04c4504c642892320c7..3e97f7661a80ac8d87f1f9579f0e202443c298fe 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -176,6 +176,7 @@ typedef	struct	global_data {
 	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
 #endif
 	void		**jt;		/* jump table */
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -187,7 +188,7 @@ typedef	struct	global_data {
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #if 1
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
diff --git a/arch/sh/include/asm/global_data.h b/arch/sh/include/asm/global_data.h
index c12b8558ecbd7a2fc6a335762f14f31ebd1973a7..7fda1e1b62a1e905b8ac0a70c1979921d60c8d4a 100644
--- a/arch/sh/include/asm/global_data.h
+++ b/arch/sh/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * (C) Copyright 2007
@@ -38,7 +38,8 @@ typedef	struct global_data
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid */
 	void		**jt;		/* Standalone app jump table */
-}gd_t;
+	char		env_buf[32];	/* buffer for getenv() before reloc. */
+} gd_t;
 
 #define	GD_FLG_RELOC	0x00001		/* Code was relocated to RAM		*/
 #define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
@@ -46,7 +47,7 @@ typedef	struct global_data
 #define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020		/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 
 #define DECLARE_GLOBAL_DATA_PTR	register gd_t *gd asm ("r13")
 
diff --git a/arch/sparc/include/asm/global_data.h b/arch/sparc/include/asm/global_data.h
index dea2857274c80cc9fa5fb360bfe907abdb819bcd..de6482f51202feb72873941acb0d9a42476ff7b2 100644
--- a/arch/sparc/include/asm/global_data.h
+++ b/arch/sparc/include/asm/global_data.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2002
+ * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * (C) Copyright 2007
@@ -70,7 +70,8 @@ typedef struct global_data {
 #ifdef CONFIG_LWMON
 	unsigned long kbd_status;
 #endif
-	void **jt;		/* jump table */
+	void	**jt;			/* jump table */
+	char	env_buf[32];		/* buffer for getenv() before reloc. */
 } gd_t;
 
 /*
@@ -82,7 +83,7 @@ typedef struct global_data {
 #define	GD_FLG_POSTFAIL	0x00008	/* Critical POST test failed		*/
 #define	GD_FLG_POSTSTOP	0x00010	/* POST seqeunce aborted		*/
 #define	GD_FLG_LOGINIT	0x00020	/* Log Buffer has been initialized	*/
-#define GD_FLG_DISABLE_CONSOLE	0x00040		/* Disable console (in & out)	 */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	*/
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")
 
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index dc15750b6469e88c08c57154c1cb513cfb218401..74a506979d6f8bd914aab57651f5631c3598f588 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -511,24 +511,31 @@ int do_editenv(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 char *getenv (char *name)
 {
-	int i, nxt;
+	if (gd->flags & GD_FLG_RELOC) {	/* full C runtime after reloc */
+		int i, nxt;
 
-	WATCHDOG_RESET();
+		WATCHDOG_RESET();
 
-	for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
-		int val;
+		for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
+			int val;
 
-		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
-			if (nxt >= CONFIG_ENV_SIZE) {
-				return (NULL);
+			for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) {
+				if (nxt >= CONFIG_ENV_SIZE) {
+					return (NULL);
+				}
 			}
+			if ((val=envmatch((uchar *)name, i)) < 0)
+				continue;
+			return ((char *)env_get_addr(val));
 		}
-		if ((val=envmatch((uchar *)name, i)) < 0)
-			continue;
-		return ((char *)env_get_addr(val));
+
+		return (NULL);
 	}
 
-	return (NULL);
+	/* restricted C runtime before reloc */
+
+	return ((getenv_f(name,gd->env_buf,sizeof(gd->env_buf)) > 0) ?
+		gd->env_buf : NULL);
 }
 
 int getenv_f(char *name, char *buf, unsigned len)