90f36e63c4c2a7985720d8a74d347345d250d349
[openwrt/svn-archive/archive.git] / target / linux / xburst / files-2.6.32 / arch / mips / boot / compressed / Makefile
1 #
2 # linux/arch/mips/boot/compressed/Makefile
3 #
4 # create a compressed zImage from the original vmlinux
5 #
6
7 targets := zImage vmlinuz vmlinux.bin.gz head.o misc.o piggy.o dummy.o
8
9 OBJS := $(obj)/head.o $(obj)/misc.o
10
11 LD_ARGS := -T $(obj)/ld.script -Ttext 0x80600000 -Bstatic
12 OBJCOPY_ARGS := -O elf32-tradlittlemips
13
14 ENTRY := $(obj)/../tools/entry
15 FILESIZE := $(obj)/../tools/filesize
16
17 drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
18 strip-flags = $(addprefix --remove-section=,$(drop-sections))
19
20
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
25
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 $<
32
33 $(obj)/vmlinuz: $(OBJS) $(obj)/ld.script $(obj)/vmlinux.bin.gz $(obj)/dummy.o
34 $(OBJCOPY) \
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
40
41 zImage: $(obj)/vmlinuz
42 $(OBJCOPY) -O binary $(obj)/vmlinuz $(obj)/zImage