1# 2# Makefile for Broadcom BCM947XX boards 3# 4# Copyright 2007, 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: Makefile,v 1.1.1.1 2008/10/15 03:26:06 james26_jang Exp $ 13# 14 15 16# Link at 3 MB offset in RAM 17TEXT_START ?= 0x80300000 18 19OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S 20OBJCOPYSREC := $(CROSS_COMPILE)objcopy -O srec -R .reginfo -R .note -R .comment -R .mdebug -S 21 22vpath %.c $(SRCBASE)/shared 23vpath %.S $(SRCBASE)/shared 24vpath %.lds.in $(SRCBASE)/shared 25 26ASFLAGS += -D__ASSEMBLY__ -DLOADADDR=$(LOADADDR) 27CFLAGS += -DLOADADDR=$(LOADADDR) -DBCM5354 28# The self-decompresor is standalone, get rid of the linux flags 29CFLAGS := $(subst -Dlinux,,$(CFLAGS)) 30CFLAGS += -Ulinux -D_MINOSL_ -ffreestanding 31ifdef CONFIG_MCOUNT 32CFLAGS := $(subst -pg,,$(CFLAGS)) 33endif 34CFLAGS += -ffunction-sections $(call check_gcc, -fvtable-gc, ) 35 36SYSTEM ?= $(TOPDIR)/vmlinux 37OBJECTS := boot.o sbsdram.o load.o sflash.o hndmips.o hndchipc.o \ 38 sbutils.o hndpmu.o \ 39 min_osl.o bcmutils.o sromstubs.o nvramstubs.o bcmstdlib.o 40 41# Default to bzip2 42COMPRESS ?= bzip2 -c 43 44ifneq ($(findstring gzip,$(COMPRESS)),) 45CFLAGS += -DUSE_GZIP 46else 47ifneq ($(findstring bzip2,$(COMPRESS)),) 48CFLAGS += -DUSE_BZIP2 49else 50COMPRESS := cat 51endif 52endif 53 54all: zImage vmlinuz 55 56# Don't build dependencies, this may die if $(CC) isn't gcc 57dep: 58 59zImage: vmlinux 60 $(OBJCOPY) $< $@ 61 62# Link the loader and the kernel binary together 63vmlinux: vmlinux.lds $(OBJECTS) piggy.o 64 $(LD) -static --gc-sections -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS) piggy.o 65 66vmlinux.lds: hndrte.lds.in Makefile 67 @sed -e s/TEXT_START/$(TEXT_START)/ \ 68 -e s/TARGET_ARCH/mips/ < $< > $@ 69 70# Create a linkable version of the (possibly compressed) kernel binary 71piggy.o: piggz piggy.lds 72 $(LD) -no-warn-mismatch -T piggy.lds -r -o $@ -b binary piggz -b elf32-tradlittlemips 73 74piggy.lds: 75 @echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@ 76 77# Always create a gzipped version named vmlinuz for compatibility 78vmlinuz: piggy 79 gzip -c9 $< > $@ 80 81piggz: piggy 82 $(COMPRESS) $< > $@ 83 84piggy: $(SYSTEM) 85 $(OBJCOPY) $< $@ 86 87mrproper: clean 88 89clean: 90 rm -f vmlinux vmlinuz zImage piggz piggy *.lds *.o 91