When a ARCH_MVEBU platform is selected, generate barebox.kwb and
barebox.kwbuart images from barebox.bin, using kwbimage.

barebox.kwb is generated by executing kwbimage on the board
kwbimage.cfg file, and is therefore designed to be booted from the
default boot media of the board, as defined by kwbimage.cfg (typically
a NAND flash or SPI flash).

barebox.kwbuart is generated by executing kwbimage on the board
kwbimage.cfg file, but by overriding the boot media to be UART. This
image is suitable for usage with the kwbtool and is generally useful
for recovery purposes.

Signed-off-by: Thomas Petazzoni <thomas.petazz...@free-electrons.com>
---
 Makefile          |    2 +-
 arch/arm/Makefile |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f919993..9fcdd78 100644
--- a/Makefile
+++ b/Makefile
@@ -970,7 +970,7 @@ CLEAN_FILES +=      barebox System.map 
include/generated/barebox_default_env.h \
                .tmp_kallsyms* common/barebox_default_env* barebox.ldr \
                scripts/bareboxenv-target barebox-flash-image \
                Doxyfile.version barebox.srec barebox.s5p barebox.ubl \
-               barebox.uimage barebox.spi
+               barebox.uimage barebox.spi barebox.kwb barebox.kwbuart
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2 usr/include
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index bb47506..d9e0cf1 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -263,6 +263,26 @@ KBUILD_TARGET := barebox.zynq
 KBUILD_IMAGE := barebox.zynq
 endif
 
+KWBIMAGE_OPTS = \
+       -c -i $(srctree)/$(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)
+
+quiet_cmd_kwbimage = KWB     $@
+      cmd_kwbimage = scripts/kwbimage -p $< $(KWBIMAGE_OPTS) -o $@
+
+quiet_cmd_kwbimage_uart = KWBUART $@
+      cmd_kwbimage_uart = scripts/kwbimage -m uart -p $< $(KWBIMAGE_OPTS) -o $@
+
+barebox.kwb: $(KBUILD_BINARY) FORCE
+       $(call if_changed,kwbimage)
+
+barebox.kwbuart: $(KBUILD_BINARY) FORCE
+       $(call if_changed,kwbimage_uart)
+
+ifeq ($(CONFIG_ARCH_MVEBU),y)
+KBUILD_TARGET := barebox.kwb barebox.kwbuart
+KBUILD_IMAGE  := barebox.kwb barebox.kwbuart
+endif
+
 pbl := arch/arm/pbl
 zbarebox.S zbarebox.bin zbarebox: barebox.bin
        $(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to