2 # linux/arch/mips/boot/compressed/Makefile
4 # create a compressed zImage from the original vmlinux
7 targets
:= zImage vmlinuz vmlinux.bin.gz head.o misc.o piggy.o dummy.o
9 OBJS
:= $(obj
)/head.o
$(obj
)/misc.o
11 LD_ARGS
:= -T
$(obj
)/ld.script
-Ttext
0x80600000 -Bstatic
12 OBJCOPY_ARGS
:= -O elf32-tradlittlemips
14 ENTRY
:= $(obj
)/..
/tools
/entry
15 FILESIZE
:= $(obj
)/..
/tools
/filesize
17 drop-sections
= .reginfo .mdebug .comment .note .pdr .options .MIPS.options
18 strip-flags
= $(addprefix --remove-section
=,$(drop-sections
))
21 $(obj
)/vmlinux.bin.gz
: vmlinux
22 rm -f
$(obj
)/vmlinux.bin.gz
23 $(OBJCOPY
) -O binary
$(strip-flags
) vmlinux
$(obj
)/vmlinux.bin
24 gzip
-v9f
$(obj
)/vmlinux.bin
26 $(obj
)/head.o
: $(obj
)/head.S
$(obj
)/vmlinux.bin.gz vmlinux
27 $(CC
) $(KBUILD_AFLAGS
) \
28 -DIMAGESIZE
=$(shell sh
$(FILESIZE
) $(obj
)/vmlinux.bin.gz
) \
29 -DKERNEL_ENTRY
=$(shell sh
$(ENTRY
) $(NM
) vmlinux
) \
30 -DLOADADDR
=$(loadaddr
) \
31 -c
-o
$(obj
)/head.o
$<
33 $(obj
)/vmlinuz
: $(OBJS
) $(obj
)/ld.script
$(obj
)/vmlinux.bin.gz
$(obj
)/dummy.o
35 --add-section
=.image
=$(obj
)/vmlinux.bin.gz \
36 --set-section-flags
=.image
=contents
,alloc
,load
,readonly
,data \
37 $(obj
)/dummy.o
$(obj
)/piggy.o
38 $(LD
) $(LD_ARGS
) -o
$@
$(OBJS
) $(obj
)/piggy.o
39 $(OBJCOPY
) $(OBJCOPY_ARGS
) $@
$@
-R .comment
-R .stab
-R .stabstr
-R .initrd
-R .sysmap
41 zImage
: $(obj
)/vmlinuz
42 $(OBJCOPY
) -O binary
$(obj
)/vmlinuz
$(obj
)/zImage