xref: /linux/arch/arm/boot/compressed/Makefile (revision ad0f7cfaa85fc033523a09ab1f3dd6b8ded3dff5)
1#
2# linux/arch/arm/boot/compressed/Makefile
3#
4# create a compressed vmlinuz image from the original vmlinux
5#
6
7AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
8HEAD	= head.o
9OBJS	= misc.o decompress.o
10FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
11
12#
13# Architecture dependencies
14#
15ifeq ($(CONFIG_ARCH_ACORN),y)
16OBJS		+= ll_char_wr.o font.o
17endif
18
19ifeq ($(CONFIG_ARCH_SHARK),y)
20OBJS		+= head-shark.o ofw-shark.o
21endif
22
23ifeq ($(CONFIG_ARCH_P720T),y)
24# Borrow this code from SA1100
25OBJS		+= head-sa1100.o
26endif
27
28ifeq ($(CONFIG_ARCH_SA1100),y)
29OBJS		+= head-sa1100.o
30endif
31
32ifeq ($(CONFIG_CPU_XSCALE),y)
33OBJS		+= head-xscale.o
34endif
35
36ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y)
37OBJS		+= head-sharpsl.o
38endif
39
40ifeq ($(CONFIG_CPU_ENDIAN_BE32),y)
41ifeq ($(CONFIG_CPU_CP15),y)
42OBJS		+= big-endian.o
43else
44# The endian should be set by h/w design.
45endif
46endif
47
48#
49# We now have a PIC decompressor implementation.  Decompressors running
50# from RAM should not define ZTEXTADDR.  Decompressors running directly
51# from ROM or Flash must define ZTEXTADDR (preferably via the config)
52# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
53ifeq ($(CONFIG_ZBOOT_ROM),y)
54ZTEXTADDR	:= $(CONFIG_ZBOOT_ROM_TEXT)
55ZBSSADDR	:= $(CONFIG_ZBOOT_ROM_BSS)
56else
57ZTEXTADDR	:= 0
58ZBSSADDR	:= ALIGN(4)
59endif
60
61SEDFLAGS	= s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
62
63suffix_$(CONFIG_KERNEL_GZIP) = gzip
64suffix_$(CONFIG_KERNEL_LZO)  = lzo
65suffix_$(CONFIG_KERNEL_LZMA) = lzma
66
67targets       := vmlinux vmlinux.lds \
68		 piggy.$(suffix_y) piggy.$(suffix_y).o \
69		 font.o font.c head.o misc.o $(OBJS)
70
71# Make sure files are removed during clean
72extra-y       += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S
73
74ifeq ($(CONFIG_FUNCTION_TRACER),y)
75ORIG_CFLAGS := $(KBUILD_CFLAGS)
76KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
77endif
78
79EXTRA_CFLAGS  := -fpic -fno-builtin
80EXTRA_AFLAGS  := -Wa,-march=all
81
82# Supply ZRELADDR to the decompressor via a linker symbol.
83ifneq ($(CONFIG_AUTO_ZRELADDR),y)
84LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR)
85endif
86ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
87LDFLAGS_vmlinux += --be8
88endif
89# ?
90LDFLAGS_vmlinux += -p
91# Report unresolved symbol references
92LDFLAGS_vmlinux += --no-undefined
93# Delete all temporary local symbols
94LDFLAGS_vmlinux += -X
95# Next argument is a linker script
96LDFLAGS_vmlinux += -T
97
98# For __aeabi_uidivmod
99lib1funcs = $(obj)/lib1funcs.o
100
101$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
102	$(call cmd,shipped)
103
104$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
105	 	$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
106	$(call if_changed,ld)
107	@:
108
109$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
110	$(call if_changed,$(suffix_y))
111
112$(obj)/piggy.$(suffix_y).o:  $(obj)/piggy.$(suffix_y) FORCE
113
114CFLAGS_font.o := -Dstatic=
115
116$(obj)/font.c: $(FONTC)
117	$(call cmd,shipped)
118
119$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
120	@sed "$(SEDFLAGS)" < $< > $@
121