1#
2# Toplevel Makefile for the BCM947xx Linux Router release
3#
4# Copyright (C) 2015, Broadcom Corporation. All Rights Reserved.
5# 
6# Permission to use, copy, modify, and/or distribute this software for any
7# purpose with or without fee is hereby granted, provided that the above
8# copyright notice and this permission notice appear in all copies.
9# 
10# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17#
18# $Id: toplevel-release.mk 348309 2012-08-01 10:21:23Z $
19#
20
21SRCBASE := $(shell pwd)
22RELEASEDIR := $(shell (cd $(SRCBASE)/.. && pwd -P))
23ARCH ?= arm
24PLT ?= arm
25
26ifeq ($(PLT),arm)
27ARCH = arm
28endif
29
30install: all
31	install -d $(RELEASEDIR)/image
32	$(MAKE) -C router install PLT=$(PLT)
33	-cp router/$(PLT)/linux.trx $(RELEASEDIR)/image/linux-glibc.trx
34	-cp router/$(PLT)-uclibc/linux.trx $(RELEASEDIR)/image/linux.trx
35	-cp router/$(PLT)-uclibc/linux-gzip.trx $(RELEASEDIR)/image/linux-gzip.trx
36	-cp router/$(PLT)-uclibc/linux.bin $(RELEASEDIR)/image/linux.bin
37	-cp dongle/rte/wl/builds/4322-bmac-usbap/roml-ag-nodis/rtecdc.exe $(RELEASEDIR)/image/rtecdc-4323.exe
38	-cp dongle/rte/wl/builds/43236-bmac-usbap/roml-ag-nodis/rtecdc.exe $(RELEASEDIR)/image/rtecdc-43236.exe
39	# Create linux-apsta.trx or linux-ap.trx sibling
40	$(MAKE) -C router sibling SIBLING_INSTALL_DIR=$(RELEASEDIR)/image
41ifneq ($(wildcard cfe),)
42	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/
43	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/
44ifneq ($(PLT),arm)
45	# Clean and make one more time linked at 3MB
46	$(MAKE) -C cfe clean
47	$(MAKE) -C cfe CFG_TEXT_START=0x80300000
48	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe4.bin
49	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez4.bin
50	# Clean and make one more time with GigE
51	$(MAKE) -C cfe clean
52	$(MAKE) -C cfe CFG_PCI=1
53	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-gige.bin
54	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-gige.bin
55	# Clean and make one more time with GMAC
56	$(MAKE) -C cfe clean
57	$(MAKE) -C cfe CFG_GMAC=1
58	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-gmac.bin
59	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-gmac.bin
60	cp cfe/build/chipimages/bcm5357/cfe_script.cfesh $(RELEASEDIR)/image/
61endif
62	# Clean and make one more time with NFLASH
63	$(MAKE) -C cfe ARCH=$(ARCH) clean
64	$(MAKE) -C cfe ARCH=$(ARCH) CFG_GMAC=1 CFG_NFLASH=1
65	cp cfe/build/broadcom/bcm947xx/cfe.bin $(RELEASEDIR)/image/cfe-nflash.bin
66	cp cfe/build/broadcom/bcm947xx/compressed/cfez.bin $(RELEASEDIR)/image/cfez-nflash.bin
67endif
68	cp shared/nvram/*.txt $(RELEASEDIR)/image/
69
70all clean:
71	$(MAKE) -C router $@ PLT=$(PLT)
72ifneq ($(wildcard cfe),)
73	$(MAKE) -C cfe $@ ARCH=$(ARCH)
74endif
75
76.PHONY: all clean install
77