[PATCH] MIPS: add U-boot uImage build target to arch Makefile

Sergey Kvachonok ravenexp at gmail.com
Tue Nov 23 07:02:18 EST 2010


Requires mkimage tool from u-boot-tools.
Uses gzip compression by default.
---
 arch/mips/Makefile               |    6 ++++++
 arch/mips/boot/u-boot/.gitignore |    2 ++
 arch/mips/boot/u-boot/Makefile   |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/boot/u-boot/.gitignore
 create mode 100644 arch/mips/boot/u-boot/Makefile

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index f4a4b66..d0968af 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -282,6 +282,11 @@ vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE
 	$(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
 	   VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@
 
+# u-boot
+uImage: vmlinux.bin FORCE
+	$(Q)$(MAKE) $(build)=arch/mips/boot/u-boot \
+	  VMLINUX=$(vmlinux-32) VMLINUXBIN=arch/mips/boot/vmlinux.bin \
+	  VMLINUX_LOAD_ADDRESS=$(load-y) arch/mips/boot/u-boot/$@
 
 CLEAN_FILES += vmlinux.32 vmlinux.64
 
@@ -315,6 +320,7 @@ define archhelp
 	echo '  vmlinuz.ecoff        - ECOFF zboot image'
 	echo '  vmlinuz.bin          - Raw binary zboot image'
 	echo '  vmlinuz.srec         - SREC zboot image'
+	echo '  uImage               - U-boot image (gzip)'
 	echo
 	echo '  These will be default as apropriate for a configured platform.'
 endef
diff --git a/arch/mips/boot/u-boot/.gitignore b/arch/mips/boot/u-boot/.gitignore
new file mode 100644
index 0000000..1080c94
--- /dev/null
+++ b/arch/mips/boot/u-boot/.gitignore
@@ -0,0 +1,2 @@
+vmlinux.bin.gz
+uImage
diff --git a/arch/mips/boot/u-boot/Makefile b/arch/mips/boot/u-boot/Makefile
new file mode 100644
index 0000000..318dc50
--- /dev/null
+++ b/arch/mips/boot/u-boot/Makefile
@@ -0,0 +1,15 @@
+targets += vmlinux.bin.gz
+quiet_cmd_gzip = GZIP $@
+cmd_gzip = gzip -c9 $(VMLINUXBIN) $(obj)/vmlinux.bin.gz
+$(obj)/vmlinux.bin.gz: $(obj)/../vmlinux.bin FORCE
+	$(call if_changed,gzip)
+
+MKIMAGE = mkimage
+
+targets += uImage
+quiet_cmd_uImage = MKIMAGE $@
+cmd_uImage = $(MKIMAGE) -A mips -O linux -T kernel -C gzip -a $(VMLINUX_LOAD_ADDRESS) \
+-e 0x$(shell $(NM) $(VMLINUX) | grep ' kernel_entry' | cut -f1 -d ' ') \
+-n MIPS -d $(obj)/vmlinux.bin.gz $(obj)/uImage
+$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,uImage)
-- 
1.7.3.2





More information about the discussion mailing list


interactive