Makefile 1.5 KB
Newer Older
1
# SPDX-License-Identifier: GPL-2.0-only
G
Guo Ren 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
OBJCOPYFLAGS		:=-O binary
GZFLAGS			:=-9

ifdef CONFIG_CPU_HAS_FPU
FPUEXT = f
endif

ifdef CONFIG_CPU_HAS_VDSP
VDSPEXT = v
endif

ifdef CONFIG_CPU_HAS_TEE
TEEEXT = t
endif

ifdef CONFIG_CPU_CK610
CPUTYPE	= ck610
CSKYABI	= abiv1
endif

ifdef CONFIG_CPU_CK810
CPUTYPE = ck810
CSKYABI	= abiv2
endif

ifdef CONFIG_CPU_CK807
CPUTYPE = ck807
CSKYABI	= abiv2
endif

ifdef CONFIG_CPU_CK860
CPUTYPE = ck860
CSKYABI	= abiv2
endif

ifneq ($(CSKYABI),)
MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
G
Guo Ren 已提交
39
KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
G
Guo Ren 已提交
40 41 42 43 44 45 46 47 48 49
KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
KBUILD_CFLAGS += -msoft-float -mdiv
KBUILD_CFLAGS += -fno-tree-vectorize
endif

KBUILD_CFLAGS += -pipe
ifeq ($(CSKYABI),abiv2)
KBUILD_CFLAGS += -mno-stack-size
endif

G
Guo Ren 已提交
50
ifdef CONFIG_FRAME_POINTER
G
Guo Ren 已提交
51 52 53
KBUILD_CFLAGS += -mbacktrace
endif

G
Guo Ren 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))

KBUILD_CPPFLAGS += -mlittle-endian
LDFLAGS += -EL

KBUILD_AFLAGS += $(KBUILD_CFLAGS)

head-y := arch/csky/kernel/head.o

core-y += arch/csky/$(CSKYABI)/

libs-y += arch/csky/lib/ \
	$(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)

boot := arch/csky/boot

all: zImage

G
Guo Ren 已提交
73
zImage Image uImage: vmlinux
G
Guo Ren 已提交
74 75 76 77 78 79 80
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

define archhelp
  echo  '* zImage       - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
  echo  '  Image        - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
  echo  '  uImage       - U-Boot wrapped zImage'
endef