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

143 lines
5.5 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-xlr-4_19,v 0.1 Broadcom SDK $
# $Copyright: (c) 2015 Broadcom Corp.
# All Rights Reserved.$
#
# XLR system make file.
#
# Most of this was taken from target x86-smp_generic_64-2_6.
#
#############################################################################
# this segment is custom and not sourced from any existing makefile #
# (base thanks to http:<slash><slash>confluence.broadcom.com/display/NTSWSW/X86+System) #
#############################################################################
# set up a basic feature list. tcl, etc. #
#ifeq (,$(FEATURE_LIST))
#FEATURE_LIST = TCL BFD PTP CINT L3 I2C MEM_SCAN EDITLINE BCM_SAL_PROFILE CUSTOMER TEST CHASSIS MSTP RCPU
#endif
# some basic path variables for tools and kernel source, etc #
export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419
TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr
KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux
# set up cross compile prefix, tools dir variables. #
export CROSS_COMPILE := x86_64-broadcom-linux-gnu-
export TOOLS_DIR := $(TOOLCHAIN_DIR)/bin
# architecture. #
ARCH = x86_64
TARGET_ARCHITECTURE = x86_64-broadcom-linux-gnu
# Noisy kernel build
KBUILD_VERBOSE = 1
export ARCH KBUILD_VERBOSE
# set up paths. #
export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PATH)
export PATH := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH)
# set up SYSINC path #
export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include
# CFLAGS/CFGFLAGS #
CFLAGS += -DUSE_LINUX_BDE_MMAP=1
#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT
CFLAGS += -Wno-error=unused-value
CFLAGS += -Wno-error=unused-but-set-variable
CFLAGS += -Wno-error=maybe-uninitialized
CFLAGS += -Wno-error=cpp
CFLAGS += -Wno-error=aggressive-loop-optimizations
CFLAGS += -Wno-error=array-bounds
CFLAGS += -Wno-error=strict-overflow
CFLAGS += -L$(TOOLCHAIN_DIR)/lib
CFLAGS += -L$(TOOLCHAIN_DIR)/lib64
#CFLAGS += -Wl,--rpath=/lib64 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, #
#CFLAGS += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 # if we want to build the target executable to be used with shared libs #
#XLDK-568 fix inline references
CFGFLAGS += -fgnu89-inline
# set up KFLAGS appropriately. #
ifeq (,$(KFLAGS))
KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-larger-than=1024 -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack
endif
######################################################################
# this segment comes from make/Makefile.linux-x86-smp_generic_64-2_6 #
######################################################################
CFGFLAGS += -DLONGS_ARE_64BITS
CFGFLAGS += -DPTRS_ARE_64BITS
CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
##############################################################
# This segment comes from make/Makefile.linux-x86-common-2_6 #
##############################################################
CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
ENDIAN = LE_HOST=1
CFGFLAGS += -D$(ENDIAN)
CFGFLAGS += -DBCM_PLATFORM_STRING=\"X86\"
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
# Extra variables.
EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
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)))")
ifdef LTSW_CHIPS
# Ensure we do not use an out-of-date libelf.so
ELFUTILS_MIN = 158
ELFUTILS_DIR ?= /projects/ntsw-tools/lib
# Default open source target build
OPENSRC_BUILD ?= fed21-x86_64
# 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)
# By default we exclude -Werror from x86 kernel builds
BCM_CFLAGS = -Wall
include ${SDK}/make/Makefile.linux-kernel-2_6
endif