xref: /openbmc/linux/arch/arm/boot/compressed/Makefile (revision 606576ce)
1#
2# linux/arch/arm/boot/compressed/Makefile
3#
4# create a compressed vmlinuz image from the original vmlinux
5#
6
7HEAD	= head.o
8OBJS	= misc.o
9FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
10
11#
12# Architecture dependencies
13#
14ifeq ($(CONFIG_ARCH_ACORN),y)
15OBJS		+= ll_char_wr.o font.o
16endif
17
18ifeq ($(CONFIG_ARCH_SHARK),y)
19OBJS		+= head-shark.o ofw-shark.o
20endif
21
22ifeq ($(CONFIG_ARCH_L7200),y)
23OBJS		+= head-l7200.o
24endif
25
26ifeq ($(CONFIG_ARCH_CLPS7500),y)
27HEAD		= head-clps7500.o
28endif
29
30ifeq ($(CONFIG_ARCH_P720T),y)
31# Borrow this code from SA1100
32OBJS		+= head-sa1100.o
33endif
34
35ifeq ($(CONFIG_ARCH_SA1100),y)
36OBJS		+= head-sa1100.o
37endif
38
39ifeq ($(CONFIG_CPU_XSCALE),y)
40OBJS		+= head-xscale.o
41endif
42
43ifeq ($(CONFIG_PXA_SHARPSL),y)
44OBJS		+= head-sharpsl.o
45endif
46
47ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
48ifeq ($(CONFIG_CPU_CP15),y)
49OBJS		+= big-endian.o
50else
51# The endian should be set by h/w design.
52endif
53endif
54
55#
56# We now have a PIC decompressor implementation.  Decompressors running
57# from RAM should not define ZTEXTADDR.  Decompressors running directly
58# from ROM or Flash must define ZTEXTADDR (preferably via the config)
59# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
60ifeq ($(CONFIG_ZBOOT_ROM),y)
61ZTEXTADDR	:= $(CONFIG_ZBOOT_ROM_TEXT)
62ZBSSADDR	:= $(CONFIG_ZBOOT_ROM_BSS)
63else
64ZTEXTADDR	:= 0
65ZBSSADDR	:= ALIGN(4)
66endif
67
68SEDFLAGS	= s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
69
70targets       := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \
71		 head.o misc.o $(OBJS)
72
73ifeq ($(CONFIG_FUNCTION_TRACER),y)
74ORIG_CFLAGS := $(KBUILD_CFLAGS)
75KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
76endif
77
78EXTRA_CFLAGS  := -fpic -fno-builtin
79EXTRA_AFLAGS  := -Wa,-march=all
80
81# Supply ZRELADDR, INITRD_PHYS and PARAMS_PHYS to the decompressor via
82# linker symbols.  We only define initrd_phys and params_phys if the
83# machine class defined the corresponding makefile variable.
84LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR)
85ifneq ($(INITRD_PHYS),)
86LDFLAGS_vmlinux += --defsym initrd_phys=$(INITRD_PHYS)
87endif
88ifneq ($(PARAMS_PHYS),)
89LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
90endif
91LDFLAGS_vmlinux += -p --no-undefined -X \
92	$(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T
93
94# Don't allow any static data in misc.o, which
95# would otherwise mess up our GOT table
96CFLAGS_misc.o := -Dstatic=
97
98$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
99	 	$(addprefix $(obj)/, $(OBJS)) FORCE
100	$(call if_changed,ld)
101	@:
102
103$(obj)/piggy.gz: $(obj)/../Image FORCE
104	$(call if_changed,gzip)
105
106$(obj)/piggy.o:  $(obj)/piggy.gz FORCE
107
108CFLAGS_font.o := -Dstatic=
109
110$(obj)/font.c: $(FONTC)
111	$(call cmd,shipped)
112
113$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
114	@sed "$(SEDFLAGS)" < $< > $@
115