Root/arch/mips/boot/compressed/Makefile

Source at commit 9f03be916e6e871da7b0e5f3d30ca3f41a32259e created 11 years 2 months ago.
By xiangfu, 600-fix-compile-zImage.patch
1#
2# linux/arch/mips/boot/compressed/Makefile
3#
4# create a compressed zImage from the original vmlinux
5#
6
7targets := zImage vmlinuz vmlinux.bin.gz head.o misc.o piggy.o dummy.o
8
9OBJS := $(obj)/head.o $(obj)/misc.o
10
11LD_ARGS := -T $(obj)/ld.script -Ttext 0x80600000 -Bstatic
12OBJCOPY_ARGS := -O elf32-tradlittlemips
13
14ENTRY := $(obj)/../tools/entry
15FILESIZE := $(obj)/../tools/filesize
16
17drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
18strip-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) -I$(srctree)/arch/mips/include \
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
41zImage: $(obj)/vmlinuz
42    $(OBJCOPY) -O binary $(obj)/vmlinuz $(obj)/zImage
43

Archive Download this file



interactive