Merge with /home/m8/git/u-boot
diff --git a/CHANGELOG b/CHANGELOG
index ca73b1e..95ca866 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,28 @@
 Changes for U-Boot 1.1.4:
 ======================================================================
 
+* Cleanup for GCC-4.x
+
+* Add documentation for Open Firmware Flat Tree and usage.
+  Patch by Pantelis Antoniou, 13 Oct 2005
+
+* Add missing files for Pantelis Antoniou's patch
+  Patch by Pantelis Antoniou, 04 Sep 2005
+
+* Fix problem in ppc4xx eth-driver without ethaddr (only without
+  CONFIG_NET_MULTI set)
+  Patch by Stefan Roese, 10 Oct 2005
+
+* Fix gzip bmp support (test if malloc fails, warning when truncated).
+  Increase CFG_VIDEO_LOGO_MAX_SIZE on HH405 board.
+  Patch by Stefan Roese, 07 Oct 2005
+
+* Add support for OF flat tree for the STXtc board.
+  Patch by Pantelis Antoniou, 04 Sep 2005
+
+* Support passing of OF flat trees to the kernel.
+  Patch by Pantelis Antoniou, 04 Sep 2005
+
 * Cleanup
 
 * Add support for NetSilicon NS7520 processor.
diff --git a/Makefile b/Makefile
index fa9b787..b91d5b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1601,6 +1601,9 @@
 logodl_config	:	unconfig
 	@./mkconfig $(@:_config=) arm pxa logodl
 
+pxa255_idp_config:	unconfig
+	@./mkconfig $(@:_config=) arm pxa pxa255_idp
+
 wepep250_config	:	unconfig
 	@./mkconfig $(@:_config=) arm pxa wepep250
 
diff --git a/README b/README
index a45ed6d..b0e1fb2 100644
--- a/README
+++ b/README
@@ -399,6 +399,20 @@
 		expect it to be in bytes, others in MB.
 		Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes.
 
+		CONFIG_OF_FLAT_TREE
+
+		New kernel versions are expecting firmware settings to be
+		passed using flat open firmware trees.
+		The environment variable "disable_of", when set, disables this
+		functionality.
+
+		CONFIG_OF_FLAT_TREE_MAX_SIZE
+
+		The maximum size of the constructed OF tree.
+
+		OF_CPU - The proper name of the cpus node.
+		OF_TBCLK - The timebase frequency.
+
 - Serial Ports:
 		CFG_PL010_SERIAL
 
diff --git a/board/LEOX/elpt860/elpt860.c b/board/LEOX/elpt860/elpt860.c
index 82a831f..775db73 100644
--- a/board/LEOX/elpt860/elpt860.c
+++ b/board/LEOX/elpt860/elpt860.c
@@ -169,7 +169,7 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	if (!s || strncmp (s, "ELPT860", 7))
 		printf ("### No HW ID - assuming ELPT860\n");
