blob: 37f593a4bf53612dd8ff5492bde0e24bec13f574 [file] [log] [blame]
Thomas Gleixnerec8f24b2019-05-19 13:07:45 +01001# SPDX-License-Identifier: GPL-2.0-only
Guo Renc32e64e2018-09-05 14:25:06 +08002OBJCOPYFLAGS :=-O binary
3GZFLAGS :=-9
Guo Renc32e64e2018-09-05 14:25:06 +08004
5ifdef CONFIG_CPU_HAS_FPU
6FPUEXT = f
7endif
8
9ifdef CONFIG_CPU_HAS_VDSP
10VDSPEXT = v
11endif
12
13ifdef CONFIG_CPU_HAS_TEE
14TEEEXT = t
15endif
16
17ifdef CONFIG_CPU_CK610
18CPUTYPE = ck610
19CSKYABI = abiv1
20endif
21
22ifdef CONFIG_CPU_CK810
23CPUTYPE = ck810
24CSKYABI = abiv2
25endif
26
27ifdef CONFIG_CPU_CK807
28CPUTYPE = ck807
29CSKYABI = abiv2
30endif
31
32ifdef CONFIG_CPU_CK860
33CPUTYPE = ck860
34CSKYABI = abiv2
35endif
36
37ifneq ($(CSKYABI),)
38MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
Guo Ren3dfc2422019-02-19 12:32:41 +080039KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
Guo Renc32e64e2018-09-05 14:25:06 +080040KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
41KBUILD_CFLAGS += -msoft-float -mdiv
42KBUILD_CFLAGS += -fno-tree-vectorize
43endif
44
45KBUILD_CFLAGS += -pipe
46ifeq ($(CSKYABI),abiv2)
47KBUILD_CFLAGS += -mno-stack-size
48endif
49
Guo Ren18c07d22020-05-13 15:15:25 +080050ifdef CONFIG_FRAME_POINTER
Guo Ren0ea2dc72018-12-09 14:18:05 +080051KBUILD_CFLAGS += -mbacktrace
52endif
53
Guo Renc32e64e2018-09-05 14:25:06 +080054abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
55KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))
56
57KBUILD_CPPFLAGS += -mlittle-endian
58LDFLAGS += -EL
59
60KBUILD_AFLAGS += $(KBUILD_CFLAGS)
61
62head-y := arch/csky/kernel/head.o
63
64core-y += arch/csky/kernel/
65core-y += arch/csky/mm/
66core-y += arch/csky/$(CSKYABI)/
67
68libs-y += arch/csky/lib/ \
69 $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
70
71boot := arch/csky/boot
Guo Renc32e64e2018-09-05 14:25:06 +080072core-y += $(boot)/dts/
Guo Renc32e64e2018-09-05 14:25:06 +080073
74all: zImage
75
Guo Rene8d0c9a2018-10-30 18:46:47 +080076zImage Image uImage: vmlinux
Guo Renc32e64e2018-09-05 14:25:06 +080077 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
78
79archclean:
80 $(Q)$(MAKE) $(clean)=$(boot)
Guo Renc32e64e2018-09-05 14:25:06 +080081
82define 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'
86endef