add all source code from linksys/broadcom which is free, to cvs for better maintainen...
[openwrt.git] / package / linux / kernel-source / arch / mips / brcm-boards / bcm947xx / compressed / Makefile
1 #
2 # Makefile for Broadcom BCM947XX boards
3 #
4 # Copyright 2001-2003, Broadcom Corporation
5 # All Rights Reserved.
6 #
7 # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 #
12 # $Id$
13 #
14 # Copyright 2004 Manuel Novoa III <mjn3@codepoet.org>
15 # Modified to support bzip'd kernels.
16 # Of course, it would be better to integrate bunzip capability into CFE.
17 #
18
19 # Link at 3 MB offset in RAM
20 #TEXT_START ?= 0x80300000
21 TEXT_START ?= 0x80001000
22 BZ_MEM_TOP := 0x81000000
23 BZ_TEXT_START := BZ_MEM_TOP-0x4000
24 BZ_STACK_TOP := BZ_TEXT_START-4
25
26 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
27
28 SRCBASE := $(TOPDIR)/../..
29 VPATH := $(SRCBASE)/shared
30 ASFLAGS += -D__ASSEMBLY__ -I$(SRCBASE)/include -DLOADADDR=$(LOADADDR)
31 ASFLAGS += -DBZ_MEM_TOP=$(BZ_MEM_TOP)
32 ASFLAGS += -DBZ_TEXT_START=$(BZ_TEXT_START)
33 ASFLAGS += -DBZ_STACK_TOP=$(BZ_STACK_TOP)
34 CFLAGS += -I$(SRCBASE)/include -DLOADADDR=$(LOADADDR)
35 CFLAGS += -DBZ_MEM_TOP=$(BZ_MEM_TOP)
36 CFLAGS += -DBZ_TEXT_START=$(BZ_TEXT_START)
37 CFLAGS += -DBZ_STACK_TOP=$(BZ_STACK_TOP)
38 ifdef CONFIG_MCOUNT
39 CFLAGS := $(subst -pg,,$(CFLAGS))
40 endif
41 CFLAGS += -ffunction-sections $(call check_gcc, -fvtable-gc, )
42 SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/BZ_MEM_TOP/$(BZ_MEM_TOP)/;s/TEXT_START/$(TEXT_START)/
43
44 SYSTEM ?= $(TOPDIR)/vmlinux
45 OBJECTS := head.o data.o
46
47 all: bzImage vmlinuz
48
49 # Don't build dependencies, this may die if $(CC) isn't gcc
50 dep:
51
52 # Create a gzipped version named vmlinuz for compatibility
53 vmlinuz: piggy
54 gzip -c9 $< > $@
55
56 # Our bzImage is a gzip'd binary that decompresses and runs
57 # the appended bzip'd kernel.
58 bzImage: bzLoaderImage.gz piggz
59 cat bzLoaderImage.gz piggz > $@
60
61 bzLoaderImage.gz: bzLoaderImage
62 gzip -nc9 $< > $@
63
64 bzLoaderImage: bzLoader
65 $(OBJCOPY) $< $@
66
67 bzLoader: vmlinux.lds $(OBJECTS)
68 $(LD) -static --gc-sections -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS)
69
70 vmlinux.lds: vmlinux.lds.in Makefile
71 @sed "$(SEDFLAGS)" < $< > $@
72
73 piggz: piggy
74 bzip2 -c9 $< > $@
75
76 piggy: $(SYSTEM)
77 $(OBJCOPY) $< $@
78
79 data.o: data.lds data.image
80 $(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary data.image -b elf32-tradlittlemips
81
82 data.lds:
83 @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@
84
85 data.image: decompress_bunzip2.image
86 $(OBJCOPY) $< $@
87
88 decompress_bunzip2.image: decompress_bunzip2.lds decompress_bunzip2.o
89 $(LD) -static --gc-sections -no-warn-mismatch -T decompress_bunzip2.lds -o $@ decompress_bunzip2.o
90
91 decompress_bunzip2.lds: decompress_bunzip2.lds.in Makefile
92 @sed "$(SEDFLAGS)" < $< > $@
93
94 mrproper: clean
95
96 clean:
97 rm -f vmlinux vmlinuz piggz piggy *.lds *.o \
98 bzLoader bzLoaderImage bzLoaderImage.gz bzImage \
99 data.lds data.image \
100 decompress_bunzip2.lds decompress_bunzip2.image
This page took 0.053191 seconds and 5 git commands to generate.