18c2ecf20Sopenharmony_ci#
28c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci# for more details.
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# Copyright (C) 2013 Altera Corporation
78c2ecf20Sopenharmony_ci# Copyright (C) 1994, 95, 96, 2003 by Wind River Systems
88c2ecf20Sopenharmony_ci# Written by Fredrik Markstrom
98c2ecf20Sopenharmony_ci#
108c2ecf20Sopenharmony_ci# This file is included by the global makefile so that you can add your own
118c2ecf20Sopenharmony_ci# architecture-specific flags and dependencies. Remember to do have actions
128c2ecf20Sopenharmony_ci# for "archclean" cleaning up for this architecture.
138c2ecf20Sopenharmony_ci#
148c2ecf20Sopenharmony_ci# Nios2 port by Wind River Systems Inc trough:
158c2ecf20Sopenharmony_ci#   fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciKBUILD_DEFCONFIG := 3c120_defconfig
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciUTS_SYSNAME = Linux
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciexport MMU
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciLIBGCC         := $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciKBUILD_AFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
288c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
298c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
308c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
318c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
328c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx)
338c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_CDX_SUPPORT),-mcdx,-mno-cdx)
348c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -fno-optimize-sibling-calls
378c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
388c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -fno-builtin
398c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -G 0
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cihead-y		:= arch/nios2/kernel/head.o
428c2ecf20Sopenharmony_cilibs-y		+= arch/nios2/lib/ $(LIBGCC)
438c2ecf20Sopenharmony_cicore-y		+= arch/nios2/kernel/ arch/nios2/mm/
448c2ecf20Sopenharmony_cicore-y		+= arch/nios2/platform/
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciINSTALL_PATH ?= /tftpboot
478c2ecf20Sopenharmony_cinios2-boot := arch/$(ARCH)/boot
488c2ecf20Sopenharmony_ciBOOT_TARGETS = vmImage zImage
498c2ecf20Sopenharmony_ciPHONY += $(BOOT_TARGETS) install
508c2ecf20Sopenharmony_ciKBUILD_IMAGE := $(nios2-boot)/vmImage
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cicore-y	+= $(nios2-boot)/dts/
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciall: vmImage
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciarchclean:
578c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(clean)=$(nios2-boot)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci$(BOOT_TARGETS): vmlinux
608c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciinstall:
638c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cidefine archhelp
668c2ecf20Sopenharmony_ci  echo  '* vmImage         - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
678c2ecf20Sopenharmony_ci  echo  '  install         - Install kernel using'
688c2ecf20Sopenharmony_ci  echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
698c2ecf20Sopenharmony_ci  echo  '                     (distribution) /sbin/$(INSTALLKERNEL) or'
708c2ecf20Sopenharmony_ci  echo  '                     install to $$(INSTALL_PATH)'
718c2ecf20Sopenharmony_ciendef
72