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