18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ciOBJCOPYFLAGS		:=-O binary
38c2ecf20Sopenharmony_ciGZFLAGS			:=-9
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciifdef CONFIG_CPU_HAS_FPU
68c2ecf20Sopenharmony_ciFPUEXT = f
78c2ecf20Sopenharmony_ciendif
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciifdef CONFIG_CPU_HAS_VDSP
108c2ecf20Sopenharmony_ciVDSPEXT = v
118c2ecf20Sopenharmony_ciendif
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciifdef CONFIG_CPU_HAS_TEE
148c2ecf20Sopenharmony_ciTEEEXT = t
158c2ecf20Sopenharmony_ciendif
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciifdef CONFIG_CPU_CK610
188c2ecf20Sopenharmony_ciCPUTYPE	= ck610
198c2ecf20Sopenharmony_ciCSKYABI	= abiv1
208c2ecf20Sopenharmony_ciendif
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciifdef CONFIG_CPU_CK810
238c2ecf20Sopenharmony_ciCPUTYPE = ck810
248c2ecf20Sopenharmony_ciCSKYABI	= abiv2
258c2ecf20Sopenharmony_ciendif
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciifdef CONFIG_CPU_CK807
288c2ecf20Sopenharmony_ciCPUTYPE = ck807
298c2ecf20Sopenharmony_ciCSKYABI	= abiv2
308c2ecf20Sopenharmony_ciendif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciifdef CONFIG_CPU_CK860
338c2ecf20Sopenharmony_ciCPUTYPE = ck860
348c2ecf20Sopenharmony_ciCSKYABI	= abiv2
358c2ecf20Sopenharmony_ciendif
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciifneq ($(CSKYABI),)
388c2ecf20Sopenharmony_ciMCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
398c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
408c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
418c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -msoft-float -mdiv
428c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -fno-tree-vectorize
438c2ecf20Sopenharmony_ciendif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -pipe
468c2ecf20Sopenharmony_ciifeq ($(CSKYABI),abiv2)
478c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -mno-stack-size
488c2ecf20Sopenharmony_ciendif
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciifdef CONFIG_FRAME_POINTER
518c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -mbacktrace
528c2ecf20Sopenharmony_ciendif
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciabidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
558c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciKBUILD_CPPFLAGS += -mlittle-endian
588c2ecf20Sopenharmony_ciLDFLAGS += -EL
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciKBUILD_AFLAGS += $(KBUILD_CFLAGS)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cihead-y := arch/csky/kernel/head.o
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cicore-y += arch/csky/kernel/
658c2ecf20Sopenharmony_cicore-y += arch/csky/mm/
668c2ecf20Sopenharmony_cicore-y += arch/csky/$(CSKYABI)/
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cilibs-y += arch/csky/lib/ \
698c2ecf20Sopenharmony_ci	$(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciboot := arch/csky/boot
728c2ecf20Sopenharmony_cicore-y += $(boot)/dts/
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciall: zImage
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cizImage Image uImage: vmlinux
778c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciarchclean:
808c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(clean)=$(boot)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cidefine archhelp
838c2ecf20Sopenharmony_ci  echo  '* zImage       - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
848c2ecf20Sopenharmony_ci  echo  '  Image        - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
858c2ecf20Sopenharmony_ci  echo  '  uImage       - U-Boot wrapped zImage'
868c2ecf20Sopenharmony_ciendef
87