Thomas Gleixner | ec8f24b | 2019-05-19 13:07:45 +0100 | [diff] [blame^] | 1 | # SPDX-License-Identifier: GPL-2.0-only |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 2 | OBJCOPYFLAGS :=-O binary |
| 3 | GZFLAGS :=-9 |
| 4 | KBUILD_DEFCONFIG := defconfig |
| 5 | |
| 6 | ifdef CONFIG_CPU_HAS_FPU |
| 7 | FPUEXT = f |
| 8 | endif |
| 9 | |
| 10 | ifdef CONFIG_CPU_HAS_VDSP |
| 11 | VDSPEXT = v |
| 12 | endif |
| 13 | |
| 14 | ifdef CONFIG_CPU_HAS_TEE |
| 15 | TEEEXT = t |
| 16 | endif |
| 17 | |
| 18 | ifdef CONFIG_CPU_CK610 |
| 19 | CPUTYPE = ck610 |
| 20 | CSKYABI = abiv1 |
| 21 | endif |
| 22 | |
| 23 | ifdef CONFIG_CPU_CK810 |
| 24 | CPUTYPE = ck810 |
| 25 | CSKYABI = abiv2 |
| 26 | endif |
| 27 | |
| 28 | ifdef CONFIG_CPU_CK807 |
| 29 | CPUTYPE = ck807 |
| 30 | CSKYABI = abiv2 |
| 31 | endif |
| 32 | |
| 33 | ifdef CONFIG_CPU_CK860 |
| 34 | CPUTYPE = ck860 |
| 35 | CSKYABI = abiv2 |
| 36 | endif |
| 37 | |
| 38 | ifneq ($(CSKYABI),) |
| 39 | MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT) |
Guo Ren | 3dfc242 | 2019-02-19 12:32:41 +0800 | [diff] [blame] | 40 | KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR) |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 41 | KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\" |
| 42 | KBUILD_CFLAGS += -msoft-float -mdiv |
| 43 | KBUILD_CFLAGS += -fno-tree-vectorize |
| 44 | endif |
| 45 | |
| 46 | KBUILD_CFLAGS += -pipe |
| 47 | ifeq ($(CSKYABI),abiv2) |
| 48 | KBUILD_CFLAGS += -mno-stack-size |
| 49 | endif |
| 50 | |
Guo Ren | 0ea2dc7 | 2018-12-09 14:18:05 +0800 | [diff] [blame] | 51 | ifdef CONFIG_STACKTRACE |
| 52 | KBUILD_CFLAGS += -mbacktrace |
| 53 | endif |
| 54 | |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 55 | abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI)) |
| 56 | KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs)) |
| 57 | |
| 58 | KBUILD_CPPFLAGS += -mlittle-endian |
| 59 | LDFLAGS += -EL |
| 60 | |
| 61 | KBUILD_AFLAGS += $(KBUILD_CFLAGS) |
| 62 | |
| 63 | head-y := arch/csky/kernel/head.o |
| 64 | |
| 65 | core-y += arch/csky/kernel/ |
| 66 | core-y += arch/csky/mm/ |
| 67 | core-y += arch/csky/$(CSKYABI)/ |
| 68 | |
| 69 | libs-y += arch/csky/lib/ \ |
| 70 | $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name) |
| 71 | |
| 72 | boot := arch/csky/boot |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 73 | core-y += $(boot)/dts/ |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 74 | |
| 75 | all: zImage |
| 76 | |
Guo Ren | e8d0c9a | 2018-10-30 18:46:47 +0800 | [diff] [blame] | 77 | zImage Image uImage: vmlinux |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 78 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 79 | |
| 80 | archclean: |
| 81 | $(Q)$(MAKE) $(clean)=$(boot) |
Guo Ren | c32e64e | 2018-09-05 14:25:06 +0800 | [diff] [blame] | 82 | |
| 83 | define archhelp |
| 84 | echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' |
| 85 | echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' |
| 86 | echo ' uImage - U-Boot wrapped zImage' |
| 87 | endef |