From 46bf132f15ec073c0a6d9abc30a516302888ed13 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Thu, 20 Sep 2012 21:13:44 +0200 Subject: Makefile: add target to produce a SPL compatible uImage This is mostly useful during the initial port of barebox to a new board which is supported by u-boot. It also allows starting barebox from a SRAM-based u-boot SPL. A different load address can be set like this: make barebox.uimage UIMAGE_BASE=0x80000000 Also add barebox.ubl to CLEAN_FILES. Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- .gitignore | 1 + Makefile | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4154c7397e..7e98a2558b 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ barebox.srec barebox.netx barebox.s5p barebox.ubl +barebox.uimage barebox.map System.map Module.symvers diff --git a/Makefile b/Makefile index c6264d3404..b0304d2654 100644 --- a/Makefile +++ b/Makefile @@ -680,6 +680,22 @@ ifndef CONFIG_PBL_IMAGE $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) endif +# By default the uImage load address is 2MB below CONFIG_TEXT_BASE, +# leaving space for the compressed PBL image at 1MB below CONFIG_TEXT_BASE. +UIMAGE_BASE ?= $(shell printf "0x%08x" $$(($(CONFIG_TEXT_BASE) - 0x200000))) + +# For development provide a target which makes barebox loadable by an +# unmodified u-boot +quiet_cmd_barebox_mkimage = MKIMAGE $@ + cmd_barebox_mkimage = $(srctree)/scripts/mkimage -A $(ARCH) -T firmware -C none \ + -O barebox -a $(UIMAGE_BASE) -e $(UIMAGE_BASE) \ + -n "barebox $(KERNELRELEASE)" -d $< $@ + +# barebox.uimage is build from the raw barebox binary, without any other +# headers. +barebox.uimage: $(KBUILD_BINARY) FORCE + $(call if_changed,barebox_mkimage) + ifdef CONFIG_X86 barebox.S: barebox ifdef CONFIG_X86_HDBOOT @@ -1009,7 +1025,8 @@ CLEAN_FILES += barebox System.map include/generated/barebox_default_env.h \ .tmp_version .tmp_barebox* barebox.bin barebox.map barebox.S \ .tmp_kallsyms* barebox_default_env* barebox.ldr \ scripts/bareboxenv-target barebox-flash-image \ - Doxyfile.version barebox.srec barebox.s5p + Doxyfile.version barebox.srec barebox.s5p barebox.ubl \ + barebox.uimage # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include2 usr/include -- cgit v1.2.3