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