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 # set the default size of the mallocing area for decompressing
16 BOOT_HEAP_SIZE
:= 0x400000
18 # Disable Function Tracer
19 KBUILD_CFLAGS
:= $(shell echo
$(KBUILD_CFLAGS
) | sed
-e
"s/-pg//")
21 KBUILD_CFLAGS
:= $(LINUXINCLUDE
) $(KBUILD_CFLAGS
) -D__KERNEL__ \
22 -DBOOT_HEAP_SIZE
=$(BOOT_HEAP_SIZE
) -D
"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
24 KBUILD_AFLAGS
:= $(LINUXINCLUDE
) $(KBUILD_AFLAGS
) -D__ASSEMBLY__ \
25 -DBOOT_HEAP_SIZE
=$(BOOT_HEAP_SIZE
) \
26 -DKERNEL_ENTRY
=0x
$(shell $(NM
) $(objtree
)/$(KBUILD_IMAGE
) 2>/dev
/null | grep
" kernel_entry" | cut
-f1
-d \
)
28 targets
:= head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
30 # decompressor objects (linked with vmlinuz)
31 vmlinuzobjs-y
:= $(obj
)/head.o
$(obj
)/decompress.o
$(obj
)/dbg.o
33 ifdef CONFIG_DEBUG_ZBOOT
34 vmlinuzobjs-
$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550
) += $(obj
)/uart-16550.o
35 vmlinuzobjs-
$(CONFIG_MIPS_ALCHEMY
) += $(obj
)/uart-alchemy.o
38 targets
+= vmlinux.bin
39 OBJCOPYFLAGS_vmlinux.bin
:= $(OBJCOPYFLAGS
) -O binary
-R .comment
-S
40 $(obj
)/vmlinux.bin
: $(KBUILD_IMAGE
) FORCE
41 $(call if_changed
,objcopy
)
43 tool_
$(CONFIG_KERNEL_GZIP
) = gzip
44 tool_
$(CONFIG_KERNEL_BZIP2
) = bzip2
45 tool_
$(CONFIG_KERNEL_LZMA
) = lzma
46 tool_
$(CONFIG_KERNEL_LZO
) = lzo
48 targets
+= vmlinux.bin.z
49 $(obj
)/vmlinux.bin.z
: $(obj
)/vmlinux.bin FORCE
50 $(call if_changed
,$(tool_y
))
53 OBJCOPYFLAGS_piggy.o
:= --add-section
=.image
=$(obj
)/vmlinux.bin.z \
54 --set-section-flags
=.image
=contents
,alloc
,load
,readonly
,data
55 $(obj
)/piggy.o
: $(obj
)/dummy.o
$(obj
)/vmlinux.bin.z FORCE
56 $(call if_changed
,objcopy
)
58 # Calculate the load address of the compressed kernel image
59 hostprogs-y
:= calc_vmlinuz_load_addr
61 VMLINUZ_LOAD_ADDRESS
= $(shell $(obj
)/calc_vmlinuz_load_addr \
62 $(objtree
)/$(KBUILD_IMAGE
) $(VMLINUX_LOAD_ADDRESS
))
64 vmlinuzobjs-y
+= $(obj
)/piggy.o
67 cmd_zld
= $(LD
) $(LDFLAGS
) -Ttext
$(VMLINUZ_LOAD_ADDRESS
) -T
$< $(vmlinuzobjs-y
) -o
$@
68 quiet_cmd_strip
= STRIP
$@
69 cmd_strip
= $(STRIP
) -s
$@
70 vmlinuz
: $(src
)/ld.script
$(vmlinuzobjs-y
) $(obj
)/calc_vmlinuz_load_addr
75 # Some DECstations need all possible sections of an ECOFF executable
77 ifdef CONFIG_MACH_DECSTATION
81 # elf2ecoff can only handle 32bit image
82 hostprogs-y
+= ..
/elf2ecoff
90 quiet_cmd_32
= OBJCOPY
$@
91 cmd_32
= $(OBJCOPY
) -O
$(32bit-bfd
) $(OBJCOPYFLAGS
) $< $@
95 quiet_cmd_ecoff
= ECOFF
$@
96 cmd_ecoff
= $< $(VMLINUZ
) $@
$(e2eflag
)
97 vmlinuz.ecoff
: $(obj
)/..
/elf2ecoff
$(VMLINUZ
)
100 OBJCOPYFLAGS_vmlinuz.bin
:= $(OBJCOPYFLAGS
) -O binary
104 OBJCOPYFLAGS_vmlinuz.srec
:= $(OBJCOPYFLAGS
) -S
-O srec
105 vmlinuz.srec
: vmlinuz
108 clean-files
:= $(objtree
)/vmlinuz.
*