Linux 4.1.18
[linux/fpc-iii.git] / arch / mips / boot / compressed / Makefile
blobdc91bde10d622e3d3fd90f77646f33f3232b6a9b
2 # This file is subject to the terms and conditions of the GNU General Public
3 # License.
5 # Adapted for MIPS Pete Popov, Dan Malek
7 # Copyright (C) 1994 by Linus Torvalds
8 # Adapted for PowerPC by Gary Thomas
9 # modified by Cort (cort@cs.nmt.edu)
11 # Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University
12 # Author: Wu Zhangjin <wuzhangjin@gmail.com>
15 include $(srctree)/arch/mips/Kbuild.platforms
17 # set the default size of the mallocing area for decompressing
18 BOOT_HEAP_SIZE := 0x400000
20 # Disable Function Tracer
21 KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
23 KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS))
25 KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
26 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
28 KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
29 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
30 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
32 targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
34 # decompressor objects (linked with vmlinuz)
35 vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
37 ifdef CONFIG_DEBUG_ZBOOT
38 vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) += $(obj)/dbg.o
39 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
40 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
41 endif
43 ifdef CONFIG_KERNEL_XZ
44 vmlinuzobjs-y += $(obj)/../../lib/ashldi3.o
45 endif
47 targets += vmlinux.bin
48 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
49 $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
50 $(call if_changed,objcopy)
52 tool_$(CONFIG_KERNEL_GZIP) = gzip
53 tool_$(CONFIG_KERNEL_BZIP2) = bzip2
54 tool_$(CONFIG_KERNEL_LZ4) = lz4
55 tool_$(CONFIG_KERNEL_LZMA) = lzma
56 tool_$(CONFIG_KERNEL_LZO) = lzo
57 tool_$(CONFIG_KERNEL_XZ) = xzkern
59 targets += vmlinux.bin.z
60 $(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
61 $(call if_changed,$(tool_y))
63 targets += piggy.o
64 OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
65 --set-section-flags=.image=contents,alloc,load,readonly,data
66 $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
67 $(call if_changed,objcopy)
69 # Calculate the load address of the compressed kernel image
70 hostprogs-y := calc_vmlinuz_load_addr
72 ifneq ($(zload-y),)
73 VMLINUZ_LOAD_ADDRESS := $(zload-y)
74 else
75 VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
76 $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS))
77 endif
79 vmlinuzobjs-y += $(obj)/piggy.o
81 quiet_cmd_zld = LD $@
82 cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
83 quiet_cmd_strip = STRIP $@
84 cmd_strip = $(STRIP) -s $@
85 vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
86 $(call cmd,zld)
87 $(call cmd,strip)
90 # Some DECstations need all possible sections of an ECOFF executable
92 ifdef CONFIG_MACH_DECSTATION
93 e2eflag := -a
94 endif
96 # elf2ecoff can only handle 32bit image
97 hostprogs-y += ../elf2ecoff
99 ifdef CONFIG_32BIT
100 VMLINUZ = vmlinuz
101 else
102 VMLINUZ = vmlinuz.32
103 endif
105 quiet_cmd_32 = OBJCOPY $@
106 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
107 vmlinuz.32: vmlinuz
108 $(call cmd,32)
110 quiet_cmd_ecoff = ECOFF $@
111 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
112 vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
113 $(call cmd,ecoff)
115 OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
116 vmlinuz.bin: vmlinuz
117 $(call cmd,objcopy)
119 OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
120 vmlinuz.srec: vmlinuz
121 $(call cmd,objcopy)
123 clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec}