diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 4fc51fd..b190aa1 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -37,9 +37,7 @@ typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
 	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	fb_base;	/* base address of frame buffer */
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
@@ -88,6 +86,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 4ef8fc5..010b358 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -37,10 +37,8 @@ typedef	struct	global_data {
 	unsigned long	flags;
 	unsigned long	baudrate;
 	unsigned long	stack_end;	/* highest stack address */
-	unsigned long	have_console;	/* serial_init() was called */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address of env struct */
-	unsigned long	env_valid;	/* Checksum of env valid? */
 	unsigned long	cpu_hz;		/* cpu core clock frequency */
 #if defined(CONFIG_LCD)
 	void		*fb_base;	/* framebuffer address */
@@ -60,6 +58,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 eba5e93..73dbeed 100644
--- a/arch/blackfin/include/asm/global_data.h
+++ b/arch/blackfin/include/asm/global_data.h
@@ -44,10 +44,8 @@ typedef struct global_data {
 	unsigned long flags;
 	unsigned long board_type;
 	unsigned long baudrate;
-	unsigned long have_console;	/* serial_init() was called */
 	phys_size_t ram_size;		/* RAM size */
 	unsigned long env_addr;	/* Address  of Environment struct */
-	unsigned long env_valid;	/* Checksum of Environment valid? */
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long post_log_word;	/* Record POST activities */
 	unsigned long post_init_f_time;	/* When post_init_f started */
@@ -68,6 +66,9 @@ typedef struct global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P3")

diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index bfdb586..d388516 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -83,10 +83,8 @@ static void display_global_data(void)
 	printf(" |-flags: %lx\n", gd->flags);
 	printf(" |-board_type: %lx\n", gd->board_type);
 	printf(" |-baudrate: %lu\n", gd->baudrate);
-	printf(" |-have_console: %lx\n", gd->have_console);
 	printf(" |-ram_size: %lx\n", gd->ram_size);
 	printf(" |-env_addr: %lx\n", gd->env_addr);
-	printf(" |-env_valid: %lx\n", gd->env_valid);
 	printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
 	printf(" \\-bd: %p\n", gd->bd);
 	printf("   |-bi_baudrate: %x\n", bd->bi_baudrate);
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index fc486fd..b95e810 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -55,8 +55,6 @@ typedef	struct	global_data {
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	reset_status;	/* reset status register at boot	*/
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
-	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
-	unsigned long	have_console;	/* serial_init() was called		*/
 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	unsigned long	fb_base;	/* Base addr of framebuffer memory */
 #endif
@@ -78,6 +76,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 557ad27..b37f934 100644
--- a/arch/microblaze/include/asm/global_data.h
+++ b/arch/microblaze/include/asm/global_data.h
@@ -38,9 +38,7 @@ typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
 	unsigned long	env_addr;	/* Address  of Environment struct */
-	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. */
@@ -57,6 +55,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 271a290..a3a5f75 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -40,11 +40,9 @@ typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	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;
@@ -60,6 +58,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 2c4a719..a3d1801 100644
--- a/arch/nios2/include/asm/global_data.h
+++ b/arch/nios2/include/asm/global_data.h
@@ -28,10 +28,8 @@ typedef	struct	global_data {
 	unsigned long	flags;
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
-	unsigned long	have_console;	/* serial_init() was called */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid */
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long	post_log_word;	/* Record POST activities */
 	unsigned long	post_init_f_time; /* When post_init_f started */
@@ -49,6 +47,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("gp")

diff --git a/arch/powerpc/cpu/mpc5xxx/i2c.c b/arch/powerpc/cpu/mpc5xxx/i2c.c
index 9fb330f..2ae8121 100644
--- a/arch/powerpc/cpu/mpc5xxx/i2c.c
+++ b/arch/powerpc/cpu/mpc5xxx/i2c.c
@@ -332,7 +332,7 @@ static int mpc_get_fdr(int speed)
 		if (gd->flags & GD_FLG_RELOC) {
 			fdr = divider;
 		} else {
-			if (gd->have_console)
+			if (gd->flags & GD_FLG_HAVE_CONSOLE)
 				printf("%ld kHz, ", best_speed / 1000);
 			return divider;
 		}
@@ -374,33 +374,33 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len)
 	xaddr[3] =  addr	& 0xFF;

 	if (wait_for_bb()) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: bus is busy\n");
 		goto Done;
 	}

 	mpc_reg_out(&regs->mcr, I2C_STA, I2C_STA);
 	if (do_address(chip, 0)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: failed to address chip\n");
 		goto Done;
 	}

 	if (send_bytes(chip, &xaddr[4-alen], alen)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: send_bytes failed\n");
 		goto Done;
 	}

 	mpc_reg_out(&regs->mcr, I2C_RSTA, I2C_RSTA);
 	if (do_address(chip, 1)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: failed to address chip\n");
 		goto Done;
 	}

 	if (receive_bytes(chip, (char *)buf, len)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: receive_bytes failed\n");
 		goto Done;
 	}
@@ -423,26 +423,26 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 	xaddr[3] =  addr	& 0xFF;

 	if (wait_for_bb()) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: bus is busy\n");
 		goto Done;
 	}

 	mpc_reg_out(&regs->mcr, I2C_STA, I2C_STA);
 	if (do_address(chip, 0)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: failed to address chip\n");
 		goto Done;
 	}

 	if (send_bytes(chip, &xaddr[4-alen], alen)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: send_bytes failed\n");
 		goto Done;
 	}

 	if (send_bytes(chip, (char *)buf, len)) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: send_bytes failed\n");
 		goto Done;
 	}
