1# 2# Makefile for Broadcom BCM947XX boards 3# 4# Copyright 2006, 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.orig,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) 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 sbutils.o \ 38 min_osl.o bcmutils.o sromstubs.o nvramstubs.o bcmstdlib.o 39 40# Default to bzip2 41COMPRESS ?= bzip2 -c 42 43ifneq ($(findstring gzip,$(COMPRESS)),) 44CFLAGS += -DUSE_GZIP 45else 46ifneq ($(findstring bzip2,$(COMPRESS)),) 47CFLAGS += -DUSE_BZIP2 48else 49COMPRESS := cat 50endif 51endif 52 53all: zImage vmlinuz 54 55# Don't build dependencies, this may die if $(CC) isn't gcc 56dep: 57 58zImage: vmlinux 59 $(OBJCOPY) $< $@ 60 61# Link the loader and the kernel binary together 62vmlinux: vmlinux.lds $(OBJECTS) piggy.o 63 $(LD) -static --gc-sections -no-warn-mismatch -T vmlinux.lds -o $@ $(OBJECTS) piggy.o 64 65vmlinux.lds: hndrte.lds.in Makefile 66 @sed -e s/TEXT_START/$(TEXT_START)/ \ 67 -e s/TARGET_ARCH/mips/ < $< > $@ 68 69# Create a linkable version of the (possibly compressed) kernel binary 70piggy.o: piggz piggy.lds 71 $(LD) -no-warn-mismatch -T piggy.lds -r -o $@ -b binary piggz -b elf32-tradlittlemips 72 73piggy.lds: 74 @echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $@ 75 76# Always create a gzipped version named vmlinuz for compatibility 77vmlinuz: piggy 78 gzip -c9 $< > $@ 79 80piggz: piggy 81 $(COMPRESS) $< > $@ 82 83piggy: $(SYSTEM) 84 $(OBJCOPY) $< $@ 85 86mrproper: clean 87 88clean: 89 rm -f vmlinux vmlinuz zImage piggz piggy *.lds *.o 90