diff --git a/Makefile b/Makefile
index 9dee9483c63ead629084dd484a587705216a75ee..65efd3f5e05906cf8f454335c20480ac38b1d7ab 100644
--- a/Makefile
+++ b/Makefile
@@ -1900,7 +1900,7 @@ TQM8560_config:		unconfig
 #########################################################################
 
 MPC8641HPCN_config:    unconfig
-	@$(MKCONFIG) $(@:_config=) ppc mpc86xx mpc8641hpcn
+	@$(MKCONFIG) $(@:_config=) ppc mpc86xx mpc8641hpcn freescale
 
 sbc8641d_config:	unconfig
 	@./mkconfig $(@:_config=) ppc mpc86xx sbc8641d
diff --git a/board/mpc8641hpcn/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
similarity index 100%
rename from board/mpc8641hpcn/sys_eeprom.c
rename to board/freescale/common/sys_eeprom.c
diff --git a/board/mpc8641hpcn/Makefile b/board/freescale/mpc8641hpcn/Makefile
similarity index 93%
rename from board/mpc8641hpcn/Makefile
rename to board/freescale/mpc8641hpcn/Makefile
index df56b31e581bcfa2983d26dd89a4ace330a6cc6e..93b015d47436b831bef728af8c7f6da7b8c48f9f 100644
--- a/board/mpc8641hpcn/Makefile
+++ b/board/freescale/mpc8641hpcn/Makefile
@@ -24,13 +24,14 @@
 include $(TOPDIR)/config.mk
 
 ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)../freescale/common)
+$(shell mkdir -p $(obj)../common)
 endif
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= $(BOARD).o sys_eeprom.o \
-		../freescale/common/pixis.o
+COBJS	:= $(BOARD).o \
+		../common/sys_eeprom.o \
+		../common/pixis.o
 
 SOBJS	:= init.o
 
diff --git a/board/mpc8641hpcn/config.mk b/board/freescale/mpc8641hpcn/config.mk
similarity index 100%
rename from board/mpc8641hpcn/config.mk
rename to board/freescale/mpc8641hpcn/config.mk
diff --git a/board/mpc8641hpcn/init.S b/board/freescale/mpc8641hpcn/init.S
similarity index 100%
rename from board/mpc8641hpcn/init.S
rename to board/freescale/mpc8641hpcn/init.S
diff --git a/board/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
similarity index 99%
rename from board/mpc8641hpcn/mpc8641hpcn.c
rename to board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 1bfbe88b5aafb7625757bda01ca2bc6fb0fafd96..ffd11cb5f1384e2a6e428cc7f393ccc4b795fdf5 100644
--- a/board/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -33,7 +33,7 @@
 extern void ft_cpu_setup(void *blob, bd_t *bd);
 #endif
 
-#include "../freescale/common/pixis.h"
+#include "../common/pixis.h"
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
diff --git a/board/mpc8641hpcn/u-boot.lds b/board/freescale/mpc8641hpcn/u-boot.lds
similarity index 98%
rename from board/mpc8641hpcn/u-boot.lds
rename to board/freescale/mpc8641hpcn/u-boot.lds
index 58644648c78846388bcf8236858cc927d80fb01b..fd163622a82918f0041ff8ba21c979250922cd35 100644
--- a/board/mpc8641hpcn/u-boot.lds
+++ b/board/freescale/mpc8641hpcn/u-boot.lds
@@ -51,7 +51,7 @@ SECTIONS
   .text      :
   {
     cpu/mpc86xx/start.o	(.text)
-    board/mpc8641hpcn/init.o (.bootpg)
+    board/freescale/mpc8641hpcn/init.o (.bootpg)
     cpu/mpc86xx/traps.o (.text)
     cpu/mpc86xx/interrupts.o (.text)
     cpu/mpc86xx/cpu_init.o (.text)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8249dceb4e3325b65d116da064c389c66f4c5d3e..df1d0380d4affdcfe06cda3a6c93ef512781533d 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -924,16 +924,17 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 		initrd_end = 0;
 	}
 
+#if defined(CONFIG_OF_LIBFDT)
+
 #ifdef CFG_BOOTMAPSZ
 	/*
 	 * The blob must be within CFG_BOOTMAPSZ,
-	 * so we flag it to be copied if it is
+	 * so we flag it to be copied if it is not.
 	 */
 	if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
 		of_data = of_flat_tree;
 #endif
 
-#if defined(CONFIG_OF_LIBFDT)
 	/* move of_flat_tree if needed */
 	if (of_data) {
 		int err;
diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h
index 68d31ca1dbc3562afb4790bd16fa47a16f592ab8..277b611409d877e790301730c348ac8cf5330a14 100644
--- a/include/configs/sbc8641d.h
+++ b/include/configs/sbc8641d.h
@@ -492,7 +492,7 @@
 #define CFG_LOAD_ADDR	0x2000000	/* default load address */
 #define CFG_PROMPT	"=> "		/* Monitor Command Prompt */
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
     #define CFG_CBSIZE	1024		/* Console I/O Buffer Size */
 #else
     #define CFG_CBSIZE	256		/* Console I/O Buffer Size */
@@ -513,7 +513,7 @@
 /* Cache Configuration */
 #define CFG_DCACHE_SIZE		32768
 #define CFG_CACHELINE_SIZE	32
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 #define CFG_CACHELINE_SHIFT	5	/*log base 2 of the above value*/
 #endif
 
@@ -525,7 +525,7 @@
 #define BOOTFLAG_COLD	0x01		/* Normal Power-On: Boot from FLASH */
 #define BOOTFLAG_WARM	0x02		/* Software reboot */
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb serial port */
 #define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
diff --git a/net/tftp.c b/net/tftp.c
index 888ec987cfcb24edecfb3fea028802acceb557bc..d6db91c05841a450cdd51a5360121d8e4cdbf93a 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -614,4 +614,4 @@ static void parse_multicast_oack(char *pkt, int len)
 
 #endif /* Multicast TFTP */
 
-#endif /* CFG_CMD_NET */
+#endif