diff --git a/arch/powerpc/cpu/mpc8xx/i2c.c b/arch/powerpc/cpu/mpc8xx/i2c.c
index 338caba..e33d1a0 100644
--- a/arch/powerpc/cpu/mpc8xx/i2c.c
+++ b/arch/powerpc/cpu/mpc8xx/i2c.c
@@ -633,21 +633,21 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)

 	rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: i2c_send failed (%d)\n", rc);
 		return 1;
 	}

 	rc = i2c_receive(&state, chip, 0, I2CF_STOP_COND, len, buffer);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: i2c_receive failed (%d)\n", rc);
 		return 1;
 	}

 	rc = i2c_doio(&state);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_read: i2c_doio failed (%d)\n", rc);
 		return 1;
 	}
@@ -683,21 +683,21 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)

 	rc = i2c_send(&state, chip, 0, I2CF_START_COND, alen, &xaddr[4-alen]);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: first i2c_send failed (%d)\n", rc);
 		return 1;
 	}

 	rc = i2c_send(&state, 0, 0, I2CF_STOP_COND, len, buffer);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: second i2c_send failed (%d)\n", rc);
 		return 1;
 	}

 	rc = i2c_doio(&state);
 	if (rc != 0) {
-		if (gd->have_console)
+		if (gd->flags & GD_FLG_HAVE_CONSOLE)
 			printf("i2c_write: i2c_doio failed (%d)\n", rc);
 		return 1;
 	}
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index a33ca2f..5a73a24 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -136,8 +136,6 @@ typedef	struct	global_data {
 	unsigned long	arbiter_event_address;
 #endif
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
-	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
-	unsigned long	have_console;	/* serial_init() was called		*/
 #if defined(CONFIG_SYS_ALLOC_DPRAM) || defined(CONFIG_CPM2)
 	unsigned int	dp_alloc_base;
 	unsigned int	dp_alloc_top;
@@ -193,6 +191,9 @@ typedef	struct	global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 0c09ba9..d27d21e 100644
--- a/arch/sh/include/asm/global_data.h
+++ b/arch/sh/include/asm/global_data.h
@@ -33,10 +33,8 @@ typedef	struct global_data
 	unsigned long	flags;
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
-	unsigned long	have_console;	/* serial_init() was called */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid */
 	void		**jt;		/* Standalone app jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
 } gd_t;
@@ -49,6 +47,9 @@ typedef	struct global_data
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #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 9b14674..08984f8 100644
--- a/arch/sparc/include/asm/global_data.h
+++ b/arch/sparc/include/asm/global_data.h
@@ -50,8 +50,6 @@ typedef struct global_data {
 	unsigned long reloc_off;	/* Relocation Offset */
 	unsigned long reset_status;	/* reset status register at boot        */
 	unsigned long env_addr;	/* Address  of Environment struct       */
-	unsigned long env_valid;	/* Checksum of Environment valid?       */
-	unsigned long have_console;	/* serial_init() was called */

 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	unsigned long fb_base;	/* Base address of framebuffer memory   */
@@ -85,6 +83,9 @@ typedef struct global_data {
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_HAVE_CONSOLE	0x00100	/* serial_init() was called 		*/
+#define GD_FLG_PRI_ENV_VALID	0x00200	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x00400	/* Redundant environment valid		*/

 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")

diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index f8a16d6..2902e61 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -39,11 +39,9 @@ typedef	struct global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	load_off;	/* Load Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
 	unsigned long	bus_clk;
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
@@ -59,23 +57,21 @@ extern gd_t *gd;
 #endif

 /* Word Offsets into Global Data - MUST match struct gd_t */
-#define GD_BD		0
-#define GD_FLAGS	1
-#define GD_BAUDRATE	2
-#define GD_HAVE_CONSOLE	3
-#define GD_RELOC_OFF	4
-#define GD_LOAD_OFF	5
-#define GD_ENV_ADDR	6
-#define GD_ENV_VALID	7
-#define GD_CPU_CLK	8
-#define GD_BUS_CLK	9
-#define GD_RELOC_ADDR	10
-#define GD_START_ADDR_SP	11
-#define GD_RAM_SIZE	12
-#define GD_RESET_STATUS	13
-#define GD_JT		14
+#define GD_BD			0
+#define GD_FLAGS		1
+#define GD_BAUDRATE		2
+#define GD_RELOC_OFF		3
+#define GD_LOAD_OFF		4
+#define GD_ENV_ADDR		5
+#define GD_CPU_CLK		6
+#define GD_BUS_CLK		7
+#define GD_RELOC_ADDR		8
+#define GD_START_ADDR_SP	9
+#define GD_RAM_SIZE		10
+#define GD_RESET_STATUS		11
+#define GD_JT			12

-#define GD_SIZE		15
+#define GD_SIZE			13

 /*
  * Global Data Flags
@@ -90,6 +86,10 @@ extern gd_t *gd;
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
 #define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
 #define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
+#define GD_FLG_HAVE_CONSOLE	0x00400	/* Warm Boot */
+#define GD_FLG_PRI_ENV_VALID	0x00800	/* Primary environment valid		*/
+#define GD_FLG_RED_ENV_VALID	0x01000	/* Redundant environment valid		*/
+

 #if 0
 #define DECLARE_GLOBAL_DATA_PTR
diff --git a/board/edb93xx/edb93xx.c b/board/edb93xx/edb93xx.c
index dde30ff..80dfec7 100644
--- a/board/edb93xx/edb93xx.c
+++ b/board/edb93xx/edb93xx.c
@@ -77,7 +77,7 @@ int board_init(void)
 	gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;

 	/* We have a console */
-	gd->have_console = 1;
+	gd->flags &= GD_FLG_HAVE_CONSOLE;

 	return 0;
 }
diff --git a/board/matrix_vision/common/mv_common.c b/board/matrix_vision/common/mv_common.c
index 404c8b4..cadbe0b 100644
--- a/board/matrix_vision/common/mv_common.c
+++ b/board/matrix_vision/common/mv_common.c
@@ -56,7 +56,7 @@ void mv_reset_environment(void)
 		}
 	}

