Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0-only
0002 #
0003 # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
0004 #
0005 
0006 KBUILD_DEFCONFIG := haps_hs_smp_defconfig
0007 
0008 ifeq ($(CROSS_COMPILE),)
0009 CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
0010 endif
0011 
0012 cflags-y        += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
0013 
0014 tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT)   := -mcpu=arc700
0015 tune-mcpu-def-$(CONFIG_ISA_ARCV2)       := -mcpu=hs38
0016 
0017 ifeq ($(CONFIG_ARC_TUNE_MCPU),)
0018 cflags-y                                += $(tune-mcpu-def-y)
0019 else
0020 tune-mcpu                               := $(CONFIG_ARC_TUNE_MCPU)
0021 ifneq ($(call cc-option,$(tune-mcpu)),)
0022 cflags-y                                += $(tune-mcpu)
0023 else
0024 # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
0025 # (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
0026 $(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
0027 cflags-y                                += $(tune-mcpu-def-y)
0028 endif
0029 endif
0030 
0031 
0032 ifdef CONFIG_ARC_CURR_IN_REG
0033 # For a global register definition, make sure it gets passed to every file
0034 # We had a customer reported bug where some code built in kernel was NOT using
0035 # any kernel headers, and missing the r25 global register
0036 # Can't do unconditionally because of recursive include issues
0037 # due to <linux/thread_info.h>
0038 LINUXINCLUDE    +=  -include $(srctree)/arch/arc/include/asm/current.h
0039 endif
0040 
0041 cflags-y                                += -fsection-anchors
0042 
0043 cflags-$(CONFIG_ARC_HAS_LLSC)           += -mlock
0044 cflags-$(CONFIG_ARC_HAS_SWAPE)          += -mswape
0045 
0046 ifdef CONFIG_ISA_ARCV2
0047 
0048 ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
0049 cflags-y                                += -munaligned-access
0050 else
0051 cflags-y                                += -mno-unaligned-access
0052 endif
0053 
0054 ifndef CONFIG_ARC_HAS_LL64
0055 cflags-y                                += -mno-ll64
0056 endif
0057 
0058 ifndef CONFIG_ARC_HAS_DIV_REM
0059 cflags-y                                += -mno-div-rem
0060 endif
0061 
0062 endif
0063 
0064 cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
0065 cflags-$(CONFIG_ARC_DW2_UNWIND)         += -fasynchronous-unwind-tables $(cfi)
0066 
0067 # small data is default for elf32 tool-chain. If not usable, disable it
0068 # This also allows repurposing GP as scratch reg to gcc reg allocator
0069 disable_small_data := y
0070 cflags-$(disable_small_data)            += -mno-sdata -fcall-used-gp
0071 
0072 cflags-$(CONFIG_CPU_BIG_ENDIAN)         += -mbig-endian
0073 ldflags-$(CONFIG_CPU_BIG_ENDIAN)        += -EB
0074 
0075 LIBGCC  = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
0076 
0077 # Modules with short calls might break for calls into builtin-kernel
0078 KBUILD_CFLAGS_MODULE    += -mlong-calls -mno-millicode
0079 
0080 # Finally dump eveything into kernel build system
0081 KBUILD_CFLAGS   += $(cflags-y)
0082 KBUILD_AFLAGS   += $(KBUILD_CFLAGS)
0083 KBUILD_LDFLAGS  += $(ldflags-y)
0084 
0085 head-y          := arch/arc/kernel/head.o
0086 
0087 # w/o this dtb won't embed into kernel binary
0088 core-y          += arch/arc/boot/dts/
0089 
0090 core-y                          += arch/arc/plat-sim/
0091 core-$(CONFIG_ARC_PLAT_TB10X)   += arch/arc/plat-tb10x/
0092 core-$(CONFIG_ARC_PLAT_AXS10X)  += arch/arc/plat-axs10x/
0093 core-$(CONFIG_ARC_SOC_HSDK)     += arch/arc/plat-hsdk/
0094 
0095 libs-y          += arch/arc/lib/ $(LIBGCC)
0096 
0097 boot            := arch/arc/boot
0098 
0099 boot_targets := uImage.bin uImage.gz uImage.lzma
0100 
0101 PHONY += $(boot_targets)
0102 $(boot_targets): vmlinux
0103         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
0104 
0105 uimage-default-y                        := uImage.bin
0106 uimage-default-$(CONFIG_KERNEL_GZIP)    := uImage.gz
0107 uimage-default-$(CONFIG_KERNEL_LZMA)    := uImage.lzma
0108 
0109 PHONY += uImage
0110 uImage: $(uimage-default-y)
0111         @ln -sf $< $(boot)/uImage
0112         @$(kecho) '  Image $(boot)/uImage is ready'
0113 
0114 CLEAN_FILES += $(boot)/uImage