sonic-buildimage/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc
Guohan Lu aa2e340f5a [broadcom]: build broadcom kernel modules from gpl source codes
Signed-off-by: Guohan Lu <gulv@microsoft.com>
2018-08-11 09:09:03 +00:00

94 lines
3.7 KiB
Makefile

#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $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))
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc-be/XLDK
TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
else
TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc/XLDK
TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
endif
ifeq (,$(CROSS_COMPILE))
CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
endif
# arm9tools
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
# 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) -DIPROC_CMICD
CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
ARCH = arm
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)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.3/include
ifeq (,$(KFLAGS))
KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls
KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi
endif
ifneq ($(targetplat),user)
include ${SDK}/make/Makefile.linux-kernel-3_6
endif