-	gd->env_valid = 0;
+	SET_NO_ENV_VALID();
 	env_relocate();

 	for (i = 0; i < MV_KEEP_ENTRIES; i++) {
diff --git a/board/zeus/zeus.c b/board/zeus/zeus.c
index 18cb85f..c877c65 100644
--- a/board/zeus/zeus.c
+++ b/board/zeus/zeus.c
@@ -224,7 +224,7 @@ static int restore_default(void)

 	set_default_env("");

-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();

 	/*
 	 * Read board specific values from I2C EEPROM
diff --git a/common/console.c b/common/console.c
index 8c650e0..6b69ecd 100644
--- a/common/console.c
+++ b/common/console.c
@@ -404,7 +404,7 @@ static int ctrlc_disabled = 0;	/* see disable_ctrl() */
 static int ctrlc_was_pressed = 0;
 int ctrlc(void)
 {
-	if (!ctrlc_disabled && gd->have_console) {
+	if (!ctrlc_disabled && (gd->flags & GD_FLG_HAVE_CONSOLE)) {
 		if (tstc()) {
 			switch (getc()) {
 			case 0x03:		/* ^C - Control C */
@@ -522,7 +522,7 @@ int console_assign(int file, const char *devname)
 /* Called before relocation - use serial functions */
 int console_init_f(void)
 {
-	gd->have_console = 1;
+	gd->flags &= GD_FLG_HAVE_CONSOLE;

 #ifdef CONFIG_SILENT_CONSOLE
 	if (getenv("silent") != NULL)
diff --git a/common/env_common.c b/common/env_common.c
index 19149b5..aaf7304 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -136,7 +136,7 @@ static uchar env_get_char_init (int index)
 	uchar c;

 	/* if crc was bad, use the default environment */
-	if (gd->env_valid)
+	if (gd->flags & (GD_FLG_PRI_ENV_VALID | GD_FLG_RED_ENV_VALID))
 		c = env_get_char_spec(index);
 	else
 		c = default_environment[index];
@@ -164,7 +164,7 @@ uchar env_get_char (int index)

 const uchar *env_get_addr (int index)
 {
-	if (gd->env_valid)
+	if (gd->flags & (GD_FLG_PRI_ENV_VALID | GD_FLG_RED_ENV_VALID))
 		return (uchar *)(gd->env_addr + index);
 	else
 		return &default_environment[index];
@@ -234,7 +234,7 @@ void env_relocate (void)

 	env_reloc();
 #endif
-	if (gd->env_valid == 0) {
+	if (!(gd->flags & (GD_FLG_PRI_ENV_VALID | GD_FLG_RED_ENV_VALID))) {
 #if defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
 		set_default_env(NULL);
 #else
diff --git a/common/env_dataflash.c b/common/env_dataflash.c
index 1d57079..d90ec05 100644
--- a/common/env_dataflash.c
+++ b/common/env_dataflash.c
@@ -92,7 +92,7 @@ int env_init(void)
 	unsigned off;
 	uchar buf[64];

-	if (gd->env_valid)
+	if (gd->flags & (GD_FLG_PRI_ENV_VALID | GD_FLG_RED_ENV_VALID))
 		return 0;

 	AT91F_DataflashInit();	/* prepare for DATAFLASH read/write */
@@ -116,10 +116,10 @@ int env_init(void)

 	if (crc == new) {
 		gd->env_addr  = offsetof(env_t,data);
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else {
 		gd->env_addr  = (ulong)&default_environment[0];
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();
 	}

 	return 0;
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 0a179ad..24b017a 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -101,7 +101,7 @@ uchar env_get_char_spec (int index)
 	off = CONFIG_ENV_OFFSET;

 #ifdef CONFIG_ENV_OFFSET_REDUND
-	if (gd->env_valid == 2)
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
 		off = CONFIG_ENV_OFFSET_REDUND;
 #endif
 	eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
@@ -117,7 +117,7 @@ void env_relocate_spec (void)
 	unsigned int off = CONFIG_ENV_OFFSET;

 #ifdef CONFIG_ENV_OFFSET_REDUND
-	if (gd->env_valid == 2)
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
 		off = CONFIG_ENV_OFFSET_REDUND;
 #endif
 	eeprom_bus_read(CONFIG_SYS_DEF_EEPROM_ADDR,
@@ -151,7 +151,7 @@ int saveenv(void)
 	env_new.crc = crc32(0, env_new.data, ENV_SIZE);

 #ifdef CONFIG_ENV_OFFSET_REDUND
-	if (gd->env_valid == 1) {
+	if (gd->flags & GD_FLG_PRI_ENV_VALID) {
 		off = CONFIG_ENV_OFFSET_REDUND;
 		off_red = CONFIG_ENV_OFFSET;
 	}
@@ -170,10 +170,10 @@ int saveenv(void)
 				  off_red + offsetof(env_t,flags),
 				  (uchar *)&flag_obsolete,
 				  1);
-		if (gd->env_valid == 1)
-			gd->env_valid = 2;
+		if (gd->flags & GD_FLG_PRI_ENV_VALID)
+			SET_REDUNDANT_ENV_VALID();
 		else
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();

 	}
 #endif
@@ -233,31 +233,31 @@ int env_init(void)

 	if (!crc_ok[0] && !crc_ok[1]) {
 		gd->env_addr  = 0;
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();

 		return 0;
 	} else if (crc_ok[0] && !crc_ok[1]) {
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	}
 	else if (!crc_ok[0] && crc_ok[1]) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else {
 		/* both ok - check serial */
 		if (flags[0] == ACTIVE_FLAG && flags[1] == OBSOLETE_FLAG)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else if (flags[0] == OBSOLETE_FLAG && flags[1] == ACTIVE_FLAG)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else if (flags[0] == 0xFF && flags[1] == 0)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else if(flags[1] == 0xFF && flags[0] == 0)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else /* flags are equal - almost impossible */
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 	}

-	if (gd->env_valid == 2)
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
 		gd->env_addr = off_env[1] + offsetof(env_t,data);
-	else if (gd->env_valid == 1)
+	else if (gd->flags & GD_FLG_PRI_ENV_VALID)
 		gd->env_addr = off_env[0] + offsetof(env_t,data);

 	return (0);
@@ -292,10 +292,10 @@ int env_init(void)

 	if (crc == new) {
 		gd->env_addr  = offsetof(env_t,data);
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else {
 		gd->env_addr  = 0;
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();
 	}

 	return (0);
diff --git a/common/env_flash.c b/common/env_flash.c
index 50ca4ffa..20586e1 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -100,28 +100,28 @@ int  env_init(void)

 	if (crc1_ok && ! crc2_ok) {
 		gd->env_addr  = addr1;
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (! crc1_ok && crc2_ok) {
 		gd->env_addr  = addr2;
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (! crc1_ok && ! crc2_ok) {
 		gd->env_addr  = addr_default;
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();
 	} else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
 		gd->env_addr  = addr1;
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
 		gd->env_addr  = addr2;
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (flag1 == flag2) {
 		gd->env_addr  = addr1;
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else if (flag1 == 0xFF) {
 		gd->env_addr  = addr1;
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else if (flag2 == 0xFF) {
 		gd->env_addr  = addr2;
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	}

 	return 0;
@@ -244,12 +244,12 @@ int  env_init(void)
 {
 	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
 		gd->env_addr  = (ulong)&(env_ptr->data);
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 		return(0);
 	}

 	gd->env_addr  = (ulong)&default_environment[0];
-	gd->env_valid = 0;
+	SET_NO_ENV_VALID();
 	return 0;
 }

@@ -351,7 +351,7 @@ void env_relocate_spec(void)
 	    flash_addr_new->crc) {
 		char flag = OBSOLETE_FLAG;

-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 		flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new);
 		flash_write(&flag,
 			    (ulong)&(flash_addr_new->flags),
@@ -363,7 +363,7 @@ void env_relocate_spec(void)
 	    (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
 		char flag = ACTIVE_FLAG;

-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 		flash_sect_protect(0, (ulong)flash_addr, end_addr);
 		flash_write(&flag,
 			    (ulong)&(flash_addr->flags),
@@ -371,7 +371,7 @@ void env_relocate_spec(void)
 		flash_sect_protect(1, (ulong)flash_addr, end_addr);
 	}

-	if (gd->env_valid == 2)
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
 		puts ("*** Warning - some problems detected "
 		      "reading environment; recovered successfully\n\n");
 #endif /* CONFIG_ENV_ADDR_REDUND */
diff --git a/common/env_mgdisk.c b/common/env_mgdisk.c
index a69923b..0a91317 100644
--- a/common/env_mgdisk.c
+++ b/common/env_mgdisk.c
@@ -78,7 +78,7 @@ int env_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();

 	return 0;
 }
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 83f40f4..b69efcb 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -73,7 +73,7 @@ int env_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong)&default_environment[0];
-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();

 	return 0;
 }
diff --git a/common/env_nand.c b/common/env_nand.c
index 14446a6..9440a1e 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -108,41 +108,41 @@ int env_init(void)

 	if (!crc1_ok && !crc2_ok) {
 		gd->env_addr  = 0;
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();

 		return 0;
 	} else if (crc1_ok && !crc2_ok) {
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	}
 #ifdef CONFIG_ENV_OFFSET_REDUND
 	else if (!crc1_ok && crc2_ok) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else {
 		/* both ok - check serial */
 		if(tmp_env1->flags == 255 && tmp_env2->flags == 0)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else if(tmp_env2->flags == 255 && tmp_env1->flags == 0)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else if(tmp_env1->flags > tmp_env2->flags)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else if(tmp_env2->flags > tmp_env1->flags)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else /* flags are equal - almost impossible */
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 	}

-	if (gd->env_valid == 2)
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
 		env_ptr = tmp_env2;
 	else
 #endif
-	if (gd->env_valid == 1)
+	if (gd->flags & GD_FLG_PRI_ENV_VALID)
 		env_ptr = tmp_env1;

 	gd->env_addr = (ulong)env_ptr->data;

 #else /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */
 	gd->env_addr  = (ulong)&default_environment[0];
-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();
 #endif /* ENV_IS_EMBEDDED || CONFIG_NAND_ENV_DST */

 	return (0);
@@ -208,7 +208,7 @@ int saveenv(void)
 	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
 	env_new.flags = ++env_flags; /* increase the serial */

-	if(gd->env_valid == 1) {
+	if(gd->flags & GD_FLG_PRI_ENV_VALID) {
 		puts("Erasing redundant NAND...\n");
 		nand_erase_options.offset = CONFIG_ENV_OFFSET_REDUND;
 		if (nand_erase_opts(&nand_info[0], &nand_erase_options))
@@ -234,7 +234,10 @@ int saveenv(void)

 	puts("done\n");

-	gd->env_valid = (gd->env_valid == 2 ? 1 : 2);
+	if (gd->flags & GD_FLG_RED_ENV_VALID)
+		SET_PRIMARY_ENV_VALID();
+	else
+		SET_REDUNDANT_ENV_VALID();

 	return ret;
 }
@@ -373,27 +376,27 @@ void env_relocate_spec(void)
 		set_default_env("!bad CRC");
 		return;
 	} else if (crc1_ok && !crc2_ok) {
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (!crc1_ok && crc2_ok) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else {
 		/* both ok - check serial */
 		if (tmp_env1->flags == 255 && tmp_env2->flags == 0)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else if (tmp_env2->flags == 255 && tmp_env1->flags == 0)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else if (tmp_env1->flags > tmp_env2->flags)
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();
 		else if (tmp_env2->flags > tmp_env1->flags)
-			gd->env_valid = 2;
+			SET_REDUNDANT_ENV_VALID();
 		else /* flags are equal - almost impossible */
-			gd->env_valid = 1;
+			SET_PRIMARY_ENV_VALID();

 	}

 	free(env_ptr);

-	if (gd->env_valid == 1)
+	if (gd->flags & GD_FLG_PRI_ENV_VALID)
 		ep = tmp_env1;
 	else
 		ep = tmp_env2;
diff --git a/common/env_nowhere.c b/common/env_nowhere.c
index 75ef78d..9441575 100644
--- a/common/env_nowhere.c
+++ b/common/env_nowhere.c
@@ -52,7 +52,7 @@ uchar env_get_char_spec(int index)
 int env_init(void)
 {
 	gd->env_addr  = (ulong)&default_environment[0];
-	gd->env_valid = 0;
+	SET_NO_ENV_VALID();

 	return (0);
 }
diff --git a/common/env_nvram.c b/common/env_nvram.c
index 544ce47..78ea38b 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -131,10 +131,10 @@ int env_init(void)
 	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
 		gd->env_addr  = (ulong)&(env_ptr->data);
 #endif
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else {
 		gd->env_addr  = (ulong)&default_environment[0];
-		gd->env_valid = 0;
+		SET_NO_ENV_VALID();
 	}
 	return (0);
 }
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 5e04a06..5201b35 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -90,7 +90,7 @@ void env_relocate_spec(void)

 	rc = env_import(buf, 1);
 	if (rc)
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 }

 int saveenv(void)
@@ -145,7 +145,7 @@ int env_init(void)
 {
 	/* use default */
 	gd->env_addr = (ulong) & default_environment[0];
-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();

 	return 0;
 }
diff --git a/common/env_sf.c b/common/env_sf.c
index d3b36d0..0e9d136 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -99,7 +99,7 @@ int saveenv(void)
 	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
 	env_new.flags = ACTIVE_FLAG;

-	if (gd->env_valid == 1) {
+	if (gd->flags & GD_FLG_PRI_ENV_VALID) {
 		env_new_offset = CONFIG_ENV_OFFSET_REDUND;
 		env_offset = CONFIG_ENV_OFFSET;
 	} else {
@@ -156,9 +156,14 @@ int saveenv(void)

 	puts("done\n");

-	gd->env_valid = (gd->env_valid == 2 ? 1 : 2);
+	if (gd->flags & GD_FLG_RED_ENV_VALID) {
+		SET_PRIMARY_ENV_VALID();
+		printf("Valid environment: Primary\n");
+	} else {
+		SET_REDUNDANT_ENV_VALID();
+		printf("Valid environment: Redundant\n");
+	}

-	printf("Valid environment: %d\n", (int)gd->env_valid);

  done:
 	if (saved_buffer)
@@ -210,28 +215,28 @@ void env_relocate_spec(void)
 		set_default_env("!bad CRC");
 		goto err_read;
 	} else if (crc1_ok && !crc2_ok) {
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (!crc1_ok && crc2_ok) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else if (tmp_env1->flags == ACTIVE_FLAG &&
 		   tmp_env2->flags == OBSOLETE_FLAG) {
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 	} else if (tmp_env1->flags == OBSOLETE_FLAG &&
 		   tmp_env2->flags == ACTIVE_FLAG) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else if (tmp_env1->flags == tmp_env2->flags) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else if (tmp_env1->flags == 0xFF) {
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	} else {
 		/*
 		 * this differs from code in env_flash.c, but I think a sane
 		 * default path is desirable.
 		 */
-		gd->env_valid = 2;
+		SET_REDUNDANT_ENV_VALID();
 	}

-	if (gd->env_valid == 1)
+	if (gd->flags & GD_FLG_PRI_ENV_VALID)
 		ep = tmp_env1;
 	else
 		ep = tmp_env2;
@@ -350,7 +355,7 @@ void env_relocate_spec(void)
 	ret = env_import(buf, 1);

 	if (ret)
-		gd->env_valid = 1;
+		SET_PRIMARY_ENV_VALID();
 out:
 	spi_flash_free(env_flash);
 	env_flash = NULL;
@@ -361,7 +366,7 @@ int env_init(void)
 {
 	/* SPI flash isn't usable before relocation */
 	gd->env_addr = (ulong)&default_environment[0];
-	gd->env_valid = 1;
+	SET_PRIMARY_ENV_VALID();

 	return 0;
 }
diff --git a/drivers/i2c/ppc4xx_i2c.c b/drivers/i2c/ppc4xx_i2c.c
index c1cbe55..4c980d5 100644
--- a/drivers/i2c/ppc4xx_i2c.c
+++ b/drivers/i2c/ppc4xx_i2c.c
@@ -396,7 +396,7 @@ static int ppc4xx_i2c_transfer(uchar chip, uint addr, int alen, uchar *buffer,
 #endif
 	if ((ret = i2c_transfer(read, chip << 1, &xaddr[4 - alen], alen,
 				buffer, len)) != 0) {
-		if (gd->have_console) {
+		if (gd->flags & GD_FLG_HAVE_CONSOLE) {
 			printf("I2C %s: failed %d\n",
 			       read ? "read" : "write", ret);
 		}
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index 9b02e89..9e1dd44 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -118,9 +118,9 @@ DECLARE_GLOBAL_DATA_PTR;


 #ifdef DEBUG_I2C
-#define PRINTD(fmt,args...)	do {	\
-	if (gd->have_console)		\
-		printf (fmt ,##args);	\
+#define PRINTD(fmt,args...)	do {		\
+	if (gd->flags & GD_FLG_HAVE_CONSOLE)	\
+		printf (fmt ,##args);		\
 	} while (0)
 #else
 #define PRINTD(fmt,args...)
diff --git a/include/environment.h b/include/environment.h
index 6394a96..5f2b583 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -152,6 +152,24 @@ typedef	struct environment_s {
 	unsigned char	data[ENV_SIZE]; /* Environment data		*/
 } env_t;

+#define SET_NO_ENV_VALID()				\
+	do {						\
+		gd->flags &= ~(GD_FLG_PRI_ENV_VALID |	\
+				GD_FLG_RED_ENV_VALID);	\
+	} while (0)
+
+#define SET_PRIMARY_ENV_VALID()				\
+	do {						\
+		SET_NO_ENV_VALID();			\
+		gd->flags |= GD_FLG_PRI_ENV_VALID;	\
+	} while (0)
+
+#define SET_REDUNDANT_ENV_VALID()			\
+	do {						\
+		SET_NO_ENV_VALID();			\
+		gd->flags |= GD_FLG_RED_ENV_VALID;	\
+	} while (0)
+
 #ifndef DO_DEPS_ONLY

 #include <search.h>
