xref: /linux/arch/arm/boot/compressed/Makefile (revision 3bd2cbb95543acf44fe123eb9f038de54e655eb4)
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
9f45b1149SSimon 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 Hormanifeq ($(CONFIG_ARCH_SH7372),y)
14f45b1149SSimon HormanOBJS		+= mmcif-sh7372.o
15f45b1149SSimon Hormanendif
16f45b1149SSimon Hormanendif
17f45b1149SSimon Horman
18e69edc79SEric MiaoAFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
191da177e4SLinus TorvaldsHEAD	= head.o
20f45b1149SSimon HormanOBJS	+= misc.o decompress.o
214486b863SRussell KingFONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
221da177e4SLinus Torvalds
231da177e4SLinus Torvalds#
241da177e4SLinus Torvalds# Architecture dependencies
251da177e4SLinus Torvalds#
261da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_ACORN),y)
274486b863SRussell KingOBJS		+= ll_char_wr.o font.o
281da177e4SLinus Torvaldsendif
291da177e4SLinus Torvalds
301da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_SHARK),y)
311da177e4SLinus TorvaldsOBJS		+= head-shark.o ofw-shark.o
321da177e4SLinus Torvaldsendif
331da177e4SLinus Torvalds
341da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_P720T),y)
351da177e4SLinus Torvalds# Borrow this code from SA1100
361da177e4SLinus TorvaldsOBJS		+= head-sa1100.o
371da177e4SLinus Torvaldsendif
381da177e4SLinus Torvalds
391da177e4SLinus Torvaldsifeq ($(CONFIG_ARCH_SA1100),y)
401da177e4SLinus TorvaldsOBJS		+= head-sa1100.o
411da177e4SLinus Torvaldsendif
421da177e4SLinus Torvalds
4321f47fbcSAlexey Charkovifeq ($(CONFIG_ARCH_VT8500),y)
4421f47fbcSAlexey CharkovOBJS		+= head-vt8500.o
4521f47fbcSAlexey Charkovendif
4621f47fbcSAlexey Charkov
471da177e4SLinus Torvaldsifeq ($(CONFIG_CPU_XSCALE),y)
481da177e4SLinus TorvaldsOBJS		+= head-xscale.o
491da177e4SLinus Torvaldsendif
501da177e4SLinus Torvalds
519c3fca2eSEric Miaoifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y)
521da177e4SLinus TorvaldsOBJS		+= head-sharpsl.o
531da177e4SLinus Torvaldsendif
541da177e4SLinus Torvalds
5526584853SCatalin Marinasifeq ($(CONFIG_CPU_ENDIAN_BE32),y)
56f12d0d7cSHyok S. Choiifeq ($(CONFIG_CPU_CP15),y)
571da177e4SLinus TorvaldsOBJS		+= big-endian.o
58f12d0d7cSHyok S. Choielse
59f12d0d7cSHyok S. Choi# The endian should be set by h/w design.
60f12d0d7cSHyok S. Choiendif
611da177e4SLinus Torvaldsendif
621da177e4SLinus Torvalds
639a4af112SKuninori Morimotoifeq ($(CONFIG_ARCH_SHMOBILE),y)
649a4af112SKuninori MorimotoOBJS		+= head-shmobile.o
659a4af112SKuninori Morimotoendif
669a4af112SKuninori Morimoto
671da177e4SLinus Torvalds#
681da177e4SLinus Torvalds# We now have a PIC decompressor implementation.  Decompressors running
691da177e4SLinus Torvalds# from RAM should not define ZTEXTADDR.  Decompressors running directly
701da177e4SLinus Torvalds# from ROM or Flash must define ZTEXTADDR (preferably via the config)
711da177e4SLinus Torvalds# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
721da177e4SLinus Torvaldsifeq ($(CONFIG_ZBOOT_ROM),y)
731da177e4SLinus TorvaldsZTEXTADDR	:= $(CONFIG_ZBOOT_ROM_TEXT)
741da177e4SLinus TorvaldsZBSSADDR	:= $(CONFIG_ZBOOT_ROM_BSS)
751da177e4SLinus Torvaldselse
761da177e4SLinus TorvaldsZTEXTADDR	:= 0
77*3bd2cbb9SNicolas PitreZBSSADDR	:= ALIGN(8)
781da177e4SLinus Torvaldsendif
791da177e4SLinus Torvalds
801da177e4SLinus TorvaldsSEDFLAGS	= s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
811da177e4SLinus Torvalds
82e7db7b42SAlbin Tonnerresuffix_$(CONFIG_KERNEL_GZIP) = gzip
83e7db7b42SAlbin Tonnerresuffix_$(CONFIG_KERNEL_LZO)  = lzo
846e8699f7SAlbin Tonnerresuffix_$(CONFIG_KERNEL_LZMA) = lzma
85e7db7b42SAlbin Tonnerre
86e7db7b42SAlbin Tonnerretargets       := vmlinux vmlinux.lds \
87e7db7b42SAlbin Tonnerre		 piggy.$(suffix_y) piggy.$(suffix_y).o \
88e7db7b42SAlbin Tonnerre		 font.o font.c head.o misc.o $(OBJS)
89014c257cSAbhishek Sagar
90f1b957d3SMagnus Damm# Make sure files are removed during clean
91f1b957d3SMagnus Dammextra-y       += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S
92f1b957d3SMagnus Damm
93606576ceSSteven Rostedtifeq ($(CONFIG_FUNCTION_TRACER),y)
94014c257cSAbhishek SagarORIG_CFLAGS := $(KBUILD_CFLAGS)
95014c257cSAbhishek SagarKBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
96014c257cSAbhishek Sagarendif
97014c257cSAbhishek Sagar
9821f0b311Smatt mooneyccflags-y := -fpic -fno-builtin
9921f0b311Smatt mooneyasflags-y := -Wa,-march=all
1001da177e4SLinus Torvalds
101d239b1dcSNicolas Pitre# Provide size of uncompressed kernel to the decompressor via a linker symbol.
1021cf7cf06SNicolas PitreLDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
1039e84ed63SRussell King# Supply ZRELADDR to the decompressor via a linker symbol.
1049e84ed63SRussell Kingifneq ($(CONFIG_AUTO_ZRELADDR),y)
105d239b1dcSNicolas PitreLDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
1069e84ed63SRussell Kingendif
10726584853SCatalin Marinasifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
10826584853SCatalin MarinasLDFLAGS_vmlinux += --be8
10926584853SCatalin Marinasendif
110e7db7b42SAlbin Tonnerre# ?
111e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -p
112e7db7b42SAlbin Tonnerre# Report unresolved symbol references
113e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += --no-undefined
114e7db7b42SAlbin Tonnerre# Delete all temporary local symbols
115e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -X
116e7db7b42SAlbin Tonnerre# Next argument is a linker script
117e7db7b42SAlbin TonnerreLDFLAGS_vmlinux += -T
118e7db7b42SAlbin Tonnerre
119e7db7b42SAlbin Tonnerre# For __aeabi_uidivmod
120e7db7b42SAlbin Tonnerrelib1funcs = $(obj)/lib1funcs.o
121e7db7b42SAlbin Tonnerre
122e7db7b42SAlbin Tonnerre$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
123e7db7b42SAlbin Tonnerre	$(call cmd,shipped)
1241da177e4SLinus Torvalds
125e7db7b42SAlbin Tonnerre$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
126e7db7b42SAlbin Tonnerre	 	$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
1271da177e4SLinus Torvalds	$(call if_changed,ld)
1281da177e4SLinus Torvalds	@:
1291da177e4SLinus Torvalds
130e7db7b42SAlbin Tonnerre$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
131e7db7b42SAlbin Tonnerre	$(call if_changed,$(suffix_y))
1321da177e4SLinus Torvalds
133e7db7b42SAlbin Tonnerre$(obj)/piggy.$(suffix_y).o:  $(obj)/piggy.$(suffix_y) FORCE
1341da177e4SLinus Torvalds
1354486b863SRussell KingCFLAGS_font.o := -Dstatic=
1364486b863SRussell King
1374486b863SRussell King$(obj)/font.c: $(FONTC)
1384486b863SRussell King	$(call cmd,shipped)
1391da177e4SLinus Torvalds
140d93c333dSRussell King$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
1411da177e4SLinus Torvalds	@sed "$(SEDFLAGS)" < $< > $@
142