diff --git a/Makefile b/Makefile
index 0400930..7a9cae7 100644
--- a/Makefile
+++ b/Makefile
@@ -317,6 +317,16 @@ ifeq ($(CONFIG_NAND_U_BOOT),y)
 ALL += $(obj)u-boot-nand.bin
 endif
 
+ifndef CONFIG_IN_BOOTSTRAP
+ifeq ($(CONFIG_SPIFLASH), y)
+ALL += $(obj)u-boot-spi.bin
+endif
+
+ifeq ($(CONFIG_SDCARD), y)
+ALL += $(obj)u-boot-sd.bin
+endif
+endif
+
 ifeq ($(CONFIG_ONENAND_U_BOOT),y)
 ALL += $(obj)u-boot-onenand.bin
 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
@@ -404,8 +414,16 @@ $(obj)u-boot.lds: $(LDSCRIPT)
 nand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
 		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
+NAND_SPL_OBJS-y += $(obj)nand_spl/u-boot-spl-16k.bin
+NAND_SPL_OBJS-$(CONFIG_BOOTSTRAP) += $(obj)u-boot-bootstrap.bin
+NAND_SPL_OBJS-y += $(obj)u-boot.bin
+
+ifeq ($(CONFIG_BOOTSTRAP),y)
+$(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin
+else
 $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
-		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+endif
+		cat $(NAND_SPL_OBJS-y) > $(obj)u-boot-nand.bin
 
 onenand_ipl:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
@@ -413,6 +431,23 @@ onenand_ipl:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 $(obj)u-boot-onenand.bin:	onenand_ipl $(obj)u-boot.bin
 		cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
 
+ifdef CONFIG_BOOTSTRAP
+$(obj)u-boot-spi.bin:		$(obj)u-boot.bin $(obj)u-boot-bootstrap.bin
+		cat $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin > $(obj)u-boot-spi.bin
+$(obj)u-boot-sd.bin:		$(obj)u-boot.bin $(obj)u-boot-bootstrap.bin
+		cat $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin > $(obj)u-boot-sd.bin
+else
+$(obj)u-boot-spi.bin:		$(obj)u-boot.bin
+		ln -s u-boot.bin u-boot-spi.bin
+$(obj)u-boot-sd.bin:		$(obj)u-boot.bin
+		ln -s u-boot.bin u-boot-sd.bin
+endif
+
+$(obj)u-boot-bootstrap.bin:
+		rm -rf $(BUILD_DIR)bootstrap
+		$(MAKE) $(CONFIG_BOARD_NAME) O=bootstrap/ EXTRA_OPTS=IN_BOOTSTRAP
+		cp $(BUILD_DIR)bootstrap/u-boot.bin u-boot-bootstrap.bin
+
 $(VERSION_FILE):
 		@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
 		   printf '#define PLAIN_VERSION "%s%s"\n' \
@@ -1130,6 +1165,7 @@ clean:
 		\( -name 'core' -o -name '*.bak' -o -name '*~' \
 		-o -name '*.o'	-o -name '*.a' -o -name '*.exe'	\) -print \
 		| xargs rm -f
+	@rm -fr $(BUILD_DIR)bootstrap/
 
 clobber:	clean
 	@find $(OBJTREE) -type f \( -name '*.depend' \
diff --git a/mkconfig b/mkconfig
index e72ec3d..74294ec 100755
--- a/mkconfig
+++ b/mkconfig
@@ -159,6 +159,7 @@ for i in ${TARGETS} ; do
 done
 
 cat << EOF >> config.h
+#define CONFIG_BOARD_NAME $BOARD_NAME
 #define CONFIG_BOARDDIR board/$BOARDDIR
 #include <config_cmd_defaults.h>
 #include <config_defaults.h>
