[kernel] add more 2.6.37 missing symbols
[openwrt.git] / target / linux / generic / image / lzma-loader / src / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 RAMSTART = 0x80000000
8 RAMSIZE = 0x00100000 # 1MB
9 LOADADDR = 0x80400000 # RAM start + 4M
10 KERNEL_ENTRY = 0x80001000
11 IMAGE_COPY:=0
12
13 CROSS_COMPILE = mips-linux-
14
15 OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
16 CFLAGS := -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSTART=${RAMSTART} -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} -D_LZMA_IN_CB
17 ifeq ($(IMAGE_COPY),1)
18 CFLAGS += -DLOADADDR=${LOADADDR} -DIMAGE_COPY=1
19 endif
20
21 .S.s:
22 $(CPP) $(CFLAGS) $< -o $*.s
23 .S.o:
24 $(CC) $(CFLAGS) -c $< -o $*.o
25 .c.o:
26 $(CC) $(CFLAGS) -c $< -o $*.o
27
28 CC = $(CROSS_COMPILE)gcc
29 LD = $(CROSS_COMPILE)ld
30 OBJDUMP = $(CROSS_COMPILE)objdump
31
32 O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
33
34 # Drop some uninteresting sections in the kernel.
35 # This is only relevant for ELF kernels but doesn't hurt a.out
36 drop-sections = .reginfo .mdebug .comment
37 strip-flags = $(addprefix --remove-section=,$(drop-sections))
38
39 all : lzma.elf lzma.bin
40
41 lzma.lds: lzma.lds.in
42 sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,_start,g' $< >$@
43
44 kernel.o: vmlinux.lzma lzma.lds
45 $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
46
47 lzma.bin: lzma.elf
48 $(OBJCOPY) $< $@
49
50 ifeq ($(IMAGE_COPY),1)
51 LOADER_ENTRY ?= $(KERNEL_ENTRY)
52 lzma.o: decompress.o LzmaDecode.o kernel.o
53 sed -e 's,@LOADADDR@,$(LOADADDR),g' -e 's,@ENTRY@,entry,g' lzma.lds.in >lzma-stage2.lds
54 $(LD) -static --no-warn-mismatch -e entry -Tlzma-stage2.lds -o temp-$@ $^
55 $(OBJCOPY) temp-$@ lzma.tmp
56 @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > lzma-data.lds
57 $(LD) -no-warn-mismatch -T lzma-data.lds -r -o $@ -b binary lzma.tmp --oformat $(O_FORMAT)
58
59 lzma.elf: start.o lzma.o
60 sed -e 's,@LOADADDR@,$(LOADER_ENTRY),g' lzma-copy.lds.in >lzma-copy.lds
61 $(LD) -s -Tlzma-copy.lds -o $@ $^
62 else
63 lzma.elf: start.o decompress.o LzmaDecode.o kernel.o
64 $(LD) -s -Tlzma.lds -o $@ $^
65 endif
66
67 clean:
68 rm -f *.o lzma.elf lzma.bin *.tmp *.lds
This page took 0.049581 seconds and 5 git commands to generate.