sh: bzip2/lzma uImage support.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 21 Jul 2009 08:24:36 +0000 (17:24 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 21 Jul 2009 08:24:36 +0000 (17:24 +0900)
This builds on the bzip2/lzma zImage support change and wires it up for
uImages. Based on the blackfin implementation.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/Makefile
arch/sh/boot/.gitignore
arch/sh/boot/Makefile
arch/sh/boot/compressed/Makefile

index 75d049b03f7e04231de0525ba6b57e3779fe2984..2aba73eccb315611c45731c9d463512470043577 100644 (file)
@@ -189,14 +189,16 @@ KBUILD_AFLAGS             += $(cflags-y)
 libs-$(CONFIG_SUPERH32)                := arch/sh/lib/ $(libs-y)
 libs-$(CONFIG_SUPERH64)                := arch/sh/lib64/ $(libs-y)
 
-PHONY += maketools FORCE
+BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec \
+              zImage vmlinux.srec
+PHONY += maketools $(BOOT_TARGETS) FORCE
 
 maketools:  include/linux/version.h FORCE
        $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
 
 all: $(KBUILD_IMAGE)
 
-zImage uImage uImage.srec vmlinux.srec: vmlinux
+$(BOOT_TARGETS): vmlinux
        $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 compressed: zImage
@@ -208,10 +210,13 @@ archclean:
        $(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall
 
 define archhelp
-       @echo '* zImage                    - Compressed kernel image'
+       @echo '  zImage                    - Compressed kernel image'
        @echo '  vmlinux.srec              - Create an ELF S-record'
-       @echo '  uImage                    - Create a bootable image for U-Boot'
-       @echo '  uImage.srec               - Create an S-record for U-Boot'
+       @echo '* uImage                    - Alias to bootable U-Boot image'
+       @echo '  uImage.srec               - Create an S-record for U-Boot'
+       @echo '* uImage.gz                 - Kernel-only image for U-Boot (gzip)'
+       @echo '  uImage.bz2                - Kernel-only image for U-Boot (bzip2)'
+       @echo '  uImage.lzma               - Kernel-only image for U-Boot (lzma)'
 endef
 
 CLEAN_FILES += include/asm-sh/machtypes.h
index aad5edddf93baf232cafbb216172a5e712a4fe31..541087d2029c8e859768677aa2f88e4706c466ad 100644 (file)
@@ -1,4 +1,3 @@
 zImage
-vmlinux.srec
-uImage
-uImage.srec
+vmlinux*
+uImage*
index 78efb04c28f3dfb2362e6610318491a99e08ce54..dd2a852041e9ceb8bf39c4bf9dd0c81407186b10 100644 (file)
@@ -20,7 +20,12 @@ CONFIG_BOOT_LINK_OFFSET      ?= 0x00800000
 CONFIG_ZERO_PAGE_OFFSET        ?= 0x00001000
 CONFIG_ENTRY_OFFSET    ?= 0x00001000
 
-targets := zImage vmlinux.srec uImage uImage.srec
+suffix-$(CONFIG_KERNEL_GZIP)  := gz
+suffix-$(CONFIG_KERNEL_BZIP2) := bz2
+suffix-$(CONFIG_KERNEL_LZMA)  := lzma
+
+targets := zImage vmlinux.srec uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma
+extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
 subdir- := compressed
 
 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
@@ -40,9 +45,6 @@ KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
                     $$[$(CONFIG_MEMORY_START)]')
 endif
 
-export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
-       CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY
-
 KERNEL_LOAD    := $(shell /bin/bash -c 'printf "0x%08x" \
                     $$[$(CONFIG_PAGE_OFFSET)  + \
                        $(KERNEL_MEMORY) + \
@@ -55,19 +57,30 @@ KERNEL_ENTRY        := $(shell /bin/bash -c 'printf "0x%08x" \
 
 quiet_cmd_uimage = UIMAGE  $@
       cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
-                  -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
+                  -C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
                   -n 'Linux-$(KERNELRELEASE)' -d $< $@
 
-$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
-       $(call if_changed,uimage)
-       @echo '  Image $@ is ready'
-
 $(obj)/vmlinux.bin: vmlinux FORCE
        $(call if_changed,objcopy)
 
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
        $(call if_changed,gzip)
 
+$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
+       $(call if_changed,bzip2)
+
+$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
+       $(call if_changed,lzma)
+
+$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
+       $(call if_changed,uimage,bzip2)
+
+$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
+       $(call if_changed,uimage,gzip)
+
+$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
+       $(call if_changed,uimage,lzma)
+
 OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
 $(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
        $(call if_changed,objcopy)
@@ -76,5 +89,9 @@ OBJCOPYFLAGS_uImage.srec := -I binary -O srec
 $(obj)/uImage.srec: $(obj)/uImage
        $(call if_changed,objcopy)
 
-clean-files    += uImage uImage.srec vmlinux.srec \
-                  vmlinux.bin vmlinux.bin.gz
+$(obj)/uImage: $(obj)/uImage.$(suffix-y)
+       @ln -sf $(notdir $<) $@
+       @echo '  Image $@ is ready'
+
+export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
+       CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY suffix-y
index 3324019e207ef3dd7374e2d9d0cc51453d65673b..b31618e9e8c89be8c729472aec391d842f40e28b 100644 (file)
@@ -48,10 +48,6 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
        $(call if_changed,lzma)
 
-suffix-$(CONFIG_KERNEL_GZIP)   := gz
-suffix-$(CONFIG_KERNEL_BZIP2)  := bz2
-suffix-$(CONFIG_KERNEL_LZMA)   := lzma
-
 OBJCOPYFLAGS += -R .empty_zero_page
 
 LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T