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

131 lines
5.0 KiB
Makefile

#
# 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-iproc Exp $
# $Copyright: (c) 2007 Broadcom Corp.
# All Rights Reserved.$
# Makefile for iproc-CMICd
# User must select one platform from below.By default ARM_LINUX is selected. .
ifeq (,$(BUILD_PLATFORM))
BUILD_PLATFORM=ARM_LINUX
endif
# TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices
# TARGET_ARCHITECTURE Compiler for target architecture
# KERNDIR Kernel directory for iPROC-CMICd devices
ifeq (BE,$(ENDIAN_MODE))
#We've never actually built a 64 BE executable. Just here for any future
#customer requirements.
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61-be/XLDK64
KERN_BASE_DIR ?= $(TOOLCHAIN_BASE_DIR)
TARGET_ARCHITECTURE ?= aarch64_be-broadcom-linux-uclibc
KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux
else
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/XLDK_GCC10/XLDK64
KERN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK64
TARGET_ARCHITECTURE ?= aarch64-broadcom-linux-uclibc
KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux
endif
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
endif
# A72 tools
TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin
override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib
export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion)
# 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
CFLAGS += -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS
CFLAGS += -DPHYS_ADDRS_ARE_64BITS
CFLAGS += -fno-aggressive-loop-optimizations -fno-strict-overflow
CFLAGS += -Wno-error=maybe-uninitialized
CFLAGS += -Wno-error=unused-function
CFLAGS += -Wno-error=array-bounds
CFLAGS += -Wno-error=format-overflow
CFLAGS += -fgnu89-inline
ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 8)" "1"
CFLAGS += -Wno-stringop-overflow
CFLAGS += -Wno-stringop-truncation
CFLAGS += -Wno-error=restrict
endif
ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 9)" "1"
CFLAGS += -Wno-address-of-packed-member
endif
ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \== 10)" "1"
CFLAGS += -Wno-error=uninitialized
CFLAGS += -Wno-error=format-overflow
CFLAGS += -fcommon
endif
CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=16
ARCH = arm64
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 ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/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/uapi -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 -O2 -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mcmodel=large
endif
ifneq ($(targetplat),user)
include ${SDK}/make/Makefile.linux-kernel-3_6
endif