^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) LDFLAGS_vmlinux := --no-undefined -X
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ifdef CONFIG_FUNCTION_TRACER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) arch-y += -malways-save-lp -mno-relax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # Avoid generating FPU instructions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) arch-y += -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) KBUILD_CFLAGS += -mcmodel=large
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) KBUILD_CFLAGS +=$(arch-y) $(tune-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) KBUILD_AFLAGS +=$(arch-y) $(tune-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #Default value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) head-y := arch/nds32/kernel/head.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) textaddr-y := $(CONFIG_PAGE_OFFSET)+0xc000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) TEXTADDR := $(textaddr-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) export TEXTADDR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # If we have a machine-specific directory, then include it in the build.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) core-y += arch/nds32/kernel/ arch/nds32/mm/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) core-$(CONFIG_FPU) += arch/nds32/math-emu/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) libs-y += arch/nds32/lib/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) BUILTIN_DTB := y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) BUILTIN_DTB := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) ifdef CONFIG_CPU_LITTLE_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) KBUILD_CFLAGS += $(call cc-option, -EL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) KBUILD_AFLAGS += $(call cc-option, -EL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) KBUILD_LDFLAGS += $(call cc-option, -EL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) CHECKFLAGS += -D__NDS32_EL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) KBUILD_CFLAGS += $(call cc-option, -EB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) KBUILD_AFLAGS += $(call cc-option, -EB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) KBUILD_LDFLAGS += $(call cc-option, -EB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) CHECKFLAGS += -D__NDS32_EB__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) boot := arch/nds32/boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) core-y += $(boot)/dts/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Image: vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) PHONY += vdso_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) vdso_install:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) prepare: vdso_prepare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) vdso_prepare: prepare0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) archclean:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) $(Q)$(MAKE) $(clean)=$(boot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) define archhelp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) echo ' Image - kernel image (arch/$(ARCH)/boot/Image)'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) endef