openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

Makefile.linux-xlr (5670B)


      1 #
      2 #  Copyright 2017 Broadcom
      3 #  
      4 #  This program is free software; you can redistribute it and/or modify
      5 #  it under the terms of the GNU General Public License, version 2, as
      6 #  published by the Free Software Foundation (the "GPL").
      7 #  
      8 #  This program is distributed in the hope that it will be useful, but
      9 #  WITHOUT ANY WARRANTY; without even the implied warranty of
     10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11 #  General Public License version 2 (GPLv2) for more details.
     12 #  
     13 #  You should have received a copy of the GNU General Public License
     14 #  version 2 (GPLv2) along with this source code.
     15 #
     16 # $Id: Makefile.linux-xlr-4_19,v 0.1 Broadcom SDK $
     17 # $Copyright: (c) 2015 Broadcom Corp.
     18 # All Rights Reserved.$
     19 
     20 #
     21 # XLR system make file.
     22 #
     23 # Most of this was taken from target x86-smp_generic_64-2_6.
     24 #
     25 
     26 
     27 #############################################################################
     28 # this segment is custom and not sourced from any existing makefile         #
     29 # (base thanks to http:<slash><slash>confluence.broadcom.com/display/NTSWSW/X86+System) #
     30 #############################################################################
     31 
     32 # set up a basic feature list. tcl, etc. #
     33 #ifeq (,$(FEATURE_LIST))
     34 #FEATURE_LIST = TCL BFD PTP CINT L3 I2C MEM_SCAN EDITLINE BCM_SAL_PROFILE CUSTOMER TEST CHASSIS MSTP RCPU
     35 #endif
     36 
     37 # some basic path variables for tools and kernel source, etc #
     38 export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419
     39 TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr
     40 KERNDIR       = $(XLR_TOOLS_BASE)/kernel/linux
     41 
     42 # set up cross compile prefix, tools dir variables. #
     43 export CROSS_COMPILE := x86_64-broadcom-linux-gnu-
     44 export TOOLS_DIR     := $(TOOLCHAIN_DIR)/bin
     45 
     46 # architecture. #
     47 ARCH                = x86_64
     48 TARGET_ARCHITECTURE = x86_64-broadcom-linux-gnu
     49 
     50 # Noisy kernel build
     51 KBUILD_VERBOSE = 1
     52 
     53 export ARCH KBUILD_VERBOSE
     54 
     55 # set up paths. #
     56 export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PATH)
     57 export PATH         := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH)
     58 
     59 # set up SYSINC path #
     60 export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include
     61 
     62 
     63 # CFLAGS/CFGFLAGS #
     64 CFLAGS += -DUSE_LINUX_BDE_MMAP=1
     65 #CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT
     66 CFLAGS += -Wno-error=unused-value
     67 CFLAGS += -Wno-error=unused-but-set-variable
     68 CFLAGS += -Wno-error=maybe-uninitialized
     69 CFLAGS += -Wno-error=cpp
     70 CFLAGS += -Wno-error=aggressive-loop-optimizations
     71 CFLAGS += -Wno-error=array-bounds
     72 CFLAGS += -Wno-error=strict-overflow
     73 CFLAGS += -L$(TOOLCHAIN_DIR)/lib
     74 CFLAGS += -L$(TOOLCHAIN_DIR)/lib64
     75 #CFLAGS += -Wl,--rpath=/lib64                                 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, #
     76 #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 #
     77 
     78 #XLDK-568 fix inline references
     79 CFGFLAGS += -fgnu89-inline
     80 
     81 
     82 # set up KFLAGS appropriately. #
     83 ifeq (,$(KFLAGS))
     84 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
     85 endif
     86 
     87 
     88 ######################################################################
     89 # this segment comes from make/Makefile.linux-x86-smp_generic_64-2_6 #
     90 ######################################################################
     91 CFGFLAGS += -DLONGS_ARE_64BITS
     92 CFGFLAGS += -DPTRS_ARE_64BITS
     93 CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
     94 
     95 
     96 ##############################################################
     97 # This segment comes from make/Makefile.linux-x86-common-2_6 #
     98 ##############################################################
     99 CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
    100 ENDIAN = LE_HOST=1
    101 CFGFLAGS += -D$(ENDIAN)
    102 CFGFLAGS += -DBCM_PLATFORM_STRING=\"X86\"
    103 CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32
    104 
    105 # Extra variables.
    106 EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
    107 
    108 comma = ,
    109 basetarget = $(basename $(notdir $@))
    110 modname = $(basetarget)
    111 
    112 name-fix = $(subst $(comma),_,$(subst -,_,$1))
    113 basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
    114 modname_flags  = $(if $(filter 1,$(words $(modname))),\
    115 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
    116 
    117 ifdef LTSW_CHIPS
    118 # Ensure we do not use an out-of-date libelf.so
    119 ELFUTILS_MIN = 158
    120 ELFUTILS_DIR ?= /projects/ntsw-tools/lib
    121 
    122 # Default open source target build
    123 OPENSRC_BUILD ?= fed21-x86_64
    124 
    125 # Hardware interface (see $SDKLT/bcma/sys/probe directory)
    126 SYSTEM_INTERFACE ?= ngbde
    127 
    128 # Turn on direct register access if running on real hardware.
    129 ifeq (ngbde,$(SYSTEM_INTERFACE))
    130 LTSW_ADD_CPPFLAGS += -DBCMDRD_CONFIG_MEMMAP_DIRECT=1
    131 endif
    132 
    133 export SYSTEM_INTERFACE
    134 endif
    135 
    136 ifneq ($(targetplat),user)
    137 # By default we exclude -Werror from x86 kernel builds
    138 BCM_CFLAGS   = -Wall
    139 include ${SDK}/make/Makefile.linux-kernel-2_6
    140 endif
    141 
    142