aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2012-03-16 17:03:55 -0400
committerMichal Marek <mmarek@suse.cz>2012-03-26 09:49:20 -0400
commite33936451484b06b61b259172fa3761a7d1cd4dc (patch)
treeacdbb021fc7f3ba4c13adbd70059f7a7c70c9803 /arch
parentf75a8df3bd6466e29a4e40b86b2cfc96fe06d328 (diff)
Kbuild: centralize MKIMAGE and cmd_uimage definitions
All ARCHs have the same definition of MKIMAGE. Move it to Makefile.lib to avoid duplication. All ARCHs have similar definitions of cmd_uimage. Place a sufficiently parameterized version in Makefile.lib to avoid duplication. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Nicolas Pitre <nico@linaro.org> Tested-by: Mike Frysinger <vapier@gentoo.org> [Blackfin] Tested-by: Michal Simek <monstr@monstr.eu> [Microblaze] Tested-by: Guan Xuetao <gxt@mprc.pku.edu.cn> [unicore32] Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/Makefile23
-rw-r--r--arch/avr32/boot/images/Makefile9
-rw-r--r--arch/blackfin/boot/Makefile19
-rw-r--r--arch/microblaze/boot/Makefile10
-rw-r--r--arch/sh/boot/Makefile8
-rw-r--r--arch/sparc/boot/Makefile9
-rw-r--r--arch/unicore32/boot/Makefile12
7 files changed, 30 insertions, 60 deletions
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index fc871e719aae..c877087d2000 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -11,8 +11,6 @@
11# Copyright (C) 1995-2002 Russell King 11# Copyright (C) 1995-2002 Russell King
12# 12#
13 13
14MKIMAGE := $(srctree)/scripts/mkuboot.sh
15
16ifneq ($(MACHINE),) 14ifneq ($(MACHINE),)
17include $(srctree)/$(MACHINE)/Makefile.boot 15include $(srctree)/$(MACHINE)/Makefile.boot
18endif 16endif
@@ -69,22 +67,19 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
69 67
70clean-files := *.dtb 68clean-files := *.dtb
71 69
72quiet_cmd_uimage = UIMAGE $@ 70ifneq ($(LOADADDR),)
73 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 71 UIMAGE_LOADADDR=$(LOADADDR)
74 -C none -a $(LOADADDR) -e $(STARTADDR) \
75 -n 'Linux-$(KERNELRELEASE)' -d $< $@
76
77ifeq ($(CONFIG_ZBOOT_ROM),y)
78$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
79else 72else
80$(obj)/uImage: LOADADDR=$(ZRELADDR) 73 ifeq ($(CONFIG_ZBOOT_ROM),y)
74 UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
75 else
76 UIMAGE_LOADADDR=$(ZRELADDR)
77 endif
81endif 78endif
82 79
83$(obj)/uImage: STARTADDR=$(LOADADDR)
84
85check_for_multiple_loadaddr = \ 80check_for_multiple_loadaddr = \
86if [ $(words $(LOADADDR)) -gt 1 ]; then \ 81if [ $(words $(UIMAGE_LOADADDR)) -gt 1 ]; then \
87 echo 'multiple load addresses: $(LOADADDR)'; \ 82 echo 'multiple load addresses: $(UIMAGE_LOADADDR)'; \
88 echo 'This is incompatible with uImages'; \ 83 echo 'This is incompatible with uImages'; \
89 echo 'Specify LOADADDR on the commandline to build an uImage'; \ 84 echo 'Specify LOADADDR on the commandline to build an uImage'; \
90 false; \ 85 false; \
diff --git a/arch/avr32/boot/images/Makefile b/arch/avr32/boot/images/Makefile
index 1848bf0d7f62..2a3b53978a3b 100644
--- a/arch/avr32/boot/images/Makefile
+++ b/arch/avr32/boot/images/Makefile
@@ -6,8 +6,6 @@
6# for more details. 6# for more details.
7# 7#
8 8
9MKIMAGE := $(srctree)/scripts/mkuboot.sh
10
11extra-y := vmlinux.bin vmlinux.gz 9extra-y := vmlinux.bin vmlinux.gz
12 10
13OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note.gnu.build-id 11OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note.gnu.build-id
@@ -17,10 +15,9 @@ $(obj)/vmlinux.bin: vmlinux FORCE
17$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE 15$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
18 $(call if_changed,gzip) 16 $(call if_changed,gzip)
19 17
20quiet_cmd_uimage = UIMAGE $@ 18UIMAGE_LOADADDR = $(CONFIG_LOAD_ADDRESS)
21 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T kernel \ 19UIMAGE_ENTRYADDR = $(CONFIG_ENTRY_ADDRESS)
22 -C gzip -a $(CONFIG_LOAD_ADDRESS) -e $(CONFIG_ENTRY_ADDRESS) \ 20UIMAGE_COMPRESSION = gzip
23 -n 'Linux-$(KERNELRELEASE)' -d $< $@
24 21
25targets += uImage uImage.srec 22targets += uImage uImage.srec
26$(obj)/uImage: $(obj)/vmlinux.gz 23$(obj)/uImage: $(obj)/vmlinux.gz
diff --git a/arch/blackfin/boot/Makefile b/arch/blackfin/boot/Makefile
index 0a49279e3428..f7d27d50d02c 100644
--- a/arch/blackfin/boot/Makefile
+++ b/arch/blackfin/boot/Makefile
@@ -6,20 +6,17 @@
6# for more details. 6# for more details.
7# 7#
8 8
9MKIMAGE := $(srctree)/scripts/mkuboot.sh
10
11targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.lzo vmImage.xip 9targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.lzo vmImage.xip
12extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.xip 10extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.xip
13 11
14UIMAGE_OPTS-y := 12ifeq ($(CONFIG_RAMKERNEL),y)
15UIMAGE_OPTS-$(CONFIG_RAMKERNEL) += -a $(CONFIG_BOOT_LOAD) 13UIMAGE_LOADADDR = $(CONFIG_BOOT_LOAD)
16UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -a $(CONFIG_ROM_BASE) -x 14else # CONFIG_ROMKERNEL must be set
17 15UIMAGE_LOADADDR = $(CONFIG_ROM_BASE)
18quiet_cmd_uimage = UIMAGE $@ 16endif
19 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \ 17UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}')
20 -C $(2) -n '$(CPU_REV)-$(KERNELRELEASE)' \ 18UIMAGE_NAME = '$(CPU_REV)-$(KERNELRELEASE)'
21 -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \ 19UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -x
22 $(UIMAGE_OPTS-y) -d $< $@
23 20
24$(obj)/vmlinux.bin: vmlinux FORCE 21$(obj)/vmlinux.bin: vmlinux FORCE
25 $(call if_changed,objcopy) 22 $(call if_changed,objcopy)
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index 0c796cf81586..ca76ecdcf1a0 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -2,8 +2,6 @@
2# arch/microblaze/boot/Makefile 2# arch/microblaze/boot/Makefile
3# 3#
4 4
5MKIMAGE := $(srctree)/scripts/mkuboot.sh
6
7obj-y += linked_dtb.o 5obj-y += linked_dtb.o
8 6
9targets := linux.bin linux.bin.gz simpleImage.% 7targets := linux.bin linux.bin.gz simpleImage.%
@@ -35,11 +33,9 @@ quiet_cmd_strip = STRIP $@
35 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \ 33 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
36 -K _fdt_start vmlinux -o $@ 34 -K _fdt_start vmlinux -o $@
37 35
38quiet_cmd_uimage = UIMAGE $@.ub 36UIMAGE_IN = $@
39 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \ 37UIMAGE_OUT = $@.ub
40 -C none -n 'Linux-$(KERNELRELEASE)' \ 38UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
41 -a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
42 -d $@ $@.ub
43 39
44$(obj)/simpleImage.%: vmlinux FORCE 40$(obj)/simpleImage.%: vmlinux FORCE
45 $(call if_changed,cp,.unstrip) 41 $(call if_changed,cp,.unstrip)
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index e4ea31a62c55..58592dfa5cb6 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -8,8 +8,6 @@
8# Copyright (C) 1999 Stuart Menefy 8# Copyright (C) 1999 Stuart Menefy
9# 9#
10 10
11MKIMAGE := $(srctree)/scripts/mkuboot.sh
12
13# 11#
14# Assign safe dummy values if these variables are not defined, 12# Assign safe dummy values if these variables are not defined,
15# in order to suppress error message. 13# in order to suppress error message.
@@ -61,10 +59,8 @@ KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
61 $(KERNEL_MEMORY) + \ 59 $(KERNEL_MEMORY) + \
62 $(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]') 60 $(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
63 61
64quiet_cmd_uimage = UIMAGE $@ 62UIMAGE_LOADADDR = $(KERNEL_LOAD)
65 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ 63UIMAGE_ENTRYADDR = $(KERNEL_ENTRY)
66 -C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
67 -n 'Linux-$(KERNELRELEASE)' -d $< $@
68 64
69$(obj)/vmlinux.bin: vmlinux FORCE 65$(obj)/vmlinux.bin: vmlinux FORCE
70 $(call if_changed,objcopy) 66 $(call if_changed,objcopy)
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index 9205416b1e67..d56d199c1aa8 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -5,7 +5,6 @@
5 5
6ROOT_IMG := /usr/src/root.img 6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout 7ELFTOAOUT := elftoaout
8MKIMAGE := $(srctree)/scripts/mkuboot.sh
9 8
10hostprogs-y := piggyback btfixupprep 9hostprogs-y := piggyback btfixupprep
11targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout 10targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
@@ -92,11 +91,9 @@ $(obj)/image.bin: $(obj)/image FORCE
92$(obj)/image.gz: $(obj)/image.bin 91$(obj)/image.gz: $(obj)/image.bin
93 $(call if_changed,gzip) 92 $(call if_changed,gzip)
94 93
95quiet_cmd_uimage = UIMAGE $@ 94UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
96 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sparc -O linux -T kernel \ 95UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
97 -C gzip -a $(CONFIG_UBOOT_LOAD_ADDR) \ 96UIMAGE_COMPRESSION = gzip
98 -e $(CONFIG_UBOOT_ENTRY_ADDR) -n 'Linux-$(KERNELRELEASE)' \
99 -d $< $@
100 97
101quiet_cmd_uimage.o = UIMAGE.O $@ 98quiet_cmd_uimage.o = UIMAGE.O $@
102 cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \ 99 cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
diff --git a/arch/unicore32/boot/Makefile b/arch/unicore32/boot/Makefile
index 79e5f88845d9..ec7fb70b412b 100644
--- a/arch/unicore32/boot/Makefile
+++ b/arch/unicore32/boot/Makefile
@@ -11,8 +11,6 @@
11# Copyright (C) 2001~2010 GUAN Xue-tao 11# Copyright (C) 2001~2010 GUAN Xue-tao
12# 12#
13 13
14MKIMAGE := $(srctree)/scripts/mkuboot.sh
15
16targets := Image zImage uImage 14targets := Image zImage uImage
17 15
18$(obj)/Image: vmlinux FORCE 16$(obj)/Image: vmlinux FORCE
@@ -26,14 +24,8 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
26 $(call if_changed,objcopy) 24 $(call if_changed,objcopy)
27 @echo ' Kernel: $@ is ready' 25 @echo ' Kernel: $@ is ready'
28 26
29quiet_cmd_uimage = UIMAGE $@ 27UIMAGE_ARCH = unicore
30 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A unicore -O linux -T kernel \ 28UIMAGE_LOADADDR = 0x0
31 -C none -a $(LOADADDR) -e $(STARTADDR) \
32 -n 'Linux-$(KERNELRELEASE)' -d $< $@
33
34$(obj)/uImage: LOADADDR=0x0
35
36$(obj)/uImage: STARTADDR=$(LOADADDR)
37 29
38$(obj)/uImage: $(obj)/zImage FORCE 30$(obj)/uImage: $(obj)/zImage FORCE
39 $(call if_changed,uimage) 31 $(call if_changed,uimage)