sonic-buildimage/platform/broadcom/saibcm-modules/make/Makefile.linux-slk

162 lines
5.1 KiB
Makefile
Raw Normal View History

#
# Copyright 2007-2020 Broadcom Inc. All rights reserved.
#
# Permission is granted to use, copy, modify and/or distribute this
# software under either one of the licenses below.
#
# License Option 1: GPL
#
# 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.
#
#
# License Option 2: Broadcom Open Network Switch APIs (OpenNSA) license
#
# This software is governed by the Broadcom Open Network Switch APIs license:
# https://www.broadcom.com/products/ethernet-connectivity/software/opennsa
#
# $Id: Makefile.linux-slk-3_14,v 1.2 Broadcom SDK $
# $Copyright: (c) 2013 Broadcom Corp.
# All Rights Reserved.$
# Makefile for SLK(BCM957812)
# User must select one platform from below.By default ARM_LINUX is selected. .
ifeq (,$(BUILD_PLATFORM))
BUILD_PLATFORM=ARM_LINUX
endif
# Toolchain base directory for NS2 XMC card
ifeq (BE,$(ENDIAN_MODE))
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/toolchains/slk/linaro-be
TARGET_ARCHITECTURE:=aarch64_be-linux-gnu
# Target machine for EDK-Host defconfig
TARGET_MACHINE ?= slk_be
KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/slk-be/poky/brcm-released-source/git
else
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/toolchains/slk/linaro-le
# Compiler for target architecture
TARGET_ARCHITECTURE:= aarch64-linux-gnu
# Target machine for EDK-Host defconfig
TARGET_MACHINE ?= slk_le
# Kernel directory
KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/slk/poky/brcm-released-source/git
endif
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
endif
# armtools
TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/bin
override PATH:=$(TOOLCHAIN_BIN_DIR):$(PATH)
LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/lib
export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
# Default Linux include directory
ifeq (,$(LINUX_INCLUDE))
LINUX_INCLUDE := $(KERNDIR)/include
endif
ifeq (BE,$(ENDIAN_MODE))
CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
ENDIAN = BE_HOST=1
else
CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
ENDIAN = LE_HOST=1
endif
CFGFLAGS += -D$(ENDIAN) -DBCM958525
CFGFLAGS += -DBCM_PLATFORM_STRING=\"SLK_BCM957812\"
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
ifeq (1,$(SLK_32BIT))
CFGFLAGS += -DSAL_BDE_32BIT_USER_64BIT_KERNEL
else
CFGFLAGS += -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS
endif
CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS
CFLAGS += -Wno-unused-value -Wno-unused-but-set-variable -Wno-sizeof-pointer-memaccess -fno-aggressive-loop-optimizations
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_SLK_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__
endif
# Enable cached DMA memory by default
ifeq (,$(SAL_BDE_USE_CACHED_DMA_MEM))
SAL_BDE_USE_CACHED_DMA_MEM = 1
endif
ifeq ($(SAL_BDE_USE_CACHED_DMA_MEM),1)
CFGFLAGS += -DSAL_BDE_CACHE_DMA_MEM
endif
ifeq (1,$(SLK_32BIT))
ARCH = arm
else
ARCH = arm64
endif
KBUILD_VERBOSE = 1
export ARCH KBUILD_VERBOSE
comma = ,
basetarget = $(basename $(notdir $@))
modname = $(basetarget)
# Extra variables.
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
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)))")
KFLAG_INCLD = $(TOOLCHAIN_BASE_DIR)/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.2/include
ifeq (,$(KFLAGS))
KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign
endif
ifdef LTSW_CHIPS
# Default open source target build
ifeq (BE,$(ENDIAN_MODE))
OPENSRC_BUILD ?= linaro_arm64_be
else
OPENSRC_BUILD ?= linaro_arm64_le
endif
# Hardware interface (see $SDKLT/bcma/sys/probe directory)
SYSTEM_INTERFACE ?= ngbde
# Turn on direct register access if running on real hardware.
ifeq (ngbde,$(SYSTEM_INTERFACE))
LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
endif
export SYSTEM_INTERFACE
endif
ifneq ($(targetplat),user)
include ${SDK}/make/Makefile.linux-kernel-3_6
endif