@@ -253,7 +253,7 @@
 	 * try 8 column mode
 	 */
 	size8 = dram_size (CFG_MAMR_8COL,
-			   (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
+			   SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
 
 	udelay (1000);
 
@@ -261,7 +261,7 @@
 	 * try 9 column mode
 	 */
 	size9 = dram_size (CFG_MAMR_9COL,
-			   (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
+			   SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {	/* leave configuration at 9 columns       */
 		size_b0 = size9;
diff --git a/board/Marvell/common/flash.c b/board/Marvell/common/flash.c
index c2c5b76..a8add85 100644
--- a/board/Marvell/common/flash.c
+++ b/board/Marvell/common/flash.c
@@ -526,7 +526,7 @@
 
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
-	volatile unsigned char *addr = (char *) (info->start[0]);
+	volatile unsigned char *addr = (uchar *) (info->start[0]);
 	int flag, prot, sect, l_sect;
 	ulong start, now, last;
 
@@ -696,7 +696,7 @@
 		for (sect = s_first; sect <= s_last; sect++) {
 			int sector_size = info->size / info->sector_count;
 
-			addr = (char *) (info->start[sect]);
+			addr = (uchar *) (info->start[sect]);
 			memset ((void *) addr, 0, sector_size);
 		}
 		return 0;
@@ -752,7 +752,7 @@
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last; sect++) {
 		if (info->protect[sect] == 0) {	/* not protected */
-			addr = (char *) (info->start[sect]);
+			addr = (uchar *) (info->start[sect]);
 			flash_cmd (info->portwidth, addr, 0, 0x30);
 			l_sect = sect;
 		}
@@ -893,7 +893,7 @@
 /* broken for 2x16: TODO */
 static int write_word (flash_info_t * info, ulong dest, ulong data)
 {
-	volatile unsigned char *addr = (char *) (info->start[0]);
+	volatile unsigned char *addr = (uchar *) (info->start[0]);
 	ulong start;
 	int flag, i;
 	ulong mask;
@@ -926,7 +926,7 @@
 					   CHIP_CMD_RST);
 				/* 1st cycle of word/byte program */
 				/* write 0x40 to the location to program */
-				flash_cmd (info->portwidth, (char *) dest, 0,
+				flash_cmd (info->portwidth, (uchar *) dest, 0,
 					   CHIP_CMD_PROG);
 				/* 2nd cycle of word/byte program */
 				/* write the data to the destination address */
diff --git a/board/Marvell/common/i2c.c b/board/Marvell/common/i2c.c
index 624ee5c..32b2b30 100644
--- a/board/Marvell/common/i2c.c
+++ b/board/Marvell/common/i2c.c
@@ -168,7 +168,7 @@
 static uchar i2c_get_data (uchar * return_data, int len)
 {
 
-	unsigned int data, status;
+	unsigned int data, status = 0;
 	int count = 0;
 
 	DP (puts ("i2c_get_data\n"));
diff --git a/board/Marvell/db64360/db64360.c b/board/Marvell/db64360/db64360.c
index 8e181d4..a2ab2d7 100644
--- a/board/Marvell/db64360/db64360.c
+++ b/board/Marvell/db64360/db64360.c
@@ -610,7 +610,7 @@
 int mem_test_data (void)
 {
 	unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
-	unsigned long long temp64;
+	unsigned long long temp64 = 0;
 	int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
 	int i;
 	unsigned int hi, lo;
@@ -717,7 +717,7 @@
 	       unsigned long long wmask, short read, short write)
 {
 	unsigned int i;
-	unsigned long long temp;
+	unsigned long long temp = 0;
 	unsigned int hitemp, lotemp, himask, lomask;
 
 	for (i = 0; i < size; i++) {
diff --git a/board/Marvell/db64360/mv_eth.c b/board/Marvell/db64360/mv_eth.c
index e2719b9..2dd47bf 100644
--- a/board/Marvell/db64360/mv_eth.c
+++ b/board/Marvell/db64360/mv_eth.c
@@ -267,8 +267,9 @@
 		dev->send = (void *) db64360_eth_transmit;
 		dev->recv = (void *) db64360_eth_poll;
 
-		dev->priv = (void *) ethernet_private =
-			calloc (sizeof (*ethernet_private), 1);
+		ethernet_private = calloc (sizeof (*ethernet_private), 1);
+		dev->priv = (void *) ethernet_private;
+
 		if (!ethernet_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
@@ -281,8 +282,8 @@
 		memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
 
 		/* set pointer to memory for stats data structure etc... */
-		ethernet_private->port_private = (void *) port_private =
-			calloc (sizeof (*ethernet_private), 1);
+		port_private = calloc (sizeof (*ethernet_private), 1);
+		ethernet_private->port_private = (void *)port_private; 
 		if (!port_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
diff --git a/board/Marvell/db64460/db64460.c b/board/Marvell/db64460/db64460.c
index 75eb5e8..a4abf8d 100644
--- a/board/Marvell/db64460/db64460.c
+++ b/board/Marvell/db64460/db64460.c
@@ -610,7 +610,7 @@
 int mem_test_data (void)
 {
 	unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
-	unsigned long long temp64;
+	unsigned long long temp64 = 0;
 	int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
 	int i;
 	unsigned int hi, lo;
@@ -717,7 +717,7 @@
 	       unsigned long long wmask, short read, short write)
 {
 	unsigned int i;
-	unsigned long long temp;
+	unsigned long long temp = 0;
 	unsigned int hitemp, lotemp, himask, lomask;
 
 	for (i = 0; i < size; i++) {
diff --git a/board/Marvell/db64460/mv_eth.c b/board/Marvell/db64460/mv_eth.c
index b78fda3..a50f174 100644
--- a/board/Marvell/db64460/mv_eth.c
+++ b/board/Marvell/db64460/mv_eth.c
@@ -267,8 +267,8 @@
 		dev->send = (void *) db64460_eth_transmit;
 		dev->recv = (void *) db64460_eth_poll;
 
-		dev->priv = (void *) ethernet_private =
-			calloc (sizeof (*ethernet_private), 1);
+		ethernet_private = calloc (sizeof (*ethernet_private), 1);
+		dev->priv = (void *)ethernet_private; 
 		if (!ethernet_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
@@ -281,8 +281,8 @@
 		memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
 
 		/* set pointer to memory for stats data structure etc... */
-		ethernet_private->port_private = (void *) port_private =
-			calloc (sizeof (*ethernet_private), 1);
+		port_private = calloc (sizeof (*ethernet_private), 1);
+		ethernet_private->port_private = (void *)port_private; 
 		if (!port_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
diff --git a/board/RPXClassic/RPXClassic.c b/board/RPXClassic/RPXClassic.c
index 5b12a0c..49cb8ad 100644
--- a/board/RPXClassic/RPXClassic.c
+++ b/board/RPXClassic/RPXClassic.c
@@ -114,8 +114,8 @@
 	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
 
 	/* Read 256 bytes in EEPROM				*/
-	i2c_read (0x54, 0, 1, buff, 128);
-	i2c_read (0x54, 128, 1, buff + 128, 128);
+	i2c_read (0x54, 0, 1, (uchar *)buff, 128);
+	i2c_read (0x54, 128, 1, (uchar *)buff + 128, 128);
 
 	/* Retrieve MAC address in buffer (key EA)		*/
 	for (cp = buff;;) {
@@ -123,7 +123,7 @@
 			cp += 3;
 			/* Read MAC address			*/
 			for (i = 0; i < 6; i++, cp += 2) {
-				enet[i] = aschex_to_byte (cp);
+				enet[i] = aschex_to_byte ((unsigned char *)cp);
 			}
 		}
 		/* Scan to the end of the record		*/
@@ -200,7 +200,7 @@
 	 * try 10 column mode
 	 */
 
-	size10 = dram_size (CFG_MAMR_10COL, (ulong *) SDRAM_BASE_PRELIM,
+	size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE_PRELIM,
 						SDRAM_MAX_SIZE);
 
 	return (size10);
diff --git a/board/RPXlite/RPXlite.c b/board/RPXlite/RPXlite.c
index d2c2116..f37e07b 100644
--- a/board/RPXlite/RPXlite.c
+++ b/board/RPXlite/RPXlite.c
@@ -137,7 +137,7 @@
 	 * try 10 column mode
 	 */
 
-	size10 = dram_size (CFG_MAMR_10COL, (ulong *) SDRAM_BASE_PRELIM,
+	size10 = dram_size (CFG_MAMR_10COL, SDRAM_BASE_PRELIM,
 			    SDRAM_MAX_SIZE);
 
 	return (size10);
diff --git a/board/RPXlite_dw/RPXlite_dw.c b/board/RPXlite_dw/RPXlite_dw.c
index 86cf6c1..237c58a 100644
--- a/board/RPXlite_dw/RPXlite_dw.c
+++ b/board/RPXlite_dw/RPXlite_dw.c
@@ -142,7 +142,7 @@
 	  * try 9 column mode
 	  */
 
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE);
+	size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE);
 
 	/*
 	 * Final mapping:
diff --git a/board/RRvision/RRvision.c b/board/RRvision/RRvision.c
index d12ea82..f46bb9e 100644
--- a/board/RRvision/RRvision.c
+++ b/board/RRvision/RRvision.c
@@ -93,7 +93,7 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	puts ("Board: RRvision ");
 
@@ -157,7 +157,7 @@
 	 * try 8 column mode
 	 */
 	size8 = dram_size (CFG_MAMR_8COL,
-			   (ulong *)SDRAM_BASE2_PRELIM,
+			   SDRAM_BASE2_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -166,7 +166,7 @@
 	 * try 9 column mode
 	 */
 	size9 = dram_size (CFG_MAMR_9COL,
-			   (ulong *) SDRAM_BASE2_PRELIM,
+			   SDRAM_BASE2_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
diff --git a/board/amcc/bubinga/bubinga.c b/board/amcc/bubinga/bubinga.c
index b4e9349..fe6ce8a 100644
--- a/board/amcc/bubinga/bubinga.c
+++ b/board/amcc/bubinga/bubinga.c
@@ -42,7 +42,7 @@
  */
 int checkboard(void)
 {
-	unsigned char *s = getenv("serial#");
+	char *s = getenv("serial#");
 
 	puts("Board: Bubinga - AMCC PPC405EP Evaluation Board");
 
diff --git a/board/amcc/ebony/ebony.c b/board/amcc/ebony/ebony.c
index f6bb837..9191f0f 100644
--- a/board/amcc/ebony/ebony.c
+++ b/board/amcc/ebony/ebony.c
@@ -91,7 +91,7 @@
 int checkboard(void)
 {
 	sys_info_t sysinfo;
-	unsigned char *s = getenv("serial#");
+	char *s = getenv("serial#");
 
 	get_sys_info(&sysinfo);
 
diff --git a/board/amcc/ocotea/ocotea.c b/board/amcc/ocotea/ocotea.c
index 50981c2..5b28c3b 100644
--- a/board/amcc/ocotea/ocotea.c
+++ b/board/amcc/ocotea/ocotea.c
@@ -187,7 +187,7 @@
 int checkboard (void)
 {
 	sys_info_t sysinfo;
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	get_sys_info (&sysinfo);
 
diff --git a/board/amcc/walnut/walnut.c b/board/amcc/walnut/walnut.c
index 9fca0a6..f1a96a6 100644
--- a/board/amcc/walnut/walnut.c
+++ b/board/amcc/walnut/walnut.c
@@ -67,7 +67,7 @@
  */
 int checkboard(void)
 {
-	unsigned char *s = getenv("serial#");
+	char *s = getenv("serial#");
 	uint pvr = get_pvr();
 
 	if (pvr == PVR_405GPR_RB) {
diff --git a/board/atc/flash.c b/board/atc/flash.c
index 26b7c80..2ab60e8 100644
--- a/board/atc/flash.c
+++ b/board/atc/flash.c
@@ -181,7 +181,7 @@
 	int i;
 	uchar *boottype;
 	uchar *bootletter;
-	uchar *fmt;
+	char *fmt;
 	uchar botbootletter[] = "B";
 	uchar topbootletter[] = "T";
 	uchar botboottype[] = "bottom boot sector";
diff --git a/board/barco/barco.c b/board/barco/barco.c
index 2fb3700..becbd0a 100644
--- a/board/barco/barco.c
+++ b/board/barco/barco.c
@@ -90,17 +90,17 @@
 	long mear1;
 	long emear1;
 
-	size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
+	size = get_ram_size (CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
 
 	new_bank0_end = size - 1;
-	mear1 = mpc824x_mpc107_getreg(MEAR1);
-	emear1 = mpc824x_mpc107_getreg(EMEAR1);
+	mear1 = mpc824x_mpc107_getreg (MEAR1);
+	emear1 = mpc824x_mpc107_getreg (EMEAR1);
 	mear1 = (mear1  & 0xFFFFFF00) |
 		((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
 	emear1 = (emear1 & 0xFFFFFF00) |
 		((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
-	mpc824x_mpc107_setreg(MEAR1, mear1);
-	mpc824x_mpc107_setreg(EMEAR1, emear1);
+	mpc824x_mpc107_setreg (MEAR1, mear1);
+	mpc824x_mpc107_setreg (EMEAR1, emear1);
 
 	return (size);
 }
@@ -113,11 +113,11 @@
 	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
 	  pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
 				       PCI_ENET0_MEMADDR,
-				       PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
+				       PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
 	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
 	  pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
 				       PCI_ENET1_MEMADDR,
-				       PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
+				       PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
 	{ }
 };
 #endif
@@ -128,68 +128,66 @@
 #endif
 };
 
-void pci_init_board(void)
+void pci_init_board (void)
 {
-	pci_mpc824x_init(&hose);
+	pci_mpc824x_init (&hose);
 }
 
-int write_flash(char *addr, char value)
+int write_flash (char *addr, char value)
 {
 	char *adr = (char *)0xFF800000;
 	int cnt = 0;
 	char status,oldstatus;
-	*(adr+0x55) = 0xAA;
 
-	udelay(1);
-	*(adr+0xAA) = 0x55;
-	udelay(1);
-	*(adr+0x55) = 0xA0;
-	udelay(1);
+	*(adr+0x55) = 0xAA; udelay (1);
+	*(adr+0xAA) = 0x55; udelay (1);
+	*(adr+0x55) = 0xA0; udelay (1);
 	*addr = value;
 
 	status = *addr;
-	do{
-
+	do {
 		oldstatus = status;
 		status = *addr;
 
-		if ((oldstatus & 0x40) == (status & 0x40)){
+		if ((oldstatus & 0x40) == (status & 0x40)) {
 			return 4;
 		}
 		cnt++;
-		if (cnt > 10000){
+		if (cnt > 10000) {
 			return 2;
 		}
-	}while( (status & 0x20) == 0 );
+	} while ( (status & 0x20) == 0 );
 
 	oldstatus = *addr;
 	status = *addr;
 
-	if ((oldstatus & 0x40) == (status & 0x40)) return 0;
-	else {
+	if ((oldstatus & 0x40) == (status & 0x40)) {
+		return 0;
+	} else {
 		*(adr+0x55) = 0xF0;
 		return 1;
 	}
 }
 
-unsigned update_flash(unsigned char* buf){
-	switch((*buf) & 0x3){
-		case TRY_WORKING:
-			printf("found 3 and converted it to 2\n");
-			write_flash(buf, (*buf) & 0xFE);
-			*((unsigned char *)0xFF800000) = 0xF0;
-			udelay(100);
-			printf("buf [%#010x] %#010x\n",buf,(*buf));
-		case BOOT_WORKING :
-			return BOOT_WORKING;
+unsigned update_flash (unsigned char *buf)
+{
+	switch ((*buf) & 0x3) {
+	case TRY_WORKING:
+		printf ("found 3 and converted it to 2\n");
+		write_flash ((char *)buf, (*buf) & 0xFE);
+		*((unsigned char *)0xFF800000) = 0xF0;
+		udelay (100);
+		printf ("buf [%#010x] %#010x\n", buf, (*buf));
+		/* XXX - fall through??? */
+	case BOOT_WORKING :
+		return BOOT_WORKING;
 	}
 	return BOOT_DEFAULT;
 }
 
-unsigned scan_flash(void)
+unsigned scan_flash (void)
 {
 	char section[] =  "kernel";
-	ulong   sp;
 	int cfgFileLen  =  (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1);
 	int sectionPtr  = 0;
 	int foundItem   = 0; /* 0: None, 1: section found, 2: "=" found */
@@ -198,57 +196,54 @@
 
 	buf = (unsigned char*)(CFG_FLASH_RANGE_BASE + CFG_FLASH_RANGE_SIZE \
 			- CFG_FLASH_ERASE_SECTOR_LENGTH);
-	for(bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr){
+	for (bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr) {
 		if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) {
 			return BOOT_DEFAULT;
 		}
-		switch(foundItem)
-		{
-			/* This is the scanning loop, we try to find a particular
-			 * quoted value
-			 */
-			case 0:
-				if((section[sectionPtr] == 0)){
-					++foundItem;
-				}
-				else if(buf[bufPtr] == section[sectionPtr]){
-					++sectionPtr;
-				}
-				else {
-					sectionPtr = 0;
-				}
-				break;
-			case 1:
+		/* This is the scanning loop, we try to find a particular
+		 * quoted value
+		 */
+		switch (foundItem) {
+		case 0:
+			if ((section[sectionPtr] == 0)) {
 				++foundItem;
-				break;
-			case 2:
-				++foundItem;
-				break;
-			case 3:
-			default:
-				return update_flash(buf[bufPtr - 1]);
+			} else if (buf[bufPtr] == section[sectionPtr]) {
+				++sectionPtr;
+			} else {
+				sectionPtr = 0;
+			}
+			break;
+		case 1:
+			++foundItem;
+			break;
+		case 2:
+			++foundItem;
+			break;
+		case 3:
+		default:
+			return update_flash (&buf[bufPtr - 1]);
 		}
 	}
 
-	printf("Failed to read %s\n",section);
+	printf ("Failed to read %s\n",section);
 	return BOOT_DEFAULT;
 }
 
-TSBootInfo* find_boot_info(void)
+TSBootInfo* find_boot_info (void)
 {
-	unsigned bootimage = scan_flash();
-	TSBootInfo* info = (TSBootInfo*)malloc(sizeof(TSBootInfo));
+	unsigned bootimage = scan_flash ();
+	TSBootInfo* info = (TSBootInfo*)malloc (sizeof(TSBootInfo));
 
-	switch(bootimage){
-		case TRY_WORKING:
-				info->address = CFG_WORKING_KERNEL_ADDRESS;
-				break;
-		case BOOT_WORKING :
-				info->address = CFG_WORKING_KERNEL_ADDRESS;
-				break;
-		case BOOT_DEFAULT:
-		default:
-				info->address= CFG_DEFAULT_KERNEL_ADDRESS;
+	switch (bootimage) {
+	case TRY_WORKING:
+		info->address = CFG_WORKING_KERNEL_ADDRESS;
+		break;
+	case BOOT_WORKING :
+		info->address = CFG_WORKING_KERNEL_ADDRESS;
+		break;
+	case BOOT_DEFAULT:
+	default:
+		info->address= CFG_DEFAULT_KERNEL_ADDRESS;
 
 	}
 	info->size = *((unsigned int *)(info->address ));
@@ -256,43 +251,44 @@
 	return info;
 }
 
-void barcobcd_boot(void)
+void barcobcd_boot (void)
 {
 	TSBootInfo* start;
 	char *bootm_args[2];
 	char *buf;
 	int cnt;
+	extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
 
 	buf = (char *)(0x00800000);
 	/* make certain there are enough chars to print the command line here!
 	 */
-	bootm_args[0]=(char *)malloc(16*sizeof(char));
-	bootm_args[1]=(char *)malloc(16*sizeof(char));
+	bootm_args[0] = (char *)malloc (16*sizeof(char));
+	bootm_args[1] = (char *)malloc (16*sizeof(char));
 
-	start = find_boot_info();
+	start = find_boot_info ();
 
-	printf("Booting kernel at address %#10x with size %#10x\n",
+	printf ("Booting kernel at address %#10x with size %#10x\n",
 			start->address, start->size);
 
 	/* give length of the kernel image to bootm */
-	sprintf(bootm_args[0],"%x",start->size);
+	sprintf (bootm_args[0],"%x",start->size);
 	/* give address of the kernel image to bootm */
-	sprintf(bootm_args[1],"%x",buf);
+	sprintf (bootm_args[1],"%x",buf);
 
-	printf("flash address: %#10x\n",start->address+8);
-	printf("buf address: %#10x\n",buf);
+	printf ("flash address: %#10x\n",start->address+8);
+	printf ("buf address: %#10x\n",buf);
 
 	/* aha, we reserve 8 bytes here... */
-	for (cnt = 0; cnt < start->size ; cnt++){
+	for (cnt = 0; cnt < start->size ; cnt++) {
 		buf[cnt] = ((char *)start->address)[cnt+8];
 	}
 
 	/* initialise RAM memory */
 	*((unsigned int *)0xFEC00000) = 0x00141A98;
-	do_bootm(NULL,0,2,bootm_args);
+	do_bootm (NULL,0,2,bootm_args);
 }
 
-int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int barcobcd_boot_image (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 #if 0
 	if (argc > 1) {
@@ -300,7 +296,7 @@
 		return 1;
 	}
 #endif
-	barcobcd_boot();
+	barcobcd_boot ();
 
 	return 0;
 }
@@ -308,19 +304,19 @@
 /* Currently, boot_working and boot_default are the same command. This is
  * left in here to see what we'll do in the future */
 
-U_BOOT_CMD(
+U_BOOT_CMD (
 		try_working, 1, 1, barcobcd_boot_image,
 		" try_working - check flash value and boot the appropriate image\n",
 		"\n"
 	  );
 
-U_BOOT_CMD(
+U_BOOT_CMD (
 		boot_working, 1, 1, barcobcd_boot_image,
 		" boot_working - check flash value and boot the appropriate image\n",
 		"\n"
 	  );
 
-U_BOOT_CMD(
+U_BOOT_CMD (
 		boot_default, 1, 1, barcobcd_boot_image,
 		" boot_default - check flash value and boot the appropriate image\n",
 		"\n"
@@ -328,13 +324,40 @@
 /*
  * We are not using serial communication, so just provide empty functions
  */
-int serial_init(void){return 0;}
-void serial_setbrg(void){}
-void serial_putc(const char c){}
-void serial_puts(const char *c){}
-void serial_addr(unsigned int i){}
-int serial_getc(void){return 0;}
-int serial_tstc(void){return 0;}
+int serial_init (void)
+{
+	return 0;
+}
+void serial_setbrg (void)
+{
+	return;
+}
+void serial_putc (const char c)
+{
+	return;
+}
+void serial_puts (const char *c)
+{
+	return;
+}
+void serial_addr (unsigned int i)
+{
+	return;
+}
+int serial_getc (void)
+{
+	return 0;
+}
+int serial_tstc (void)
+{
+	return 0;
+}
 
-unsigned long post_word_load(void){return 0l;};
-void post_word_store(unsigned long val){}
+unsigned long post_word_load (void)
+{
+	return 0l;
+}
+void post_word_store (unsigned long val)
+{
+	return;
+}
diff --git a/board/c2mon/c2mon.c b/board/c2mon/c2mon.c
index 873ff8c..ca8eb0c 100644
--- a/board/c2mon/c2mon.c
+++ b/board/c2mon/c2mon.c
@@ -91,7 +91,7 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
+	unsigned char *s = (unsigned char *)getenv ("serial#");
 
 	puts ("Board: TTTech C2MON ");
 
@@ -155,7 +155,7 @@
 	 * try 8 column mode
 	 */
 	size8 = dram_size (CFG_MAMR_8COL,
-			   (ulong *)SDRAM_BASE2_PRELIM,
+			   SDRAM_BASE2_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -164,7 +164,7 @@
 	 * try 9 column mode
 	 */
 	size9 = dram_size (CFG_MAMR_9COL,
-			   (ulong *) SDRAM_BASE2_PRELIM,
+			   SDRAM_BASE2_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
diff --git a/board/cray/L1/L1.c b/board/cray/L1/L1.c
index fb28c42..a7114eb 100644
--- a/board/cray/L1/L1.c
+++ b/board/cray/L1/L1.c
@@ -133,7 +133,7 @@
 /* ------------------------------------------------------------------------- */
 int misc_init_r (void)
 {
-	unsigned char *s, *e;
+	char *s, *e;
 	image_header_t *hdr;
 	time_t timestamp;
 	struct rtc_time tm;
@@ -146,7 +146,7 @@
 
 #define FACTORY_SETTINGS 0xFFFC0000
 	if ((s = getenv ("ethaddr")) == NULL) {
-		e = (unsigned char *) (FACTORY_SETTINGS);
+		e = (char *) (FACTORY_SETTINGS);
 		if (*(e + 0) != '0'
 			|| *(e + 1) != '0'
 			|| *(e + 2) != ':'
@@ -314,7 +314,7 @@
 	{
 		setenv (Things[thing].envname, Things[thing].dhcpvalue);
 	}
-	return (Things[thing].dhcpvalue);
+	return ((u8 *)(Things[thing].dhcpvalue));
 }
 
 /* ------------------------------------------------------------------------- */
diff --git a/board/dave/PPChameleonEVB/PPChameleonEVB.c b/board/dave/PPChameleonEVB/PPChameleonEVB.c
index b425d63..5f2c705 100644
--- a/board/dave/PPChameleonEVB/PPChameleonEVB.c
+++ b/board/dave/PPChameleonEVB/PPChameleonEVB.c
@@ -185,7 +185,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/eltec/bab7xx/misc.c b/board/eltec/bab7xx/misc.c
index b50d11b..6a24807 100644
--- a/board/eltec/bab7xx/misc.c
+++ b/board/eltec/bab7xx/misc.c
@@ -58,7 +58,7 @@
 int misc_init_r (void)
 {
     revinfo eerev;
-    u_char *ptr;
+    char *ptr;
     u_int  i, l, initSrom, copyNv;
     char buf[256];
     char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
@@ -139,7 +139,7 @@
     if (strcmp (eerev.magic, "ELTEC") != 0)
     {
 	/* srom is not initialized -> create a default revision info */
-	for (i = 0, ptr = (u_char *)&eerev; i < sizeof(revinfo); i++)
+	for (i = 0, ptr = (char *)&eerev; i < sizeof(revinfo); i++)
 	    *ptr++ = 0x00;
 	strcpy(eerev.magic, "ELTEC");
 	eerev.revrev[0] = 1;
diff --git a/board/eltec/elppc/eepro100_srom.c b/board/eltec/elppc/eepro100_srom.c
index 9754c1d..f021c50 100644
--- a/board/eltec/elppc/eepro100_srom.c
+++ b/board/eltec/elppc/eepro100_srom.c
@@ -57,7 +57,7 @@
 
     /* get onboard network iobase */
     pci_read_config_dword(PCI_BDF(0,0x10,0), PCI_BASE_ADDRESS_0,
-		 &onboard_dev.iobase);
+		 (unsigned int *)&onboard_dev.iobase);
     onboard_dev.iobase &= ~0xf;
 
     source[63] = eepro100_srom_checksum (source);
diff --git a/board/eltec/mhpc/mhpc.c b/board/eltec/mhpc/mhpc.c
index bc3d9f4..0ffbdf0 100644
--- a/board/eltec/mhpc/mhpc.c
+++ b/board/eltec/mhpc/mhpc.c
@@ -160,7 +160,7 @@
 	int i;
 
 	/* check revision data */
-	eeprom_read (CFG_I2C_EEPROM_ADDR, 480, (char *) &mhpcRevInfo, 32);
+	eeprom_read (CFG_I2C_EEPROM_ADDR, 480, (uchar *) &mhpcRevInfo, 32);
 
 	if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
 		printf ("Enter revision number (0-9): %c  ",
@@ -228,7 +228,7 @@
 		}
 
 		/* setup new revision data */
-		eeprom_write (CFG_I2C_EEPROM_ADDR, 480, (char *) &mhpcRevInfo,
+		eeprom_write (CFG_I2C_EEPROM_ADDR, 480, (uchar *) &mhpcRevInfo,
 			      32);
 	}
 
@@ -422,8 +422,8 @@
 	immap_t *immr = (immap_t *) CFG_IMMR;
 
 	/* enable video only on CLUT value */
-	if ((penv = getenv ("clut")) != NULL)
-		clut = (u_int) simple_strtoul (penv, NULL, 10);
+	if ((penv = (uchar *)getenv ("clut")) != NULL)
+		clut = (u_int) simple_strtoul ((char *)penv, NULL, 10);
 	else
 		return NULL;
 
diff --git a/board/emk/common/flash.c b/board/emk/common/flash.c
index 28fe29d..d6161bf 100644
--- a/board/emk/common/flash.c
+++ b/board/emk/common/flash.c
@@ -165,7 +165,7 @@
 	int i;
 	uchar *boottype;
 	uchar *bootletter;
-	uchar *fmt;
+	char *fmt;
 	uchar botbootletter[] = "B";
 	uchar topbootletter[] = "T";
 	uchar botboottype[] = "bottom boot sector";
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index cbb7f8f..8a3a12b 100644
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -69,11 +69,11 @@
 		/*printf ("%s\n", buf); */
 		/* search for our specific entry */
 		if (!strncmp ((char *) buf, "[RLA/lan/Ethernet] ", 19)) {
-			setenv ("ethaddr", buf + 19);
+			setenv ("ethaddr", (char *)(buf + 19));
 		} else if (!strncmp ((char *) buf, "[BOARD/SERIAL] ", 15)) {
-			setenv ("serial#", buf + 15);
+			setenv ("serial#", (char *)(buf + 15));
 		} else if (!strncmp ((char *) buf, "[BOARD/TYPE] ", 13)) {
-			setenv ("board_id", buf + 13);
+			setenv ("board_id", (char *)(buf + 13));
 		}
 	}
 }
diff --git a/board/eric/eric.c b/board/eric/eric.c
index 02fe8dc..5413ae1 100644
--- a/board/eric/eric.c
+++ b/board/eric/eric.c
@@ -85,8 +85,8 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
-	unsigned char *e;
+	char *s = getenv ("serial#");
+	char *e;
 
 	puts ("Board: ");
 
diff --git a/board/esd/adciop/adciop.c b/board/esd/adciop/adciop.c
index 93bc843..7a11a12 100644
--- a/board/esd/adciop/adciop.c
+++ b/board/esd/adciop/adciop.c
@@ -60,7 +60,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/esd/ar405/ar405.c b/board/esd/ar405/ar405.c
index 14b0e42..3aac3c6 100644
--- a/board/esd/ar405/ar405.c
+++ b/board/esd/ar405/ar405.c
@@ -155,7 +155,7 @@
 
 	int index;
 	int len;
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 	const unsigned char *fpga;
 
diff --git a/board/esd/ash405/ash405.c b/board/esd/ash405/ash405.c
index 012505e..03ae7fd 100644
--- a/board/esd/ash405/ash405.c
+++ b/board/esd/ash405/ash405.c
@@ -193,7 +193,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/canbt/canbt.c b/board/esd/canbt/canbt.c
index ab49249..2ced6cb 100644
--- a/board/esd/canbt/canbt.c
+++ b/board/esd/canbt/canbt.c
@@ -156,7 +156,7 @@
 {
 	int index;
 	int len;
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c
index 0604a4e..1dceb3a 100644
--- a/board/esd/common/auto_update.c
+++ b/board/esd/common/auto_update.c
@@ -103,7 +103,7 @@
 	/* check the data CRC */
 	checksum = ntohl(hdr->ih_dcrc);
 
-	if (crc32 (0, (char *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
+	if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
 		!= checksum) {
 		printf ("Image %s bad data checksum\n", au_image[i].name);
 		return -1;
@@ -140,7 +140,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(*hdr)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(*hdr)) != checksum) {
 		printf ("Image %s bad header checksum\n", au_image[i].name);
 		return -1;
 	}
@@ -283,12 +283,12 @@
 		 */
 		if (au_image[i].type != AU_NAND) {
 			debug ("flash_write(%p, %lx %x)\n", addr, start, nbytes);
-			rc = flash_write(addr, start, nbytes);
+			rc = flash_write((uchar *)addr, start, nbytes);
 		} else {
 #if (CONFIG_COMMANDS & CFG_CMD_NAND)
 			debug ("nand_rw(%p, %lx %x)\n", addr, start, nbytes);
 			rc = nand_rw(nand_dev_desc, NANDRW_WRITE | NANDRW_JFFS2,
-				     start, nbytes, &total, addr);
+				     start, nbytes, (size_t *)&total, (uchar *)addr);
 			debug ("nand_rw: ret=%x total=%d nbytes=%d\n", rc, total, nbytes);
 #endif
 		}
@@ -301,12 +301,12 @@
 		 * check the dcrc of the copy
 		 */
 		if (au_image[i].type != AU_NAND) {
-			rc = crc32 (0, (char *)(start + off), ntohl(hdr->ih_size));
+			rc = crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size));
 		} else {
 #if (CONFIG_COMMANDS & CFG_CMD_NAND)
 			rc = nand_rw(nand_dev_desc, NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP,
-				     start, nbytes, &total, addr);
-			rc = crc32 (0, (char *)(addr + off), ntohl(hdr->ih_size));
+				     start, nbytes, (size_t *)&total, (uchar *)addr);
+			rc = crc32 (0, (uchar *)(addr + off), ntohl(hdr->ih_size));
 #endif
 		}
 		if (rc != ntohl(hdr->ih_dcrc)) {
diff --git a/board/esd/common/lcd.c b/board/esd/common/lcd.c
index 05c76ff..0edc083 100644
--- a/board/esd/common/lcd.c
+++ b/board/esd/common/lcd.c
@@ -81,7 +81,7 @@
 	uchar *ptr;
 	ushort *ptr2;
 	ushort val;
-	unsigned char *dst;
+	unsigned char *dst = NULL;
 	int x, y;
 	int width, height, bpp, colors, line_size;
 	int header_size;
@@ -89,7 +89,6 @@
 	unsigned char r, g, b;
 	BITMAPINFOHEADER *bm_info;
 	ulong len;
-	int do_free = 0;
 
 	/*
 	 * Check for bmp mark 'BM'
@@ -99,12 +98,18 @@
 		/*
 		 * Decompress bmp image
 		 */
-		len = CFG_LCD_LOGO_MAX_SIZE;
-		dst = malloc(CFG_LCD_LOGO_MAX_SIZE);
-		do_free = 1;
-		if (gunzip(dst, CFG_LCD_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+		len = CFG_VIDEO_LOGO_MAX_SIZE;
+		dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+		if (dst == NULL) {
+			printf("Error: malloc in gunzip failed!\n");
 			return;
 		}
+		if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+			return;
+		}
+		if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+			printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+		}
 
 		/*
 		 * Check for bmp mark 'BM'
@@ -147,7 +152,9 @@
 		break;
 	default:
 		printf("LCD: Unknown bpp (%d) im image!\n", bpp);
-		free(dst);
+		if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
+			free(dst);
+		}
 		return;
 	}
 	printf(" (%d*%d, %dbpp)\n", width, height, bpp);
@@ -205,7 +212,7 @@
 		}
 	}
 
-	if (do_free) {
+	if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
 		free(dst);
 	}
 }
diff --git a/board/esd/cpci2dp/cpci2dp.c b/board/esd/cpci2dp/cpci2dp.c
index 0949a7d..727640e 100644
--- a/board/esd/cpci2dp/cpci2dp.c
+++ b/board/esd/cpci2dp/cpci2dp.c
@@ -95,7 +95,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c
index f27668d..2ab9673 100644
--- a/board/esd/cpci405/cpci405.c
+++ b/board/esd/cpci405/cpci405.c
@@ -440,7 +440,7 @@
 	int index;
 	int len;
 #endif
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 	unsigned short ver;
 
@@ -468,7 +468,7 @@
 #endif
 
 	if (ctermm2()) {
-		unsigned char str[4];
+		char str[4];
 
 		/*
 		 * Read board-id and save in env-variable
@@ -664,7 +664,7 @@
 	int result;
 	int i;
 	unsigned char ow_id[6];
-	unsigned char str[32];
+	char str[32];
 	unsigned char ow_crc;
 
 	/*
@@ -717,10 +717,10 @@
 	IPaddr_t ipaddr;
 
 	buf = malloc(CFG_ENV_SIZE_2);
-	if (eeprom_read(CFG_I2C_EEPROM_ADDR_2, 0, buf, CFG_ENV_SIZE_2)) {
+	if (eeprom_read(CFG_I2C_EEPROM_ADDR_2, 0, (uchar *)buf, CFG_ENV_SIZE_2)) {
 		puts("\nError reading backplane EEPROM!\n");
 	} else {
-		crc = crc32(0, buf+4, CFG_ENV_SIZE_2-4);
+		crc = crc32(0, (uchar *)(buf+4), CFG_ENV_SIZE_2-4);
 		if (crc != *(ulong *)buf) {
 			printf("ERROR: crc mismatch %08lx %08lx\n", crc, *(ulong *)buf);
 			return -1;
@@ -766,7 +766,7 @@
 int do_set_bpip(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	char *buf;
-	unsigned char str[32];
+	char str[32];
 	ulong crc;
 
 	if (argc < 2) {
@@ -779,10 +779,10 @@
 	memset(buf, 0, CFG_ENV_SIZE_2);
 	sprintf(str, "bp_ip=%s", argv[1]);
 	strcpy(buf+4, str);
-	crc = crc32(0, buf+4, CFG_ENV_SIZE_2-4);
+	crc = crc32(0, (uchar *)(buf+4), CFG_ENV_SIZE_2-4);
 	*(ulong *)buf = crc;
 
-	if (eeprom_write(CFG_I2C_EEPROM_ADDR_2, 0, buf, CFG_ENV_SIZE_2)) {
+	if (eeprom_write(CFG_I2C_EEPROM_ADDR_2, 0, (uchar *)buf, CFG_ENV_SIZE_2)) {
 		puts("\nError writing backplane EEPROM!\n");
 	}
 
diff --git a/board/esd/cpci5200/cpci5200.c b/board/esd/cpci5200/cpci5200.c
index 01c4171..6c98f13 100644
--- a/board/esd/cpci5200/cpci5200.c
+++ b/board/esd/cpci5200/cpci5200.c
@@ -105,9 +105,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
 
 	if (test1 > test2) {
 		sdram_start(0);
diff --git a/board/esd/cpci750/cpci750.c b/board/esd/cpci750/cpci750.c
index 68f121d..e4b062b 100644
--- a/board/esd/cpci750/cpci750.c
+++ b/board/esd/cpci750/cpci750.c
@@ -555,7 +555,7 @@
 int mem_test_data (void)
 {
 	unsigned long long *pmem = (unsigned long long *) CFG_MEMTEST_START;
-	unsigned long long temp64;
+	unsigned long long temp64 = 0;
 	int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
 	int i;
 	unsigned int hi, lo;
@@ -662,7 +662,7 @@
 	       unsigned long long wmask, short read, short write)
 {
 	unsigned int i;
-	unsigned long long temp;
+	unsigned long long temp = 0;
 	unsigned int hitemp, lotemp, himask, lomask;
 
 	for (i = 0; i < size; i++) {
diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c
index e2719b9..880528f 100644
--- a/board/esd/cpci750/mv_eth.c
+++ b/board/esd/cpci750/mv_eth.c
@@ -267,8 +267,9 @@
 		dev->send = (void *) db64360_eth_transmit;
 		dev->recv = (void *) db64360_eth_poll;
 
-		dev->priv = (void *) ethernet_private =
+		ethernet_private =
 			calloc (sizeof (*ethernet_private), 1);
+		dev->priv = (void *) ethernet_private;
 		if (!ethernet_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
@@ -281,8 +282,9 @@
 		memcpy (ethernet_private->port_mac_addr, dev->enetaddr, 6);
 
 		/* set pointer to memory for stats data structure etc... */
-		ethernet_private->port_private = (void *) port_private =
+		port_private =
 			calloc (sizeof (*ethernet_private), 1);
+		ethernet_private->port_private = (void *)port_private; 
 		if (!port_private) {
 			printf ("%s: %s allocation failure, %s\n",
 				__FUNCTION__, dev->name,
diff --git a/board/esd/cpciiser4/cpciiser4.c b/board/esd/cpciiser4/cpciiser4.c
index 3d1f1fa..7bf7bb5 100644
--- a/board/esd/cpciiser4/cpciiser4.c
+++ b/board/esd/cpciiser4/cpciiser4.c
@@ -153,7 +153,7 @@
 {
 	int index;
 	int len;
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/esd/dasa_sim/cmd_dasa_sim.c b/board/esd/dasa_sim/cmd_dasa_sim.c
index 9edb3af..89a4aaf 100644
--- a/board/esd/dasa_sim/cmd_dasa_sim.c
+++ b/board/esd/dasa_sim/cmd_dasa_sim.c
@@ -111,7 +111,7 @@
 		for (i = 0; i < 4; i++) {
 			pci_read_config_dword (CFG_PCI9054_DEV_FN,
 						l * 16 + i * 4,
-						&val);
+						(unsigned int *)&val);
 			printf ("%08x ", val);
 		}
 		printf ("\n");
diff --git a/board/esd/dasa_sim/dasa_sim.c b/board/esd/dasa_sim/dasa_sim.c
index 57a971f..2f8ab1a 100644
--- a/board/esd/dasa_sim/dasa_sim.c
+++ b/board/esd/dasa_sim/dasa_sim.c
@@ -162,7 +162,7 @@
 {
 	int index;
 	int len;
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 	int fpga;
 	unsigned short val;
diff --git a/board/esd/dp405/dp405.c b/board/esd/dp405/dp405.c
index 056063e..fd51f7f 100644
--- a/board/esd/dp405/dp405.c
+++ b/board/esd/dp405/dp405.c
@@ -100,7 +100,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 	unsigned char trans[16] = {0x0,0x8,0x4,0xc,0x2,0xa,0x6,0xe,
 				   0x1,0x9,0x5,0xd,0x3,0xb,0x7,0xf};
diff --git a/board/esd/du405/du405.c b/board/esd/du405/du405.c
index 7db2a60..26e8341 100644
--- a/board/esd/du405/du405.c
+++ b/board/esd/du405/du405.c
@@ -162,7 +162,7 @@
 {
 	int index;
 	int len;
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/esd/hub405/hub405.c b/board/esd/hub405/hub405.c
index bbd8555..e77dba8 100644
--- a/board/esd/hub405/hub405.c
+++ b/board/esd/hub405/hub405.c
@@ -210,7 +210,7 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/ocrtc/ocrtc.c b/board/esd/ocrtc/ocrtc.c
index ac032ef..261b8a5 100644
--- a/board/esd/ocrtc/ocrtc.c
+++ b/board/esd/ocrtc/ocrtc.c
@@ -74,7 +74,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/esd/pci405/cmd_pci405.c b/board/esd/pci405/cmd_pci405.c
index e1ca583..0315c3d 100644
--- a/board/esd/pci405/cmd_pci405.c
+++ b/board/esd/pci405/cmd_pci405.c
@@ -91,7 +91,7 @@
 			pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
 		}
 		ptr = (unsigned int *)PCI_REGS_ADDR;
-		*ptr = crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
+		*ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
 
 		printf("\nStoring PCI Configuration Regs...\n");
 	} else {
@@ -874,7 +874,7 @@
 		pci_read_config_dword(PCIDEVID_405GP, i, ptr++);
 	}
 	ptr = (unsigned int *)PCI_REGS_ADDR;
-	*ptr = crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
+	*ptr = crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4);
 
 	printf("\nStoring PCI Configuration Regs...\n");
 
@@ -896,7 +896,7 @@
 	 * Rewrite pci config regs (only after soft-reset with magic set)
 	 */
 	ptr = (unsigned int *)PCI_REGS_ADDR;
-	if (crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
+	if (crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
 		puts("Restoring PCI Configurations Regs!\n");
 		ptr = (unsigned int *)PCI_REGS_ADDR + 1;
 		for (i=0; i<0x40; i+=4) {
diff --git a/board/esd/pci405/pci405.c b/board/esd/pci405/pci405.c
index d1b6807..4be4d7e 100644
--- a/board/esd/pci405/pci405.c
+++ b/board/esd/pci405/pci405.c
@@ -275,7 +275,7 @@
 		 * Rewrite pci config regs (only after soft-reset with magic set)
 		 */
 		ptr = (unsigned int *)PCI_REGS_ADDR;
-		if (crc32(0, (char *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
+		if (crc32(0, (uchar *)PCI_REGS_ADDR+4, PCI_REGS_LEN-4) == *ptr) {
 			puts("Restoring PCI Configurations Regs!\n");
 			ptr = (unsigned int *)PCI_REGS_ADDR + 1;
 			for (i=0; i<0x40; i+=4) {
@@ -322,7 +322,7 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/pf5200/flash.c b/board/esd/pf5200/flash.c
index bfbd090..53afbc0 100644
--- a/board/esd/pf5200/flash.c
+++ b/board/esd/pf5200/flash.c
@@ -122,7 +122,7 @@
 
 void flash_print_info(flash_info_t * info) {
 	int i;
-	uchar *fmt;
+	char *fmt;
 
 	if (info->flash_id == FLASH_UNKNOWN) {
 		printf("missing or unknown FLASH type\n");
diff --git a/board/esd/pf5200/pf5200.c b/board/esd/pf5200/pf5200.c
index fa71c79..2b47012 100644
--- a/board/esd/pf5200/pf5200.c
+++ b/board/esd/pf5200/pf5200.c
@@ -105,9 +105,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *) CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *) CFG_SDRAM_BASE, 0x80000000);
 
 	if (test1 > test2) {
 		sdram_start(0);
diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c
index e3eff31..16f2360 100644
--- a/board/esd/plu405/plu405.c
+++ b/board/esd/plu405/plu405.c
@@ -203,7 +203,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/pmc405/pmc405.c b/board/esd/pmc405/pmc405.c
index a72547d..33b5f77 100644
--- a/board/esd/pmc405/pmc405.c
+++ b/board/esd/pmc405/pmc405.c
@@ -107,7 +107,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/voh405/voh405.c b/board/esd/voh405/voh405.c
index 9cea69f..eda3fd9 100644
--- a/board/esd/voh405/voh405.c
+++ b/board/esd/voh405/voh405.c
@@ -268,7 +268,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esd/wuh405/wuh405.c b/board/esd/wuh405/wuh405.c
index 09c4d36..db24122 100644
--- a/board/esd/wuh405/wuh405.c
+++ b/board/esd/wuh405/wuh405.c
@@ -193,7 +193,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/esteem192e/esteem192e.c b/board/esteem192e/esteem192e.c
index 5c3e9b4..3959eea 100644
--- a/board/esteem192e/esteem192e.c
+++ b/board/esteem192e/esteem192e.c
@@ -147,8 +147,8 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 *
 	 */
-	size_b0 = get_ram_size ((ulong *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
-	size_b1 = get_ram_size ((ulong *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+	size_b0 = get_ram_size ( (long *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+	size_b1 = get_ram_size ( (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
 
 	printf ("\nbank 0 size %lu\nbank 1 size %lu\n", size_b0, size_b1);
 
diff --git a/board/etx094/etx094.c b/board/etx094/etx094.c
index efe7cb2..dba3c11 100644
--- a/board/etx094/etx094.c
+++ b/board/etx094/etx094.c
@@ -92,8 +92,8 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char *s = getenv ("serial#");
-	unsigned char *e;
+	char *s = getenv ("serial#");
+	char *e;
 
 	puts ("Board: ");
 
@@ -186,7 +186,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -194,7 +194,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
@@ -215,7 +215,7 @@
 		 *  but then only half the real size will be used.]
 		 */
 		size_b1 =
-				dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE3_PRELIM,
+				dram_size (memctl->memc_mamr, (long *) SDRAM_BASE3_PRELIM,
 						   SDRAM_MAX_SIZE);
 /*	debug ("SDRAM Bank 1: %ld MB\n", size8 >> 20);	*/
 	} else {
diff --git a/board/evb64260/eth.c b/board/evb64260/eth.c
index f0743fa..a248cad 100644
--- a/board/evb64260/eth.c
+++ b/board/evb64260/eth.c
@@ -182,7 +182,7 @@
 	 */
 
 	/* let the upper layer handle the packet */
-	NetReceive (eth_data, eth_len);
+	NetReceive ((uchar *)eth_data, eth_len);
 
 	rx->buff_size_byte_count = GT6426x_ETH_BUF_SIZE<<16;
 
@@ -266,7 +266,7 @@
 #endif
 	memcpy(dev->eth_tx_buffer, (char *) p, s);
 
-	tx->buff_pointer = dev->eth_tx_buffer;
+	tx->buff_pointer = (uchar *)dev->eth_tx_buffer;
 	tx->bytecount_reserved = ((__u16)s) << 16;
 
 	/*    31 - own
@@ -583,7 +583,7 @@
 
 	/* Initialize Rx Side */
 	for (temp = 0; temp < NR; temp++) {
-		p->eth_rx_desc[temp].buff_pointer = p->eth_rx_buffer[temp];
+		p->eth_rx_desc[temp].buff_pointer = (uchar *)p->eth_rx_buffer[temp];
 		p->eth_rx_desc[temp].buff_size_byte_count = GT6426x_ETH_BUF_SIZE<<16;
 
 		/* GT96100 Owner */
@@ -719,7 +719,8 @@
 		dev->send = (void*)gt6426x_eth_transmit;
 		dev->recv = (void*)gt6426x_eth_poll;
 
-		dev->priv = (void*)p = calloc( sizeof(*p), 1 );
+		p = calloc( sizeof(*p), 1 );
+		dev->priv = (void*)p;
 		if (!p)
 		{
 			printf( "%s: %s allocation failure, %s\n",
diff --git a/board/evb64260/eth.h b/board/evb64260/eth.h
index ecc3762..beb6db1 100644
--- a/board/evb64260/eth.h
+++ b/board/evb64260/eth.h
@@ -39,14 +39,14 @@
 	volatile struct eth0_tx_desc_struct * next_desc;
 	/* Note - the following will not work for 64 bit addressing */
 	volatile unsigned char * buff_pointer;
-} eth0_tx_desc_single __attribute__ ((packed));
+} __attribute__ ((packed)) eth0_tx_desc_single;
 
 typedef struct eth0_rx_desc_struct {
   volatile __u32 buff_size_byte_count;
   volatile __u32 command_status;
   volatile struct eth0_rx_desc_struct * next_desc;
   volatile unsigned char * buff_pointer;
-} eth0_rx_desc_single __attribute__ ((packed));
+} __attribute__ ((packed)) eth0_rx_desc_single;
 
 #define NT 20 /* Number of Transmit buffers */
 #define NR 20 /* Number of Receive buffers */
diff --git a/board/evb64260/eth_addrtbl.c b/board/evb64260/eth_addrtbl.c
index 0abc7d4..69882f5 100644
--- a/board/evb64260/eth_addrtbl.c
+++ b/board/evb64260/eth_addrtbl.c
@@ -55,8 +55,9 @@
 		int bytes =
 			hashLength[hashSizeSelector] * sizeof (addrTblEntry);
 
-		tableBase = (unsigned int) realAddrTableBase[port] =
+		realAddrTableBase[port] =
 			malloc (bytes + 64);
+		tableBase = (unsigned int)realAddrTableBase; 
 
 		if (!tableBase) {
 			printf ("%s: alloc memory failed \n", __FUNCTION__);
diff --git a/board/evb64260/flash.c b/board/evb64260/flash.c
index 7ca6f0a..6ab23dc 100644
--- a/board/evb64260/flash.c
+++ b/board/evb64260/flash.c
@@ -589,7 +589,7 @@
 int
 flash_erase (flash_info_t *info, int s_first, int s_last)
 {
-	volatile unsigned char *addr = (char *)(info->start[0]);
+	volatile unsigned char *addr = (uchar *)(info->start[0]);
 	int flag, prot, sect, l_sect;
 	ulong start, now, last;
 
@@ -600,7 +600,7 @@
 	if((info->flash_id & FLASH_TYPEMASK) == FLASH_RAM) {
 	    for (sect = s_first; sect<=s_last; sect++) {
 		int sector_size=info->size/info->sector_count;
-		addr = (char *)(info->start[sect]);
+		addr = (uchar *)(info->start[sect]);
 		memset((void *)addr, 0, sector_size);
 	    }
 	    return 0;
@@ -658,7 +658,7 @@
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect<=s_last; sect++) {
 		if (info->protect[sect] == 0) {	/* not protected */
-			addr = (char *)(info->start[sect]);
+			addr = (uchar *)(info->start[sect]);
 			flash_cmd(info->portwidth,addr,0,0x30);
 			l_sect = sect;
 		}
@@ -794,7 +794,7 @@
 static int
 write_word (flash_info_t *info, ulong dest, ulong data)
 {
-	volatile unsigned char *addr = (char *)(info->start[0]);
+	volatile unsigned char *addr = (uchar *)(info->start[0]);
 	ulong start;
 	int flag, i;
 
diff --git a/board/evb64260/i2c.c b/board/evb64260/i2c.c
index 22cb809..c62b647 100644
--- a/board/evb64260/i2c.c
+++ b/board/evb64260/i2c.c
@@ -146,7 +146,7 @@
 static uchar
 i2c_get_data(uchar* return_data, int len) {
 
-	unsigned int data, status;
+	unsigned int data, status = 0;
 	int count = 0;
 
 	DP(puts("i2c_get_data\n"));
diff --git a/board/evb64260/zuma_pbb_mbox.c b/board/evb64260/zuma_pbb_mbox.c
index 5131339..2b9a469 100644
--- a/board/evb64260/zuma_pbb_mbox.c
+++ b/board/evb64260/zuma_pbb_mbox.c
@@ -116,7 +116,7 @@
 static void
 zuma_mbox_setenv(void)
 {
-  unsigned char *data, buf[32];
+  char *data, buf[32];
   unsigned char save = 0;
 
   data = getenv("baudrate");
diff --git a/board/g2000/g2000.c b/board/g2000/g2000.c
index 5967e90..3f78753 100644
--- a/board/g2000/g2000.c
+++ b/board/g2000/g2000.c
@@ -90,7 +90,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/gen860t/gen860t.c b/board/gen860t/gen860t.c
index f1d173e..b7a1b56 100644
--- a/board/gen860t/gen860t.c
+++ b/board/gen860t/gen860t.c
@@ -128,8 +128,8 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char *s;
-	unsigned char buf[64];
+	char *s;
+	char buf[64];
 	int i;
 
 	i = getenv_r ("board_id", buf, sizeof (buf));
@@ -266,7 +266,7 @@
 int last_stage_init (void)
 {
 #if !defined(CONFIG_SC)
-	unsigned char buf[256];
+	char buf[256];
 	int i;
 
 	/*
diff --git a/board/genietv/flash.c b/board/genietv/flash.c
index f12d0be..1c1728b 100644
--- a/board/genietv/flash.c
+++ b/board/genietv/flash.c
@@ -188,12 +188,11 @@
 #endif
 	switch (value)
 	{
-		case 0x01:
-		case AMD_MANUFACT:
+		case 0x1: /* AMD_MANUFACT */
 			info->flash_id = FLASH_MAN_AMD;
 		break;
 
-		case FUJ_MANUFACT:
+		case 0x4: /* FUJ_MANUFACT */
 			info->flash_id = FLASH_MAN_FUJ;
 		break;
 
diff --git a/board/genietv/genietv.c b/board/genietv/genietv.c
index c19841a..5f8c899 100644
--- a/board/genietv/genietv.c
+++ b/board/genietv/genietv.c
@@ -187,14 +187,14 @@
 	PrintState ();
 #endif
 /*    printf ("\nChecking bank1..."); */
-	size8 = dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+	size8 = dram_size (CFG_MBMR_8COL, (long *) SDRAM_BASE1_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	size_b0 = size8;
 
 /*    printf ("\nChecking bank2..."); */
 	size_b1 =
-		dram_size (memctl->memc_mbmr, (ulong *) SDRAM_BASE2_PRELIM,
+		dram_size (memctl->memc_mbmr, (long *) SDRAM_BASE2_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	/*
diff --git a/board/gth/flash.c b/board/gth/flash.c
index c8b56fb..41a5c50 100644
--- a/board/gth/flash.c
+++ b/board/gth/flash.c
@@ -261,7 +261,7 @@
 #if 0
 	ulong base = (ulong)addr;
 #endif
-	uchar value;
+	ulong value;
 
 	/* Write auto select command: read Manufacturer ID */
 #if 0
@@ -278,7 +278,7 @@
 
 	switch (value)
 	{
-		case AMD_MANUFACT:case 0x01:
+		case AMD_MANUFACT:
 			info->flash_id = FLASH_MAN_AMD;
 		break;
 
diff --git a/board/gth/gth.c b/board/gth/gth.c
index 6f972ce..b1fcbf5 100644
--- a/board/gth/gth.c
+++ b/board/gth/gth.c
@@ -589,7 +589,7 @@
 		(Rx[8] != ':') | (Rx[11] != ':') | (Rx[14] != ':')) {
 		printf ("*** ethernet addr invalid, using default ***\n");
 	} else {
-		setenv ("ethaddr", Rx);
+		setenv ("ethaddr", (char *)Rx);
 	}
 	return (0);
 }
diff --git a/board/gw8260/gw8260.c b/board/gw8260/gw8260.c
index 163d58c..2719a95 100644
--- a/board/gw8260/gw8260.c
+++ b/board/gw8260/gw8260.c
@@ -320,7 +320,7 @@
 int mem_test_data (void)
 {
 	unsigned long long *pmem = (unsigned long long *) CFG_SDRAM_BASE;
-	unsigned long long temp64;
+	unsigned long long temp64 = 0;
 	int num_patterns = sizeof (pattern) / sizeof (pattern[0]);
 	int i;
 	unsigned int hi, lo;
@@ -427,7 +427,7 @@
 	       unsigned long long wmask, short read, short write)
 {
 	unsigned int i;
-	unsigned long long temp;
+	unsigned long long temp = 0;
 	unsigned int hitemp, lotemp, himask, lomask;
 
 	for (i = 0; i < size; i++) {
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index 7490324..e95d9ee 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -107,8 +107,8 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char *s = getenv ("serial#");
-	unsigned char *e;
+	char *s = getenv ("serial#");
+	char *e;
 
 	puts ("Board: ");
 
@@ -179,7 +179,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -187,7 +187,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
diff --git a/board/hymod/eeprom.c b/board/hymod/eeprom.c
index 15eb48e..c9b9b18 100644
--- a/board/hymod/eeprom.c
+++ b/board/hymod/eeprom.c
@@ -58,7 +58,7 @@
 	eeprom_read (dev_addr, offset, (uchar *)&crc, sizeof (ulong));
 	offset += sizeof (ulong);
 
-	if (crc32 (crc32 (0, (char *)&hdr, sizeof hdr), data, len) != crc)
+	if (crc32 (crc32 (0, (uchar *)&hdr, sizeof hdr), data, len) != crc)
 		return (0);
 
 	ep->ver = hdr.ver;
@@ -260,7 +260,7 @@
 	char *eval;
 	ulong lval;
 
-	lval = simple_strtol (val, &eval, 10);
+	lval = simple_strtol ((char *)val, &eval, 10);
 
 	if ((uchar *)eval == val || *eval != '\0') {
 		printf ("%s rec (%s) is not a valid uint\n", rp->name, val);
@@ -315,12 +315,12 @@
 date_handler (eerec_map_t *rp, uchar *val, uchar *dp, uchar *edp)
 {
 	hymod_date_t date;
-	uchar *p = val;
+	char *p = (char *)val;
 	char *ep;
 	ulong lval;
 
 	lval = simple_strtol (p, &ep, 10);
-	if ((uchar *)ep == p || *ep++ != '-') {
+	if (ep == p || *ep++ != '-') {
 bad_date:
 		printf ("%s rec (%s) is not a valid date\n", rp->name, val);
 		return (NULL);
@@ -330,12 +330,12 @@
 	date.year = lval;
 
 	lval = simple_strtol (p = ep, &ep, 10);
-	if ((uchar *)ep == p || *ep++ != '-' || lval == 0 || lval > 12)
+	if (ep == p || *ep++ != '-' || lval == 0 || lval > 12)
 		goto bad_date;
 	date.month = lval;
 
 	lval = simple_strtol (p = ep, &ep, 10);
-	if ((uchar *)ep == p || *ep != '\0' || lval == 0 || lval > 31)
+	if (ep == p || *ep != '\0' || lval == 0 || lval > 31)
 		goto bad_date;
 	date.day = lval;
 
@@ -359,7 +359,7 @@
 {
 	uint len;
 
-	if ((len = strlen (val)) > rp->maxlen) {
+	if ((len = strlen ((char *)val)) > rp->maxlen) {
 		printf ("%s rec (%s) string is too long (%d>%d)\n",
 			rp->name, val, len, rp->maxlen);
 		return (NULL);
@@ -387,7 +387,7 @@
 	for (nbytes = 0, p = val; *p != '\0'; p = (uchar *)ep) {
 		ulong lval;
 
-		lval = simple_strtol (p, &ep, 10);
+		lval = simple_strtol ((char *)p, &ep, 10);
 		if ((uchar *)ep == p || (*ep != '\0' && *ep != ',') || \
 		    lval >= 256) {
 			printf ("%s rec (%s) byte array has invalid uint\n",
@@ -451,7 +451,7 @@
 	eerec_map_t *rp;
 
 	for (rp = eerec_map; rp < &eerec_map[neerecs]; rp++)
-		if (strcmp (name, rp->name) == 0)
+		if (strcmp ((char *)name, rp->name) == 0)
 			break;
 
 	if (rp >= &eerec_map[neerecs])
diff --git a/board/hymod/env.c b/board/hymod/env.c
index f58aec2..f9e1421 100644
--- a/board/hymod/env.c
+++ b/board/hymod/env.c
@@ -38,7 +38,7 @@
 	char ov[CFG_CBSIZE], nv[CFG_CBSIZE], *p, *q, *nn, c, *curver, *newver;
 	int override = 1, append = 0, remove = 0, nnl, ovl, nvl;
 
-	nn = name;
+	nn = (char *)name;
 
 	if (*nn == '-') {
 		override = 0;
@@ -68,7 +68,7 @@
 		return (0);
 	}
 
-	p = value;
+	p = (char *)value;
 	q = nv;
 
 	while ((c = *p) == ' ' || c == '\t')
diff --git a/board/icecube/flash.c b/board/icecube/flash.c
index 4ae71e6..713011c 100644
--- a/board/icecube/flash.c
+++ b/board/icecube/flash.c
@@ -139,7 +139,7 @@
 	int i;
 	uchar *boottype;
 	uchar *bootletter;
-	uchar *fmt;
+	char *fmt;
 	uchar botbootletter[] = "B";
 	uchar topbootletter[] = "T";
 	uchar botboottype[] = "bottom boot sector";
diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c
index 7c9a92a..1f1a74c 100644
--- a/board/icecube/icecube.c
+++ b/board/icecube/icecube.c
@@ -107,9 +107,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize = test1;
@@ -135,10 +135,10 @@
 	/* find RAM size using SDRAM CS1 only */
 	if (!dramsize)
 		sdram_start(0);
-	test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+	test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	if (!dramsize) {
 		sdram_start(1);
-		test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+		test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	}
 	if (test1 > test2) {
 		sdram_start(0);
@@ -207,9 +207,9 @@
 
 	/* find RAM size */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize = test1;
diff --git a/board/icu862/flash.c b/board/icu862/flash.c
index 6315bd9..ca5bcf3 100644
--- a/board/icu862/flash.c
+++ b/board/icu862/flash.c
@@ -251,7 +251,7 @@
 
 	value = addr[1];			/* device ID		*/
 
-	switch (value) {
+	switch ((unsigned long)value) {
 	case AMD_ID_F040B:
 		info->flash_id += FLASH_AM040;
 		info->sector_count = 8;
diff --git a/board/icu862/icu862.c b/board/icu862/icu862.c
index b41ebae..8da9d1c 100644
--- a/board/icu862/icu862.c
+++ b/board/icu862/icu862.c
@@ -143,7 +143,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE1_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -151,7 +151,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE1_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE1_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
diff --git a/board/ip860/ip860.c b/board/ip860/ip860.c
index 5b634e4..9dd809b 100644
--- a/board/ip860/ip860.c
+++ b/board/ip860/ip860.c
@@ -114,10 +114,10 @@
 
 	puts ("Board: ");
 
-	i = getenv_r ("serial#", buf, sizeof (buf));
+	i = getenv_r ("serial#", (char *)buf, sizeof (buf));
 	s = (i > 0) ? buf : NULL;
 
-	if (!s || strncmp (s, "IP860", 5)) {
+	if (!s || strncmp ((char *)s, "IP860", 5)) {
 		puts ("### No HW ID - assuming IP860");
 	} else {
 		for (e = s; *e; ++e) {
@@ -190,9 +190,9 @@
 	 * Check SDRAM Memory Size
 	 */
 	if (ip860_get_dram_size() == 16)
-		size = dram_size (refresh_val | 0x00804114, (ulong *)SDRAM_BASE, SDRAM_MAX_SIZE);
+		size = dram_size (refresh_val | 0x00804114, SDRAM_BASE, SDRAM_MAX_SIZE);
 	else
-		size = dram_size (refresh_val | 0x00906114, (ulong *)SDRAM_BASE, SDRAM_MAX_SIZE);
+		size = dram_size (refresh_val | 0x00906114, SDRAM_BASE, SDRAM_MAX_SIZE);
 
 	udelay (1000);
 
diff --git a/board/iphase4539/iphase4539.c b/board/iphase4539/iphase4539.c
index e50250e..0ca9cf5 100644
--- a/board/iphase4539/iphase4539.c
+++ b/board/iphase4539/iphase4539.c
@@ -342,7 +342,7 @@
 {
 	int sn = -1;
 
-	if (!seeprom_read (0xa0, (char *) &sn, sizeof (sn))) {
+	if (!seeprom_read (0xa0, (uchar *) &sn, sizeof (sn))) {
 		sn = cpu_to_le32 (sn);
 	}
 	return sn;
@@ -351,7 +351,7 @@
 {
 	char mac[6];
 
-	if (!seeprom_read (0xb0, mac, sizeof (mac))) {
+	if (!seeprom_read (0xb0, (uchar *)mac, sizeof (mac))) {
 		sprintf (str, "%02x:%02x:%02x:%02x:%02x:%02x\n",
 				 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 	} else {
diff --git a/board/ispan/ispan.c b/board/ispan/ispan.c
index fd34899..d39b8cd 100644
--- a/board/ispan/ispan.c
+++ b/board/ispan/ispan.c
@@ -290,7 +290,7 @@
 {
 	int sn = -1;
 
-	if (!seeprom_read (0xa0, (char *) &sn, sizeof (sn))) {
+	if (!seeprom_read (0xa0, (uchar *) &sn, sizeof (sn))) {
 		sn = cpu_to_le32 (sn);
 	}
 	return sn;
@@ -300,7 +300,7 @@
 {
 	char mac[6];
 
-	if (!seeprom_read (0xb0, mac, sizeof (mac))) {
+	if (!seeprom_read (0xb0, (uchar *)mac, sizeof (mac))) {
 		sprintf (str, "%02X:%02X:%02X:%02X:%02X:%02X",
 				 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 	} else {
diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c
index cb661c9..7927ea9 100644
--- a/board/ivm/ivm.c
+++ b/board/ivm/ivm.c
@@ -251,7 +251,7 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 */
 	size_b0 =
-		dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE3_PRELIM,
+		dram_size (CFG_MBMR_8COL, (long *) SDRAM_BASE3_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
diff --git a/board/kup/common/load_sernum_ethaddr.c b/board/kup/common/load_sernum_ethaddr.c
index 39ee124..b7b7499 100644
--- a/board/kup/common/load_sernum_ethaddr.c
+++ b/board/kup/common/load_sernum_ethaddr.c
@@ -54,9 +54,9 @@
 void load_sernum_ethaddr (void)
 {
 	unsigned char *hwi;
-	unsigned char *var;
+	char *var;
 	unsigned char hwi_stack[CFG_HWINFO_SIZE];
-	unsigned char *p;
+	char *p;
 
 	hwi = (unsigned char *) (CFG_FLASH_BASE + CFG_HWINFO_OFFSET);
 	if (*((unsigned long *) hwi) != (unsigned long) CFG_HWINFO_MAGIC) {
@@ -68,11 +68,11 @@
 	/*
 	 ** ethaddr
 	 */
-	var = strstr (hwi_stack, ETHADDR_TOKEN);
+	var = strstr ((char *)hwi_stack, ETHADDR_TOKEN);
 	if (var) {
 		var += sizeof (ETHADDR_TOKEN) - 1;
 		p = strchr (var, '\r');
-		if (p < hwi + CFG_HWINFO_SIZE) {
+		if ((unsigned char *)p < hwi + CFG_HWINFO_SIZE) {
 			*p = '\0';
 			setenv ("ethaddr", var);
 			*p = '\r';
@@ -81,11 +81,11 @@
 	/*
 	 ** lcd
 	 */
-	var = strstr (hwi_stack, LCD_TOKEN);
+	var = strstr ((char *)hwi_stack, LCD_TOKEN);
 	if (var) {
 		var += sizeof (LCD_TOKEN) - 1;
 		p = strchr (var, '\r');
-		if (p < hwi + CFG_HWINFO_SIZE) {
+		if ((unsigned char *)p < hwi + CFG_HWINFO_SIZE) {
 			*p = '\0';
 			setenv ("lcd", var);
 			*p = '\r';
diff --git a/board/kup/kup4k/kup4k.c b/board/kup/kup4k/kup4k.c
index c352c8b..e621c43 100644
--- a/board/kup/kup4k/kup4k.c
+++ b/board/kup/kup4k/kup4k.c
@@ -327,7 +327,7 @@
 	int r = 8, g = 8, b = 4;
 	int r1, g1, b1;
 	int n;
-	uchar tmp[64];		/* long enough for environment variables */
+	char tmp[64];		/* long enough for environment variables */
 	int tft = 0;
 
 	immr->im_cpm.cp_pbpar &= ~(PB_LCD_PWM);
@@ -453,7 +453,7 @@
 	}
 
 	/* copy bitmap */
-	fb = (char *) (fb_info.VmemAddr);
+	fb = (uchar *) (fb_info.VmemAddr);
 	memcpy (fb, (uchar *) CONFIG_KUP4K_LOGO, 320 * 240);
 }
 #endif	/* CONFIG_KUP4K_LOGO */
diff --git a/board/lantec/lantec.c b/board/lantec/lantec.c
index aa96a16..417dbbb 100644
--- a/board/lantec/lantec.c
+++ b/board/lantec/lantec.c
@@ -171,7 +171,7 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 */
 	size_b0 = dram_size (CFG_MAMR_8COL,
-			     (ulong *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+			     (long *) SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
 
 	memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTAE;
 
diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c
index 7cf5778..a174b57 100644
--- a/board/lwmon/lwmon.c
+++ b/board/lwmon/lwmon.c
@@ -266,14 +266,14 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+	size8 = dram_size (CFG_MAMR_8COL, (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
 
 	udelay (1000);
 
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
+	size9 = dram_size (CFG_MAMR_9COL, (long *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
 		size_b0 = size9;
@@ -574,11 +574,11 @@
 	DECLARE_GLOBAL_DATA_PTR;
 
 	uchar kbd_data[KEYBD_DATALEN];
-	uchar keybd_env[2 * KEYBD_DATALEN + 1];
+	char keybd_env[2 * KEYBD_DATALEN + 1];
 	uchar kbd_init_status = gd->kbd_status >> 8;
 	uchar kbd_status = gd->kbd_status;
 	uchar val;
-	uchar *str;
+	char *str;
 	int i;
 
 	if (kbd_init_status) {
@@ -617,7 +617,7 @@
 	}
 	setenv ("keybd", keybd_env);
 
-	str = strdup (key_match (kbd_data));	/* decode keys */
+	str = strdup ((char *)key_match (kbd_data));	/* decode keys */
 #ifdef KEYBD_SET_DEBUGMODE
 	if (kbd_data[0] == KEYBD_SET_DEBUGMODE) {	/* set debug mode */
 		if ((console_assign (stdout, "lcd") < 0) ||
@@ -649,11 +649,11 @@
 	/* Don't include modifier byte */
 	memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
 
-	for (; str != NULL; str = (*nxt) ? nxt+1 : nxt) {
+	for (; str != NULL; str = (*nxt) ? (uchar *)(nxt+1) : (uchar *)nxt) {
 		uchar c;
 		int k;
 
-		c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
+		c = (uchar) simple_strtoul ((char *)str, (char **) (&nxt), 16);
 
 		if (str == (uchar *)nxt) {	/* invalid character */
 			break;
@@ -719,9 +719,9 @@
  ***********************************************************************/
 static uchar *key_match (uchar *kbd_data)
 {
-	uchar magic[sizeof (kbd_magic_prefix) + 1];
+	char magic[sizeof (kbd_magic_prefix) + 1];
 	uchar *suffix;
-	uchar *kbd_magic_keys;
+	char *kbd_magic_keys;
 
 	/*
 	 * The following string defines the characters that can pe appended
@@ -737,13 +737,13 @@
 	/* loop over all magic keys;
 	 * use '\0' suffix in case of empty string
 	 */
-	for (suffix=kbd_magic_keys; *suffix || suffix==kbd_magic_keys; ++suffix) {
+	for (suffix=(uchar *)kbd_magic_keys; *suffix || suffix==(uchar *)kbd_magic_keys; ++suffix) {
 		sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
 #if 0
 		printf ("### Check magic \"%s\"\n", magic);
 #endif
-		if (compare_magic(kbd_data, getenv(magic)) == 0) {
-			uchar cmd_name[sizeof (kbd_command_prefix) + 1];
+		if (compare_magic(kbd_data, (uchar *)getenv(magic)) == 0) {
+			char cmd_name[sizeof (kbd_command_prefix) + 1];
 			char *cmd;
 
 			sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix);
@@ -754,7 +754,7 @@
 					cmd_name, cmd ? cmd : "<<NULL>>");
 #endif
 			*kbd_data = *suffix;
-			return (cmd);
+			return ((uchar *)cmd);
 		}
 	}
 #if 0
@@ -863,7 +863,7 @@
 int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	uchar kbd_data[KEYBD_DATALEN];
-	uchar keybd_env[2 * KEYBD_DATALEN + 1];
+	char keybd_env[2 * KEYBD_DATALEN + 1];
 	uchar val;
 	int i;
 
@@ -1044,7 +1044,7 @@
 	i2c_write (kbd_addr, 0, 0, &val, 1);
 	i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
 
-	return (compare_magic(kbd_data, CONFIG_MODEM_KEY_MAGIC) == 0);
+	return (compare_magic(kbd_data, (uchar *)CONFIG_MODEM_KEY_MAGIC) == 0);
 }
 #endif	/* CONFIG_MODEM_SUPPORT */
 
@@ -1063,6 +1063,6 @@
 	i2c_write (kbd_addr, 0, 0, &val, 1);
 	i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
 
-	return (compare_magic(kbd_data, CONFIG_POST_KEY_MAGIC) == 0);
+	return (compare_magic(kbd_data, (uchar *)CONFIG_POST_KEY_MAGIC) == 0);
 }
 #endif
diff --git a/board/ml2/flash.c b/board/ml2/flash.c
index 4f805a6..87cb1ff 100644
--- a/board/ml2/flash.c
+++ b/board/ml2/flash.c
@@ -216,7 +216,7 @@
 	return rc;
 }
 
-volatile static int write_word (flash_info_t *info, ulong dest, unsigned long long data) {
+static int write_word (flash_info_t *info, ulong dest, unsigned long long data) {
 
 	volatile unsigned long long *addr=(unsigned long long *)dest;
 	unsigned long long result;
diff --git a/board/ml2/ml2.c b/board/ml2/ml2.c
index ff5f816..f32e512 100644
--- a/board/ml2/ml2.c
+++ b/board/ml2/ml2.c
@@ -30,8 +30,8 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
-	unsigned char *e;
+	char *s = getenv ("serial#");
+	char *e;
 
 	if (!s || strncmp (s, "ML2", 9)) {
 		printf ("### No HW ID - assuming ML2");
diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index e14bcca..b331d6e 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -163,7 +163,7 @@
 #endif
 	printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",
 		(ulong)src, size);
-	if ((rc = flash_write (src, start, size)) != 0) {
+	if ((rc = flash_write ((char *)src, start, size)) != 0) {
 		puts("ERROR ");
 		flash_perror(rc);
 		return (1);
@@ -200,14 +200,14 @@
 	len  = sizeof(image_header_t);
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
-	if (crc32 (0, (char *)data, len) != checksum) {
+	if (crc32 (0, (uchar *)data, len) != checksum) {
 		puts("Bad Header Checksum\n");
 		return 1;
 	}
 	data = ld_addr + sizeof(image_header_t);
 	len  = ntohl(hdr->ih_size);
 	puts("Verifying Checksum ... ");
-	if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+	if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 		puts("Bad Data CRC\n");
 		return 1;
 	}
@@ -376,8 +376,8 @@
 			} while(len > off);
 			name=&name_buf[0];
 			value=&value_buf[0];
-			if(strncmp(name,"baudrate",8)!=0) {
-				setenv(name,value);
+			if(strncmp((char *)name,"baudrate",8)!=0) {
+				setenv((char *)name,(char *)value);
 			}
 
 		}
@@ -387,7 +387,7 @@
 
 void check_env(void)
 {
-	unsigned char *s;
+	char *s;
 	int i=0;
 	char buf[32];
 	backup_t back;
@@ -592,7 +592,7 @@
 	char buf[64];
 	char tmp[16];
 	char cpustr[16];
-	unsigned char *s, *e, bc;
+	char *s, *e, bc;
 	switch (line_number)
 	{
 	case 2:
diff --git a/board/mpl/common/isa.c b/board/mpl/common/isa.c
index 793c34f..51b2773 100644
--- a/board/mpl/common/isa.c
+++ b/board/mpl/common/isa.c
@@ -155,7 +155,7 @@
 
 void isa_sio_loadtable(void)
 {
-	unsigned char *s = getenv("floppy");
+	char *s = getenv("floppy");
 	/* setup Floppy device 0*/
 	isa_write_table((SIO_LOGDEV_TABLE *)&sio_fdc,0);
 	/* setup parallel port device 3 */
diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c
index b1adde6..84d3e1e 100644
--- a/board/mpl/mip405/mip405.c
+++ b/board/mpl/mip405/mip405.c
@@ -585,15 +585,15 @@
 
 int checkboard (void)
 {
-	unsigned char s[50];
+	char s[50];
 	unsigned char bc, var;
 	int i;
 	backup_t *b = (backup_t *) s;
 
 	puts ("Board: ");
 	get_pcbrev_var(&bc,&var);
-	i = getenv_r ("serial#", s, 32);
-	if ((i == 0) || strncmp (s, BOARD_NAME,sizeof(BOARD_NAME))) {
+	i = getenv_r ("serial#", (char *)s, 32);
+	if ((i == 0) || strncmp ((char *)s, BOARD_NAME,sizeof(BOARD_NAME))) {
 		get_backup_values (b);
 		if (strncmp (b->signature, "MPL\0", 4) != 0) {
 			puts ("### No HW ID - assuming " BOARD_NAME);
@@ -728,7 +728,7 @@
 {
 	unsigned long stop;
 	struct rtc_time newtm;
-	unsigned char *s;
+	char *s;
 	mem_test_reloc();
 	/* write correct LED configuration */
 	if (miiphy_write (0x1, 0x14, 0x2402) != 0) {
diff --git a/board/mpl/pip405/pip405.c b/board/mpl/pip405/pip405.c
index 590bd20..a398362 100644
--- a/board/mpl/pip405/pip405.c
+++ b/board/mpl/pip405/pip405.c
@@ -180,7 +180,7 @@
 {
 	unsigned char dataout[1];
 	unsigned char datain[128];
-	unsigned long sdram_size;
+	unsigned long sdram_size = 0;
 	SDRAM_SETUP *t = (SDRAM_SETUP *) sdram_setup_table;
 	unsigned long memclk;
 	unsigned long tmemclk = 0;
@@ -574,15 +574,15 @@
 
 int checkboard (void)
 {
-	unsigned char s[50];
+	char s[50];
 	unsigned char bc;
 	int i;
 	backup_t *b = (backup_t *) s;
 
 	puts ("Board: ");
 
-	i = getenv_r ("serial#", s, 32);
-	if ((i == 0) || strncmp (s, "PIP405", 6)) {
+	i = getenv_r ("serial#", (char *)s, 32);
+	if ((i == 0) || strncmp ((char *)s, "PIP405", 6)) {
 		get_backup_values (b);
 		if (strncmp (b->signature, "MPL\0", 4) != 0) {
 			puts ("### No HW ID - assuming PIP405");
diff --git a/board/mvs1/mvs1.c b/board/mvs1/mvs1.c
index fb7547f..f8a8cb7 100644
--- a/board/mvs1/mvs1.c
+++ b/board/mvs1/mvs1.c
@@ -197,14 +197,14 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	udelay (1000);
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
diff --git a/board/nx823/nx823.c b/board/nx823/nx823.c
index cbcbab8..65d45c1 100644
--- a/board/nx823/nx823.c
+++ b/board/nx823/nx823.c
@@ -221,7 +221,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE1_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -229,7 +229,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE1_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE1_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {	/* leave configuration at 9 columns     */
@@ -248,7 +248,7 @@
 	 * [9 column SDRAM may also be used in 8 column mode,
 	 *  but then only half the real size will be used.]
 	 */
-	size_b1 = dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE2_PRELIM,
+	size_b1 = dram_size (memctl->memc_mamr, (long *) SDRAM_BASE2_PRELIM,
 			     SDRAM_MAX_SIZE);
 /*	debug ("SDRAM Bank 1: %ld MB\n", size8 >> 20);	*/
 
diff --git a/board/o2dnt/flash.c b/board/o2dnt/flash.c
index dbb49f7..037d287 100644
--- a/board/o2dnt/flash.c
+++ b/board/o2dnt/flash.c
@@ -154,7 +154,7 @@
 	int i;
 	uchar *boottype;
 	uchar *bootletter;
-	uchar *fmt;
+	char *fmt;
 	uchar botbootletter[] = "B";
 	uchar topbootletter[] = "T";
 	uchar botboottype[] = "bottom boot sector";
diff --git a/board/o2dnt/o2dnt.c b/board/o2dnt/o2dnt.c
index 8c6f5db..81a2700 100644
--- a/board/o2dnt/o2dnt.c
+++ b/board/o2dnt/o2dnt.c
@@ -85,9 +85,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize = test1;
@@ -113,11 +113,11 @@
 	if (!dramsize)
 		sdram_start(0);
 
-	test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+	test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 
 	if (!dramsize) {
 		sdram_start(1);
-		test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+		test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	}
 
 	if (test1 > test2) {
diff --git a/board/pcippc2/flash.c b/board/pcippc2/flash.c
index 6e9e339..8c01415 100644
--- a/board/pcippc2/flash.c
+++ b/board/pcippc2/flash.c
@@ -136,7 +136,7 @@
 
 	DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", addr+1, value);
 
-	switch (value) {
+	switch ((ulong)value) {
 		case AMD_ID_F040B:
 			DEBUGF("Am29F040B\n");
 			info->flash_id += FLASH_AM040;
diff --git a/board/pm520/pm520.c b/board/pm520/pm520.c
index 619df59..d4cc5cb 100644
--- a/board/pm520/pm520.c
+++ b/board/pm520/pm520.c
@@ -107,9 +107,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize = test1;
@@ -135,10 +135,10 @@
 	/* find RAM size using SDRAM CS1 only */
 	if (!dramsize)
 		sdram_start(0);
-	test2 = test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+	test2 = test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	if (!dramsize) {
 		sdram_start(1);
-		test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+		test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	}
 	if (test1 > test2) {
 		sdram_start(0);
diff --git a/board/pn62/pn62.c b/board/pn62/pn62.c
index 0252240..377aaa8 100644
--- a/board/pn62/pn62.c
+++ b/board/pn62/pn62.c
@@ -167,7 +167,7 @@
 	if (size < I2155X_VPD_SN_SIZE)
 		size = I2155X_VPD_SN_SIZE;
 	for (i = 0; i < (size - 1); i++) {
-		i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, &c);
+		i2155x_read_vpd (I2155X_VPD_SN_START + i, 1, (uchar *)&c);
 		if (c == '\0')
 			break;
 		string[i] = c;
diff --git a/board/ppmc8260/ppmc8260.c b/board/ppmc8260/ppmc8260.c
index e92ad8f..2b20c26 100644
--- a/board/ppmc8260/ppmc8260.c
+++ b/board/ppmc8260/ppmc8260.c
@@ -285,7 +285,7 @@
 	int res;
 
 	if ((ds != 0) && (ds != 0xff)) {
-		res = getenv_r ("ethaddr", tmp, sizeof (tmp));
+		res = getenv_r ("ethaddr", (char *)tmp, sizeof (tmp));
 		if (res > 0) {
 			ss = ((ds >> 4) & 0x0f);
 			ss += ss < 0x0a ? '0' : ('a' - 10);
@@ -296,7 +296,7 @@
 			tmp[16] = ss;
 
 			tmp[17] = '\0';
-			setenv ("ethaddr", tmp);
+			setenv ("ethaddr", (char *)tmp);
 			/* set the led to show the address */
 			*((unsigned char *) (CFG_LED_BASE + 1)) = ds;
 		}
diff --git a/board/quantum/quantum.c b/board/quantum/quantum.c
index 8a73448..2861bc3 100644
--- a/board/quantum/quantum.c
+++ b/board/quantum/quantum.c
@@ -87,7 +87,7 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	puts ("Board QUANTUM, Serial No: ");
 
@@ -136,7 +136,7 @@
 	/* Check Bank 0 Memory Size,
 	 * 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
 			   SDRAM_MAX_SIZE);
 	/*
 	 * Final mapping:
@@ -162,7 +162,7 @@
 {
 	volatile immap_t *immap = (immap_t *) CFG_IMMR;
 	volatile memctl8xx_t *memctl = &immap->im_memctl;
-	volatile long int *addr;
+	volatile ulong *addr;
 	ulong cnt, val, size;
 	ulong save[32];		/* to make test non-destructive */
 	unsigned char i = 0;
diff --git a/board/r360mpi/r360mpi.c b/board/r360mpi/r360mpi.c
index 8ca08e2..ffb4c0e 100644
--- a/board/r360mpi/r360mpi.c
+++ b/board/r360mpi/r360mpi.c
@@ -152,7 +152,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	udelay (1000);
@@ -160,7 +160,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {		/* leave configuration at 9 columns */
@@ -287,21 +287,21 @@
 
 int misc_init_r (void)
 {
-	uchar kbd_data[KEYBD_DATALEN];
-	uchar keybd_env[2 * KEYBD_DATALEN + 1];
-	uchar *str;
+	char kbd_data[KEYBD_DATALEN];
+	char keybd_env[2 * KEYBD_DATALEN + 1];
+	char *str;
 	int i;
 
 	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
 
-	i2c_read (CFG_I2C_KEY_ADDR, 0, 0, kbd_data, KEYBD_DATALEN);
+	i2c_read (CFG_I2C_KEY_ADDR, 0, 0, (uchar *)kbd_data, KEYBD_DATALEN);
 
 	for (i = 0; i < KEYBD_DATALEN; ++i) {
 		sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
 	}
 	setenv ("keybd", keybd_env);
 
-	str = strdup (key_match (keybd_env));	/* decode keys */
+	str = strdup ((char *)key_match ((uchar *)keybd_env));	/* decode keys */
 
 #ifdef CONFIG_PREBOOT	/* automatically configure "preboot" command on key match */
 	setenv ("preboot", str);	/* set or delete definition */
@@ -347,36 +347,36 @@
 	 * "key_magic" is checked (old behaviour); the string "125" causes
 	 * checks for "key_magic1", "key_magic2" and "key_magic5", etc.
 	 */
-	if ((kbd_magic_keys = getenv ("magic_keys")) != NULL) {
+	if ((kbd_magic_keys = (uchar *)getenv ("magic_keys")) != NULL) {
 		/* loop over all magic keys;
 		 * use '\0' suffix in case of empty string
 		 */
 		for (suffix = kbd_magic_keys;
 		     *suffix || suffix == kbd_magic_keys;
 		     ++suffix) {
-			sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
+			sprintf ((char *)magic, "%s%c", kbd_magic_prefix, *suffix);
 
 #if 0
 			printf ("### Check magic \"%s\"\n", magic);
 #endif
 
-			if ((str = getenv (magic)) != 0) {
+			if ((str = (uchar *)getenv ((char *)magic)) != 0) {
 
 #if 0
 				printf ("### Compare \"%s\" \"%s\"\n",
 					kbd_str, str);
 #endif
-				if (strcmp (kbd_str, str) == 0) {
-					sprintf (cmd_name, "%s%c",
+				if (strcmp ((char *)kbd_str, (char *)str) == 0) {
+					sprintf ((char *)cmd_name, "%s%c",
 						 kbd_command_prefix,
 						 *suffix);
 
-					if ((cmd = getenv (cmd_name)) != 0) {
+					if ((cmd = getenv ((char *)cmd_name)) != 0) {
 #if 0
 						printf ("### Set PREBOOT to $(%s): \"%s\"\n",
 							cmd_name, cmd);
 #endif
-						return (cmd);
+						return ((uchar *)cmd);
 					}
 				}
 			}
@@ -404,11 +404,11 @@
 
 	puts ("Keys:");
 	for (i = 0; i < KEYBD_DATALEN; ++i) {
-		sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
+		sprintf ((char *)(keybd_env + i + i), "%02X", kbd_data[i]);
 		printf (" %02x", kbd_data[i]);
 	}
 	putc ('\n');
-	setenv ("keybd", keybd_env);
+	setenv ("keybd", (char *)keybd_env);
 	return 0;
 }
 
diff --git a/board/rbc823/flash.c b/board/rbc823/flash.c
index f12d0be..84ae5c1 100644
--- a/board/rbc823/flash.c
+++ b/board/rbc823/flash.c
@@ -188,12 +188,11 @@
 #endif
 	switch (value)
 	{
-		case 0x01:
-		case AMD_MANUFACT:
+		case 0x01: /*AMD_MANUFACT*/
 			info->flash_id = FLASH_MAN_AMD;
 		break;
 
-		case FUJ_MANUFACT:
+		case 0x04: /*FUJ_MANUFACT*/
 			info->flash_id = FLASH_MAN_FUJ;
 		break;
 
diff --git a/board/rbc823/rbc823.c b/board/rbc823/rbc823.c
index d0ceb4a..9e60c2b 100644
--- a/board/rbc823/rbc823.c
+++ b/board/rbc823/rbc823.c
@@ -127,7 +127,7 @@
 
 int checkboard (void)
 {
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	if (!s || strncmp (s, "TQM8", 4)) {
 		printf ("### No HW ID - assuming RBC823\n");
@@ -193,14 +193,14 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE4_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE4_PRELIM,
 			   SDRAM_MAX_SIZE);
 	udelay (1000);
 
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE4_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE4_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	if (size8 < size9) {	/* leave configuration at 9 columns     */
diff --git a/board/rmu/rmu.c b/board/rmu/rmu.c
index cf00efc..8cb03c7 100644
--- a/board/rmu/rmu.c
+++ b/board/rmu/rmu.c
@@ -127,7 +127,7 @@
 	 * 9 column mode
 	 */
 
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	/*
diff --git a/board/sandburst/common/ppc440gx_i2c.c b/board/sandburst/common/ppc440gx_i2c.c
index 858b38c..859dd7a 100644
--- a/board/sandburst/common/ppc440gx_i2c.c
+++ b/board/sandburst/common/ppc440gx_i2c.c
@@ -451,9 +451,9 @@
  */
 uchar i2c_reg_read1(uchar i2c_addr, uchar reg)
 {
-	char buf;
+	uchar buf;
 
-	i2c_read1(i2c_addr, reg, 1, &buf, 1);
+	i2c_read1(i2c_addr, reg, 1, &buf, (uchar)1);
 
 	return(buf);
 }
diff --git a/board/sandburst/karef/karef.h b/board/sandburst/karef/karef.h
index 7790819..5de7cb5 100644
--- a/board/sandburst/karef/karef.h
+++ b/board/sandburst/karef/karef.h
@@ -57,7 +57,7 @@
     volatile unsigned long brdout_enable_ul;  /* Read/Write */
     volatile unsigned long brdin_data_ul;     /* Read Only  */
     volatile unsigned long misc_ul;           /* Read/Write */
-} KAREF_FPGA_REGS_ST __attribute__((packed)), * KAREF_FPGA_REGS_PST;
+} __attribute__((packed)) KAREF_FPGA_REGS_ST , * KAREF_FPGA_REGS_PST;
 
 /* OFEM FPGA */
 typedef struct ofem_fpga_regs_s
@@ -70,7 +70,7 @@
     volatile unsigned long scrmask_ul;        /* Read/Write */
     volatile unsigned long control_ul;        /* Read/Write */
     volatile unsigned long mac_flow_ctrl_ul;  /* Read/Write */
-} OFEM_FPGA_REGS_ST __attribute__((packed)), * OFEM_FPGA_REGS_PST;
+} __attribute__((packed)) OFEM_FPGA_REGS_ST , * OFEM_FPGA_REGS_PST;
 
 
 #endif /* __KAREF_H__ */
diff --git a/board/sandburst/metrobox/metrobox.h b/board/sandburst/metrobox/metrobox.h
index cb7a83c..3f28f00 100644
--- a/board/sandburst/metrobox/metrobox.h
+++ b/board/sandburst/metrobox/metrobox.h
@@ -40,6 +40,6 @@
 	volatile unsigned long scrmask_ul;	/* Read/Write */
 	volatile unsigned long control_ul;	/* Read/Write */
 	volatile unsigned long boardinfo_ul;	/* Read Only  */
-} OPTO_FPGA_REGS_ST __attribute__ ((packed)), *OPTO_FPGA_REGS_PST;
+} __attribute__ ((packed)) OPTO_FPGA_REGS_ST , *OPTO_FPGA_REGS_PST;
 
 #endif /* __METROBOX_H__ */
diff --git a/board/sbc405/sbc405.c b/board/sbc405/sbc405.c
index ef9bce1..cad5873 100644
--- a/board/sbc405/sbc405.c
+++ b/board/sbc405/sbc405.c
@@ -78,7 +78,7 @@
 
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/siemens/CCM/ccm.c b/board/siemens/CCM/ccm.c
index 3ed1b75..5a32e45 100644
--- a/board/siemens/CCM/ccm.c
+++ b/board/siemens/CCM/ccm.c
@@ -102,7 +102,7 @@
     unsigned char *s;
     unsigned char buf[64];
 
-    s = (getenv_r ("serial#", buf, sizeof(buf)) > 0) ? buf : NULL;
+    s = (getenv_r ("serial#", (char *)&buf, sizeof(buf)) > 0) ? buf : NULL;
 
     puts ("Board: Siemens CCM");
 
@@ -203,14 +203,14 @@
      *
      * try 8 column mode
      */
-    size8 = dram_size (CFG_MAMR_8COL, (ulong *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+    size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
 
     udelay (1000);
 
     /*
      * try 9 column mode
      */
-    size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+    size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
 
     if (size8 < size9) {		/* leave configuration at 9 columns	*/
 	size = size9;
diff --git a/board/siemens/IAD210/IAD210.c b/board/siemens/IAD210/IAD210.c
index 52cd4e6..e498937 100644
--- a/board/siemens/IAD210/IAD210.c
+++ b/board/siemens/IAD210/IAD210.c
@@ -155,7 +155,7 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 *
 	 */
-	size = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE_PRELIM,
+	size = dram_size (CFG_MAMR, (long *) SDRAM_BASE_PRELIM,
 			  SDRAM_MAX_SIZE);
 
 	udelay (1000);
diff --git a/board/siemens/SCM/scm.c b/board/siemens/SCM/scm.c
index d832edf..d20688d 100644
--- a/board/siemens/SCM/scm.c
+++ b/board/siemens/SCM/scm.c
@@ -206,7 +206,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/siemens/common/fpga.c b/board/siemens/common/fpga.c
index 169048e..e9941cd 100644
--- a/board/siemens/common/fpga.c
+++ b/board/siemens/common/fpga.c
@@ -169,7 +169,7 @@
 	}
     }
 
-    if (checkall && fpga_get_version(fpga, hdr.ih_name) < 0)
+    if (checkall && fpga_get_version(fpga, (char *)(hdr.ih_name)) < 0)
 	return 1;
 
     /* align length */
@@ -341,7 +341,7 @@
 	}
 
 	hdr = (image_header_t *)addr;
-	if ((new_id = fpga_get_version(fpga, hdr->ih_name)) == -1)
+	if ((new_id = fpga_get_version(fpga, (char *)(hdr->ih_name))) == -1)
 	    return 1;
 
 	do_load = 1;
diff --git a/board/siemens/pcu_e/pcu_e.c b/board/siemens/pcu_e/pcu_e.c
index 6374513..3f05e4a 100644
--- a/board/siemens/pcu_e/pcu_e.c
+++ b/board/siemens/pcu_e/pcu_e.c
@@ -241,9 +241,9 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 */
 #if PCU_E_WITH_SWAPPED_CS	/* XXX */
-	size_b0 = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE5_PRELIM, SDRAM_MAX_SIZE);
+	size_b0 = dram_size (CFG_MAMR, (long *) SDRAM_BASE5_PRELIM, SDRAM_MAX_SIZE);
 #else  /* XXX */
-	size_b0 = dram_size (CFG_MAMR, (ulong *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
+	size_b0 = dram_size (CFG_MAMR, (long *) SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
 #endif /* XXX */
 
 	memctl->memc_mamr = CFG_MAMR | MAMR_PTAE;
diff --git a/board/sixnet/flash.c b/board/sixnet/flash.c
index 4ab6c1b..61d7580 100644
--- a/board/sixnet/flash.c
+++ b/board/sixnet/flash.c
@@ -196,7 +196,7 @@
 	int i;
 	uchar *boottype;
 	uchar *bootletter;
-	uchar *fmt;
+	char *fmt;
 	uchar botbootletter[] = "B";
 	uchar topbootletter[] = "T";
 	uchar botboottype[] = "bottom boot sector";
diff --git a/board/sixnet/sixnet.c b/board/sixnet/sixnet.c
index c31ea53..867589f 100644
--- a/board/sixnet/sixnet.c
+++ b/board/sixnet/sixnet.c
@@ -356,7 +356,7 @@
 static long ram_size(ulong *base, long maxsize)
 {
     volatile long	*test_addr;
-    volatile long	*base_addr = base;
+    volatile ulong	*base_addr = base;
     ulong		ofs;		/* byte offset from base_addr */
     ulong		save;		/* to make test non-destructive */
     ulong		save2;		/* to make test non-destructive */
diff --git a/board/snmc/qs850/qs850.c b/board/snmc/qs850/qs850.c
index 105eeb8..637f125 100644
--- a/board/snmc/qs850/qs850.c
+++ b/board/snmc/qs850/qs850.c
@@ -89,8 +89,8 @@
 
 int checkboard (void)
 {
-	unsigned char *s, *e;
-	unsigned char buf[64];
+	char *s, *e;
+	char buf[64];
 	int i;
 
 	i = getenv_r("serial#", buf, sizeof(buf));
@@ -192,7 +192,7 @@
 	* Check for 32M SDRAM Memory Size
 	*/
 	size = dram_size(CFG_32M_MAMR|MAMR_PTAE,
-	(ulong *)SDRAM_BASE, SDRAM_32M_MAX_SIZE);
+	(long *)SDRAM_BASE, SDRAM_32M_MAX_SIZE);
 	udelay (1000);
 
 	/*
@@ -200,7 +200,7 @@
 	*/
 	if (size != SDRAM_32M_MAX_SIZE) {
 	size = dram_size(CFG_16M_MAMR|MAMR_PTAE,
-	(ulong *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
+	(long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
 	udelay (1000);
 	}
 
diff --git a/board/snmc/qs860t/qs860t.c b/board/snmc/qs860t/qs860t.c
index 2a55157..a11d863 100644
--- a/board/snmc/qs860t/qs860t.c
+++ b/board/snmc/qs860t/qs860t.c
@@ -89,8 +89,8 @@
 
 int checkboard (void)
 {
-	unsigned char *s, *e;
-	unsigned char buf[64];
+	char *s, *e;
+	char buf[64];
 	int i;
 
 	i = getenv_r("serial#", buf, sizeof(buf));
@@ -163,7 +163,7 @@
 	*/
 	if (size != SDRAM_64M_MAX_SIZE) {
 #endif
-	size = dram_size (CFG_16M_MBMR, (ulong *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
+	size = dram_size (CFG_16M_MBMR, (long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
 	udelay (1000);
 #if 0
 	}
diff --git a/board/spd8xx/spd8xx.c b/board/spd8xx/spd8xx.c
index 9f52e33..c79b9b0 100644
--- a/board/spd8xx/spd8xx.c
+++ b/board/spd8xx/spd8xx.c
@@ -205,7 +205,7 @@
 	 * Check Bank 0 Memory Size for re-configuration
 	 */
 	size_b0 =
-		dram_size (CFG_MBMR_8COL, (ulong *) SDRAM_BASE3_PRELIM,
+		dram_size (CFG_MBMR_8COL, SDRAM_BASE3_PRELIM,
 			   SDRAM_MAX_SIZE);
 
 	memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
diff --git a/board/stxxtc/Makefile b/board/stxxtc/Makefile
index 8c529a0..11065cf 100644
--- a/board/stxxtc/Makefile
+++ b/board/stxxtc/Makefile
@@ -25,11 +25,19 @@
 
 LIB	= lib$(BOARD).a
 
-OBJS	= $(BOARD).o
+OBJS	= $(BOARD).o oftree.o
 
 $(LIB):	.depend $(OBJS)
 	$(AR) crv $@ $(OBJS)
 
+%.dtb: %.dts
+	dtc -f -V 0x10 -I dts -O dtb $< >$@
+
+%.c: %.dtb
+	xxd -i $< \
+	   | sed -e "s/^unsigned char/const unsigned char/g" \
+	   | sed -e "s/^unsigned int/const unsigned int/g" > $@
+
 #########################################################################
 
 .depend:	Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
diff --git a/board/stxxtc/oftree.dts b/board/stxxtc/oftree.dts
new file mode 100644
index 0000000..e3f3017
--- /dev/null
+++ b/board/stxxtc/oftree.dts
@@ -0,0 +1,52 @@
+/ {
+	model = "STXXTC V1";
+	compatible = "STXXTC";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		linux,phandle = <1>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		PowerPC,MPC870@0 {
+			linux,phandle = <3>;
+			name = "PowerPC,MPC870";
+			device_type = "cpu";
+			reg = <0>;
+			clock-frequency = <0>;		/* place-holder for runtime fillup */
+			timebase-frequency = <0>;	/* dido */
+			linux,boot-cpu;
+			i-cache-size = <2000>;
+			d-cache-size = <2000>;
+			32-bit;
+		};
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <00000000 00000000 00000000 20000000>;
+	};
+
+	/* copy of the bd_t information (place-holders) */
+	bd_t {
+		memstart	= <0>;
+		memsize		= <0>;
+		flashstart	= <0>;
+		flashsize	= <0>;
+		flashoffset	= <0>;
+		sramstart	= <0>;
+		sramsize	= <0>;
+
+		immr_base	= <0>;
+
+		bootflags	= <0>;
+		ip_addr		= <0>;
+		enetaddr	= [ 00 00 00 00 00 00 ];
+		ethspeed	= <0>;
+		intfreq		= <0>;
+		busfreq		= <0>;
+
+		baudrate	= <0>;
+	};
+
+};
diff --git a/board/svm_sc8xx/svm_sc8xx.c b/board/svm_sc8xx/svm_sc8xx.c
index 1311ea9..9bb9fd0 100644
--- a/board/svm_sc8xx/svm_sc8xx.c
+++ b/board/svm_sc8xx/svm_sc8xx.c
@@ -77,7 +77,7 @@
 
 int checkboard (void)
 {
-    unsigned char *s = getenv("serial#");
+    char *s = getenv("serial#");
     int board_type;
 
     if (!s || strncmp(s, "SVM8", 4)) {
diff --git a/board/total5200/sdram.c b/board/total5200/sdram.c
index 367c826..a1601f2 100644
--- a/board/total5200/sdram.c
+++ b/board/total5200/sdram.c
@@ -102,9 +102,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	mpc5xxx_sdram_start(sdram_conf, 0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	mpc5xxx_sdram_start(sdram_conf, 1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		mpc5xxx_sdram_start(sdram_conf, 0);
 		dramsize = test1;
@@ -129,9 +129,9 @@
 
 	/* find RAM size using SDRAM CS1 only */
 	mpc5xxx_sdram_start(sdram_conf, 0);
-	test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+	test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	mpc5xxx_sdram_start(sdram_conf, 1);
-	test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
+	test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
 	if (test1 > test2) {
 		mpc5xxx_sdram_start(sdram_conf, 0);
 		dramsize2 = test1;
@@ -199,9 +199,9 @@
 
 	/* find RAM size */
 	mpc5xxx_sdram_start(sdram_conf, 0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	mpc5xxx_sdram_start(sdram_conf, 1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x80000000);
 	if (test1 > test2) {
 		mpc5xxx_sdram_start(sdram_conf, 0);
 		dramsize = test1;
diff --git a/board/tqm5200/cmd_stk52xx.c b/board/tqm5200/cmd_stk52xx.c
index c30e9df..8b9057f 100755
--- a/board/tqm5200/cmd_stk52xx.c
+++ b/board/tqm5200/cmd_stk52xx.c
@@ -181,7 +181,7 @@
 static int i2s_play_wave(unsigned long addr, unsigned long len)
 {
 	unsigned long i;
-	unsigned char *wave_file = (char *)addr + 44;	/* quick'n dirty: skip
+	unsigned char *wave_file = (uchar *)addr + 44;	/* quick'n dirty: skip
 							 * wav header*/
 	unsigned char swapped[4];
 	struct mpc5xxx_psc *psc = (struct mpc5xxx_psc*)MPC5XXX_PSC2;
@@ -304,7 +304,7 @@
 static int cmd_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	unsigned long reg, val, duration;
-	unsigned char *tmp;
+	char *tmp;
 	unsigned int freq, channel;
 	unsigned char volume;
 	int rcode = 1;
diff --git a/board/tqm5200/tqm5200.c b/board/tqm5200/tqm5200.c
index dbd78d5..6aad920 100644
--- a/board/tqm5200/tqm5200.c
+++ b/board/tqm5200/tqm5200.c
@@ -122,9 +122,9 @@
 
 	/* find RAM size using SDRAM CS0 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x20000000);
+	test1 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x20000000);
+	test2 = get_ram_size((long *)CFG_SDRAM_BASE, 0x20000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize = test1;
@@ -150,9 +150,9 @@
 
 	/* find RAM size using SDRAM CS1 only */
 	sdram_start(0);
-	test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+	test1 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
 	sdram_start(1);
-	test2 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
+	test2 = get_ram_size((long *)(CFG_SDRAM_BASE + dramsize), 0x20000000);
 	if (test1 > test2) {
 		sdram_start(0);
 		dramsize2 = test1;
diff --git a/board/tqm8260/tqm8260.c b/board/tqm8260/tqm8260.c
index 2291987..029863b 100644
--- a/board/tqm8260/tqm8260.c
+++ b/board/tqm8260/tqm8260.c
@@ -195,7 +195,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof (str));
 
 	puts ("Board: ");
diff --git a/board/tqm8xx/load_sernum_ethaddr.c b/board/tqm8xx/load_sernum_ethaddr.c
index 98baf7f..143f368 100644
--- a/board/tqm8xx/load_sernum_ethaddr.c
+++ b/board/tqm8xx/load_sernum_ethaddr.c
@@ -96,10 +96,10 @@
 
 	/* set serial# and ethaddr if not yet defined */
 	if (getenv("serial#") == NULL) {
-		setenv ("serial#", serial);
+		setenv ((char *)"serial#", (char *)serial);
 	}
 
 	if (getenv("ethaddr") == NULL) {
-		setenv ("ethaddr", ethaddr);
+		setenv ((char *)"ethaddr", (char *)ethaddr);
 	}
 }
diff --git a/board/tqm8xx/tqm8xx.c b/board/tqm8xx/tqm8xx.c
index a7a6f2a..017bdf9 100644
--- a/board/tqm8xx/tqm8xx.c
+++ b/board/tqm8xx/tqm8xx.c
@@ -106,7 +106,7 @@
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
-	unsigned char *s = getenv ("serial#");
+	char *s = getenv ("serial#");
 
 	puts ("Board: ");
 
@@ -215,7 +215,7 @@
 	 *
 	 * try 8 column mode
 	 */
-	size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size8 = dram_size (CFG_MAMR_8COL, SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 	debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
 
@@ -224,7 +224,7 @@
 	/*
 	 * try 9 column mode
 	 */
-	size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+	size9 = dram_size (CFG_MAMR_9COL, SDRAM_BASE2_PRELIM,
 					   SDRAM_MAX_SIZE);
 	debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
 
@@ -263,7 +263,7 @@
 		 * [9 column SDRAM may also be used in 8 column mode,
 		 *  but then only half the real size will be used.]
 		 */
-		size_b1 = dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE3_PRELIM,
+		size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
 				     SDRAM_MAX_SIZE);
 		debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
 	} else {
diff --git a/board/uc100/uc100.c b/board/uc100/uc100.c
index 6fc68e5..1387b93 100644
--- a/board/uc100/uc100.c
+++ b/board/uc100/uc100.c
@@ -147,7 +147,7 @@
  */
 int checkboard (void)
 {
-	unsigned char str[64];
+	char str[64];
 	int i = getenv_r ("serial#", str, sizeof(str));
 
 	puts ("Board: ");
diff --git a/board/w7o/flash.c b/board/w7o/flash.c
index d6ea635..32815fb 100644
--- a/board/w7o/flash.c
+++ b/board/w7o/flash.c
@@ -805,7 +805,7 @@
     int flag;
     ulong status;
     int rcode = 0;
-    volatile long *addr = (unsigned long *)sector;
+    volatile long *addr = (long *)sector;
 
     switch(info->flash_id & FLASH_TYPEMASK) {
 	case FLASH_28F320J3A:
@@ -863,7 +863,7 @@
     int flag;
     ulong status;
     int rcode = 0;
-    volatile long *addr = (unsigned long *)sector;
+    volatile long *addr = (long *)sector;
 
     switch(info->flash_id & FLASH_TYPEMASK) {
 	case FLASH_28F320J3A:
diff --git a/board/w7o/fpga.c b/board/w7o/fpga.c
index 336bfba..100bce4 100644
--- a/board/w7o/fpga.c
+++ b/board/w7o/fpga.c
@@ -252,7 +252,7 @@
     xcv_len = len - 14 - fn_len;		/* fpga image length */
 
     /* Check for uninitialized FLASH */
-    if ((strncmp(buf, "w7o", 3)!=0) || (len > 0x0007ffffL) || (len == 0))
+    if ((strncmp((char *)buf, "w7o", 3)!=0) || (len > 0x0007ffffL) || (len == 0))
 	goto bad_image;
 
     /*
diff --git a/board/w7o/vpd.c b/board/w7o/vpd.c
index fc2cd98..2ce1568 100644
--- a/board/w7o/vpd.c
+++ b/board/w7o/vpd.c
@@ -125,7 +125,7 @@
     unsigned short  stored_crc16, calc_crc16 = 0xffff;
 
     /* Check Eyecatcher */
-    if (strncmp(vpd->header.eyecatcher, VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
+    if (strncmp((char *)(vpd->header.eyecatcher), VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
 	unsigned offset = 0;
 	if (dev_addr == CFG_DEF_EEPROM_ADDR)
 	    offset += SDRAM_SPD_DATA_SIZE;
@@ -259,7 +259,7 @@
 	    case VPD_PID_PID:
 		if (strlen_ok(packet, MAX_PROD_ID)) {
 		    strncpy(vpdInfo->productId,
-			    packet->data, packet->size);
+			    (char *)(packet->data), packet->size);
 		}
 		break;
 	    case VPD_PID_REV:
diff --git a/board/w7o/w7o.c b/board/w7o/w7o.c
index daf7f53..c56c269 100644
--- a/board/w7o/w7o.c
+++ b/board/w7o/w7o.c
@@ -207,8 +207,8 @@
 	     (strncmp (vpd->productId, "CMM", 3) == 0))) {
 		char buf[30];
 		char *eth;
-		unsigned char *serial = getenv ("serial#");
-		unsigned char *ethaddr = getenv ("ethaddr");
+		char *serial = getenv ("serial#");
+		char *ethaddr = getenv ("ethaddr");
 
 		/* Set 'serial#' envvar if serial# isn't set */
 		if (!serial) {
@@ -218,7 +218,7 @@
 		}
 
 		/* Set 'ethaddr' envvar if 'ethaddr' envvar is the default */
-		eth = vpd->ethAddrs[0];
+		eth = (char *)(vpd->ethAddrs[0]);
 		if (ethaddr
 		    && (strcmp (ethaddr, MK_STR (CONFIG_ETHADDR)) == 0)) {
 			/* Now setup ethaddr */
diff --git a/board/xilinx/common/xdma_channel.c b/board/xilinx/common/xdma_channel.c
index 25f1e26..3d5fc75 100644
--- a/board/xilinx/common/xdma_channel.c
+++ b/board/xilinx/common/xdma_channel.c
@@ -123,7 +123,7 @@
 
 	/* initialize the version of the component
 	 */
-	XVersion_FromString(&InstancePtr->Version, "1.00a");
+	XVersion_FromString(&InstancePtr->Version, (s8 *)"1.00a");
 
 	/* reset the DMA channel such that it's in a known state and ready
 	 * and indicate the initialization occured with no errors, note that
diff --git a/board/xilinx/ml300/ml300.c b/board/xilinx/ml300/ml300.c
index f335fc1..dad562f 100644
--- a/board/xilinx/ml300/ml300.c
+++ b/board/xilinx/ml300/ml300.c
@@ -55,8 +55,8 @@
 int
 checkboard(void)
 {
-	uchar tmp[64];		/* long enough for environment variables */
-	uchar *s, *e;
+	char tmp[64];		/* long enough for environment variables */
+	char *s, *e;
 	int i = getenv_r("L", tmp, sizeof (tmp));
 
 	if (i < 0) {
diff --git a/board/xilinx/xilinx_enet/emac_adapter.c b/board/xilinx/xilinx_enet/emac_adapter.c
index bf8cf0b..1076345 100644
--- a/board/xilinx/xilinx_enet/emac_adapter.c
+++ b/board/xilinx/xilinx_enet/emac_adapter.c
@@ -148,7 +148,7 @@
 	RecvFrameLength = PKTSIZE;
 	Result = XEmac_PollRecv(&Emac, (u8 *) etherrxbuff, &RecvFrameLength);
 	if (Result == XST_SUCCESS) {
-		NetReceive(etherrxbuff, RecvFrameLength);
+		NetReceive((uchar)etherrxbuff, RecvFrameLength);
 		return (1);
 	} else {
 		return (0);
diff --git a/board/xilinx/xilinx_iic/iic_adapter.c b/board/xilinx/xilinx_iic/iic_adapter.c
index 5ad4a0c..f3ecba7 100644
--- a/board/xilinx/xilinx_iic/iic_adapter.c
+++ b/board/xilinx/xilinx_iic/iic_adapter.c
@@ -291,15 +291,15 @@
 static void
 ip_ml300(uchar * s, uchar * res)
 {
-	uchar temp[2];
+	char temp[2];
 	u8 i;
 
 	res[0] = 0x00;
 
 	for (i = 0; i < 4; i++) {
 		sprintf(temp, "%02x", atoi(s));
-		s = strchr(s, '.') + 1;
-		strcat(res, temp);
+		s = (uchar *)strchr((char *)s, '.') + 1;
+		strcat((char *)res, temp);
 	}
 }
 
@@ -310,8 +310,8 @@
 change_null(uchar * s)
 {
 	if (s != NULL) {
-		change_null(strchr(s + 1, 255));
-		*(strchr(s, 255)) = '\0';
+		change_null((uchar *)strchr((char *)s + 1, 255));
+		*(strchr((char *)s, 255)) = '\0';
 	}
 }
 
@@ -321,8 +321,8 @@
 void
 convert_env(void)
 {
-	uchar *s;		/* pointer to env value */
-	uchar temp[20];		/* temp storage for addresses */
+	char *s;		/* pointer to env value */
+	char temp[20];		/* temp storage for addresses */
 
 	/* E -> ethaddr */
 	s = getenv("E");
@@ -345,8 +345,8 @@
 	/* I -> ipaddr */
 	s = getenv("I");
 	if (s != NULL) {
-		sprintf(temp, "%d.%d.%d.%d", axtoi(s), axtoi(s + 2),
-			axtoi(s + 4), axtoi(s + 6));
+		sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)),
+			axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6)));
 		setenv("ipaddr", temp);
 		setenv("I", NULL);
 	}
@@ -354,8 +354,8 @@
 	/* S -> serverip */
 	s = getenv("S");
 	if (s != NULL) {
-		sprintf(temp, "%d.%d.%d.%d", axtoi(s), axtoi(s + 2),
-			axtoi(s + 4), axtoi(s + 6));
+		sprintf(temp, "%d.%d.%d.%d", axtoi((u8 *)s), axtoi((u8 *)(s + 2)),
+			axtoi((u8 *)(s + 4)), axtoi((u8 *)(s + 6)));
 		setenv("serverip", temp);
 		setenv("S", NULL);
 	}
@@ -391,9 +391,9 @@
 static void
 save_env(void)
 {
-	uchar eprom[ENV_SIZE];	/* buffer to be written back to EEPROM */
-	uchar *s, temp[20];
-	uchar ff[] = { 0xff, 0x00 };	/* dummy null value */
+	char eprom[ENV_SIZE];	/* buffer to be written back to EEPROM */
+	char *s, temp[20];
+	char ff[] = { 0xff, 0x00 };	/* dummy null value */
 	u32 len;		/* length of env to be written to EEPROM */
 
 	eprom[0] = 0x00;
@@ -422,7 +422,7 @@
 	s = getenv("ipaddr");
 	if (s != NULL) {
 		strcat(eprom, "I=");
-		ip_ml300(s, temp);
+		ip_ml300((uchar *)s, (uchar *)temp);
 		strcat(eprom, temp);
 		strcat(eprom, ff);
 	}
@@ -431,7 +431,7 @@
 	s = getenv("serverip");
 	if (s != NULL) {
 		strcat(eprom, "S=");
-		ip_ml300(s, temp);
+		ip_ml300((uchar *)s, (uchar *)temp);
 		strcat(eprom, temp);
 		strcat(eprom, ff);
 	}
@@ -461,11 +461,11 @@
 	}
 
 	len = strlen(eprom);	/* find env length without crc */
-	change_null(eprom);	/* change 0xff to 0x00 */
+	change_null((uchar *)eprom);	/* change 0xff to 0x00 */
 
 	/* update EEPROM env values if there is enough space */
-	if (update_crc(len, eprom) == 0)
-		send(CFG_ENV_OFFSET, eprom, len + 6);
+	if (update_crc(len, (uchar *)eprom) == 0)
+		send(CFG_ENV_OFFSET, (uchar *)eprom, len + 6);
 }
 
 /************************************************************************
diff --git a/common/Makefile b/common/Makefile
index 6366e02..7dbf84a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -46,7 +46,7 @@
 	  env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
 	  env_nvram.o env_nowhere.o \
 	  exports.o \
-	  flash.o fpga.o \
+	  flash.o fpga.o ft_build.o \
 	  hush.o kgdb.o lcd.o lists.o lynxkdi.o \
 	  memsize.o miiphybb.o miiphyutil.o \
 	  s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index 2d1f431..e325302 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -76,7 +76,7 @@
 	hdr->ih_hcrc = 0;
 	len = sizeof (image_header_t);
 	data = (ulong)hdr;
-	if (crc32(0, (char *)data, len) != crc) {
+	if (crc32(0, (uchar *)data, len) != crc) {
 		puts ("Bad header crc\n");
 		return 1;
 	}
@@ -85,7 +85,7 @@
 	len = ntohl(hdr->ih_size);
 
 	if (verify) {
-		if (crc32(0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+		if (crc32(0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 			puts ("Bad data crc\n");
 			return 1;
 		}
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index daa54e7..ad412c8 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -29,12 +29,15 @@
 #include <bmp_layout.h>
 #include <command.h>
 #include <asm/byteorder.h>
+#include <malloc.h>
 
 #if (CONFIG_COMMANDS & CFG_CMD_BMP)
 
 static int bmp_info (ulong addr);
 static int bmp_display (ulong addr, int x, int y);
 
+int gunzip(void *, int, unsigned char *, unsigned long *);
+
 /*
  * Subroutine:  do_bmp
  *
@@ -100,15 +103,64 @@
 static int bmp_info(ulong addr)
 {
 	bmp_image_t *bmp=(bmp_image_t *)addr;
+#ifdef CONFIG_VIDEO_BMP_GZIP
+	unsigned char *dst = NULL;
+	ulong len;
+#endif /* CONFIG_VIDEO_BMP_GZIP */
+
 	if (!((bmp->header.signature[0]=='B') &&
 	      (bmp->header.signature[1]=='M'))) {
+
+#ifdef CONFIG_VIDEO_BMP_GZIP
+		/*
+		 * Decompress bmp image
+		 */
+		len = CFG_VIDEO_LOGO_MAX_SIZE;
+		dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+		if (dst == NULL) {
+			printf("Error: malloc in gunzip failed!\n");
+			return(1);
+		}
+		if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) {
+			printf("There is no valid bmp file at the given address\n");
+			return(1);
+		}
+		if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+			printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+		}
+
+		/*
+		 * Set addr to decompressed image
+		 */
+		bmp = (bmp_image_t *)dst;
+
+		/*
+		 * Check for bmp mark 'BM'
+		 */
+		if (!((bmp->header.signature[0] == 'B') &&
+		      (bmp->header.signature[1] == 'M'))) {
+			printf("There is no valid bmp file at the given address\n");
+			free(dst);
+			return(1);
+		}
+
+		printf("Gzipped BMP image detected!\n");
+#else /* CONFIG_VIDEO_BMP_GZIP */
 		printf("There is no valid bmp file at the given address\n");
 		return(1);
+#endif /* CONFIG_VIDEO_BMP_GZIP */
 	}
 	printf("Image size    : %d x %d\n", le32_to_cpu(bmp->header.width),
 	       le32_to_cpu(bmp->header.height));
 	printf("Bits per pixel: %d\n", le16_to_cpu(bmp->header.bit_count));
 	printf("Compression   : %d\n", le32_to_cpu(bmp->header.compression));
+
+#ifdef CONFIG_VIDEO_BMP_GZIP
+	if (dst) {
+		free(dst);
+	}
+#endif /* CONFIG_VIDEO_BMP_GZIP */
+
 	return(0);
 }
 
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 6a5576c..8599a49 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -34,6 +34,10 @@
 #include <environment.h>
 #include <asm/byteorder.h>
 
+#ifdef CONFIG_OF_FLAT_TREE
+#include <ft_build.h>
+#endif
+
  /*cmd_boot.c*/
  extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
@@ -197,7 +201,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)data, len) != checksum) {
+	if (crc32 (0, (uchar *)data, len) != checksum) {
 		puts ("Bad Header Checksum\n");
 		SHOW_BOOT_PROGRESS (-2);
 		return 1;
@@ -221,7 +225,7 @@
 
 	if (verify) {
 		puts ("   Verifying Checksum ... ");
-		if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+		if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 			printf ("Bad Data CRC\n");
 			SHOW_BOOT_PROGRESS (-3);
 			return 1;
@@ -489,6 +493,11 @@
 }
 #endif /* CONFIG_SILENT_CONSOLE */
 
+#ifdef CONFIG_OF_FLAT_TREE
+extern const unsigned char oftree_dtb[];
+extern const unsigned int oftree_dtb_len;
+#endif
+
 #ifdef CONFIG_PPC
 static void
 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
@@ -511,6 +520,9 @@
 	bd_t	*kbd;
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
 	image_header_t *hdr = &header;
+#ifdef CONFIG_OF_FLAT_TREE
+	char	*of_flat_tree;
+#endif
 
 	if ((s = getenv ("initrd_high")) != NULL) {
 		/* a value of "no" or a similar string will act like 0,
@@ -621,7 +633,7 @@
 		checksum = hdr->ih_hcrc;
 		hdr->ih_hcrc = 0;
 
-		if (crc32 (0, (char *)data, len) != checksum) {
+		if (crc32 (0, (uchar *)data, len) != checksum) {
 			puts ("Bad Header Checksum\n");
 			SHOW_BOOT_PROGRESS (-11);
 			do_reset (cmdtp, flag, argc, argv);
@@ -649,13 +661,13 @@
 
 				if (chunk > CHUNKSZ)
 					chunk = CHUNKSZ;
-				csum = crc32 (csum, (char *)cdata, chunk);
+				csum = crc32 (csum, (uchar *)cdata, chunk);
 				cdata += chunk;
 
 				WATCHDOG_RESET();
 			}
 #else	/* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
-			csum = crc32 (0, (char *)data, len);
+			csum = crc32 (0, (uchar *)data, len);
 #endif	/* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
 
 			if (csum != hdr->ih_dcrc) {
@@ -776,15 +788,26 @@
 		initrd_end = 0;
 	}
 
+#ifdef CONFIG_OF_FLAT_TREE
+	if (initrd_start == 0)
+		of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE -
+					sizeof(bd_t)) & ~0xF);
+	else
+		of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE -
+					sizeof(bd_t)) & ~0xF);
+#endif
 
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 
 	SHOW_BOOT_PROGRESS (15);
 
+#ifndef CONFIG_OF_FLAT_TREE
+
 #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
 	unlock_ram_in_cache();
 #endif
+
 	/*
 	 * Linux Kernel Parameters:
 	 *   r3: ptr to board info data
@@ -794,6 +817,25 @@
 	 *   r7: End   of command line string
 	 */
 	(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
+
+#else
+	ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd);
+	/* ft_dump_blob(of_flat_tree); */
+
+#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
+	unlock_ram_in_cache();
+#endif
+	/*
+	 * Linux Kernel Parameters:
+	 *   r3: ptr to OF flat tree, followed by the board info data
+	 *   r4: initrd_start or 0 if no initrd
+	 *   r5: initrd_end - unused if r4 is 0
+	 *   r6: Start of command line string
+	 *   r7: End   of command line string
+	 */
+	(*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end, cmd_start, cmd_end);
+
+#endif
 }
 #endif /* CONFIG_PPC */
 
@@ -1037,7 +1079,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)data, len) != checksum) {
+	if (crc32 (0, (uchar *)data, len) != checksum) {
 		puts ("   Bad Header Checksum\n");
 		return 1;
 	}
@@ -1049,7 +1091,7 @@
 	len  = ntohl(hdr->ih_size);
 
 	puts ("   Verifying Checksum ... ");
-	if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+	if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 		puts ("   Bad Data CRC\n");
 		return 1;
 	}
@@ -1094,7 +1136,7 @@
 			checksum = ntohl(header.ih_hcrc);
 			header.ih_hcrc = 0;
 
-			if (crc32 (0, (char *)&header, sizeof(image_header_t))
+			if (crc32 (0, (uchar *)&header, sizeof(image_header_t))
 			    != checksum)
 				goto next_sector;
 
@@ -1105,7 +1147,7 @@
 			len  = ntohl(hdr->ih_size);
 
 			puts ("   Verifying Checksum ... ");
-			if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+			if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 				puts ("   Bad Data CRC\n");
 			}
 			puts ("OK\n");
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index e5db1bc..5e9bea3 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -143,7 +143,7 @@
 			cmd ? "read" : "write", curr_device, off, size);
 
 		ret = doc_rw(doc_dev_desc + curr_device, cmd, off, size,
-			     &total, (u_char*)addr);
+			     (size_t *)&total, (u_char*)addr);
 
 		printf ("%d bytes %s: %s\n", total, cmd ? "read" : "write",
 			ret ? "ERROR" : "OK");
@@ -304,12 +304,12 @@
 
 		if (cmd)
 			ret = doc_read_ecc(this, from, len,
-					   &n, (u_char*)buf,
-					   noecc ? NULL : eccbuf);
+					   (size_t *)&n, (u_char*)buf,
+					   noecc ? (uchar *)NULL : (uchar *)eccbuf);
 		else
 			ret = doc_write_ecc(this, from, len,
-					    &n, (u_char*)buf,
-					    noecc ? NULL : eccbuf);
+					    (size_t *)&n, (u_char*)buf,
+					    noecc ? (uchar *)NULL : (uchar *)eccbuf);
 
 		if (ret)
 			break;
@@ -804,7 +804,7 @@
 		/* Check for ANAND header first. Then can whinge if it's found but later
 		   checks fail */
 		if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize, SECTORSIZE,
-					&retlen, buf, NULL))) {
+					(size_t *)&retlen, buf, NULL))) {
 			static int warncount = 5;
 
 			if (warncount) {
@@ -829,7 +829,7 @@
 
 		/* To be safer with BIOS, also use erase mark as discriminant */
 		if ((ret = doc_read_oob(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
-				8, &retlen, (char *)&h1) < 0)) {
+				8, (size_t *)&retlen, (uchar *)&h1) < 0)) {
 #ifdef NFTL_DEBUG
 			printf("ANAND header found at 0x%x, but OOB data read failed\n",
 			       block * nftl->EraseSize);
@@ -902,7 +902,7 @@
 				/* read one sector for every SECTORSIZE of blocks */
 				if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize +
 						       i + SECTORSIZE, SECTORSIZE,
-						       &retlen, buf, (char *)&oob)) < 0) {
+						       (size_t *)&retlen, buf, (uchar *)&oob)) < 0) {
 					puts ("Read of bad sector table failed\n");
 					return -1;
 				}
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index af836cd..927e22f 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -231,7 +231,7 @@
 			return(1);
 		}
 
-		if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
+		if (strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
 			printf ("\n** Invalid partition type \"%.32s\""
 				" (expect \"" BOOT_PART_TYPE "\")\n",
 				info.type);
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index c4b7392..9a01e7d 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -69,7 +69,7 @@
 	unsigned int i;
 	int rc;
 
-	dataptr = fpgadata;
+	dataptr = (unsigned char *)fpgadata;
 
 #if CFG_FPGA_XILINX
 	/* skip the first bytes of the bitsteam, their meaning is unknown */
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 2e44c7f..c543bb5 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -461,7 +461,7 @@
 	 */
 	do {
 		printf("%08lx:", addr);
-		if(i2c_read(chip, addr, alen, (char *)&data, size) != 0) {
+		if(i2c_read(chip, addr, alen, (uchar *)&data, size) != 0) {
 			puts ("\nError reading the chip,\n");
 		} else {
 			data = cpu_to_be32(data);
@@ -510,7 +510,7 @@
 				 */
 				reset_cmd_timeout();
 #endif
-				if(i2c_write(chip, addr, alen, (char *)&data, size) != 0) {
+				if(i2c_write(chip, addr, alen, (uchar *)&data, size) != 0) {
 					puts ("Error writing the chip.\n");
 				}
 #ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 1adfe2b..6663dea 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -417,8 +417,8 @@
 		SHOW_BOOT_PROGRESS (-1);
 		return 1;
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -450,7 +450,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		SHOW_BOOT_PROGRESS (-2);
 		return 1;
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index 9db5f2c..559d7b4 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -318,11 +318,20 @@
 do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	uint rcode = 0;
+	iopin_t iopin;
 	static uint port = 0;
 	static uint pin = 0;
 	static uint value = 0;
-	static enum { DIR, PAR, SOR, ODR, DAT, INT } cmd = DAT;
-	iopin_t iopin;
+	static enum {
+		DIR,
+		PAR,
+		SOR,
+		ODR,
+		DAT,
+#if defined(CONFIG_8xx)
+		INT
+#endif
+	} cmd = DAT;
 
 	if (argc != 5) {
 		puts ("iopset PORT PIN CMD VALUE\n");
@@ -374,6 +383,7 @@
 	if (rcode == 0) {
 		iopin.port = port;
 		iopin.pin = pin;
+		iopin.flag = 0;
 		switch (cmd) {
 		case DIR:
 			if (value)
diff --git a/common/cmd_load.c b/common/cmd_load.c
index b85db69..7498497 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -166,7 +166,7 @@
 		    if (addr2info(store_addr)) {
 			int rc;
 
-			rc = flash_write((uchar *)binbuf,store_addr,binlen);
+			rc = flash_write((char *)binbuf,store_addr,binlen);
 			if (rc != 0) {
 				flash_perror (rc);
 				return (~0);
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 57ef484..efc9689 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -179,7 +179,7 @@
 	case 2:
 		if (strcmp(argv[1],"show") == 0) {
 			for (i=0; i < (log_size&LOGBUFF_MASK); i++) {
-				s = log_buf+((log_start+i)&LOGBUFF_MASK);
+				s = (char *)log_buf+((log_start+i)&LOGBUFF_MASK);
 				putc (*s);
 			}
 			return 0;
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index bafb1d6..0f4f9b7 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -179,7 +179,7 @@
 		}
 #endif
 		puts ("    ");
-		cp = linebuf;
+		cp = (u_char *)linebuf;
 		for (i=0; i<linebytes; i++) {
 			if ((*cp < 0x20) || (*cp > 0x7e))
 				putc ('.');
@@ -430,7 +430,7 @@
 
 		puts ("Copy to Flash... ");
 
-		rc = flash_write ((uchar *)addr, dest, count*size);
+		rc = flash_write ((char *)addr, dest, count*size);
 		if (rc != 0) {
 			flash_perror (rc);
 			return (1);
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 5648ab2..b0c01d1 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -200,12 +200,12 @@
 			/* read out-of-band data */
 			if (cmd & NANDRW_READ) {
 				ret = nand_read_oob(nand_dev_desc + curr_device,
-						    off, size, &total,
+						    off, size, (size_t *)&total,
 						    (u_char*)addr);
 			}
 			else {
 				ret = nand_write_oob(nand_dev_desc + curr_device,
-						     off, size, &total,
+						     off, size, (size_t *)&total,
 						     (u_char*)addr);
 			}
 			return ret;
@@ -241,7 +241,7 @@
 			curr_device, off, size);
 
 		ret = nand_rw(nand_dev_desc + curr_device, cmd, off, size,
-			     &total, (u_char*)addr);
+			     (size_t *)&total, (u_char*)addr);
 
 		printf (" %d bytes %s: %s\n", total,
 			(cmd & NANDRW_READ) ? "read" : "written",
@@ -401,7 +401,7 @@
  */
 int check_block (struct nand_chip *nand, unsigned long pos)
 {
-	int retlen;
+	size_t retlen;
 	uint8_t oob_data;
 	uint16_t oob_data16[6];
 	int page0 = pos & (-nand->erasesize);
@@ -423,9 +423,9 @@
 			return 1;
 	} else {
 		/* Note - bad block marker can be on first or second page */
-		if (nand_read_oob(nand, page0 + badpos, 1, &retlen, &oob_data)
+		if (nand_read_oob(nand, page0 + badpos, 1, &retlen, (unsigned char *)&oob_data)
 		    || oob_data != 0xff
-		    || nand_read_oob (nand, page1 + badpos, 1, &retlen, &oob_data)
+		    || nand_read_oob (nand, page1 + badpos, 1, &retlen, (unsigned char *)&oob_data)
 		    || oob_data != 0xff)
 			return 1;
 	}
@@ -501,11 +501,11 @@
 		if (cmd & NANDRW_READ) {
 			ret = nand_read_ecc(nand, start,
 					   min(len, eblk + erasesize - start),
-					   &n, (u_char*)buf, eccbuf);
+					   (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
 		} else {
 			ret = nand_write_ecc(nand, start,
 					    min(len, eblk + erasesize - start),
-					    &n, (u_char*)buf, eccbuf);
+					    (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
 		}
 
 		if (ret)
@@ -1591,7 +1591,7 @@
 					l = NAND_JFFS2_OOB16_FSDALEN;
 				}
 
-				ret = nand_write_oob(nand, ofs + p, l, &n,
+				ret = nand_write_oob(nand, ofs + p, l, (size_t *)&n,
 						     (u_char *)&clean_marker);
 				/* quit here if write failed */
 				if (ret)
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 578b0ca..1babffe 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -124,7 +124,7 @@
 
 			for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
 				;
-			k = envmatch(name, j);
+			k = envmatch((uchar *)name, j);
 			if (k < 0) {
 				continue;
 			}
@@ -157,7 +157,7 @@
 	int   i, len, oldval;
 	int   console = -1;
 	uchar *env, *nxt = NULL;
-	uchar *name;
+	char *name;
 	bd_t *bd = gd->bd;
 
 	uchar *env_data = env_get_addr(0);
@@ -174,7 +174,7 @@
 	for (env=env_data; *env; env=nxt+1) {
 		for (nxt=env; *nxt; ++nxt)
 			;
-		if ((oldval = envmatch(name, env-env_data)) >= 0)
+		if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
 			break;
 	}
 
@@ -191,7 +191,7 @@
 		if ( (strcmp (name, "serial#") == 0) ||
 		    ((strcmp (name, "ethaddr") == 0)
 #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
-		     && (strcmp (env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
+		     && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
 #endif	/* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
 		    ) ) {
 			printf ("Can't overwrite \"%s\"\n", name);
@@ -483,7 +483,7 @@
  * or NULL if not found
  */
 
-char *getenv (uchar *name)
+char *getenv (char *name)
 {
 	int i, nxt;
 
@@ -497,15 +497,15 @@
 				return (NULL);
 			}
 		}
-		if ((val=envmatch(name, i)) < 0)
+		if ((val=envmatch((uchar *)name, i)) < 0)
 			continue;
-		return (env_get_addr(val));
+		return ((char *)env_get_addr(val));
 	}
 
 	return (NULL);
 }
 
-int getenv_r (uchar *name, uchar *buf, unsigned len)
+int getenv_r (char *name, char *buf, unsigned len)
 {
 	int i, nxt;
 
@@ -517,7 +517,7 @@
 				return (-1);
 			}
 		}
-		if ((val=envmatch(name, i)) < 0)
+		if ((val=envmatch((uchar *)name, i)) < 0)
 			continue;
 		/* found; copy out */
 		n = 0;
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index 31f2ba2..62446d4 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -2681,7 +2681,7 @@
 #define	MAX_IDENT_FIELDS	4
 
 static uchar *known_cards[] = {
-	"ARGOSY PnPIDE D5",
+	(uchar *)"ARGOSY PnPIDE D5",
 	NULL
 };
 
@@ -2722,12 +2722,12 @@
 		else
 			break;
 	}
-	puts (id_str);
+	puts ((char *)id_str);
 	putc ('\n');
 
 	for (card=known_cards; *card; ++card) {
 		debug ("## Compare against \"%s\"\n", *card);
-		if (strcmp(*card, id_str) == 0) {	/* found! */
+		if (strcmp((char *)*card, (char *)id_str) == 0) {	/* found! */
 			debug ("## CARD FOUND ##\n");
 			return (1);
 		}
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index ec53790..e804861 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -247,8 +247,8 @@
 		printf("error reading partinfo\n");
 		return 1;
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)(info.type), BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)(info.type), BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -277,7 +277,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		return 1;
 	}
diff --git a/common/cmd_spi.c b/common/cmd_spi.c
index 7b6faf7..a6fdf7f 100644
--- a/common/cmd_spi.c
+++ b/common/cmd_spi.c
@@ -119,7 +119,7 @@
 		printf("Error with the SPI transaction.\n");
 		rcode = 1;
 	} else {
-		cp = din;
+		cp = (char *)din;
 		for(j = 0; j < ((bitlen + 7) / 8); j++) {
 			printf("%02X", *cp++);
 		}
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 0738f55..fdfd042 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -362,15 +362,15 @@
 
 	if (get_partition_info (stor_dev, part, &info)) {
 		/* try to boot raw .... */
-		strncpy(&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
-		strncpy(&info.name[0], "Raw", 4);
+		strncpy((char *)&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
+		strncpy((char *)&info.name[0], "Raw", 4);
 		info.start=0;
 		info.blksz=0x200;
 		info.size=2880;
 		printf("error reading partinfo...try to boot raw\n");
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -398,7 +398,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		return 1;
 	}
diff --git a/common/env_common.c b/common/env_common.c
index 9be4cc1..3201135 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -283,7 +283,7 @@
 		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
 			;
 
-		lval = env_get_addr(i);
+		lval = (char *)env_get_addr(i);
 		rval = strchr(lval, '=');
 		if (rval != NULL) {
 			vallen = rval - lval;
diff --git a/common/env_flash.c b/common/env_flash.c
index d6257d0..a2ea9c4 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -202,7 +202,7 @@
 	debug (" %08lX ... %08lX ...",
 		(ulong)&(flash_addr_new->data),
 		sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
-	if ((rc = flash_write(env_ptr->data,
+	if ((rc = flash_write((char *)env_ptr->data,
 			(ulong)&(flash_addr_new->data),
 			sizeof(env_ptr->data))) ||
 	    (rc = flash_write((char *)&(env_ptr->crc),
@@ -291,7 +291,7 @@
 	ulong	flash_offset;
 	uchar	env_buffer[CFG_ENV_SECT_SIZE];
 #else
-	uchar *env_buffer = (char *)env_ptr;
+	uchar *env_buffer = (uchar *)env_ptr;
 #endif	/* CFG_ENV_SECT_SIZE */
 	int rcode = 0;
 
@@ -337,7 +337,7 @@
 		return 1;
 
 	puts ("Writing to Flash... ");
-	rc = flash_write(env_buffer, flash_sect_addr, len);
+	rc = flash_write((char *)env_buffer, flash_sect_addr, len);
 	if (rc != 0) {
 		flash_perror (rc);
 		rcode = 1;
diff --git a/common/flash.c b/common/flash.c
index 2fb3319..a64bc98 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -135,7 +135,7 @@
  *			(only some targets require alignment)
  */
 int
-flash_write (uchar *src, ulong addr, ulong cnt)
+flash_write (char *src, ulong addr, ulong cnt)
 {
 #ifdef CONFIG_SPD823TS
 	return (ERR_TIMOUT);	/* any other error codes are possible as well */
@@ -174,7 +174,7 @@
 		len = info->start[0] + info->size - addr;
 		if (len > cnt)
 			len = cnt;
-		if ((i = write_buff(info, src, addr, len)) != 0) {
+		if ((i = write_buff(info, (uchar *)src, addr, len)) != 0) {
 			return (i);
 		}
 		cnt  -= len;
diff --git a/common/fpga.c b/common/fpga.c
index c41c6f8..02d3e42 100644
--- a/common/fpga.c
+++ b/common/fpga.c
@@ -53,8 +53,8 @@
 static fpga_desc desc_table[CONFIG_MAX_FPGA_DEVICES];
 
 /* Local static functions */
-static const fpga_desc * const fpga_get_desc( int devnum );
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum );
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
 					 size_t bsize, char *fn );
 static int fpga_dev_info( int devnum );
 
@@ -82,7 +82,7 @@
 /* fpga_get_desc
  *	map a device number to a descriptor
  */
-static const fpga_desc * const fpga_get_desc( int devnum )
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum )
 {
 	fpga_desc *desc = (fpga_desc * )NULL;
 
@@ -99,10 +99,10 @@
 /* fpga_validate
  *	generic parameter checking code
  */
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
 					 size_t bsize, char *fn )
 {
-	const fpga_desc * const desc = fpga_get_desc( devnum );
+	fpga_desc * desc = fpga_get_desc( devnum );
 
 	if ( !desc ) {
 		printf( "%s: Invalid device number %d\n", fn, devnum );
@@ -147,7 +147,7 @@
 			printf( "Altera Device\nDescriptor @ 0x%p\n", desc );
 			ret_val = altera_info( desc->devdesc );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
@@ -185,7 +185,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 		ret_val = altera_reloc( desc, reloc_off );
 #else
-		fpga_no_sup( __FUNCTION__, "Altera devices" );
+		fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 		break;
 	default:
@@ -216,7 +216,7 @@
 /* fpga_count
  * Basic interface function to get the current number of devices available.
  */
-const int fpga_count( void )
+int fpga_count( void )
 {
 	return next_desc;
 }
@@ -263,7 +263,7 @@
 int fpga_load( int devnum, void *buf, size_t bsize )
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
 
 	if ( desc ) {
 		switch ( desc->devtype ) {
@@ -278,7 +278,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 			ret_val = altera_load( desc->devdesc, buf, bsize );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
@@ -296,7 +296,7 @@
 int fpga_dump( int devnum, void *buf, size_t bsize )
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
 
 	if ( desc ) {
 		switch ( desc->devtype ) {
@@ -311,7 +311,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 			ret_val = altera_dump( desc->devdesc, buf, bsize );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
diff --git a/common/ft_build.c b/common/ft_build.c
new file mode 100644
index 0000000..624a1e1
--- /dev/null
+++ b/common/ft_build.c
@@ -0,0 +1,695 @@
+/*
+ * OF flat tree builder
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <environment.h>
+
+#include <asm/errno.h>
+#include <stddef.h>
+
+#include <ft_build.h>
+
+#ifdef CONFIG_OF_FLAT_TREE
+
+/* align addr on a size boundary - adjust address up if needed -- Cort */
+#define _ALIGN(addr,size)       (((addr)+(size)-1)&(~((size)-1)))
+
+static void ft_put_word(struct ft_cxt *cxt, u32 v)
+{
+	if (cxt->overflow)	/* do nothing */
+		return;
+
+	/* check for overflow */
+	if (cxt->p + 4 > cxt->pstr) {
+		cxt->overflow = 1;
+		return;
+	}
+
+	*(u32 *) cxt->p = cpu_to_be32(v);
+	cxt->p += 4;
+}
+
+static inline void ft_put_bin(struct ft_cxt *cxt, const void *data, int sz)
+{
+	u8 *p;
+
+	if (cxt->overflow)	/* do nothing */
+		return;
+
+	/* next pointer pos */
+	p = (u8 *) _ALIGN((unsigned long)cxt->p + sz, 4);
+
+	/* check for overflow */
+	if (p > cxt->pstr) {
+		cxt->overflow = 1;
+		return;
+	}
+
+	memcpy(cxt->p, data, sz);
+	if ((sz & 3) != 0)
+		memset(cxt->p + sz, 0, 4 - (sz & 3));
+	cxt->p = p;
+}
+
+void ft_begin_node(struct ft_cxt *cxt, const char *name)
+{
+	ft_put_word(cxt, OF_DT_BEGIN_NODE);
+	ft_put_bin(cxt, name, strlen(name) + 1);
+}
+
+void ft_end_node(struct ft_cxt *cxt)
+{
+	ft_put_word(cxt, OF_DT_END_NODE);
+}
+
+void ft_nop(struct ft_cxt *cxt)
+{
+	ft_put_word(cxt, OF_DT_NOP);
+}
+
+static int lookup_string(struct ft_cxt *cxt, const char *name)
+{
+	u8 *p;
+
+	p = cxt->pstr;
+	while (p < cxt->pstr_begin) {
+		if (strcmp(p, name) == 0)
+			return p - cxt->p_begin;
+		p += strlen(p) + 1;
+	}
+
+	return -1;
+}
+
+void ft_prop(struct ft_cxt *cxt, const char *name, const void *data, int sz)
+{
+	int len, off;
+
+	if (cxt->overflow)
+		return;
+
+	len = strlen(name) + 1;
+
+	off = lookup_string(cxt, name);
+	if (off == -1) {
+		/* check if we have space */
+		if (cxt->p + 12 + sz + len > cxt->pstr) {
+			cxt->overflow = 1;
+			return;
+		}
+
+		cxt->pstr -= len;
+		memcpy(cxt->pstr, name, len);
+		off = cxt->pstr - cxt->p_begin;
+	}
+
+	/* now put offset from beginning of *STRUCTURE* */
+	/* will be fixed up at the end */
+	ft_put_word(cxt, OF_DT_PROP);
+	ft_put_word(cxt, sz);
+	ft_put_word(cxt, off);
+	ft_put_bin(cxt, data, sz);
+}
+
+void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str)
+{
+	ft_prop(cxt, name, str, strlen(str) + 1);
+}
+
+void ft_prop_int(struct ft_cxt *cxt, const char *name, int val)
+{
+	u32 v = cpu_to_be32((u32) val);
+
+	ft_prop(cxt, name, &v, 4);
+}
+
+/* start construction of the flat OF tree */
+void ft_begin(struct ft_cxt *cxt, void *blob, int max_size)
+{
+	struct boot_param_header *bph = blob;
+	u32 off;
+
+	/* clear the cxt */
+	memset(cxt, 0, sizeof(*cxt));
+
+	cxt->bph = bph;
+	cxt->max_size = max_size;
+
+	/* zero everything in the header area */
+	memset(bph, 0, sizeof(*bph));
+
+	bph->magic = cpu_to_be32(OF_DT_HEADER);
+	bph->version = cpu_to_be32(0x10);
+	bph->last_comp_version = cpu_to_be32(0x10);
+
+	/* start pointers */
+	cxt->pres_begin = (u8 *) _ALIGN((unsigned long)(bph + 1), 8);
+	cxt->pres = cxt->pres_begin;
+
+	off = (unsigned long)cxt->pres_begin - (unsigned long)bph;
+	bph->off_mem_rsvmap = cpu_to_be32(off);
+
+	((u64 *) cxt->pres)[0] = 0;	/* phys = 0, size = 0, terminate */
+	((u64 *) cxt->pres)[1] = 0;
+
+	cxt->p_anchor = cxt->pres + 16;	/* over the terminator */
+}
+
+/* add a reserver physical area to the rsvmap */
+void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size)
+{
+	((u64 *) cxt->pres)[0] = cpu_to_be64(physaddr);	/* phys = 0, size = 0, terminate */
+	((u64 *) cxt->pres)[1] = cpu_to_be64(size);
+
+	cxt->pres += 18;	/* advance */
+
+	((u64 *) cxt->pres)[0] = 0;	/* phys = 0, size = 0, terminate */
+	((u64 *) cxt->pres)[1] = 0;
+
+	/* keep track of size */
+	cxt->res_size = cxt->pres + 16 - cxt->pres_begin;
+
+	cxt->p_anchor = cxt->pres + 16;	/* over the terminator */
+}
+
+void ft_begin_tree(struct ft_cxt *cxt)
+{
+	cxt->p_begin = cxt->p_anchor;
+	cxt->pstr_begin = (char *)cxt->bph + cxt->max_size;	/* point at the end */
+
+	cxt->p = cxt->p_begin;
+	cxt->pstr = cxt->pstr_begin;
+}
+
+int ft_end_tree(struct ft_cxt *cxt)
+{
+	struct boot_param_header *bph = cxt->bph;
+	int off, sz, sz1;
+	u32 tag, v;
+	u8 *p;
+
+	ft_put_word(cxt, OF_DT_END);
+
+	if (cxt->overflow)
+		return -ENOMEM;
+
+	/* size of the areas */
+	cxt->struct_size = cxt->p - cxt->p_begin;
+	cxt->strings_size = cxt->pstr_begin - cxt->pstr;
+
+	/* the offset we must move */
+	off = (cxt->pstr_begin - cxt->p_begin) - cxt->strings_size;
+
+	/* the new strings start */
+	cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
+
+	/* move the whole string area */
+	memmove(cxt->pstr_begin, cxt->pstr, cxt->strings_size);
+
+	/* now perform the fixup of the strings */
+	p = cxt->p_begin;
+	while ((tag = be32_to_cpu(*(u32 *) p)) != OF_DT_END) {
+		p += 4;
+
+		if (tag == OF_DT_BEGIN_NODE) {
+			p = (u8 *) _ALIGN((unsigned long)p + strlen(p) + 1, 4);
+			continue;
+		}
+
+		if (tag == OF_DT_END_NODE || tag == OF_DT_NOP)
+			continue;
+
+		if (tag != OF_DT_PROP)
+			return -EINVAL;
+
+		sz = be32_to_cpu(*(u32 *) p);
+		p += 4;
+
+		v = be32_to_cpu(*(u32 *) p);
+		v -= off;
+		*(u32 *) p = cpu_to_be32(v);	/* move down */
+		p += 4;
+
+		p = (u8 *) _ALIGN((unsigned long)p + sz, 4);
+	}
+
+	/* fix sizes */
+	p = (char *)cxt->bph;
+	sz = (cxt->pstr_begin + cxt->strings_size) - p;
+	sz1 = _ALIGN(sz, 16);	/* align at 16 bytes */
+	if (sz != sz1)
+		memset(p + sz, 0, sz1 - sz);
+	bph->totalsize = cpu_to_be32(sz1);
+	bph->off_dt_struct = cpu_to_be32(cxt->p_begin - p);
+	bph->off_dt_strings = cpu_to_be32(cxt->pstr_begin - p);
+
+	/* the new strings start */
+	cxt->pstr_begin = cxt->p_begin + cxt->struct_size;
+	cxt->pstr = cxt->pstr_begin + cxt->strings_size;
+
+	return 0;
+}
+
+/**********************************************************************/
+
+static inline int isprint(int c)
+{
+	return c >= 0x20 && c <= 0x7e;
+}
+
+static int is_printable_string(const void *data, int len)
+{
+	const char *s = data;
+	const char *ss;
+
+	/* zero length is not */
+	if (len == 0)
+		return 0;
+
+	/* must terminate with zero */
+	if (s[len - 1] != '\0')
+		return 0;
+
+	ss = s;
+	while (*s && isprint(*s))
+		s++;
+
+	/* not zero, or not done yet */
+	if (*s != '\0' || (s + 1 - ss) < len)
+		return 0;
+
+	return 1;
+}
+
+static void print_data(const void *data, int len)
+{
+	int i;
+	const u8 *s;
+
+	/* no data, don't print */
+	if (len == 0)
+		return;
+
+	if (is_printable_string(data, len)) {
+		printf(" = \"%s\"", (char *)data);
+		return;
+	}
+
+	switch (len) {
+	case 1:		/* byte */
+		printf(" = <0x%02x>", (*(u8 *) data) & 0xff);
+		break;
+	case 2:		/* half-word */
+		printf(" = <0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff);
+		break;
+	case 4:		/* word */
+		printf(" = <0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU);
+		break;
+	case 8:		/* double-word */
+		printf(" = <0x%16llx>", be64_to_cpu(*(uint64_t *) data));
+		break;
+	default:		/* anything else... hexdump */
+		printf(" = [");
+		for (i = 0, s = data; i < len; i++)
+			printf("%02x%s", s[i], i < len - 1 ? " " : "");
+		printf("]");
+
+		break;
+	}
+}
+
+void ft_dump_blob(const void *bphp)
+{
+	const struct boot_param_header *bph = bphp;
+	const uint64_t *p_rsvmap = (const uint64_t *)
+		((const char *)bph + be32_to_cpu(bph->off_mem_rsvmap));
+	const u32 *p_struct = (const u32 *)
+		((const char *)bph + be32_to_cpu(bph->off_dt_struct));
+	const u32 *p_strings = (const u32 *)
+		((const char *)bph + be32_to_cpu(bph->off_dt_strings));
+	u32 tag;
+	const u32 *p;
+	const char *s, *t;
+	int depth, sz, shift;
+	int i;
+	uint64_t addr, size;
+
+	if (be32_to_cpu(bph->magic) != OF_DT_HEADER) {
+		/* not valid tree */
+		return;
+	}
+
+	depth = 0;
+	shift = 4;
+
+	for (i = 0;; i++) {
+		addr = be64_to_cpu(p_rsvmap[i * 2]);
+		size = be64_to_cpu(p_rsvmap[i * 2 + 1]);
+		if (addr == 0 && size == 0)
+			break;
+
+		printf("/memreserve/ 0x%llx 0x%llx;\n", addr, size);
+	}
+
+	p = p_struct;
+	while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+		/* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
+
+		if (tag == OF_DT_BEGIN_NODE) {
+			s = (const char *)p;
+			p = (u32 *) _ALIGN((unsigned long)p + strlen(s) + 1, 4);
+
+			printf("%*s%s {\n", depth * shift, "", s);
+
+			depth++;
+			continue;
+		}
+
+		if (tag == OF_DT_END_NODE) {
+			depth--;
+
+			printf("%*s};\n", depth * shift, "");
+			continue;
+		}
+
+		if (tag == OF_DT_NOP) {
+			printf("%*s[NOP]\n", depth * shift, "");
+			continue;
+		}
+
+		if (tag != OF_DT_PROP) {
+			fprintf(stderr, "%*s ** Unknown tag 0x%08x\n",
+				depth * shift, "", tag);
+			break;
+		}
+		sz = be32_to_cpu(*p++);
+		s = (const char *)p_strings + be32_to_cpu(*p++);
+		t = (const char *)p;
+		p = (const u32 *)_ALIGN((unsigned long)p + sz, 4);
+		printf("%*s%s", depth * shift, "", s);
+		print_data(t, sz);
+		printf(";\n");
+	}
+}
+
+void ft_backtrack_node(struct ft_cxt *cxt)
+{
+	if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
+		return;		/* XXX only for node */
+
+	cxt->p -= 4;
+}
+
+/* note that the root node of the blob is "peeled" off */
+void ft_merge_blob(struct ft_cxt *cxt, void *blob)
+{
+	struct boot_param_header *bph = (struct boot_param_header *)blob;
+	u32 *p_struct = (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_struct));
+	u32 *p_strings =
+	    (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_strings));
+	u32 tag, *p;
+	char *s, *t;
+	int depth, sz;
+
+	if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE)
+		return;		/* XXX only for node */
+
+	cxt->p -= 4;
+
+	depth = 0;
+	p = p_struct;
+	while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+		/* printf("tag: 0x%08x (%d) - %d\n", tag, p - p_struct, depth); */
+
+		if (tag == OF_DT_BEGIN_NODE) {
+			s = (char *)p;
+			p = (u32 *) _ALIGN((unsigned long)p + strlen(s) + 1, 4);
+
+			if (depth++ > 0)
+				ft_begin_node(cxt, s);
+
+			continue;
+		}
+
+		if (tag == OF_DT_END_NODE) {
+			ft_end_node(cxt);
+			if (--depth == 0)
+				break;
+			continue;
+		}
+
+		if (tag == OF_DT_NOP)
+			continue;
+
+		if (tag != OF_DT_PROP)
+			break;
+
+		sz = be32_to_cpu(*p++);
+		s = (char *)p_strings + be32_to_cpu(*p++);
+		t = (char *)p;
+		p = (u32 *) _ALIGN((unsigned long)p + sz, 4);
+
+		ft_prop(cxt, s, t, sz);
+	}
+}
+
+void *ft_get_prop(void *bphp, const char *propname, int *szp)
+{
+	struct boot_param_header *bph = bphp;
+	uint32_t *p_struct =
+	    (uint32_t *) ((char *)bph + be32_to_cpu(bph->off_dt_struct));
+	uint32_t *p_strings =
+	    (uint32_t *) ((char *)bph + be32_to_cpu(bph->off_dt_strings));
+	uint32_t version = be32_to_cpu(bph->version);
+	uint32_t tag;
+	uint32_t *p;
+	char *s, *t;
+	char *ss;
+	int sz;
+	static char path[256], prop[256];
+
+	path[0] = '\0';
+
+	p = p_struct;
+	while ((tag = be32_to_cpu(*p++)) != OF_DT_END) {
+
+		if (tag == OF_DT_BEGIN_NODE) {
+			s = (char *)p;
+			p = (uint32_t *) _ALIGN((unsigned long)p + strlen(s) +
+						1, 4);
+			strcat(path, s);
+			strcat(path, "/");
+			continue;
+		}
+
+		if (tag == OF_DT_END_NODE) {
+			path[strlen(path) - 1] = '\0';
+			ss = strrchr(path, '/');
+			if (ss != NULL)
+				ss[1] = '\0';
+			continue;
+		}
+
+		if (tag == OF_DT_NOP)
+			continue;
+
+		if (tag != OF_DT_PROP)
+			break;
+
+		sz = be32_to_cpu(*p++);
+		s = (char *)p_strings + be32_to_cpu(*p++);
+		if (version < 0x10 && sz >= 8)
+			p = (uint32_t *) _ALIGN((unsigned long)p, 8);
+		t = (char *)p;
+		p = (uint32_t *) _ALIGN((unsigned long)p + sz, 4);
+
+		strcpy(prop, path);
+		strcat(prop, s);
+
+		if (strcmp(prop, propname) == 0) {
+			*szp = sz;
+			return t;
+		}
+	}
+
+	return NULL;
+}
+
+/********************************************************************/
+
+extern unsigned char oftree_dtb[];
+extern unsigned int oftree_dtb_len;
+
+/* Function that returns a character from the environment */
+extern uchar(*env_get_char) (int);
+
+#define BDM(x)	{	.name = #x, .offset = offsetof(bd_t, bi_ ##x ) }
+
+static const struct {
+	const char *name;
+	int offset;
+} bd_map[] = {
+	BDM(memstart),
+	BDM(memsize),
+	BDM(flashstart),
+	BDM(flashsize),
+	BDM(flashoffset),
+	BDM(sramstart),
+	BDM(sramsize),
+#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \
+	|| defined(CONFIG_E500)
+	BDM(immr_base),
+#endif
+#if defined(CONFIG_MPC5xxx)
+	BDM(mbar_base),
+#endif
+#if defined(CONFIG_MPC83XX)
+	BDM(immrbar),
+#endif
+#if defined(CONFIG_MPC8220)
+	BDM(mbar_base),
+	BDM(inpfreq),
+	BDM(pcifreq),
+	BDM(pevfreq),
+	BDM(flbfreq),
+	BDM(vcofreq),
+#endif
+	BDM(bootflags),
+	BDM(ip_addr),
+	BDM(intfreq),
+	BDM(busfreq),
+#ifdef CONFIG_CPM2
+	BDM(cpmfreq),
+	BDM(brgfreq),
+	BDM(sccfreq),
+	BDM(vco),
+#endif
+#if defined(CONFIG_MPC5xxx)
+	BDM(ipbfreq),
+	BDM(pcifreq),
+#endif
+	BDM(baudrate),
+};
+
+void ft_setup(void *blob, int size, bd_t * bd)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+	u8 *end;
+	u32 *p;
+	int len;
+	struct ft_cxt cxt;
+	int i, k, nxt;
+	static char tmpenv[256];
+	char *s, *lval, *rval;
+	ulong clock;
+	uint32_t v;
+
+	/* disable OF tree; booting old kernel */
+	if (getenv("disable_of") != NULL) {
+		memcpy(blob, bd, sizeof(*bd));
+		return;
+	}
+
+	ft_begin(&cxt, blob, size);
+
+	/* fs_add_rsvmap not used */
+
+	ft_begin_tree(&cxt);
+
+	ft_begin_node(&cxt, "");
+
+	ft_end_node(&cxt);
+
+	/* copy RO tree */
+	ft_merge_blob(&cxt, oftree_dtb);
+
+	/* back into root */
+	ft_backtrack_node(&cxt);
+
+	ft_begin_node(&cxt, "u-boot-env");
+
+	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
+		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) ;
+		s = tmpenv;
+		for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
+			*s++ = env_get_char(k);
+		*s++ = '\0';
+		lval = tmpenv;
+		s = strchr(tmpenv, '=');
+		if (s != NULL) {
+			*s++ = '\0';
+			rval = s;
+		} else
+			continue;
+		ft_prop_str(&cxt, lval, rval);
+	}
+
+	ft_end_node(&cxt);
+
+	ft_begin_node(&cxt, "chosen");
+
+	ft_prop_str(&cxt, "name", "chosen");
+	ft_prop_str(&cxt, "bootargs", getenv("bootargs"));
+	ft_prop_int(&cxt, "linux,platform", 0x600);	/* what is this? */
+
+	ft_end_node(&cxt);
+
+	ft_end_node(&cxt);	/* end root */
+
+	ft_end_tree(&cxt);
+
+	/*
+	   printf("merged OF-tree\n");
+	   ft_dump_blob(blob);
+	 */
+
+	/* paste the bd_t at the end of the flat tree */
+	end = (char *)blob +
+	    be32_to_cpu(((struct boot_param_header *)blob)->totalsize);
+	memcpy(end, bd, sizeof(*bd));
+
+#ifdef CONFIG_PPC
+
+	for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
+		sprintf(tmpenv, "/bd_t/%s", bd_map[i].name);
+		v = *(uint32_t *)((char *)bd + bd_map[i].offset);
+
+		p = ft_get_prop(blob, tmpenv, &len);
+		if (p != NULL)
+			*p = cpu_to_be32(v);
+	}
+
+	p = ft_get_prop(blob, "/bd_t/enetaddr", &len);
+	if (p != NULL)
+		memcpy(p, bd->bi_enetaddr, 6);
+
+	p = ft_get_prop(blob, "/bd_t/ethspeed", &len);
+	if (p != NULL)
+		*p = cpu_to_be32((uint32_t) bd->bi_ethspeed);
+
+	clock = bd->bi_intfreq;
+	p = ft_get_prop(blob, "/cpus/" OF_CPU "/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+#ifdef OF_TBCLK
+	clock = OF_TBCLK;
+	p = ft_get_prop(blob, "/cpus/" OF_CPU "/timebase-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(OF_TBCLK);
+#endif
+
+#endif				/* __powerpc__ */
+
+	/*
+	   printf("final OF-tree\n");
+	   ft_dump_blob(blob);
+	 */
+
+}
+
+#endif
diff --git a/common/hush.c b/common/hush.c
index c10b117..bb5041a 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -296,7 +296,7 @@
 #endif
 
 /* "globals" within this file */
-static char *ifs;
+static uchar *ifs;
 static char map[256];
 #ifndef __U_BOOT__
 static int fake_mode;
@@ -3134,8 +3134,8 @@
 void update_ifs_map(void)
 {
 	/* char *ifs and char map[256] are both globals. */
-	ifs = getenv("IFS");
-	if (ifs == NULL) ifs=" \t\n";
+	ifs = (uchar *)getenv("IFS");
+	if (ifs == NULL) ifs=(uchar *)" \t\n";
 	/* Precompute a list of 'flow through' behavior so it can be treated
 	 * quickly up front.  Computation is necessary because of IFS.
 	 * Special case handling of IFS == " \t\n" is not implemented.
@@ -3144,11 +3144,11 @@
 	 */
 	memset(map,0,sizeof(map)); /* most characters flow through always */
 #ifndef __U_BOOT__
-	mapset("\\$'\"`", 3);      /* never flow through */
-	mapset("<>;&|(){}#", 1);   /* flow through if quoted */
+	mapset((uchar *)"\\$'\"`", 3);      /* never flow through */
+	mapset((uchar *)"<>;&|(){}#", 1);   /* flow through if quoted */
 #else
-	mapset("\\$'\"", 3);       /* never flow through */
-	mapset(";&|#", 1);         /* flow through if quoted */
+	mapset((uchar *)"\\$'\"", 3);       /* never flow through */
+	mapset((uchar *)";&|#", 1);         /* flow through if quoted */
 #endif
 	mapset(ifs, 2);            /* also flow through if quoted */
 }
@@ -3168,7 +3168,7 @@
 		ctx.type = flag;
 		initialize_context(&ctx);
 		update_ifs_map();
-		if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset(";$&|", 0);
+		if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
 		inp->promptmode=1;
 		rcode = parse_stream(&temp, &ctx, inp, '\n');
 #ifdef __U_BOOT__
diff --git a/common/kgdb.c b/common/kgdb.c
index 06adb3e..6de6ec9 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -144,7 +144,7 @@
 	}
 	*buf = 0;
 	longjmp_on_fault = 0;
-	return buf;
+	return (unsigned char *)buf;
 }
 
 /* convert the hex array pointed to by buf into binary to be placed in mem
@@ -353,7 +353,7 @@
 		*ptr++ = hexchars[rp->num >> 4];
 		*ptr++ = hexchars[rp->num & 0xf];
 		*ptr++ = ':';
-		ptr = mem2hex((char *)&rp->val, ptr, 4);
+		ptr = (char *)mem2hex((char *)&rp->val, ptr, 4);
 		*ptr++ = ';';
 	}
 
@@ -364,7 +364,7 @@
 		printf("kgdb: remcomOutBuffer: %s\n", remcomOutBuffer);
 #endif
 
-	putpacket(remcomOutBuffer);
+	putpacket((unsigned char *)&remcomOutBuffer);
 
 	while (1) {
 		volatile int errnum;
@@ -508,7 +508,7 @@
 #endif
 
 		/* reply to the request */
-		putpacket(remcomOutBuffer);
+		putpacket((unsigned char *)&remcomOutBuffer);
 
 	} /* while(1) */
 }
@@ -548,7 +548,7 @@
 
 	buffer[0] = 'O';
 	mem2hex ((char *)s, &buffer[1], count);
-	putpacket(buffer);
+	putpacket((unsigned char *)&buffer);
 
 	return 1;
 }
diff --git a/common/lcd.c b/common/lcd.c
index 7bf7a63..e64972f 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -279,9 +279,9 @@
 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
 {
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-	lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen (s));
+	lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
 #else
-	lcd_drawchars (x, y, s, strlen (s));
+	lcd_drawchars (x, y, s, strlen ((char *)s));
 #endif
 }
 
@@ -526,7 +526,7 @@
 		sizeof(bmp_logo_palette)/(sizeof(ushort)));
 
 	bmap = &bmp_logo_bitmap[0];
-	fb   = (char *)(lcd_base + y * lcd_line_length + x);
+	fb   = (uchar *)(lcd_base + y * lcd_line_length + x);
 
 	if (NBITS(panel_info.vl_bpix) < 12) {
 		/* Leave room for default color map */
@@ -710,15 +710,15 @@
 #ifdef CONFIG_MPC823
 # ifdef CONFIG_LCD_INFO
 	sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
-	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, info, strlen(info));
+	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
 
 	sprintf (info, "(C) 2004 DENX Software Engineering");
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 
 	sprintf (info, "    Wolfgang DENK, wd@denx.de");
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 #  ifdef CONFIG_LCD_INFO_BELOW_LOGO
 	sprintf (info, "MPC823 CPU at %s MHz",
 		strmhz(temp, gd->cpu_clk));
@@ -737,7 +737,7 @@
 		gd->ram_size >> 20,
 		gd->bd->bi_flashsize >> 20 );
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 
 #  endif /* CONFIG_LCD_INFO_BELOW_LOGO */
 # endif /* CONFIG_LCD_INFO */
diff --git a/common/main.c b/common/main.c
index 1389958..f042f3a 100644
--- a/common/main.c
+++ b/common/main.c
@@ -347,7 +347,7 @@
 #ifdef CONFIG_MODEM_SUPPORT
 	debug ("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
 	if (do_mdm_init) {
-		uchar *str = strdup(getenv("mdm_cmd"));
+		char *str = strdup(getenv("mdm_cmd"));
 		setenv ("preboot", str);  /* set or delete definition */
 		if (str != NULL)
 			free (str);
diff --git a/common/soft_i2c.c b/common/soft_i2c.c
index f7ca498..3d0e08c 100644
--- a/common/soft_i2c.c
+++ b/common/soft_i2c.c
@@ -399,7 +399,7 @@
  */
 uchar i2c_reg_read(uchar i2c_addr, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read(i2c_addr, reg, 1, &buf, 1);
 
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 69d195a..99e4ab0 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -490,7 +490,7 @@
  */
 int usb_stor_CB_comdat(ccb *srb, struct us_data *us)
 {
-	int result;
+	int result = 0;
 	int dir_in,retry;
 	unsigned int pipe;
 	unsigned long status;
@@ -528,7 +528,7 @@
 
 		USB_STOR_PRINTF("CB_transport: control msg returned %d, direction is %s to go 0x%lx\n",result,dir_in ? "IN" : "OUT",srb->datalen);
 		if (srb->datalen) {
-			result = us_one_transfer(us, pipe, srb->pdata,srb->datalen);
+			result = us_one_transfer(us, pipe, (char *)srb->pdata,srb->datalen);
 			USB_STOR_PRINTF("CBI attempted to transfer data, result is %d status %lX, len %d\n", result,us->pusb_dev->status,us->pusb_dev->act_len);
 			if(!(us->pusb_dev->status & USB_ST_NAK_REC))
 				break;
@@ -847,7 +847,7 @@
 {
 	char *ptr;
 
-	ptr=srb->pdata;
+	ptr=(char *)srb->pdata;
 	memset(&srb->cmd[0],0,12);
 	srb->cmd[0]=SCSI_REQ_SENSE;
 	srb->cmd[1]=srb->lun<<5;
@@ -857,7 +857,7 @@
 	srb->cmdlen=12;
 	ss->transport(srb,ss);
 	USB_STOR_PRINTF("Request Sense returned %02X %02X %02X\n",srb->sense_buf[2],srb->sense_buf[12],srb->sense_buf[13]);
-	srb->pdata=ptr;
+	srb->pdata=(uchar *)ptr;
 	return 0;
 }
 
diff --git a/common/xilinx.c b/common/xilinx.c
index 40ce3bc..e03e78c 100644
--- a/common/xilinx.c
+++ b/common/xilinx.c
@@ -54,7 +54,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {
@@ -101,7 +101,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {
@@ -148,7 +148,7 @@
 {
 	int ret_val = FPGA_FAIL;
 
-	if (xilinx_validate (desc, __FUNCTION__)) {
+	if (xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("Family:        \t");
 		switch (desc->family) {
 		case Xilinx_Spartan2:
@@ -244,7 +244,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {
diff --git a/cpu/arm920t/at91rm9200/ether.c b/cpu/arm920t/at91rm9200/ether.c
index d88517f..ca5b7d1 100644
--- a/cpu/arm920t/at91rm9200/ether.c
+++ b/cpu/arm920t/at91rm9200/ether.c
@@ -184,7 +184,7 @@
 
 	/* Init Ehternet buffers */
 	for (i = 0; i < RBF_FRAMEMAX; i++) {
-		rbfdt[i].addr = rbf_framebuf[i];
+		rbfdt[i].addr = (unsigned long)rbf_framebuf[i];
 		rbfdt[i].size = 0;
 	}
 	rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
diff --git a/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c
index c3d30a0..eadb7ec 100644
--- a/cpu/mpc5xxx/fec.c
+++ b/cpu/mpc5xxx/fec.c
@@ -320,7 +320,7 @@
 	 * Set individual address filter for unicast address
 	 * and set physical address registers.
 	 */
-	mpc5xxx_fec_set_hwaddr(fec, dev->enetaddr);
+	mpc5xxx_fec_set_hwaddr(fec, (char *)dev->enetaddr);
 
 	/*
 	 * Set multicast address filter
@@ -785,7 +785,7 @@
 	unsigned long ievent;
 	int frame_length, len = 0;
 	NBUF *frame;
-	char buff[FEC_MAX_PKT_SIZE];
+	uchar buff[FEC_MAX_PKT_SIZE];
 
 #if (DEBUG & 0x1)
 	printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex);
diff --git a/cpu/mpc5xxx/i2c.c b/cpu/mpc5xxx/i2c.c
index 845f7c0..044db46 100644
--- a/cpu/mpc5xxx/i2c.c
+++ b/cpu/mpc5xxx/i2c.c
@@ -55,8 +55,9 @@
 
 static int mpc_reg_in(volatile u32 *reg)
 {
-	return *reg >> 24;
+	int ret = *reg >> 24;
 	__asm__ __volatile__ ("eieio");
+	return ret;
 }
 
 static void mpc_reg_out(volatile u32 *reg, int val, int mask)
@@ -298,7 +299,7 @@
 
 int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len)
 {
-	uchar                xaddr[4];
+	char                xaddr[4];
 	struct mpc5xxx_i2c * regs        = (struct mpc5xxx_i2c *)I2C_BASE;
 	int                  ret         = -1;
 
@@ -329,7 +330,7 @@
 		goto Done;
 	}
 
-	if (receive_bytes(chip, buf, len)) {
+	if (receive_bytes(chip, (char *)buf, len)) {
 		printf("i2c_read: receive_bytes failed\n");
 		goto Done;
 	}
@@ -342,7 +343,7 @@
 
 int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 {
-	uchar               xaddr[4];
+	char               xaddr[4];
 	struct mpc5xxx_i2c *regs        = (struct mpc5xxx_i2c *)I2C_BASE;
 	int                 ret         = -1;
 
@@ -367,7 +368,7 @@
 		goto Done;
 	}
 
-	if (send_bytes(chip, buf, len)) {
+	if (send_bytes(chip, (char *)buf, len)) {
 		printf("i2c_write: send_bytes failed\n");
 		goto Done;
 	}
@@ -380,7 +381,7 @@
 
 uchar i2c_reg_read(uchar chip, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read(chip, reg, 1, &buf, 1);
 
diff --git a/cpu/mpc8220/fec.c b/cpu/mpc8220/fec.c
index e974ab3..d5cd22e 100644
--- a/cpu/mpc8220/fec.c
+++ b/cpu/mpc8220/fec.c
@@ -330,7 +330,7 @@
 	 * Set individual address filter for unicast address
 	 * and set physical address registers.
 	 */
-	mpc8220_fec_set_hwaddr (fec, dev->enetaddr);
+	mpc8220_fec_set_hwaddr (fec, (char *)(dev->enetaddr));
 
 	/*
 	 * Set multicast address filter
diff --git a/cpu/mpc8220/i2c.c b/cpu/mpc8220/i2c.c
index e9d0771..62f7c0f 100644
--- a/cpu/mpc8220/i2c.c
+++ b/cpu/mpc8220/i2c.c
@@ -73,8 +73,10 @@
 
 static int mpc_reg_in (volatile u32 * reg)
 {
-	return *reg >> 24;
+	int ret;
+	ret = *reg >> 24;
 	__asm__ __volatile__ ("eieio");
+	return ret;
 }
 
 static void mpc_reg_out (volatile u32 * reg, int val, int mask)
@@ -324,7 +326,7 @@
 		goto Done;
 	}
 
-	if (send_bytes (chip, &xaddr[4 - alen], alen)) {
+	if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
 		printf ("i2c_read: send_bytes failed\n");
 		goto Done;
 	}
@@ -335,7 +337,7 @@
 		goto Done;
 	}
 
-	if (receive_bytes (chip, buf, len)) {
+	if (receive_bytes (chip, (char *)buf, len)) {
 		printf ("i2c_read: receive_bytes failed\n");
 		goto Done;
 	}
@@ -368,12 +370,12 @@
 		goto Done;
 	}
 
-	if (send_bytes (chip, &xaddr[4 - alen], alen)) {
+	if (send_bytes (chip, (char *)&xaddr[4 - alen], alen)) {
 		printf ("i2c_write: send_bytes failed\n");
 		goto Done;
 	}
 
-	if (send_bytes (chip, buf, len)) {
+	if (send_bytes (chip, (char *)buf, len)) {
 		printf ("i2c_write: send_bytes failed\n");
 		goto Done;
 	}
@@ -386,7 +388,7 @@
 
 uchar i2c_reg_read (uchar chip, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read (chip, reg, 1, &buf, 1);
 
diff --git a/cpu/mpc824x/drivers/i2c/i2c.c b/cpu/mpc824x/drivers/i2c/i2c.c
index 7445a1c..3add687 100644
--- a/cpu/mpc824x/drivers/i2c/i2c.c
+++ b/cpu/mpc824x/drivers/i2c/i2c.c
@@ -264,12 +264,12 @@
 	 * and looking for an <ACK> back.
 	 */
 	udelay (10000);
-	return i2c_read (chip, 0, 1, (char *) &tmp, 1);
+	return i2c_read (chip, 0, 1, (uchar *) &tmp, 1);
 }
 
 uchar i2c_reg_read (uchar i2c_addr, uchar reg)
 {
-	char buf[1];
+	uchar buf[1];
 
 	i2c_read (i2c_addr, reg, 1, buf, 1);
 
diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c
index e0ac684..ea97ab8 100644
--- a/cpu/mpc8260/i2c.c
+++ b/cpu/mpc8260/i2c.c
@@ -752,7 +752,7 @@
 uchar
 i2c_reg_read(uchar chip, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read(chip, reg, 1, &buf, 1);
 
diff --git a/cpu/mpc83xx/i2c.c b/cpu/mpc83xx/i2c.c
index 7ccb8a9..4e70f80 100644
--- a/cpu/mpc83xx/i2c.c
+++ b/cpu/mpc83xx/i2c.c
@@ -233,12 +233,12 @@
 	 * and looking for an <ACK> back.
 	 */
 	udelay(10000);
-	return i2c_read (chip, 0, 1, (char *)&tmp, 1);
+	return i2c_read (chip, 0, 1, (uchar *)&tmp, 1);
 }
 
 uchar i2c_reg_read (uchar i2c_addr, uchar reg)
 {
-	char buf[1];
+	uchar buf[1];
 
 	i2c_read (i2c_addr, reg, 1, buf, 1);
 
diff --git a/cpu/mpc85xx/i2c.c b/cpu/mpc85xx/i2c.c
index 2d08487..32dcf5d 100644
--- a/cpu/mpc85xx/i2c.c
+++ b/cpu/mpc85xx/i2c.c
@@ -245,12 +245,12 @@
 	 * and looking for an <ACK> back.
 	 */
 	udelay(10000);
-	return i2c_read (chip, 0, 1, (char *)&tmp, 1);
+	return i2c_read (chip, 0, 1, (uchar *)&tmp, 1);
 }
 
 uchar i2c_reg_read (uchar i2c_addr, uchar reg)
 {
-	char buf[1];
+	uchar buf[1];
 
 	i2c_read (i2c_addr, reg, 1, buf, 1);
 
diff --git a/cpu/mpc8xx/config.mk b/cpu/mpc8xx/config.mk
index bfa6625..5fa150e 100644
--- a/cpu/mpc8xx/config.mk
+++ b/cpu/mpc8xx/config.mk
@@ -21,6 +21,6 @@
 # MA 02111-1307 USA
 #
 
-PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing
+PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing 
 
 PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float
diff --git a/cpu/mpc8xx/i2c.c b/cpu/mpc8xx/i2c.c
index baa3552..682db53 100644
--- a/cpu/mpc8xx/i2c.c
+++ b/cpu/mpc8xx/i2c.c
@@ -724,7 +724,7 @@
 uchar
 i2c_reg_read(uchar i2c_addr, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
 
diff --git a/cpu/mpc8xx/spi.c b/cpu/mpc8xx/spi.c
index 9213d10..e318ed0 100644
--- a/cpu/mpc8xx/spi.c
+++ b/cpu/mpc8xx/spi.c
@@ -525,11 +525,11 @@
 
 	for (i = 0; i < TEST_NUM; i++) {
 		for (l = TEST_MIN_LENGTH; l <= TEST_MAX_LENGTH; l += 8) {
-			packet_fill (txbuf, l);
+			packet_fill ((char *)txbuf, l);
 
 			spi_xfer (l);
 
-			if (packet_check (rxbuf, l) < 0) {
+			if (packet_check ((char *)rxbuf, l) < 0) {
 				goto Done;
 			}
 		}
diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
index f2b8814..ee60477 100644
--- a/cpu/mpc8xx/video.c
+++ b/cpu/mpc8xx/video.c
@@ -447,9 +447,9 @@
 	}
 }
 
-static inline void video_drawstring (int xx, int yy, unsigned char *s)
+static inline void video_drawstring (int xx, int yy, char *s)
 {
-	video_drawchars (xx, yy, s, strlen (s));
+	video_drawchars (xx, yy, (unsigned char *)s, strlen (s));
 }
 
 /* Relative to console plotting functions */
@@ -474,7 +474,7 @@
 
 static inline void video_putstring (int xx, int yy, unsigned char *s)
 {
-	video_putchars (xx, yy, s, strlen (s));
+	video_putchars (xx, yy, (unsigned char *)s, strlen ((char *)s));
 }
 
 /************************************************************************/
diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 34f6e97..d3f1de4 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -139,7 +139,7 @@
 static uint32_t mal_ier;
 
 #if !defined(CONFIG_NET_MULTI)
-struct eth_device *emac0_dev;
+struct eth_device *emac0_dev = NULL;
 #endif
 
 
@@ -306,8 +306,10 @@
 
 	/* before doing anything, figure out if we have a MAC address */
 	/* if not, bail */
-	if (memcmp (dev->enetaddr, "\0\0\0\0\0\0", 6) == 0)
+	if (memcmp (dev->enetaddr, "\0\0\0\0\0\0", 6) == 0) {
+		printf("ERROR: ethaddr not set!\n");
 		return -1;
+	}
 
 #if defined(CONFIG_440GX)
 	/* Need to get the OPB frequency so we can access the PHY */
@@ -1486,12 +1488,16 @@
 int eth_init (bd_t *bis)
 {
 	ppc_4xx_eth_initialize(bis);
-	return(ppc_4xx_eth_init(emac0_dev, bis));
+	if (emac0_dev) {
+		return ppc_4xx_eth_init(emac0_dev, bis);
+	} else {
+		printf("ERROR: ethaddr not set!\n");
+		return -1;
+	}
 }
 
 int eth_send(volatile void *packet, int length)
 {
-
 	return (ppc_4xx_eth_send(emac0_dev, packet, length));
 }
 
diff --git a/cpu/ppc4xx/i2c.c b/cpu/ppc4xx/i2c.c
index 3a644a4..be94b57 100644
--- a/cpu/ppc4xx/i2c.c
+++ b/cpu/ppc4xx/i2c.c
@@ -428,7 +428,7 @@
  */
 uchar i2c_reg_read(uchar i2c_addr, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read(i2c_addr, reg, 1, &buf, 1);
 
diff --git a/cpu/ppc4xx/spd_sdram.c b/cpu/ppc4xx/spd_sdram.c
index 48102ef..7c9ac25 100644
--- a/cpu/ppc4xx/spd_sdram.c
+++ b/cpu/ppc4xx/spd_sdram.c
@@ -456,7 +456,7 @@
 
 int spd_read(uint addr)
 {
-	char data[2];
+	uchar data[2];
 
 	if (i2c_read(SPD_EEPROM_ADDRESS, addr, 1, data, 1) == 0)
 		return (int)data[0];
diff --git a/disk/part_dos.c b/disk/part_dos.c
index a37c32d..133ee79 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -75,7 +75,7 @@
 	    (buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
 		return (-1);
 	} /* no DOS Signature at all */
-	if(strncmp(&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
+	if(strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
 		return DOS_PBR; /* is PBR */
 	return DOS_MBR;	    /* Is MBR */
 }
@@ -195,23 +195,23 @@
 			switch(dev_desc->if_type) {
 				case IF_TYPE_IDE:
 				case IF_TYPE_ATAPI:
-					sprintf (info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
+					sprintf ((char *)info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
 				case IF_TYPE_SCSI:
-					sprintf (info->name, "sd%c%d\n", 'a' + dev_desc->dev, part_num);
+					sprintf ((char *)info->name, "sd%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
 				case IF_TYPE_USB:
-					sprintf (info->name, "usbd%c%d\n", 'a' + dev_desc->dev, part_num);
+					sprintf ((char *)info->name, "usbd%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
 				case IF_TYPE_DOC:
-					sprintf (info->name, "docd%c%d\n", 'a' + dev_desc->dev, part_num);
+					sprintf ((char *)info->name, "docd%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
 				default:
-					sprintf (info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
+					sprintf ((char *)info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
 			}
 			/* sprintf(info->type, "%d, pt->sys_ind); */
-			sprintf (info->type, "U-Boot");
+			sprintf ((char *)info->type, "U-Boot");
 			return 0;
 		}
 
diff --git a/disk/part_iso.c b/disk/part_iso.c
index ee8c7c6..0735324 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -87,7 +87,7 @@
 				dev_desc->dev, part_num);
 		return (-1);
 	}
-	if(strncmp(ppr->stand_ident,"CD001",5)!=0) {
+	if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) {
 		if(verb)
 			printf ("** Wrong ISO Ident: %s on %d:%d **\n",
 				ppr->stand_ident,dev_desc->dev, part_num);
@@ -154,23 +154,23 @@
 	/* the validation entry seems to be ok, now search the "partition" */
 	entry_num=0;
 	offset=0x20;
-	sprintf (info->type, "U-Boot");
+	sprintf ((char *)info->type, "U-Boot");
 	switch(dev_desc->if_type) {
 		case IF_TYPE_IDE:
 		case IF_TYPE_ATAPI:
-			sprintf (info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
+			sprintf ((char *)info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
 		case IF_TYPE_SCSI:
-			sprintf (info->name, "sd%c%d\n", 'a' + dev_desc->dev, part_num);
+			sprintf ((char *)info->name, "sd%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
 		case IF_TYPE_USB:
-			sprintf (info->name, "usbd%c%d\n", 'a' + dev_desc->dev, part_num);
+			sprintf ((char *)info->name, "usbd%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
 		case IF_TYPE_DOC:
-			sprintf (info->name, "docd%c%d\n", 'a' + dev_desc->dev, part_num);
+			sprintf ((char *)info->name, "docd%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
 		default:
-			sprintf (info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
+			sprintf ((char *)info->name, "xx%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
 	}
 	/* the bootcatalog (including validation Entry) is limited to 2048Bytes
diff --git a/doc/README.OFT b/doc/README.OFT
new file mode 100644
index 0000000..8f00ebb
--- /dev/null
+++ b/doc/README.OFT
@@ -0,0 +1,28 @@
+Open Firmware Flat Tree and usage.
+----------------------------------
+
+As part of the ongoing cleanup of the Linux PPC trees, the preferred
+way to pass bootloader and board setup information is the open
+firmware flat tree.
+
+Please take a look at the following email discussion for some 
+background.
+
+  http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019408.html
+  http://ozlabs.org/pipermail/linuxppc-dev/2005-August/019362.html
+
+The generated tree is part static and part dynamic.
+
+There is a static part which is compiled in with DTC and a dynamic
+part which is programmatically appended.
+
+You'll need a fairly recent DTC tool, which is available by git at
+
+  rsync://ozlabs.org/dtc/dtc.git
+
+The xxd binary dumper is needed too which I got from
+
+  ftp://ftp.uni-erlangen.de/pub/utilities/etc/xxd-1.10.tar.gz
+
+
+Pantelis Antoniou, 13 Oct 2005
diff --git a/drivers/cfb_console.c b/drivers/cfb_console.c
index aba4a03..9727aeb 100644
--- a/drivers/cfb_console.c
+++ b/drivers/cfb_console.c
@@ -501,7 +501,7 @@
 
 static inline void video_drawstring (int xx, int yy, unsigned char *s)
 {
-	video_drawchars (xx, yy, s, strlen (s));
+	video_drawchars (xx, yy, s, strlen ((char *)s));
 }
 
 /*****************************************************************************/
@@ -548,12 +548,12 @@
 		sprintf (info, " %02d:%02d:%02d ", tm.tm_hour, tm.tm_min,
 			 tm.tm_sec);
 		video_drawstring (VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
-				  VIDEO_INFO_Y, info);
+				  VIDEO_INFO_Y, (uchar *)info);
 
 		sprintf (info, "%02d.%02d.%04d", tm.tm_mday, tm.tm_mon,
 			 tm.tm_year);
 		video_drawstring (VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
-				  VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT, info);
+				  VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT, (uchar *)info);
 	}
 #endif
 
@@ -779,11 +779,18 @@
 		 */
 		len = CFG_VIDEO_LOGO_MAX_SIZE;
 		dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
+		if (dst == NULL) {
+			printf("Error: malloc in gunzip failed!\n");
+			return(1);
+		}
 		if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)bmp_image, &len) != 0) {
 			printf ("Error: no valid bmp or bmp.gz image at %lx\n", bmp_image);
 			free(dst);
 			return 1;
 		}
+		if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+			printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
+		}
 
 		/*
 		 * Set addr to decompressed image
@@ -1112,7 +1119,7 @@
 	logo_plot (video_fb_address, VIDEO_COLS, 0, 0);
 
 	sprintf (info, " %s", &version_string);
-	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
+	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info);
 
 #ifdef CONFIG_CONSOLE_EXTRA_INFO
 	{
@@ -1123,7 +1130,7 @@
 			if (*info)
 				video_drawstring (VIDEO_INFO_X,
 						  VIDEO_INFO_Y + i * VIDEO_FONT_HEIGHT,
-						  info);
+						  (uchar *)info);
 		}
 	}
 #endif
diff --git a/drivers/dc2114x.c b/drivers/dc2114x.c
index 5386d92..c43cd5e 100644
--- a/drivers/dc2114x.c
+++ b/drivers/dc2114x.c
@@ -214,7 +214,7 @@
 {
 	int             	idx=0;
 	int             	card_number = 0;
-	int             	cfrv;
+	unsigned int           	cfrv;
 	unsigned char   	timer;
 	pci_dev_t		devbusfn;
 	unsigned int		iobase;
@@ -708,7 +708,7 @@
 #ifndef CONFIG_TULIP_FIX_DAVICOM
 static void read_hw_addr(struct eth_device *dev, bd_t *bis)
 {
-	u_short tmp, *p = (short *)(&dev->enetaddr[0]);
+	u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
 	int i, j = 0;
 
 	for (i = 0; i < (ETH_ALEN >> 1); i++) {
diff --git a/drivers/e1000.c b/drivers/e1000.c
index 787134a..927acbb 100644
--- a/drivers/e1000.c
+++ b/drivers/e1000.c
@@ -2822,7 +2822,7 @@
 	if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
 		return 0;
 	/*DEBUGOUT("recv: packet len=%d \n", rd->length); */
-	NetReceive(packet, le32_to_cpu(rd->length));
+	NetReceive((uchar *)packet, le32_to_cpu(rd->length));
 	fill_rx(hw);
 	return 1;
 }
diff --git a/drivers/natsemi.c b/drivers/natsemi.c
index 1c1b9a0..b009db6 100644
--- a/drivers/natsemi.c
+++ b/drivers/natsemi.c
@@ -756,6 +756,7 @@
 {
 	u32 i, status = 0;
 	u32 tx_status = 0;
+	vu_long *res = (vu_long *)&tx_status;
 
 	/* Stop the transmitter */
 	OUTL(dev, TxOff, ChipCmd);
@@ -781,7 +782,7 @@
 	OUTL(dev, TxOn, ChipCmd);
 
 	for (i = 0;
-	     ((vu_long)tx_status = le32_to_cpu(txd.cmdsts)) & DescOwn;
+	     (*res = le32_to_cpu(txd.cmdsts)) & DescOwn;
 	     i++) {
 		if (i >= TOUT_LOOP) {
 			printf
diff --git a/drivers/ns8382x.c b/drivers/ns8382x.c
index be99c3b..976f86a 100644
--- a/drivers/ns8382x.c
+++ b/drivers/ns8382x.c
@@ -363,7 +363,7 @@
 		/* get MAC address */
 		for (i = 0; i < 3; i++) {
 			u32 data;
-			char *mac = &dev->enetaddr[i * 2];
+			char *mac = (char *)&dev->enetaddr[i * 2];
 
 			OUTL(dev, i * 2, RxFilterAddr);
 			data = INL(dev, RxFilterData);
diff --git a/drivers/pcnet.c b/drivers/pcnet.c
index 17e8044..da9ac7f 100644
--- a/drivers/pcnet.c
+++ b/drivers/pcnet.c
@@ -195,7 +195,7 @@
 	/*
 	 * Setup the PCI device.
 	 */
-	pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, &dev->iobase);
+	pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, (unsigned int *)&dev->iobase);
 	dev->iobase &= ~0xf;
 
 	PCNET_DEBUG1("%s: devbusfn=0x%x iobase=0x%x: ",
diff --git a/drivers/smiLynxEM.c b/drivers/smiLynxEM.c
index a87aaf3..20f9beb 100644
--- a/drivers/smiLynxEM.c
+++ b/drivers/smiLynxEM.c
@@ -525,7 +525,8 @@
 /*****************************************************************************/
 static void smiLoadCcr (struct ctfb_res_modes *var, unsigned short device_id)
 {
-	unsigned int p, q;
+	unsigned int p = 0;
+	unsigned int q = 0;
 	long long freq;
 	register GraphicDevice *pGD  = (GraphicDevice *)&smi;
 
diff --git a/drivers/tsec.c b/drivers/tsec.c
index ddca901..069a42f 100644
--- a/drivers/tsec.c
+++ b/drivers/tsec.c
@@ -200,11 +200,11 @@
 	for(i=0;i<MAC_ADDR_LEN;i++) {
 		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
 	}
-	(uint)(regs->macstnaddr1) = *((uint *)(tmpbuf));
+	regs->macstnaddr1 = *((uint *)(tmpbuf));
 
 	tempval = *((uint *)(tmpbuf +4));
 
-	(uint)(regs->macstnaddr2) = tempval;
+	regs->macstnaddr2 = tempval;
 
 	/* reset the indices to zero */
 	rxIdx = 0;
diff --git a/examples/eepro100_eeprom.c b/examples/eepro100_eeprom.c
index 60b937e..020c31d 100644
--- a/examples/eepro100_eeprom.c
+++ b/examples/eepro100_eeprom.c
@@ -78,9 +78,9 @@
 
 static inline void *memcpy(void *dst, const void *src, unsigned int len)
 {
-	void * ret = dst;
-	while (len-- > 0) *((char *)dst)++ = *((char *)src)++;
-	return ret;
+	char *ret = dst;
+	while (len-- > 0) *(ret)++ = *((char *)src)++;
+	return (void *)ret;
 }
 
 /* The EEPROM commands include the alway-set leading bit. */
diff --git a/examples/sched.c b/examples/sched.c
index 6b78f69..ae01e0b 100644
--- a/examples/sched.c
+++ b/examples/sched.c
@@ -292,7 +292,7 @@
 		current_tid = id;
 		PDEBUG ("thread_start: to be stack=0%08x",
 			(unsigned)lthreads[id].stack);
-		setctxsp (&lthreads[id].stack[STK_SIZE]);
+		setctxsp ((vu_char *)&lthreads[id].stack[STK_SIZE]);
 		thread_launcher ();
 	}
 
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 1a40a70..a823b5a 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -83,7 +83,7 @@
 		/* no signature found */
 		return -1;
 	}
-	if(!strncmp(&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
+	if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
 		/* ok, we assume we are on a PBR only */
 		cur_part = 1;
 		part_offset=0;
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
index cf01f88..74577d9 100644
--- a/fs/jffs2/compr_rubin.c
+++ b/fs/jffs2/compr_rubin.c
@@ -48,8 +48,8 @@
 void rubin_do_decompress(unsigned char *bits, unsigned char *in,
 			 unsigned char *page_out, __u32 destlen)
 {
-	register char *curr = page_out;
-	char *end = page_out + destlen;
+	register char *curr = (char *)page_out;
+	char *end = (char *)(page_out + destlen);
 	register unsigned long temp;
 	register unsigned long result;
 	register unsigned long p;
@@ -85,8 +85,10 @@
 				rec_q <<= 1;
 				rec_q |= (temp >> (bit++ ^ 7)) & 1;
 				if (bit > 31) {
+					u32 *p = (u32 *)in;
 					bit = 0;
-					temp = *(++((u32 *) in));
+					temp = *(++p);
+					in = (unsigned char *)p;
 				}
 			}
 			i0 =  (bits[i] * p) >> 8;
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 0f29071..c6c0c2a 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -496,7 +496,7 @@
 
 	/* length is also the same, so use ascending sort by name
 	 */
-	cmp = strncmp(jNew->name, jOld->name, jNew->nsize);
+	cmp = strncmp((char *)jNew->name, (char *)jOld->name, jNew->nsize);
 	if (cmp != 0)
 		return cmp > 0;
 
@@ -572,8 +572,8 @@
 	struct jffs2_raw_inode *jNode;
 	u32 totalSize = 0;
 	u32 latestVersion = 0;
-	char *lDest;
-	char *src;
+	uchar *lDest;
+	uchar *src;
 	long ret;
 	int i;
 	u32 counter = 0;
@@ -624,14 +624,14 @@
 #endif
 
 			if(dest) {
-				src = ((char *) jNode) + sizeof(struct jffs2_raw_inode);
+				src = ((uchar *) jNode) + sizeof(struct jffs2_raw_inode);
 				/* ignore data behind latest known EOF */
 				if (jNode->offset > totalSize) {
 					put_fl_mem(jNode);
 					continue;
 				}
 
-				lDest = (char *) (dest + jNode->offset);
+				lDest = (uchar *) (dest + jNode->offset);
 #if 0
 				putLabeledWord("read_inode: src = ", src);
 				putLabeledWord("read_inode: dest = ", lDest);
@@ -709,7 +709,7 @@
 		jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
 		if ((pino == jDir->pino) && (len == jDir->nsize) &&
 		    (jDir->ino) &&	/* 0 for unlink */
-		    (!strncmp(jDir->name, name, len))) {	/* a match */
+		    (!strncmp((char *)jDir->name, name, len))) {	/* a match */
 			if (jDir->version < version) {
 				put_fl_mem(jDir);
 				continue;
@@ -776,7 +776,7 @@
 	if (st->st_mtime == (time_t)(-1)) /* some ctimes really hate -1 */
 		st->st_mtime = 1;
 
-	ctime_r(&st->st_mtime, s/*,64*/); /* newlib ctime doesn't have buflen */
+	ctime_r((time_t *)&st->st_mtime, s/*,64*/); /* newlib ctime doesn't have buflen */
 
 	if ((p = strchr(s,'\n')) != NULL) *p = '\0';
 	if ((p = strchr(s,'\r')) != NULL) *p = '\0';
@@ -796,7 +796,7 @@
 
 	if(!d || !i) return -1;
 
-	strncpy(fname, d->name, d->nsize);
+	strncpy(fname, (char *)d->name, d->nsize);
 	fname[d->nsize] = '\0';
 
 	memset(&st,0,sizeof(st));
@@ -971,7 +971,7 @@
 			putnstr(src, jNode->dsize);
 			putstr("\r\n");
 #endif
-			strncpy(tmp, src, jNode->dsize);
+			strncpy(tmp, (char *)src, jNode->dsize);
 			tmp[jNode->dsize] = '\0';
 			put_fl_mem(jNode);
 			break;
diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h
index 7b60482..3f5bcf6 100644
--- a/include/asm-ppc/byteorder.h
+++ b/include/asm-ppc/byteorder.h
@@ -39,7 +39,7 @@
 #  define __arch_swab16(x) ld_le16(&x)
 #  define __arch_swab32(x) ld_le32(&x)
 #else
-static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
+static __inline__ __attribute__((const)) __u16 ___arch__swab16(__u16 value)
 {
 	__u16 result;
 
@@ -49,7 +49,7 @@
 	return result;
 }
 
-static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
+static __inline__ __attribute__((const)) __u32 ___arch__swab32(__u32 value)
 {
 	__u32 result;
 
diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h
index c79a023..9ee4849 100644
--- a/include/cmd_confdefs.h
+++ b/include/cmd_confdefs.h
@@ -40,7 +40,7 @@
 						/* crc, base, loop, mtest	*/
 #define CFG_CMD_NET		0x00000080ULL	/* bootp, tftpboot, rarpboot	*/
 #define CFG_CMD_ENV		0x00000100ULL	/* saveenv			*/
-#define CFG_CMD_KGDB		0x00000200ULL	/* kgdb				*/
+#define CFG_CMD_KGDB		0x0000000000000200ULL	/* kgdb				*/
 #define CFG_CMD_PCMCIA		0x00000400ULL	/* PCMCIA support		*/
 #define CFG_CMD_IDE		0x00000800ULL	/* IDE harddisk support		*/
 #define CFG_CMD_PCI		0x00001000ULL	/* pciinfo			*/
diff --git a/include/common.h b/include/common.h
index 8536a99..d2570a8 100644
--- a/include/common.h
+++ b/include/common.h
@@ -208,8 +208,8 @@
 /* common/cmd_nvedit.c */
 int	env_init     (void);
 void	env_relocate (void);
-char	*getenv	     (uchar *);
-int	getenv_r     (uchar *name, uchar *buf, unsigned len);
+char	*getenv	     (char *);
+int	getenv_r     (char *name, char *buf, unsigned len);
 int	saveenv	     (void);
 #ifdef CONFIG_PPC		/* ARM version to be fixed! */
 void inline setenv   (char *, char *);
diff --git a/include/configs/AP1000.h b/include/configs/AP1000.h
index c34d650..ba4b1a2 100644
--- a/include/configs/AP1000.h
+++ b/include/configs/AP1000.h
@@ -24,19 +24,19 @@
 
 #undef DEBUG
 
-#define CONFIG_405  1	   /* This is a PPC405 CPU     */
-#define CONFIG_4xx  1	   /* ...member of PPC4xx family   */
+#define CONFIG_405	1		/* This is a PPC405 CPU	    */
+#define CONFIG_4xx	1		/* ...member of PPC4xx family	*/
 
-#define CONFIG_AP1000  1   /* ...on an AP1000 board    */
+#define CONFIG_AP1000	1		/* ...on an AP1000 board    */
 
-#define CONFIG_PCI 1
+#define CONFIG_PCI	1
 
-#define CFG_HUSH_PARSER		1	/* use "hush" command parser	*/
-#define CFG_PROMPT			"0> "
+#define CFG_HUSH_PARSER 1		/* use "hush" command parser	*/
+#define CFG_PROMPT		"0> "
 #define CFG_PROMPT_HUSH_PS2	"> "
 
-#define CONFIG_COMMAND_EDIT 1
-#define CONFIG_COMMAND_HISTORY 1
+#define CONFIG_COMMAND_EDIT	1
+#define CONFIG_COMMAND_HISTORY	1
 #define CONFIG_COMPLETE_ADDRESSES 1
 
 #define CFG_ENV_IS_IN_FLASH	1
@@ -50,10 +50,10 @@
 #endif
 #endif
 
-#define CONFIG_BAUDRATE	    57600
-#define CONFIG_BOOTDELAY    3  /* autoboot after 3 seconds */
+#define CONFIG_BAUDRATE		57600
+#define CONFIG_BOOTDELAY	3	/* autoboot after 3 seconds */
 
-#define CONFIG_BOOTCOMMAND  ""	    /* autoboot command */
+#define CONFIG_BOOTCOMMAND	""	/* autoboot command */
 
 /* Size (bytes) of interrupt driven serial port buffer.
  * Set to 0 to use polling instead of interrupts.
@@ -61,48 +61,47 @@
  */
 #undef	CONFIG_SERIAL_SOFTWARE_FIFO
 
-#define CONFIG_BOOTARGS	    "console=ttyS0,57600"
+#define CONFIG_BOOTARGS		"console=ttyS0,57600"
 
-#define CONFIG_LOADS_ECHO   1	/* echo on for serial download	*/
-#define CFG_LOADS_BAUD_CHANGE	1   /* allow baudrate change	*/
+#define CONFIG_LOADS_ECHO	1	/* echo on for serial download	*/
+#define CFG_LOADS_BAUD_CHANGE	1	/* allow baudrate change	*/
 
-#define CONFIG_COMMANDS	       ( (CONFIG_CMD_DFL & \
-		(~CFG_CMD_RTC) & ~(CFG_CMD_I2C)) | \
-		CFG_CMD_IRQ | \
-		CFG_CMD_PCI | \
-		CFG_CMD_DHCP | \
-		CFG_CMD_ASKENV | \
-		CFG_CMD_ELF  | \
-		CFG_CMD_PING | \
-		CFG_CMD_MVENV  \
+#define CONFIG_COMMANDS	       (CONFIG_CMD_DFL	| \
+				CFG_CMD_ASKENV	| \
+				CFG_CMD_DHCP	| \
+				CFG_CMD_ELF	| \
+				CFG_CMD_IRQ	| \
+				CFG_CMD_MVENV	| \
+				CFG_CMD_PCI	| \
+				CFG_CMD_PING	\
 			       )
 
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>
 
-#undef CONFIG_WATCHDOG		/* watchdog disabled	    */
+#undef CONFIG_WATCHDOG			/* watchdog disabled	    */
 
-#define CONFIG_SYS_CLK_FREQ 30000000
+#define CONFIG_SYS_CLK_FREQ	30000000
 
-#define CONFIG_SPD_EEPROM      1       /* use SPD EEPROM for setup    */
+#define CONFIG_SPD_EEPROM	1	/* use SPD EEPROM for setup    */
 
 /*
  * Miscellaneous configurable options
  */
-#define CFG_LONGHELP		/* undef to save memory	    */
+#define CFG_LONGHELP			/* undef to save memory	    */
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#define CFG_CBSIZE  1024	/* Console I/O Buffer Size  */
+#define CFG_CBSIZE	1024		/* Console I/O Buffer Size  */
 #else
-#define CFG_CBSIZE  256	    /* Console I/O Buffer Size	*/
+#define CFG_CBSIZE	256		/* Console I/O Buffer Size	*/
 #endif
 /* usually: (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) */
-#define CFG_PBSIZE (CFG_CBSIZE+4+16) /* Print Buffer Size */
-#define CFG_MAXARGS 16	    /* max number of command args   */
-#define CFG_BARGSIZE	CFG_CBSIZE  /* Boot Argument Buffer Size    */
+#define CFG_PBSIZE	(CFG_CBSIZE+4+16)	/* Print Buffer Size */
+#define CFG_MAXARGS	16		/* max number of command args	*/
+#define CFG_BARGSIZE	CFG_CBSIZE	/* Boot Argument Buffer Size	*/
 
-#define CFG_ALT_MEMTEST	    1
-#define CFG_MEMTEST_START   0x00400000	/* memtest works on */
-#define CFG_MEMTEST_END	    0x01000000	/* 4 ... 16 MB in DRAM	*/
+#define CFG_ALT_MEMTEST		1
+#define CFG_MEMTEST_START	0x00400000	/* memtest works on */
+#define CFG_MEMTEST_END		0x01000000	/* 4 ... 16 MB in DRAM	*/
 
 /*
  * If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
@@ -113,84 +112,84 @@
  * If CFG_405_UART_ERRATA_59 and 200MHz CPU clock,
  * set Linux BASE_BAUD to 403200.
  */
-#undef	CFG_EXT_SERIAL_CLOCK	       /* external serial clock */
-#undef	CFG_405_UART_ERRATA_59	       /* 405GP/CR Rev. D silicon */
+#undef	CFG_EXT_SERIAL_CLOCK		/* external serial clock */
+#undef	CFG_405_UART_ERRATA_59		/* 405GP/CR Rev. D silicon */
 
-#define CFG_NS16550_CLK	    40000000
-#define CFG_DUART_CHAN	    0
-#define CFG_NS16550_COM1    (0x4C000000 + 0x1000)
-#define CFG_NS16550_COM2    (0x4C800000 + 0x1000)
-#define CFG_NS16550_REG_SIZE 4
-#define CFG_NS16550 1
-#define CFG_INIT_CHAN1	 1
-#define CFG_INIT_CHAN2	 0
+#define CFG_NS16550_CLK		40000000
+#define CFG_DUART_CHAN		0
+#define CFG_NS16550_COM1	(0x4C000000 + 0x1000)
+#define CFG_NS16550_COM2	(0x4C800000 + 0x1000)
+#define CFG_NS16550_REG_SIZE	4
+#define CFG_NS16550		1
+#define CFG_INIT_CHAN1		1
+#define CFG_INIT_CHAN2		0
 
 /* The following table includes the supported baudrates */
 #define CFG_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
 
-#define CFG_LOAD_ADDR	    0x00100000	/* default load address */
-#define CFG_EXTBDINFO	    1	/* To use extended board_into (bd_t) */
+#define CFG_LOAD_ADDR		0x00200000	/* default load address */
+#define CFG_EXTBDINFO		1		/* To use extended board_into (bd_t) */
 
-#define CFG_HZ	    1000	/* decrementer freq: 1 ms ticks */
+#define CFG_HZ			1000		/* decrementer freq: 1 ms ticks */
 
 /*-----------------------------------------------------------------------
  * Start addresses for the final memory configuration
  * (Set up by the startup code)
  * Please note that CFG_SDRAM_BASE _must_ start at 0
  */
-#define CFG_SDRAM_BASE	    0x00000000
-#define CFG_FLASH_BASE	    0x20000000
-#define CFG_MONITOR_BASE    TEXT_BASE
-#define CFG_MONITOR_LEN	    (192 * 1024)    /* Reserve 196 kB for Monitor   */
-#define CFG_MALLOC_LEN	    (128 * 1024)    /* Reserve 128 kB for malloc()  */
+#define CFG_SDRAM_BASE		0x00000000
+#define CFG_FLASH_BASE		0x20000000
+#define CFG_MONITOR_BASE	TEXT_BASE
+#define CFG_MONITOR_LEN		(192 * 1024)	/* Reserve 196 kB for Monitor	*/
+#define CFG_MALLOC_LEN		(128 * 1024)	/* Reserve 128 kB for malloc()	*/
 
 /*
  * For booting Linux, the board info and command line data
  * have to be in the first 8 MB of memory, since this is
  * the maximum mapped by the Linux kernel during initialization.
  */
-#define CFG_BOOTMAPSZ	    (8 << 20)	/* Initial Memory map for Linux */
+#define CFG_BOOTMAPSZ		(8 << 20)	/* Initial Memory map for Linux */
 /*-----------------------------------------------------------------------
  * FLASH organization
  */
-#define CFG_FLASH_CFI	    1
-#define CFG_PROGFLASH_BASE  CFG_FLASH_BASE
-#define CFG_CONFFLASH_BASE  0x24000000
+#define CFG_FLASH_CFI		1
+#define CFG_PROGFLASH_BASE	CFG_FLASH_BASE
+#define CFG_CONFFLASH_BASE	0x24000000
 
-#define CFG_MAX_FLASH_BANKS 2	/* max number of memory banks	    */
-#define CFG_MAX_FLASH_SECT  256 /* max number of sectors on one chip	*/
+#define CFG_MAX_FLASH_BANKS	2	/* max number of memory banks	    */
+#define CFG_MAX_FLASH_SECT	256	/* max number of sectors on one chip	*/
 
 #define CFG_FLASH_ERASE_TOUT	120000	/* Timeout for Flash Erase (in ms)  */
-#define CFG_FLASH_WRITE_TOUT	500 /* Timeout for Flash Write (in ms)	*/
+#define CFG_FLASH_WRITE_TOUT	500	/* Timeout for Flash Write (in ms)	*/
 
-#define CFG_FLASH_PROTECTION	1   /* use hardware protection	    */
+#define CFG_FLASH_PROTECTION	1	/* use hardware protection	    */
 
 /* BEG ENVIRONNEMENT FLASH */
 #ifdef CFG_ENV_IS_IN_FLASH
-#define CFG_ENV_OFFSET	    0x00040000 /* Offset of Environment Sector	*/
-#define CFG_ENV_SIZE	    0x1000  /* Total Size of Environment Sector */
-#define CFG_ENV_SECT_SIZE   0x20000 /* see README - env sector total size   */
+#define CFG_ENV_OFFSET		0x00040000 /* Offset of Environment Sector	*/
+#define CFG_ENV_SIZE		0x1000	/* Total Size of Environment Sector */
+#define CFG_ENV_SECT_SIZE	0x20000 /* see README - env sector total size	*/
 #endif
 /* END ENVIRONNEMENT FLASH */
 /*-----------------------------------------------------------------------
  * NVRAM organization
  */
-#define CFG_NVRAM_BASE_ADDR 0xf0000000	/* NVRAM base address	*/
-#define CFG_NVRAM_SIZE	    0x1ff8	/* NVRAM size	*/
+#define CFG_NVRAM_BASE_ADDR	0xf0000000	/* NVRAM base address	*/
+#define CFG_NVRAM_SIZE		0x1ff8		/* NVRAM size	*/
 
 #ifdef CFG_ENV_IS_IN_NVRAM
-#define CFG_ENV_SIZE	    0x1000	/* Size of Environment vars */
+#define CFG_ENV_SIZE		0x1000		/* Size of Environment vars */
 #define CFG_ENV_ADDR	    \
     (CFG_NVRAM_BASE_ADDR+CFG_NVRAM_SIZE-CFG_ENV_SIZE)	/* Env	*/
 #endif
 /*-----------------------------------------------------------------------
  * Cache Configuration
  */
-#define CFG_DCACHE_SIZE	    16384
-#define CFG_CACHELINE_SIZE  32
+#define CFG_DCACHE_SIZE		16384
+#define CFG_CACHELINE_SIZE	32
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
-#define CFG_CACHELINE_SHIFT 5	/* log base 2 of the above value    */
+#define CFG_CACHELINE_SHIFT	5	/* log base 2 of the above value    */
 #endif
 
 /*
@@ -199,11 +198,11 @@
  * BR0/1 and OR0/1 (FLASH)
  */
 
-#define FLASH_BASE0_PRELIM  CFG_FLASH_BASE  /* FLASH bank #0	*/
-#define FLASH_BASE1_PRELIM  0	    /* FLASH bank #1	*/
+#define FLASH_BASE0_PRELIM	CFG_FLASH_BASE	/* FLASH bank #0	*/
+#define FLASH_BASE1_PRELIM	0		/* FLASH bank #1	*/
 
 /* Configuration Port location */
-#define CONFIG_PORT_ADDR    0xF0000500
+#define CONFIG_PORT_ADDR	0xF0000500
 
 /*-----------------------------------------------------------------------
  * Definitions for initial stack pointer and data area (in DPRAM)
@@ -211,8 +210,8 @@
 
 #define CFG_INIT_RAM_ADDR	0x400000  /* inside of SDRAM			 */
 #define CFG_INIT_RAM_END	0x2000	/* End of used area in RAM	       */
-#define CFG_GBL_DATA_SIZE      128  /* size in bytes reserved for initial data */
-#define CFG_GBL_DATA_OFFSET    (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_OFFSET	(CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
 #define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
 
 /*-----------------------------------------------------------------------
@@ -226,25 +225,25 @@
  *
  * Boot Flags
  */
-#define BOOTFLAG_COLD	0x01	    /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM	0x02	    /* Software reboot		*/
+#define BOOTFLAG_COLD	0x01		/* Normal Power-On: Boot from FLASH */
+#define BOOTFLAG_WARM	0x02		/* Software reboot		*/
 
 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX	2   /* which serial port to use */
+#define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
 
 /* JFFS2 stuff */
 
-#define CFG_JFFS2_FIRST_BANK 0
-#define CFG_JFFS2_NUM_BANKS 1
-#define CFG_JFFS2_FIRST_SECTOR 1
+#define CFG_JFFS2_FIRST_BANK	0
+#define CFG_JFFS2_NUM_BANKS	1
+#define CFG_JFFS2_FIRST_SECTOR	1
 
 #define CONFIG_NET_MULTI
 #define CONFIG_E1000
 
-#define CFG_ETH_DEV_FN	   0x0800
-#define CFG_ETH_IOBASE	   0x31000000
-#define CFG_ETH_MEMBASE	   0x32000000
+#define CFG_ETH_DEV_FN		0x0800
+#define CFG_ETH_IOBASE		0x31000000
+#define CFG_ETH_MEMBASE		0x32000000
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/APC405.h b/include/configs/APC405.h
index b53e85e..3ac567b 100644
--- a/include/configs/APC405.h
+++ b/include/configs/APC405.h
@@ -357,7 +357,7 @@
 #define CFG_LCD_MEM             CFG_LCD_BIG_MEM
 #define CFG_LCD_REG             CFG_LCD_BIG_REG
 
-#define CFG_LCD_LOGO_MAX_SIZE   (1024*1024)
+#define CFG_VIDEO_LOGO_MAX_SIZE (1 << 20)
 
 /*-----------------------------------------------------------------------
  * Definitions for initial stack pointer and data area (in data cache)
diff --git a/include/configs/HH405.h b/include/configs/HH405.h
index dd29be0..131c215 100644
--- a/include/configs/HH405.h
+++ b/include/configs/HH405.h
@@ -88,7 +88,7 @@
 #define CFG_CONSOLE_IS_IN_ENV
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_VIDEO_BMP_GZIP		/* gzip compressed bmp images	*/
-#define CFG_VIDEO_LOGO_MAX_SIZE	(1024*1024)	/* for decompressed img */
+#define CFG_VIDEO_LOGO_MAX_SIZE	(2 << 20)	/* for decompressed img */
 
 #define ADD_BMP_CMD		CFG_CMD_BMP
 #else
@@ -308,7 +308,7 @@
 #define CFG_FLASH_BASE		0xFFF80000
 #define CFG_MONITOR_BASE	TEXT_BASE
 #define CFG_MONITOR_LEN		(512 * 1024)	/* Reserve 512 kB for Monitor	*/
-#define CFG_MALLOC_LEN		(2 * 1024*1024)	/* Reserve 2 MB for malloc()	*/
+#define CFG_MALLOC_LEN		(4 << 20)	/* Reserve 4 MB for malloc()	*/
 
 #if (CFG_MONITOR_BASE < FLASH_BASE0_PRELIM)
 # define CFG_RAMBOOT		1
@@ -409,8 +409,6 @@
 #define CFG_LCD_SMALL_MEM       0xF1400000  /* Epson S1D13704 Mem Base Address  */
 #define CFG_LCD_SMALL_REG       0xF140FFE0  /* Epson S1D13704 Reg Base Address  */
 
-#define CFG_LCD_LOGO_MAX_SIZE   (1024*1024)
-
 /*-----------------------------------------------------------------------
  * Universal Interrupt Controller (UIC) Setup
  */
diff --git a/include/configs/NC650.h b/include/configs/NC650.h
index d24d05f..cd04c1a 100644
--- a/include/configs/NC650.h
+++ b/include/configs/NC650.h
@@ -99,19 +99,17 @@
 #define SCL		0x1000		/* PA 3 */
 #define SDA		0x2000		/* PA 2 */
 
-#define PAR		immr->im_ioport.iop_papar
-#define DIR		immr->im_ioport.iop_padir
-#define DAT		immr->im_ioport.iop_padat
-
-#define I2C_INIT	{PAR &= ~(SCL | SDA); DIR |=  SCL;}
-#define I2C_ACTIVE	(DIR |=  SDA)
-#define I2C_TRISTATE	(DIR &= ~SDA)
-#define I2C_READ	((DAT & SDA) != 0)
-#define I2C_SDA(bit)	if (bit) DAT |=  SDA; \
-			else DAT &= ~SDA
-#define I2C_SCL(bit)	if (bit) DAT |=  SCL; \
-			else DAT &= ~SCL
-#define I2C_DELAY	udelay(5)	/* 1/4 I2C clock duration */
+#define __I2C_DIR	immr->im_ioport.iop_padir
+#define __I2C_DAT	immr->im_ioport.iop_padat
+#define __I2C_PAR	immr->im_ioport.iop_papar
+#define	I2C_INIT	{ __I2C_PAR &= ~(SDA|SCL);	\
+			  __I2C_DIR |= (SDA|SCL);	}
+#define	I2C_READ	((__I2C_DAT & SDA) ? 1 : 0)
+#define	I2C_SDA(x)	{ if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
+#define	I2C_SCL(x)	{ if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
+#define	I2C_DELAY	{ udelay(5); }
+#define	I2C_ACTIVE	{ __I2C_DIR |= SDA; }
+#define	I2C_TRISTATE	{ __I2C_DIR &= ~SDA; }
 
 #define CONFIG_RTC_PCF8563
 #define CFG_I2C_RTC_ADDR		0x51
diff --git a/include/configs/PM854.h b/include/configs/PM854.h
index af06efc..0b8c71d 100644
--- a/include/configs/PM854.h
+++ b/include/configs/PM854.h
@@ -235,7 +235,7 @@
 #define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP			/* do pci plug-and-play */
 
-#define	CONFIG_EEPRO100
+/* #define CONFIG_EEPRO100	XXX - FIXME: conflicts when CONFIG_MII is enabled */
 #define	CONFIG_E1000
 #undef	CONFIG_TULIP
 
diff --git a/include/configs/TOP860.h b/include/configs/TOP860.h
index af74f9d..99a7b08 100644
--- a/include/configs/TOP860.h
+++ b/include/configs/TOP860.h
@@ -181,17 +181,20 @@
 #if defined (CONFIG_SOFT_I2C)
 #define	SDA	0x00010
 #define	SCL	0x00020
-#define DIR immr->im_cpm.cp_pbdir
-#define DAT	immr->im_cpm.cp_pbdat
-#define PAR	immr->im_cpm.cp_pbpar
-#define	ODR	immr->im_cpm.cp_pbodr
-#define	I2C_INIT	{PAR&=~(SDA|SCL);ODR&=~(SDA|SCL);DAT|=(SDA|SCL);DIR|=(SDA|SCL);}
-#define	I2C_READ	((DAT&SDA)?1:0)
-#define	I2C_SDA(x)	{if(x)DAT|=SDA;else DAT&=~SDA;}
-#define	I2C_SCL(x)	{if(x)DAT|=SCL;else DAT&=~SCL;}
-#define	I2C_DELAY	{udelay(5);}
-#define	I2C_ACTIVE	 {DIR|=SDA;}
-#define	I2C_TRISTATE {DIR&=~SDA;}
+#define __I2C_DIR	immr->im_cpm.cp_pbdir
+#define __I2C_DAT	immr->im_cpm.cp_pbdat
+#define __I2C_PAR	immr->im_cpm.cp_pbpar
+#define	__I2C_ODR	immr->im_cpm.cp_pbodr
+#define	I2C_INIT	{ __I2C_PAR &= ~(SDA|SCL);	\
+			  __I2C_ODR &= ~(SDA|SCL);	\
+			  __I2C_DAT |= (SDA|SCL);	\
+			  __I2C_DIR|=(SDA|SCL);	}
+#define	I2C_READ	((__I2C_DAT & SDA) ? 1 : 0)
+#define	I2C_SDA(x)	{ if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
+#define	I2C_SCL(x)	{ if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
+#define	I2C_DELAY	{ udelay(5); }
+#define	I2C_ACTIVE	{ __I2C_DIR |= SDA; }
+#define	I2C_TRISTATE	{ __I2C_DIR &= ~SDA; }
 #endif
 
 #define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
diff --git a/include/configs/TQM5200.h b/include/configs/TQM5200.h
index 909d724..a57f7cf 100644
--- a/include/configs/TQM5200.h
+++ b/include/configs/TQM5200.h
@@ -83,7 +83,7 @@
 #define CONFIG_PCI_IO_SIZE	0x01000000
 
 #define CONFIG_NET_MULTI	1
-#define CONFIG_EEPRO100		1
+/* #define CONFIG_EEPRO100	XXX - FIXME: conflicts when CONFIG_MII is enabled */
 #define CFG_RX_ETH_BUFFER	8  /* use 8 rx buffer on eepro100  */
 #define CONFIG_NS8382X		1
 #endif	/* CONFIG_STK52XX */
diff --git a/include/configs/TQM8560.h b/include/configs/TQM8560.h
index d2c230d..04966d7 100644
--- a/include/configs/TQM8560.h
+++ b/include/configs/TQM8560.h
@@ -283,7 +283,7 @@
 #define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP			/* do pci plug-and-play */
 
-#define CONFIG_EEPRO100
+/* #define CONFIG_EEPRO100	XXX - FIXME: conflicts when CONFIG_MII is enabled */
 #undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
diff --git a/include/configs/VOH405.h b/include/configs/VOH405.h
index b3ce3da..3ca137e 100644
--- a/include/configs/VOH405.h
+++ b/include/configs/VOH405.h
@@ -362,7 +362,7 @@
 #define CFG_LCD_SMALL_MEM       0xF1400000  /* Epson S1D13704 Mem Base Address  */
 #define CFG_LCD_SMALL_REG       0xF140FFE0  /* Epson S1D13704 Reg Base Address  */
 
-#define CFG_LCD_LOGO_MAX_SIZE   (1024*1024)
+#define CFG_VIDEO_LOGO_MAX_SIZE (1 << 20)
 
 /*-----------------------------------------------------------------------
  * FPGA stuff
diff --git a/include/configs/barco.h b/include/configs/barco.h
index 217c00f..624fa1d 100644
--- a/include/configs/barco.h
+++ b/include/configs/barco.h
@@ -162,7 +162,7 @@
 #define CFG_ENV_IS_IN_FLASH	1
 #define CFG_ENV_OFFSET		0x000047A4	/* Offset of Environment Sector */
 #define CFG_ENV_SIZE		0x00002000	/* Total Size of Environment Sector */
-#define ENV_CRC			0x8BF6F24B
+/* #define ENV_CRC		0x8BF6F24B	XXX - FIXME: gets defined automatically */
 
 #define CFG_MALLOC_LEN		(512 << 10)	/* Reserve 512 kB for malloc()	*/
 
diff --git a/include/configs/o2dnt.h b/include/configs/o2dnt.h
index ffa2678..62b90e8 100644
--- a/include/configs/o2dnt.h
+++ b/include/configs/o2dnt.h
@@ -69,7 +69,7 @@
 #define CFG_XLB_PIPELINING	1
 
 #define CONFIG_NET_MULTI	1
-#define CONFIG_EEPRO100		1
+/* #define CONFIG_EEPRO100	XXX - FIXME: conflicts when CONFIG_MII is enabled */
 #define CFG_RX_ETH_BUFFER	8  /* use 8 rx buffer on eepro100  */
 #define CONFIG_NS8382X		1
 
diff --git a/include/configs/stxxtc.h b/include/configs/stxxtc.h
index f6e6a60..3ffe6b2 100644
--- a/include/configs/stxxtc.h
+++ b/include/configs/stxxtc.h
@@ -574,19 +574,15 @@
 #define CONFIG_CRC32_VERIFY	1
 #define CONFIG_HUSH_OLD_PARSER_COMPATIBLE	1
 
-/* Note: change below for your network setting!!!
- * This was done just to facilitate manufacturing test and configuration.
- */
-#define CONFIG_ETHADDR	 00:e0:0c:07:9b:8a
+/*****************************************************************************/
 
-#define CONFIG_SERVERIP 	192.168.08.1
-#define CONFIG_IPADDR  		192.168.08.85
-#define CONFIG_GATEWAYIP	192.168.08.1
-#define CONFIG_NETMASK		255.255.255.0
-#define CONFIG_HOSTNAME 	stx_xtc
-#define CONFIG_ROOTPATH 	/xtcroot
-#define CONFIG_BOOTFILE 	uImage
-#define CONFIG_LOADADDR		0x1000000
+/* pass open firmware flat tree */
+#define CONFIG_OF_FLAT_TREE	1
 
+/* maximum size of the flat tree (8K) */
+#define OF_FLAT_TREE_MAX_SIZE	8192
+
+#define OF_CPU			"PowerPC,MPC870@0"
+#define OF_TBCLK		(MPC8XX_HZ / 16)
 
 #endif	/* __CONFIG_H */
diff --git a/include/flash.h b/include/flash.h
index 6381cfc..decb046 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -83,7 +83,7 @@
 
 /* common/flash.c */
 extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
-extern int flash_write (uchar *, ulong, ulong);
+extern int flash_write (char *, ulong, ulong);
 extern flash_info_t *addr2info (ulong);
 extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
 
diff --git a/include/fpga.h b/include/fpga.h
index 782b58e..a038aa1 100644
--- a/include/fpga.h
+++ b/include/fpga.h
@@ -73,7 +73,7 @@
 /* root function definitions */
 extern void fpga_init( ulong reloc_off );
 extern int fpga_add( fpga_type devtype, void *desc );
-extern const int fpga_count( void );
+extern int fpga_count( void );
 extern int fpga_load( int devnum, void *buf, size_t bsize );
 extern int fpga_dump( int devnum, void *buf, size_t bsize );
 extern int fpga_info( int devnum );
diff --git a/include/ft_build.h b/include/ft_build.h
new file mode 100644
index 0000000..9104b1a
--- /dev/null
+++ b/include/ft_build.h
@@ -0,0 +1,66 @@
+/*
+ * OF Flat tree builder
+ *
+ */
+
+#ifndef FT_BUILD_H
+#define FT_BUILD_H
+
+#include <linux/types.h>
+#include <asm/u-boot.h>
+
+/* Definitions used by the flattened device tree */
+#define OF_DT_HEADER		0xd00dfeed	/* marker */
+#define OF_DT_BEGIN_NODE	0x1	/* Start of node, full name */
+#define OF_DT_END_NODE		0x2	/* End node */
+#define OF_DT_PROP		0x3	/* Property: name off, size,
+					 * content */
+#define OF_DT_NOP		0x4	/* nop */
+#define OF_DT_END		0x9
+
+#define OF_DT_VERSION		0x10
+
+struct boot_param_header {
+	u32 magic;		/* magic word OF_DT_HEADER */
+	u32 totalsize;		/* total size of DT block */
+	u32 off_dt_struct;	/* offset to structure */
+	u32 off_dt_strings;	/* offset to strings */
+	u32 off_mem_rsvmap;	/* offset to memory reserve map */
+	u32 version;		/* format version */
+	u32 last_comp_version;	/* last compatible version */
+	/* version 2 fields below */
+	u32 boot_cpuid_phys;	/* Physical CPU id we're booting on */
+	/* version 3 fields below */
+	u32 dt_strings_size;	/* size of the DT strings block */
+};
+
+struct ft_cxt {
+	struct boot_param_header *bph;
+	int max_size;		/* maximum size of tree */
+	int overflow;		/* set when this happens */
+	u8 *p, *pstr, *pres;	/* running pointers */
+	u8 *p_begin, *pstr_begin, *pres_begin;	/* starting pointers */
+	u8 *p_anchor;		/* start of constructed area */
+	int struct_size, strings_size, res_size;
+};
+
+void ft_begin_node(struct ft_cxt *cxt, const char *name);
+void ft_end_node(struct ft_cxt *cxt);
+
+void ft_begin_tree(struct ft_cxt *cxt);
+int ft_end_tree(struct ft_cxt *cxt);
+
+void ft_nop(struct ft_cxt *cxt);
+void ft_prop(struct ft_cxt *cxt, const char *name, const void *data, int sz);
+void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str);
+void ft_prop_int(struct ft_cxt *cxt, const char *name, int val);
+void ft_begin(struct ft_cxt *cxt, void *blob, int max_size);
+void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size);
+
+void ft_setup(void *blob, int size, bd_t * bd);
+
+void ft_dump_blob(const void *bphp);
+void ft_merge_blob(struct ft_cxt *cxt, void *blob);
+void *ft_get_prop(void *bphp, const char *propname, int *szp);
+
+#endif
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 03468f7..b1d570e 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -96,7 +96,7 @@
 #endif /* OPTIMIZE */
 
 
-static __inline__ __const__ __u16 __fswab16(__u16 x)
+static __inline__ __attribute__((const)) __u16 __fswab16(__u16 x)
 {
 	return __arch__swab16(x);
 }
@@ -109,7 +109,7 @@
 	__arch__swab16s(addr);
 }
 
-static __inline__ __const__ __u32 __fswab32(__u32 x)
+static __inline__ __attribute__((const)) __u32 __fswab32(__u32 x)
 {
 	return __arch__swab32(x);
 }
@@ -123,7 +123,7 @@
 }
 
 #ifdef __BYTEORDER_HAS_U64__
-static __inline__ __const__ __u64 __fswab64(__u64 x)
+static __inline__ __attribute__((const)) __u64 __fswab64(__u64 x)
 {
 #  ifdef __SWAB_64_THRU_32__
 	__u32 h = x >> 32;
diff --git a/include/net.h b/include/net.h
index 623d225..47eab59 100644
--- a/include/net.h
+++ b/include/net.h
@@ -453,7 +453,7 @@
 extern ushort getenv_VLAN(char *);
 
 /* copy a filename (allow for "..." notation, limit length) */
-extern void	copy_filename (uchar *dst, uchar *src, int size);
+extern void	copy_filename (char *dst, char *src, int size);
 
 /**********************************************************************/
 
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index b1c6ab0..c3ce33f 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -186,7 +186,7 @@
 
 static int init_baudrate (void)
 {
-	uchar tmp[64];	/* long enough for environment variables */
+	char tmp[64];	/* long enough for environment variables */
 	int i = getenv_r ("baudrate", tmp, sizeof (tmp));
 
 	gd->baudrate = (i > 0)
@@ -401,8 +401,8 @@
 	/*
 	 * reserve protected RAM
 	 */
-	i = getenv_r ("pram", tmp, sizeof (tmp));
-	reg = (i > 0) ? simple_strtoul (tmp, NULL, 10) : CONFIG_PRAM;
+	i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
+	reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
 	addr -= (reg << 10);		/* size is in kB */
 	debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
 #endif /* CONFIG_PRAM */
@@ -542,8 +542,8 @@
 	bd->bi_baudrate = gd->baudrate;	/* Console Baudrate     */
 
 #ifdef CFG_EXTBDINFO
-	strncpy (bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
-	strncpy (bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
+	strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
+	strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
 
 	bd->bi_procfreq = gd->cpu_clk;	/* Processor Speed, In Hz */
 	bd->bi_plb_busfreq = gd->bus_clk;
@@ -1042,8 +1042,8 @@
 		/* Also take the logbuffer into account (pram is in kB) */
 		pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
 #endif
-		sprintf (memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
-		setenv ("mem", memsz);
+		sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+		setenv ("mem", (char *)memsz);
 	}
 #endif
 
@@ -1081,6 +1081,41 @@
 
 #ifdef CONFIG_MODEM_SUPPORT
 /* called from main loop (common/main.c) */
+/* 'inline' - We have to do it fast */
+static inline void mdm_readline(char *buf, int bufsiz)
+{
+	char c;
+	char *p;
+	int n;
+
+	n = 0;
+	p = buf;
+	for(;;) {
+		c = serial_getc();
+
+		/*		dbg("(%c)", c); */
+
+		switch(c) {
+		case '\r':
+			break;
+		case '\n':
+			*p = '\0';
+			return;
+
+		default:
+			if(n++ > bufsiz) {
+				*p = '\0';
+				return; /* sanity check */
+			}
+			*p = c;
+			p++;
+			break;
+		}
+	}
+}
+
+
+
 extern void  dbg(const char *fmt, ...);
 int mdm_init (void)
 {
@@ -1088,7 +1123,6 @@
 	char *init_str;
 	int i;
 	extern char console_buffer[];
-	static inline void mdm_readline(char *buf, int bufsiz);
 	extern void enable_putc(void);
 	extern int hwflow_onoff(int);
 
@@ -1143,38 +1177,6 @@
 	return 0;
 }
 
-/* 'inline' - We have to do it fast */
-static inline void mdm_readline(char *buf, int bufsiz)
-{
-	char c;
-	char *p;
-	int n;
-
-	n = 0;
-	p = buf;
-	for(;;) {
-		c = serial_getc();
-
-		/*		dbg("(%c)", c); */
-
-		switch(c) {
-		case '\r':
-			break;
-		case '\n':
-			*p = '\0';
-			return;
-
-		default:
-			if(n++ > bufsiz) {
-				*p = '\0';
-				return; /* sanity check */
-			}
-			*p = c;
-			p++;
-			break;
-		}
-	}
-}
 #endif
 
 #if 0 /* We could use plain global data, but the resulting code is bigger */
diff --git a/net/bootp.c b/net/bootp.c
index b907351..8c56c08 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -330,7 +330,7 @@
 
 	/* Retrieve extended information (we must parse the vendor area) */
 	if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
-		BootpVendorProcess(&bp->bp_vend[4], len);
+		BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
 
 	NetSetTimeout(0, (thand_f *)0);
 
@@ -387,7 +387,7 @@
 	u8 *x;
 #endif
 #if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_SEND_HOSTNAME)
-	uchar *hostname;
+	char *hostname;
 #endif
 
 	*e++ = 99;		/* RFC1048 Magic Cookie */
@@ -578,7 +578,7 @@
 	unsigned char bi_enetaddr[6];
 	int   reg;
 	char  *e,*s;
-	uchar tmp[64];
+	char tmp[64];
 	ulong tst1, tst2, sum, m_mask, m_value = 0;
 
 	if (BootpTry ==0) {
@@ -679,9 +679,9 @@
 
 	/* Request additional information from the BOOTP/DHCP server */
 #if (CONFIG_COMMANDS & CFG_CMD_DHCP)
-	ext_len = DhcpExtended(bp->bp_vend, DHCP_DISCOVER, 0, 0);
+	ext_len = DhcpExtended((u8 *)bp->bp_vend, DHCP_DISCOVER, 0, 0);
 #else
-	ext_len = BootpExtended(bp->bp_vend);
+	ext_len = BootpExtended((u8 *)bp->bp_vend);
 #endif	/* CFG_CMD_DHCP */
 
 	/*
@@ -836,7 +836,7 @@
 	 * Copy options from OFFER packet if present
 	 */
 	NetCopyIP(&OfferedIP, &bp->bp_yiaddr);
-	extlen = DhcpExtended(bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
+	extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
 
 	pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
 	iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
@@ -882,7 +882,7 @@
 			dhcp_state = REQUESTING;
 
 			if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess(&bp->bp_vend[4]);
+				DhcpOptionsProcess((u8 *)&bp->bp_vend[4]);
 
 			BootpCopyNetParams(bp); /* Store net params from reply */
 
@@ -897,11 +897,11 @@
 	case REQUESTING:
 		debug ("DHCP State: REQUESTING\n");
 
-		if ( DhcpMessageType(bp->bp_vend) == DHCP_ACK ) {
+		if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) {
 			char *s;
 
 			if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
-				DhcpOptionsProcess(&bp->bp_vend[4]);
+				DhcpOptionsProcess((u8 *)&bp->bp_vend[4]);
 			BootpCopyNetParams(bp); /* Store net params from reply */
 			dhcp_state = BOUND;
 			puts ("DHCP client bound to address ");
diff --git a/net/eth.c b/net/eth.c
index fe1edd1..cfab0e1 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -109,7 +109,7 @@
 
 int eth_initialize(bd_t *bis)
 {
-	unsigned char enetvar[32], env_enetaddr[6];
+	char enetvar[32], env_enetaddr[6];
 	int i, eth_number = 0;
 	char *tmp, *end;
 
diff --git a/net/net.c b/net/net.c
index 11b7700..d1a15e2 100644
--- a/net/net.c
+++ b/net/net.c
@@ -810,6 +810,7 @@
 	int     odd;
 	ulong   result = 0;
 	ushort  leftover;
+	ushort *p;
 
 	if (len > 0) {
 		odd = 1 & (ulong)buff;
@@ -819,7 +820,9 @@
 			buff++;
 		}
 		while (len > 1) {
-			result += *((const ushort *)buff)++;
+			p = (ushort *)buff;
+			result += *p++;
+			buff = (uchar *)p;
 			if (result & 0x80000000)
 				result = (result & 0xFFFF) + (result >> 16);
 			len -= 2;
@@ -1655,7 +1658,7 @@
 	ip->ip_sum   = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2);
 }
 
-void copy_filename (uchar *dst, uchar *src, int size)
+void copy_filename (char *dst, char *src, int size)
 {
 	if (*src && (*src == '"')) {
 		++src;
diff --git a/net/tftp.c b/net/tftp.c
index 43c4336..eca21d2 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -78,7 +78,7 @@
 	}
 
 	if (rc) { /* Flash is destination for this packet */
-		rc = flash_write ((uchar *)src, (ulong)(load_addr+offset), len);
+		rc = flash_write ((char *)src, (ulong)(load_addr+offset), len);
 		if (rc) {
 			flash_perror (rc);
 			NetState = NETLOOP_FAIL;
diff --git a/post/memory.c b/post/memory.c
index 0dac858..a10bc50 100644
--- a/post/memory.c
+++ b/post/memory.c
@@ -224,7 +224,7 @@
 
 static int memory_post_dataline(unsigned long long * pmem)
 {
-	unsigned long long temp64;
+	unsigned long long temp64 = 0;
 	int num_patterns = sizeof(pattern)/ sizeof(pattern[0]);
 	int i;
 	unsigned int hi, lo, pathi, patlo;
@@ -418,14 +418,14 @@
 	int ret = 0;
 
 	if (ret == 0)
-		ret = memory_post_dataline ((long long *)start);
+		ret = memory_post_dataline ((unsigned long long *)start);
 	WATCHDOG_RESET ();
 	if (ret == 0)
-		ret = memory_post_addrline ((long *)start, (long *)start, size);
+		ret = memory_post_addrline ((ulong *)start, (ulong *)start, size);
 	WATCHDOG_RESET ();
 	if (ret == 0)
-		ret = memory_post_addrline ((long *)(start + size - 8),
-					    (long *)start, size);
+		ret = memory_post_addrline ((ulong *)(start + size - 8),
+					    (ulong *)start, size);
 	WATCHDOG_RESET ();
 	if (ret == 0)
 		ret = memory_post_test1 (start, size, 0x00000000);