RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / mips / brcm-boards / bcm947xx / compressed / Makefile
blobdff77c06610f5acdaedb95ab755455ec61f0436a
2 # Makefile for Broadcom BCM947XX boards
4 # Copyright (C) 2008, 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.
12 # $Id: Makefile,v 1.6 2008/04/03 03:48:38 Exp $
16 # Link at 3 MB offset in RAM
17 TEXT_START ?= 0x80300000
19 LOADADDR := 0x80001000
20 CROSS_COMPILE ?= mipsel-linux-
22 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
23 OBJCOPYSREC := $(CROSS_COMPILE)objcopy -O srec -R .reginfo -R .note -R .comment -R .mdebug -S
25 vpath %.c $(SRCBASE)/shared
26 vpath %.S $(SRCBASE)/shared
27 vpath %.lds.in $(SRCBASE)/shared
29 ASFLAGS += -D__ASSEMBLY__ -DLOADADDR=$(LOADADDR) -march=mips32 -Wa,-mips32 -Wa,--trap
30 CFLAGS += -DLOADADDR=$(LOADADDR) -march=mips32 -Wa,-mips32 -Wa,--trap
31 # The self-decompresor is standalone, get rid of the linux flags
32 CFLAGS := $(subst -Dlinux,,$(CFLAGS))
33 CFLAGS += -Ulinux -D_MINOSL_ -ffreestanding
34 ifdef CONFIG_MCOUNT
35 CFLAGS := $(subst -pg,,$(CFLAGS))
36 endif
37 CFLAGS += -ffunction-sections $(call check_gcc, -fvtable-gc, )
39 SYSTEM ?= $(LINUXDIR)/vmlinux
40 OBJECTS := boot.o sisdram.o sbsdram.o aisdram.o load.o sflash.o \
41 hndmips.o hndchipc.o \
42 sbutils.o aiutils.o siutils.o hndpmu.o nicpci.o \
43 min_osl.o bcmutils.o sromstubs.o nvramstubs.o bcmstdlib.o
45 CFLAGS += -G 0 -mno-abicalls -fno-pic -pipe -msoft-float
46 ASFLAGS += -G 0 -mno-abicalls -fno-pic -pipe
48 # Default to bzip2
49 COMPRESS ?= bzip2 -c
51 ifneq ($(findstring gzip,$(COMPRESS)),)
52 CFLAGS += -DUSE_GZIP
53 else
54 ifneq ($(findstring bzip2,$(COMPRESS)),)
55 CFLAGS += -DUSE_BZIP2
56 else
57 COMPRESS := cat
58 endif
59 endif
61 CFLAGS += -I$(SRCBASE)/include -DBCMDRIVER
62 ASFLAGS += -I$(SRCBASE)/include
64 all: zImage vmlinuz
66 # Don't build dependencies, this may die if $(CC) isn't gcc
67 dep:
69 zImage: vmlinux
70 $(OBJCOPY) $< $@
72 # Link the loader and the kernel binary together
73 vmlinux: vmlinux.lds $(OBJECTS) piggy.o
74 $(LD) -static --gc-sections -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS) piggy.o
76 vmlinux.lds: hndrte.lds.in Makefile
77 @sed -e s/TEXT_START/$(TEXT_START)/ \
78 -e s/TARGET_ARCH/mips/ < $< > $@
80 # Create a linkable version of the (possibly compressed) kernel binary
81 piggy.o: piggz piggy.lds
82 $(LD) -no-warn-mismatch -T piggy.lds -r -o $@ -b binary piggz -b elf32-tradlittlemips
84 piggy.lds:
85 @echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@
87 # Always create a gzipped version named vmlinuz for compatibility
88 vmlinuz: piggy
89 $(MAKE) -C $(SRCBASE)/lzma/CPP/7zip/Compress/LZMA_Alone -f makefile.gcc
90 cat piggy | $(SRCBASE)/lzma/CPP/7zip/Compress/LZMA_Alone/lzma e -si -so -lc1 -lp2 -pb2 > vmlinuz
91 ## gzip -c9 $< > $@
93 piggz: piggy
94 $(COMPRESS) $< > $@
96 piggy: $(SYSTEM)
97 $(OBJCOPY) $< $@
99 mrproper: clean
101 clean:
102 $(Q)rm -f vmlinux vmlinuz zImage piggz piggy *.lds *.o