11da177e4SLinus Torvalds# 21da177e4SLinus Torvalds# linux/arch/arm/boot/compressed/Makefile 31da177e4SLinus Torvalds# 41da177e4SLinus Torvalds# create a compressed vmlinuz image from the original vmlinux 51da177e4SLinus Torvalds# 61da177e4SLinus Torvalds 7f45b1149SSimon HormanOBJS = 8f45b1149SSimon Horman 9*090ab3ffSSimon Horman# Ensure that MMCIF loader code appears early in the image 10f45b1149SSimon Horman# to minimise that number of bocks that have to be read in 11f45b1149SSimon Horman# order to load it. 12f45b1149SSimon Hormanifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y) 13f45b1149SSimon HormanOBJS += mmcif-sh7372.o 14f45b1149SSimon Hormanendif 15*090ab3ffSSimon Horman 16*090ab3ffSSimon Horman# Ensure that SDHI loader code appears early in the image 17*090ab3ffSSimon Horman# to minimise that number of bocks that have to be read in 18*090ab3ffSSimon Horman# order to load it. 19*090ab3ffSSimon Hormanifeq ($(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI),y) 20*090ab3ffSSimon HormanOBJS += sdhi-shmobile.o 21*090ab3ffSSimon HormanOBJS += sdhi-sh7372.o 22f45b1149SSimon Hormanendif 23f45b1149SSimon Horman 24e69edc79SEric MiaoAFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) 251da177e4SLinus TorvaldsHEAD = head.o 26f45b1149SSimon HormanOBJS += misc.o decompress.o 274486b863SRussell KingFONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 281da177e4SLinus Torvalds 291da177e4SLinus Torvalds# 301da177e4SLinus Torvalds# Architecture dependencies 311da177e4SLinus Torvalds# 321da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_ACORN),y) 334486b863SRussell KingOBJS += ll_char_wr.o font.o 341da177e4SLinus Torvaldsendif 351da177e4SLinus Torvalds 361da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_SHARK),y) 371da177e4SLinus TorvaldsOBJS += head-shark.o ofw-shark.o 381da177e4SLinus Torvaldsendif 391da177e4SLinus Torvalds 401da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_P720T),y) 411da177e4SLinus Torvalds# Borrow this code from SA1100 421da177e4SLinus TorvaldsOBJS += head-sa1100.o 431da177e4SLinus Torvaldsendif 441da177e4SLinus Torvalds 451da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_SA1100),y) 461da177e4SLinus TorvaldsOBJS += head-sa1100.o 471da177e4SLinus Torvaldsendif 481da177e4SLinus Torvalds 4921f47fbcSAlexey Charkovifeq ($(CONFIG_ARCH_VT8500),y) 5021f47fbcSAlexey CharkovOBJS += head-vt8500.o 5121f47fbcSAlexey Charkovendif 5221f47fbcSAlexey Charkov 531da177e4SLinus Torvaldsifeq ($(CONFIG_CPU_XSCALE),y) 541da177e4SLinus TorvaldsOBJS += head-xscale.o 551da177e4SLinus Torvaldsendif 561da177e4SLinus Torvalds 579c3fca2eSEric Miaoifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y) 581da177e4SLinus TorvaldsOBJS += head-sharpsl.o 591da177e4SLinus Torvaldsendif 601da177e4SLinus Torvalds 6126584853SCatalin Marinasifeq ($(CONFIG_CPU_ENDIAN_BE32),y) 62f12d0d7cSHyok S. Choiifeq ($(CONFIG_CPU_CP15),y) 631da177e4SLinus TorvaldsOBJS += big-endian.o 64f12d0d7cSHyok S. Choielse 65f12d0d7cSHyok S. Choi# The endian should be set by h/w design. 66f12d0d7cSHyok S. Choiendif 671da177e4SLinus Torvaldsendif 681da177e4SLinus Torvalds 699a4af112SKuninori Morimotoifeq ($(CONFIG_ARCH_SHMOBILE),y) 709a4af112SKuninori MorimotoOBJS += head-shmobile.o 719a4af112SKuninori Morimotoendif 729a4af112SKuninori Morimoto 731da177e4SLinus Torvalds# 741da177e4SLinus Torvalds# We now have a PIC decompressor implementation. Decompressors running 751da177e4SLinus Torvalds# from RAM should not define ZTEXTADDR. Decompressors running directly 761da177e4SLinus Torvalds# from ROM or Flash must define ZTEXTADDR (preferably via the config) 771da177e4SLinus Torvalds# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK 781da177e4SLinus Torvaldsifeq ($(CONFIG_ZBOOT_ROM),y) 791da177e4SLinus TorvaldsZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT) 801da177e4SLinus TorvaldsZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) 811da177e4SLinus Torvaldselse 821da177e4SLinus TorvaldsZTEXTADDR := 0 833bd2cbb9SNicolas PitreZBSSADDR := ALIGN(8) 841da177e4SLinus Torvaldsendif 851da177e4SLinus Torvalds 861da177e4SLinus TorvaldsSEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 871da177e4SLinus Torvalds 88e7db7b42SAlbin Tonnerresuffix_$(CONFIG_KERNEL_GZIP) = gzip 89e7db7b42SAlbin Tonnerresuffix_$(CONFIG_KERNEL_LZO) = lzo 906e8699f7SAlbin Tonnerresuffix_$(CONFIG_KERNEL_LZMA) = lzma 91e7db7b42SAlbin Tonnerre 92e7db7b42SAlbin Tonnerretargets := vmlinux vmlinux.lds \ 93e7db7b42SAlbin Tonnerre piggy.$(suffix_y) piggy.$(suffix_y).o \ 94e7db7b42SAlbin Tonnerre font.o font.c head.o misc.o $(OBJS) 95014c257cSAbhishek Sagar 96f1b957d3SMagnus Damm# Make sure files are removed during clean 97f1b957d3SMagnus Dammextra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S 98f1b957d3SMagnus Damm 99606576ceSSteven Rostedtifeq ($(CONFIG_FUNCTION_TRACER),y) 100014c257cSAbhishek SagarORIG_CFLAGS := $(KBUILD_CFLAGS) 101014c257cSAbhishek SagarKBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 102014c257cSAbhishek Sagarendif 103014c257cSAbhishek Sagar 10421f0b311Smatt mooneyccflags-y := -fpic -fno-builtin 10521f0b311Smatt mooneyasflags-y := -Wa,-march=all 1061da177e4SLinus Torvalds 1079e84ed63SRussell King# Supply ZRELADDR to the decompressor via a linker symbol. 1089e84ed63SRussell Kingifneq ($(CONFIG_AUTO_ZRELADDR),y) 109d239b1dcSNicolas PitreLDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) 1109e84ed63SRussell Kingendif 11126584853SCatalin Marinasifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 11226584853SCatalin MarinasLDFLAGS_vmlinux += --be8 11326584853SCatalin Marinasendif 114e7db7b42SAlbin Tonnerre# ? 115e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -p 116e7db7b42SAlbin Tonnerre# Report unresolved symbol references 117e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += --no-undefined 118e7db7b42SAlbin Tonnerre# Delete all temporary local symbols 119e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -X 120e7db7b42SAlbin Tonnerre# Next argument is a linker script 121e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -T 122e7db7b42SAlbin Tonnerre 123e7db7b42SAlbin Tonnerre# For __aeabi_uidivmod 124e7db7b42SAlbin Tonnerrelib1funcs = $(obj)/lib1funcs.o 125e7db7b42SAlbin Tonnerre 126e7db7b42SAlbin Tonnerre$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE 127e7db7b42SAlbin Tonnerre $(call cmd,shipped) 1281da177e4SLinus Torvalds 1298d7e4cc2SNicolas Pitre# We need to prevent any GOTOFF relocs being used with references 1308d7e4cc2SNicolas Pitre# to symbols in the .bss section since we cannot relocate them 1318d7e4cc2SNicolas Pitre# independently from the rest at run time. This can be achieved by 1328d7e4cc2SNicolas Pitre# ensuring that no private .bss symbols exist, as global symbols 1338d7e4cc2SNicolas Pitre# always have a GOT entry which is what we need. 1348d7e4cc2SNicolas Pitre# The .data section is already discarded by the linker script so no need 1358d7e4cc2SNicolas Pitre# to bother about it here. 1368d7e4cc2SNicolas Pitrecheck_for_bad_syms = \ 1378d7e4cc2SNicolas Pitrebad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ 1388d7e4cc2SNicolas Pitre[ -z "$$bad_syms" ] || \ 1398d7e4cc2SNicolas Pitre ( echo "following symbols must have non local/private scope:" >&2; \ 1408d7e4cc2SNicolas Pitre echo "$$bad_syms" >&2; rm -f $@; false ) 1418d7e4cc2SNicolas Pitre 142e7db7b42SAlbin Tonnerre$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 143e7db7b42SAlbin Tonnerre $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 1441da177e4SLinus Torvalds $(call if_changed,ld) 1458d7e4cc2SNicolas Pitre @$(check_for_bad_syms) 1461da177e4SLinus Torvalds 147e7db7b42SAlbin Tonnerre$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE 148e7db7b42SAlbin Tonnerre $(call if_changed,$(suffix_y)) 1491da177e4SLinus Torvalds 150e7db7b42SAlbin Tonnerre$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE 1511da177e4SLinus Torvalds 1524486b863SRussell KingCFLAGS_font.o := -Dstatic= 1534486b863SRussell King 1544486b863SRussell King$(obj)/font.c: $(FONTC) 1554486b863SRussell King $(call cmd,shipped) 1561da177e4SLinus Torvalds 157d93c333dSRussell King$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG) 1581da177e4SLinus Torvalds @sed "$(SEDFLAGS)" < $< > $@ 159