2 # This file is subject to the terms and conditions of the GNU General Public
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
:= $(filter-out -pg
, $(KBUILD_CFLAGS
))
23 KBUILD_CFLAGS
:= $(filter-out -fstack-protector
, $(KBUILD_CFLAGS
))
25 KBUILD_CFLAGS
:= $(KBUILD_CFLAGS
) -D__KERNEL__ \
26 -DBOOT_HEAP_SIZE
=$(BOOT_HEAP_SIZE
) -D
"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
28 KBUILD_AFLAGS
:= $(KBUILD_AFLAGS
) -D__ASSEMBLY__ \
29 -DBOOT_HEAP_SIZE
=$(BOOT_HEAP_SIZE
) \
30 -DKERNEL_ENTRY
=$(VMLINUX_ENTRY_ADDRESS
)
32 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
35 # decompressor objects (linked with vmlinuz)
36 vmlinuzobjs-y
:= $(obj
)/head.o
$(obj
)/decompress.o
$(obj
)/string.o
38 ifdef CONFIG_DEBUG_ZBOOT
39 vmlinuzobjs-
$(CONFIG_DEBUG_ZBOOT
) += $(obj
)/dbg.o
40 vmlinuzobjs-
$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550
) += $(obj
)/uart-16550.o
41 vmlinuzobjs-
$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM
) += $(obj
)/uart-prom.o
42 vmlinuzobjs-
$(CONFIG_MIPS_ALCHEMY
) += $(obj
)/uart-alchemy.o
43 vmlinuzobjs-
$(CONFIG_ATH79
) += $(obj
)/uart-ath79.o
46 extra-y
+= uart-ath79.c
47 $(obj
)/uart-ath79.c
: $(srctree
)/arch
/mips
/ath79
/early_printk.c
50 vmlinuzobjs-
$(CONFIG_KERNEL_XZ
) += $(obj
)/ashldi3.o
$(obj
)/bswapsi.o
53 $(obj
)/ashldi3.c
: $(obj
)/%.c
: $(srctree
)/lib
/%.c FORCE
54 $(call if_changed
,shipped
)
57 $(obj
)/bswapsi.c
: $(obj
)/%.c
: $(srctree
)/arch
/mips
/lib
/%.c FORCE
58 $(call if_changed
,shipped
)
60 targets
:= $(notdir $(vmlinuzobjs-y
))
62 targets
+= vmlinux.bin
63 OBJCOPYFLAGS_vmlinux.bin
:= $(OBJCOPYFLAGS
) -O binary
-R .comment
-S
64 $(obj
)/vmlinux.bin
: $(KBUILD_IMAGE
) FORCE
65 $(call if_changed
,objcopy
)
67 tool_
$(CONFIG_KERNEL_GZIP
) = gzip
68 tool_
$(CONFIG_KERNEL_BZIP2
) = bzip2
69 tool_
$(CONFIG_KERNEL_LZ4
) = lz4
70 tool_
$(CONFIG_KERNEL_LZMA
) = lzma
71 tool_
$(CONFIG_KERNEL_LZO
) = lzo
72 tool_
$(CONFIG_KERNEL_XZ
) = xzkern
74 targets
+= vmlinux.bin.z
75 $(obj
)/vmlinux.bin.z
: $(obj
)/vmlinux.bin FORCE
76 $(call if_changed
,$(tool_y
))
78 targets
+= piggy.o dummy.o
79 OBJCOPYFLAGS_piggy.o
:= --add-section
=.image
=$(obj
)/vmlinux.bin.z \
80 --set-section-flags
=.image
=contents
,alloc
,load
,readonly
,data
81 $(obj
)/piggy.o
: $(obj
)/dummy.o
$(obj
)/vmlinux.bin.z FORCE
82 $(call if_changed
,objcopy
)
84 HOSTCFLAGS_calc_vmlinuz_load_addr.o
+= $(LINUXINCLUDE
)
86 # Calculate the load address of the compressed kernel image
87 hostprogs-y
:= calc_vmlinuz_load_addr
90 VMLINUZ_LOAD_ADDRESS
:= $(zload-y
)
92 VMLINUZ_LOAD_ADDRESS
= $(shell $(obj
)/calc_vmlinuz_load_addr \
93 $(obj
)/vmlinux.bin
$(VMLINUX_LOAD_ADDRESS
))
95 UIMAGE_LOADADDR
= $(VMLINUZ_LOAD_ADDRESS
)
97 vmlinuzobjs-y
+= $(obj
)/piggy.o
100 cmd_zld
= $(LD
) $(KBUILD_LDFLAGS
) -Ttext
$(VMLINUZ_LOAD_ADDRESS
) -T
$< $(vmlinuzobjs-y
) -o
$@
101 quiet_cmd_strip
= STRIP
$@
102 cmd_strip
= $(STRIP
) -s
$@
103 vmlinuz
: $(src
)/ld.script
$(vmlinuzobjs-y
) $(obj
)/calc_vmlinuz_load_addr
108 # Some DECstations need all possible sections of an ECOFF executable
110 ifdef CONFIG_MACH_DECSTATION
114 # elf2ecoff can only handle 32bit image
115 hostprogs-y
+= ..
/elf2ecoff
123 quiet_cmd_32
= OBJCOPY
$@
124 cmd_32
= $(OBJCOPY
) -O
$(32bit-bfd
) $(OBJCOPYFLAGS
) $< $@
128 quiet_cmd_ecoff
= ECOFF
$@
129 cmd_ecoff
= $< $(VMLINUZ
) $@
$(e2eflag
)
130 vmlinuz.ecoff
: $(obj
)/..
/elf2ecoff
$(VMLINUZ
)
133 OBJCOPYFLAGS_vmlinuz.bin
:= $(OBJCOPYFLAGS
) -O binary
137 OBJCOPYFLAGS_vmlinuz.srec
:= $(OBJCOPYFLAGS
) -S
-O srec
138 vmlinuz.srec
: vmlinuz
141 uzImage.bin
: vmlinuz.bin FORCE
142 $(call if_changed
,uimage
,none
)
144 clean-files
+= $(objtree
)/vmlinuz
145 clean-files
+= $(objtree
)/vmlinuz
.32
146 clean-files
+= $(objtree
)/vmlinuz.ecoff
147 clean-files
+= $(objtree
)/vmlinuz.bin
148 clean-files
+= $(objtree
)/vmlinuz.srec