Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3393645 authored by Stephen Warren's avatar Stephen Warren Committed by Michal Marek
Browse files

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: default avatarStephen Warren <swarren@wwwdotorg.org>
Acked-by: default avatarNicolas 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: default avatarMichal Marek <mmarek@suse.cz>
parent f75a8df3
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@
# Copyright (C) 1995-2002 Russell King
#

MKIMAGE         := $(srctree)/scripts/mkuboot.sh

ifneq ($(MACHINE),)
include $(srctree)/$(MACHINE)/Makefile.boot
endif
@@ -69,22 +67,19 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))

clean-files := *.dtb

quiet_cmd_uimage = UIMAGE  $@
      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
		   -C none -a $(LOADADDR) -e $(STARTADDR) \
		   -n 'Linux-$(KERNELRELEASE)' -d $< $@

ifneq ($(LOADADDR),)
  UIMAGE_LOADADDR=$(LOADADDR)
else
  ifeq ($(CONFIG_ZBOOT_ROM),y)
$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
    UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
  else
$(obj)/uImage: LOADADDR=$(ZRELADDR)
    UIMAGE_LOADADDR=$(ZRELADDR)
  endif
endif

$(obj)/uImage: STARTADDR=$(LOADADDR)

check_for_multiple_loadaddr = \
if [ $(words $(LOADADDR)) -gt 1 ]; then \
	echo 'multiple load addresses: $(LOADADDR)'; \
if [ $(words $(UIMAGE_LOADADDR)) -gt 1 ]; then \
	echo 'multiple load addresses: $(UIMAGE_LOADADDR)'; \
	echo 'This is incompatible with uImages'; \
	echo 'Specify LOADADDR on the commandline to build an uImage'; \
	false; \
+3 −6
Original line number Diff line number Diff line
@@ -6,8 +6,6 @@
# for more details.
#

MKIMAGE		:= $(srctree)/scripts/mkuboot.sh

extra-y		:= vmlinux.bin vmlinux.gz

OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note.gnu.build-id
@@ -17,10 +15,9 @@ $(obj)/vmlinux.bin: vmlinux FORCE
$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
	$(call if_changed,gzip)

quiet_cmd_uimage = UIMAGE $@
      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T kernel	\
		-C gzip -a $(CONFIG_LOAD_ADDRESS) -e $(CONFIG_ENTRY_ADDRESS)	\
		-n 'Linux-$(KERNELRELEASE)' -d $< $@
UIMAGE_LOADADDR = $(CONFIG_LOAD_ADDRESS)
UIMAGE_ENTRYADDR = $(CONFIG_ENTRY_ADDRESS)
UIMAGE_COMPRESSION = gzip

targets += uImage uImage.srec
$(obj)/uImage: $(obj)/vmlinux.gz
+8 −11
Original line number Diff line number Diff line
@@ -6,20 +6,17 @@
# for more details.
#

MKIMAGE := $(srctree)/scripts/mkuboot.sh

targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.lzo vmImage.xip
extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.xip

UIMAGE_OPTS-y :=
UIMAGE_OPTS-$(CONFIG_RAMKERNEL) += -a $(CONFIG_BOOT_LOAD)
UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -a $(CONFIG_ROM_BASE) -x

quiet_cmd_uimage = UIMAGE  $@
      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \
                   -C $(2) -n '$(CPU_REV)-$(KERNELRELEASE)' \
                   -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \
                   $(UIMAGE_OPTS-y) -d $< $@
ifeq ($(CONFIG_RAMKERNEL),y)
UIMAGE_LOADADDR = $(CONFIG_BOOT_LOAD)
else # CONFIG_ROMKERNEL must be set
UIMAGE_LOADADDR = $(CONFIG_ROM_BASE)
endif
UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}')
UIMAGE_NAME = '$(CPU_REV)-$(KERNELRELEASE)'
UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -x

$(obj)/vmlinux.bin: vmlinux FORCE
	$(call if_changed,objcopy)
+3 −7
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@
# arch/microblaze/boot/Makefile
#

MKIMAGE := $(srctree)/scripts/mkuboot.sh

obj-y += linked_dtb.o

targets := linux.bin linux.bin.gz simpleImage.%
@@ -35,11 +33,9 @@ quiet_cmd_strip = STRIP $@
	cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
				-K _fdt_start vmlinux -o $@

quiet_cmd_uimage = UIMAGE  $@.ub
	cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
		-C none -n 'Linux-$(KERNELRELEASE)' \
		-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
		-d $@ $@.ub
UIMAGE_IN = $@
UIMAGE_OUT = $@.ub
UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)

$(obj)/simpleImage.%: vmlinux FORCE
	$(call if_changed,cp,.unstrip)
+2 −6
Original line number Diff line number Diff line
@@ -8,8 +8,6 @@
# Copyright (C) 1999 Stuart Menefy
#

MKIMAGE := $(srctree)/scripts/mkuboot.sh

#
# Assign safe dummy values if these variables are not defined,
# in order to suppress error message.
@@ -61,10 +59,8 @@ KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
			$(KERNEL_MEMORY) + \
			$(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')

quiet_cmd_uimage = UIMAGE  $@
      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
		   -C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
		   -n 'Linux-$(KERNELRELEASE)' -d $< $@
UIMAGE_LOADADDR = $(KERNEL_LOAD)
UIMAGE_ENTRYADDR = $(KERNEL_ENTRY)

$(obj)/vmlinux.bin: vmlinux FORCE
	$(call if_changed,objcopy)
Loading