aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/boot/compressed/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/boot/compressed/Makefile')
-rw-r--r--arch/mips/boot/compressed/Makefile155
1 files changed, 155 insertions, 0 deletions
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
new file mode 100644
index 000000000..eae0fad30
--- /dev/null
+++ b/arch/mips/boot/compressed/Makefile
@@ -0,0 +1,155 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.
4#
5# Adapted for MIPS Pete Popov, Dan Malek
6#
7# Copyright (C) 1994 by Linus Torvalds
8# Adapted for PowerPC by Gary Thomas
9# modified by Cort (cort@cs.nmt.edu)
10#
11# Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University
12# Author: Wu Zhangjin <wuzhangjin@gmail.com>
13#
14
15include $(srctree)/arch/mips/Kbuild.platforms
16
17# set the default size of the mallocing area for decompressing
18BOOT_HEAP_SIZE := 0x400000
19
20# Disable Function Tracer
21KBUILD_CFLAGS := $(filter-out -pg, $(KBUILD_CFLAGS))
22
23KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS))
24
25# Disable lq/sq in zboot
26ifdef CONFIG_CPU_LOONGSON64
27KBUILD_CFLAGS := $(filter-out -march=loongson3a, $(KBUILD_CFLAGS)) -march=mips64r2
28endif
29
30KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ -D__DISABLE_EXPORTS \
31 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
32
33KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
34 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
35 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
36
37# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
38KCOV_INSTRUMENT := n
39UBSAN_SANITIZE := n
40
41# decompressor objects (linked with vmlinuz)
42vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/bswapsi.o
43
44ifdef CONFIG_DEBUG_ZBOOT
45vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) += $(obj)/dbg.o
46vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
47vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM) += $(obj)/uart-prom.o
48vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
49vmlinuzobjs-$(CONFIG_ATH79) += $(obj)/uart-ath79.o
50endif
51
52extra-y += uart-ath79.c
53$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
54 $(call cmd,shipped)
55
56vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
57
58extra-y += ashldi3.c
59$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
60 $(call if_changed,shipped)
61
62extra-y += bswapsi.c
63$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
64 $(call if_changed,shipped)
65
66targets := $(notdir $(vmlinuzobjs-y))
67
68targets += vmlinux.bin
69OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
70$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
71 $(call if_changed,objcopy)
72
73tool_$(CONFIG_KERNEL_GZIP) = gzip
74tool_$(CONFIG_KERNEL_BZIP2) = bzip2
75tool_$(CONFIG_KERNEL_LZ4) = lz4
76tool_$(CONFIG_KERNEL_LZMA) = lzma
77tool_$(CONFIG_KERNEL_LZO) = lzo
78tool_$(CONFIG_KERNEL_XZ) = xzkern
79tool_$(CONFIG_KERNEL_ZSTD) = zstd22
80
81targets += vmlinux.bin.z
82$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
83 $(call if_changed,$(tool_y))
84
85targets += piggy.o dummy.o
86OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
87 --set-section-flags=.image=contents,alloc,load,readonly,data
88$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
89 $(call if_changed,objcopy)
90
91HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE)
92
93# Calculate the load address of the compressed kernel image
94hostprogs := calc_vmlinuz_load_addr
95
96ifneq ($(zload-y),)
97VMLINUZ_LOAD_ADDRESS := $(zload-y)
98else
99VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
100 $(obj)/vmlinux.bin $(LINKER_LOAD_ADDRESS))
101endif
102UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
103
104vmlinuzobjs-y += $(obj)/piggy.o
105
106quiet_cmd_zld = LD $@
107 cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
108quiet_cmd_strip = STRIP $@
109 cmd_strip = $(STRIP) -s $@
110vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
111 $(call cmd,zld)
112 $(call cmd,strip)
113
114#
115# Some DECstations need all possible sections of an ECOFF executable
116#
117ifdef CONFIG_MACH_DECSTATION
118 e2eflag := -a
119endif
120
121# elf2ecoff can only handle 32bit image
122hostprogs += ../elf2ecoff
123
124ifdef CONFIG_32BIT
125 VMLINUZ = vmlinuz
126else
127 VMLINUZ = vmlinuz.32
128endif
129
130quiet_cmd_32 = OBJCOPY $@
131 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
132vmlinuz.32: vmlinuz
133 $(call cmd,32)
134
135quiet_cmd_ecoff = ECOFF $@
136 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
137vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
138 $(call cmd,ecoff)
139
140OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
141vmlinuz.bin: vmlinuz
142 $(call cmd,objcopy)
143
144OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
145vmlinuz.srec: vmlinuz
146 $(call cmd,objcopy)
147
148uzImage.bin: vmlinuz.bin FORCE
149 $(call if_changed,uimage,none)
150
151clean-files += $(objtree)/vmlinuz
152clean-files += $(objtree)/vmlinuz.32
153clean-files += $(objtree)/vmlinuz.ecoff
154clean-files += $(objtree)/vmlinuz.bin
155clean-files += $(objtree)/vmlinuz.srec