blob: f9aab9157c4a6f0832081ba99ffa3462b4a910fb [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
4KBUILD_DEFCONFIG := defconfig
5
6ifdef CONFIG_CPU_HAS_FPU
7FPUEXT = f
8endif
9
10ifdef CONFIG_CPU_HAS_VDSP
11VDSPEXT = v
12endif
13
14ifdef CONFIG_CPU_HAS_TEE
15TEEEXT = t
16endif
17
18ifdef CONFIG_CPU_CK610
19CPUTYPE = ck610
20CSKYABI = abiv1
21endif
22
23ifdef CONFIG_CPU_CK810
24CPUTYPE = ck810
25CSKYABI = abiv2
26endif
27
28ifdef CONFIG_CPU_CK807
29CPUTYPE = ck807
30CSKYABI = abiv2
31endif
32
33ifdef CONFIG_CPU_CK860
34CPUTYPE = ck860
35CSKYABI = abiv2
36endif
37
38ifneq ($(CSKYABI),)
39MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
Guo Ren3dfc2422019-02-19 12:32:41 +080040KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
Guo Renc32e64e2018-09-05 14:25:06 +080041KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
42KBUILD_CFLAGS += -msoft-float -mdiv
43KBUILD_CFLAGS += -fno-tree-vectorize
44endif
45
46KBUILD_CFLAGS += -pipe
47ifeq ($(CSKYABI),abiv2)
48KBUILD_CFLAGS += -mno-stack-size
49endif
50
Guo Ren0ea2dc72018-12-09 14:18:05 +080051ifdef CONFIG_STACKTRACE
52KBUILD_CFLAGS += -mbacktrace
53endif
54
Guo Renc32e64e2018-09-05 14:25:06 +080055abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
56KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))
57
58KBUILD_CPPFLAGS += -mlittle-endian
59LDFLAGS += -EL
60
61KBUILD_AFLAGS += $(KBUILD_CFLAGS)
62
63head-y := arch/csky/kernel/head.o
64
65core-y += arch/csky/kernel/
66core-y += arch/csky/mm/
67core-y += arch/csky/$(CSKYABI)/
68
69libs-y += arch/csky/lib/ \
70 $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
71
72boot := arch/csky/boot
Guo Renc32e64e2018-09-05 14:25:06 +080073core-y += $(boot)/dts/
Guo Renc32e64e2018-09-05 14:25:06 +080074
75all: zImage
76
Guo Rene8d0c9a2018-10-30 18:46:47 +080077zImage Image uImage: vmlinux
Guo Renc32e64e2018-09-05 14:25:06 +080078 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
79
80archclean:
81 $(Q)$(MAKE) $(clean)=$(boot)
Guo Renc32e64e2018-09-05 14:25:06 +080082
83define 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'
87endef