sonic-buildimage/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6

277 lines
8.0 KiB
Makefile
Raw Normal View History

#
# Copyright 2017 Broadcom
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation (the "GPL").
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License version 2 (GPLv2) for more details.
#
# You should have received a copy of the GNU General Public License
# version 2 (GPLv2) along with this source code.
#
# $Id: Makefile.linux-gto-2_6,v 1.42 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
# User must select one platform from below.By default WR_LINUX is selected. .
ifeq (,$(BUILD_PLATFORM))
#BUILD_PLATFORM=ELDK
BUILD_PLATFORM=WR_LINUX
endif
# Specify the ELDK version you want to use for building SDK.
ifeq (,$(ELDK_VERSION))
ifeq (ELDK,$(BUILD_PLATFORM))
ELDK_VERSION=4.0
endif
endif
# Specify the KERNEL VERSION you want to use for building SDK.
ifeq (,$(KERN_VER))
ifeq (ELDK,$(BUILD_PLATFORM))
KERN_VER=2.6.21.7
endif
endif
# Specify the Windriver Linux version here.For example '2.0' as shown below.
ifeq (WR_LINUX,$(BUILD_PLATFORM))
ifeq (,$(WRS_LINUX_VERSION))
WRS_LINUX_VERSION=2.0
endif
endif
#glibc_small and glibc_std have their own cross-compilation tools and and path for these tools are different as implemented below. To enable glibc_small build, line given below should be uncommented.
#WRL_GLIBC_SMALL=TRUE
ifeq (2.0,$(WRS_LINUX_VERSION))
ifeq ($(WRL_GLIBC_SMALL),TRUE)
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small-
endif
KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_small/build/linux-2.6.21-standard
else
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std-
endif
KERNDIR ?= /projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_std/build/linux-2.6.21-standard
endif
export WRL_GLIBC_SMALL
# After this point glibc_std and glibc_small share these flags
WRLINUX_BASE ?=/tools/windriver/linux_ed/2.0_GA/Linux
TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2
TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX)
WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin
WRLINUX_GNU_PATH = $(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin
override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH)
export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY
endif
ifeq (3.0,$(WRS_LINUX_VERSION))
ifeq ($(WRL_GLIBC_SMALL),TRUE)
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small-
endif
KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux-broadcom_bcm98548xmc-standard-build
KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux
else
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std-
endif
KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux-broadcom_bcm98548xmc-standard-build
KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux
endif
export WRL_GLIBC_SMALL
# After this point glibc_std and glibc_small share these flags
WRLINUX_BASE ?=/tools/windriver/linux_ed/3.0/Linux
TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2
TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX)
WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin
WRLINUX_GNU_PATH = $(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2/bin
override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR_STD)/../../host-cross/bin:$(KERNDIR_STD)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH)
export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY
LINUX_INCLUDE_STD := $(KERNDIR_STD)/include
endif
ifeq (ELDK,$(BUILD_PLATFORM))
ifeq (2.6.21.7, $(KERN_VER))
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := ppc_85xx-
endif
ifeq (4.0, $(ELDK_VERSION))
override PATH := /tools/eldk/4.0/usr/bin:$(PATH)
else
override PATH := /tools/eldk/4.1/usr/bin:$(PATH)
endif
KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.21.7
endif
endif
ifeq (ELDK,$(BUILD_PLATFORM))
ifeq (2.6.24.4, $(KERN_VER))
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := ppc_85xx-
endif
ifeq (4.0, $(ELDK_VERSION))
override PATH := /tools/eldk/4.0/usr/bin:$(PATH)
else
override PATH := /tools/eldk/4.1/usr/bin:$(PATH)
endif
KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.24.4
endif
endif
ifeq (ELDK,$(BUILD_PLATFORM))
ifeq (2.6.25, $(KERN_VER))
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE := ppc_85xx-
endif
ifeq (4.0, $(ELDK_VERSION))
override PATH := /tools/eldk/4.0/usr/bin:$(PATH)
else
override PATH := /tools/eldk/4.1/usr/bin:$(PATH)
endif
KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.25
endif
endif
# Default Linux include directory
ifeq (,$(LINUX_INCLUDE))
LINUX_INCLUDE := $(KERNDIR)/include
endif
CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
ENDIAN = BE_HOST=1
CFGFLAGS += -D$(ENDIAN)
CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\"
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
# Extra variables.
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
ARCH = powerpc
KBUILD_VERBOSE = 1
export ARCH KBUILD_VERBOSE
# From linux/arch/ppc/Makefile
comma = ,
basetarget = $(basename $(notdir $@))
modname = $(basetarget)
name-fix = $(subst $(comma),_,$(subst -,_,$1))
basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
modname_flags = $(if $(filter 1,$(words $(modname))),\
-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
ifeq (,$(KFLAG_INCLD))
ifeq (4.0,$(ELDK_VERSION))
ifeq (ELDK,$(BUILD_PLATFORM))
KFLAG_INCLD = /tools/eldk/4.0/usr/lib/gcc/powerpc-linux/4.0.0/include
endif
endif
ifeq (4.1,$(ELDK_VERSION))
ifeq (ELDK,$(BUILD_PLATFORM))
KFLAG_INCLD = /tools/eldk/4.1/usr/lib/gcc/powerpc-linux/4.0.0/include
endif
endif
ifeq (2.0,$(WRS_LINUX_VERSION))
KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.1.2/include
endif
ifeq (3.0,$(WRS_LINUX_VERSION))
KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.3.2/include
endif
endif
ifdef BROADCOM_SVK
ifdef BCM_BME3200_B0
PLX_PCI2LBUS=1
endif
ifdef BCM_BM9600_B0
PLX_PCI2LBUS=1
endif
ifeq ($PLX_PCI2LBUS, 1)
CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE
endif
endif
ifdef DPP_CHIPS
CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__
CFGFLAGS += -DSOC_CM_FUNCTION
endif
ifdef DFE_CHIPS
CFLAGS += -DDUNE_BCM
CFGFLAGS += -DSOC_CM_FUNCTION
endif
ifdef SAND_CHIPS
CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
endif
ifdef SHADOW_PLX
CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK
endif
ifeq (,$(KFLAGS))
#autoconf.h was moved in later kernels
LINUX_AUTOCONF = $(LINUX_INCLUDE)/generated/autoconf.h
ifeq (,$(shell ls $(LINUX_AUTOCONF) 2>/dev/null))
LINUX_AUTOCONF = $(LINUX_INCLUDE)/linux/autoconf.h
endif
KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/version.h -include $(LINUX_AUTOCONF) -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign
endif
#Wind river Linux 3.0 needs addtional flags
ifeq (3.0,$(WRS_LINUX_VERSION))
# Use MSI interrupts if kernel is compiled with MSI support.
#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT
KFLAGS += -I$(LINUX_INCLUDE_STD) -I$(KERNDIR_STD)/arch/powerpc -I$(KERNDIR_STD)/arch/powerpc/include -I$(KERNDIR_STD)/include.asm-powerpc -mno-spe
endif
ifneq ($(targetplat),user)
include ${SDK}/make/Makefile.linux-kernel-2_6
endif