VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
4f1933620f571 (Paul Smith                     2006-03-05 17:14:10 -0500   1) #
4f1933620f571 (Paul Smith                     2006-03-05 17:14:10 -0500   2) # This file is included by the global makefile so that you can add your own
4f1933620f571 (Paul Smith                     2006-03-05 17:14:10 -0500   3) # architecture-specific flags and dependencies.
4f1933620f571 (Paul Smith                     2006-03-05 17:14:10 -0500   4) #
4c9e13851315a (Jeff Dike                      2007-10-16 01:26:54 -0700   5) # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700   6) # Licensed under the GPL
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700   7) #
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700   8) 
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530   9) # select defconfig based on actual architecture
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  10) ifeq ($(SUBARCH),x86)
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  11)   ifeq ($(shell uname -m),x86_64)
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  12)         KBUILD_DEFCONFIG := x86_64_defconfig
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  13)   else
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  14)         KBUILD_DEFCONFIG := i386_defconfig
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  15)   endif
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  16) else
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  17)         KBUILD_DEFCONFIG := $(SUBARCH)_defconfig
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  18) endif
e40f04d040c66 (Ramkumar Ramachandra           2013-09-27 09:44:46 +0530  19) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  20) ARCH_DIR := arch/um
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  21) OS := $(shell uname -s)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  22) # We require bash because the vmlinux link and loader script cpp use bash
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  23) # features.
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  24) SHELL := /bin/bash
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  25) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  26) core-y			+= $(ARCH_DIR)/kernel/		\
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  27) 			   $(ARCH_DIR)/drivers/		\
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  28) 			   $(ARCH_DIR)/os-$(OS)/
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  29) 
8569c9140bd41 (Al Viro                        2008-08-17 13:48:37 -0400  30) MODE_INCLUDE	+= -I$(srctree)/$(ARCH_DIR)/include/shared/skas
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  31) 
7bbe7204e9373 (Al Viro                        2011-08-18 20:06:29 +0100  32) HEADER_ARCH 	:= $(SUBARCH)
7bbe7204e9373 (Al Viro                        2011-08-18 20:06:29 +0100  33) 
fff6540cbcb56 (Richard Weinberger             2013-11-29 15:39:41 +0100  34) ifneq ($(filter $(SUBARCH),x86 x86_64 i386),)
fff6540cbcb56 (Richard Weinberger             2013-11-29 15:39:41 +0100  35) 	HEADER_ARCH := x86
7bbe7204e9373 (Al Viro                        2011-08-18 20:06:29 +0100  36) endif
fff6540cbcb56 (Richard Weinberger             2013-11-29 15:39:41 +0100  37) 
fff6540cbcb56 (Richard Weinberger             2013-11-29 15:39:41 +0100  38) ifdef CONFIG_64BIT
12783aa077f81 (Richard Weinberger             2012-01-24 20:09:12 +0100  39) 	KBUILD_CFLAGS += -mcmodel=large
7bbe7204e9373 (Al Viro                        2011-08-18 20:06:29 +0100  40) endif
7bbe7204e9373 (Al Viro                        2011-08-18 20:06:29 +0100  41) 
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  42) HOST_DIR := arch/$(HEADER_ARCH)
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  43) 
d828563955057 (Masahiro Yamada                2021-07-25 03:35:56 +0900  44) include $(srctree)/$(ARCH_DIR)/Makefile-skas
d828563955057 (Masahiro Yamada                2021-07-25 03:35:56 +0900  45) include $(srctree)/$(HOST_DIR)/Makefile.um
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  46) 
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  47) core-y += $(HOST_DIR)/um/
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  48) 
22409f9c80d0a (Al Viro                        2009-01-05 17:18:42 +0000  49) SHARED_HEADERS	:= $(ARCH_DIR)/include/shared
22409f9c80d0a (Al Viro                        2009-01-05 17:18:42 +0000  50) ARCH_INCLUDE	:= -I$(srctree)/$(SHARED_HEADERS)
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  51) ARCH_INCLUDE	+= -I$(srctree)/$(HOST_DIR)/um/shared
5c48b108ecbf6 (Al Viro                        2011-08-18 20:06:39 +0100  52) KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  53) 
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  54) # -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  55) # named - it's a common symbol in libpcap, so we get a binary which crashes.
fd7481047882e (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:32 +0200  56) #
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  57) # Same things for in6addr_loopback and mktime - found in libc. For these two we
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  58) # only get link-time error, luckily.
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  59) #
f44f1e7da7c8e (Florian Fainelli               2017-05-23 17:32:31 -0700  60) # -Dlongjmp=kernel_longjmp prevents anything from referencing the libpthread.a
f44f1e7da7c8e (Florian Fainelli               2017-05-23 17:32:31 -0700  61) # embedded copy of longjmp, same thing for setjmp.
f44f1e7da7c8e (Florian Fainelli               2017-05-23 17:32:31 -0700  62) #
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  63) # These apply to USER_CFLAGS to.
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  64) 
dc5be20a64543 (Al Viro                        2012-02-11 05:39:56 -0500  65) KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  66) 	$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap	\
f44f1e7da7c8e (Florian Fainelli               2017-05-23 17:32:31 -0700  67) 	-Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
818f6ef407b44 (Jeff Dike                      2007-10-16 01:26:45 -0700  68) 	-Din6addr_loopback=kernel_in6addr_loopback \
2c51a4bc02334 (Al Viro                        2011-09-14 16:21:38 -0700  69) 	-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
fd7481047882e (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:32 +0200  70) 
222d394d30e74 (Sam Ravnborg                   2007-10-15 21:59:31 +0200  71) KBUILD_AFLAGS += $(ARCH_INCLUDE)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  72) 
298e20ba8c197 (Richard Weinberger             2015-05-31 19:50:57 +0200  73) USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
298e20ba8c197 (Richard Weinberger             2015-05-31 19:50:57 +0200  74) 		$(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
0b5aedfe0e665 (Richard Weinberger             2015-06-28 22:55:26 +0200  75) 		-D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
75dd47472b92c (Masahiro Yamada                2019-07-06 12:07:11 +0900  76) 		-idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__
d45e44d4be60e (akpm@osdl.org                  2006-10-29 22:46:42 -0800  77) 
d45e44d4be60e (akpm@osdl.org                  2006-10-29 22:46:42 -0800  78) #This will adjust *FLAGS accordingly to the platform.
d828563955057 (Masahiro Yamada                2021-07-25 03:35:56 +0900  79) include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
ecc354a90af90 (Paolo 'Blaisorblade' Giarrusso 2005-07-14 00:33:41 -0700  80) 
c9b284b2024e5 (H. Peter Anvin                 2011-12-05 16:03:30 -0800  81) KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
abbf1590de22a (David Howells                  2012-10-02 18:01:26 +0100  82) 		   -I$(srctree)/$(HOST_DIR)/include/uapi \
58ab5e0c2c40e (Arnd Bergmann                  2016-06-15 17:45:46 +0200  83) 		   -I$(objtree)/$(HOST_DIR)/include/generated \
58ab5e0c2c40e (Arnd Bergmann                  2016-06-15 17:45:46 +0200  84) 		   -I$(objtree)/$(HOST_DIR)/include/generated/uapi
1de1502c96c3c (Al Viro                        2008-08-17 22:54:55 -0400  85) 
ecc354a90af90 (Paolo 'Blaisorblade' Giarrusso 2005-07-14 00:33:41 -0700  86) # -Derrno=kernel_errno - This turns all kernel references to errno into
ecc354a90af90 (Paolo 'Blaisorblade' Giarrusso 2005-07-14 00:33:41 -0700  87) # kernel_errno to separate them from the libc errno.  This allows -fno-common
a0f97e06a43cf (Sam Ravnborg                   2007-10-14 22:21:35 +0200  88) # in KBUILD_CFLAGS.  Otherwise, it would cause ld to complain about the two different
ecc354a90af90 (Paolo 'Blaisorblade' Giarrusso 2005-07-14 00:33:41 -0700  89) # errnos.
98105d47d3d62 (Paolo 'Blaisorblade' Giarrusso 2006-02-01 03:06:25 -0800  90) # These apply to kernelspace only.
f15cf5151c3ec (Jeff Dike                      2007-11-05 14:50:59 -0800  91) #
f15cf5151c3ec (Jeff Dike                      2007-11-05 14:50:59 -0800  92) # strip leading and trailing whitespace to make the USER_CFLAGS removal of these
f15cf5151c3ec (Jeff Dike                      2007-11-05 14:50:59 -0800  93) # defines more robust
ecc354a90af90 (Paolo 'Blaisorblade' Giarrusso 2005-07-14 00:33:41 -0700  94) 
f15cf5151c3ec (Jeff Dike                      2007-11-05 14:50:59 -0800  95) KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
f15cf5151c3ec (Jeff Dike                      2007-11-05 14:50:59 -0800  96) 			 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
a0f97e06a43cf (Sam Ravnborg                   2007-10-14 22:21:35 +0200  97) KBUILD_CFLAGS += $(KERNEL_DEFINES)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700  98) 
4f1933620f571 (Paul Smith                     2006-03-05 17:14:10 -0500  99) PHONY += linux
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 100) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 101) all: linux
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 102) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 103) linux: vmlinux
a4b741e380cb5 (Jeff Dike                      2006-05-01 12:16:06 -0700 104) 	@echo '  LINK $@'
cb8aa3d29b562 (Paolo 'Blaisorblade' Giarrusso 2006-05-01 12:16:03 -0700 105) 	$(Q)ln -f $< $@
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 106) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 107) define archhelp
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 108)   echo '* linux		- Binary kernel image (./linux) - for backward'
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 109)   echo '		   compatibility only, this creates a hard link to the'
4b3f686d4aa8a (Matt LaPlante                  2006-10-03 22:21:02 +0200 110)   echo '		   real kernel binary, the "vmlinux" binary you'
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 111)   echo '		   find in the kernel root.'
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 112) endef
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 113) 
c9b284b2024e5 (H. Peter Anvin                 2011-12-05 16:03:30 -0800 114) archheaders:
0004438a165b1 (Masahiro Yamada                2018-08-04 13:47:03 +0900 115) 	$(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders
699d7a5734c90 (Al Viro                        2017-09-04 02:37:17 -0400 116) 
65bba0423ecf8 (Masahiro Yamada                2018-11-29 11:58:50 +0900 117) archprepare:
65bba0423ecf8 (Masahiro Yamada                2018-11-29 11:58:50 +0900 118) 	$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 119) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 120) LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
386093c68ba3e (Johannes Berg                  2021-03-08 14:02:37 +0100 121) LINK-$(CONFIG_LD_SCRIPT_DYN) += $(call cc-option, -no-pie)
386093c68ba3e (Johannes Berg                  2021-03-08 14:02:37 +0100 122) LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 123) 
275e6e1ee2baf (Paolo 'Blaisorblade' Giarrusso 2006-05-01 12:16:04 -0700 124) CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
893ab00439a45 (Masahiro Yamada                2020-06-27 03:59:12 +0900 125) 	-fno-stack-protector $(call cc-option, -fno-stack-protector-all)
275e6e1ee2baf (Paolo 'Blaisorblade' Giarrusso 2006-05-01 12:16:04 -0700 126) 
51b563fc93c8c (Sam Ravnborg                   2009-09-20 12:28:22 +0200 127) # Options used by linker script
51b563fc93c8c (Sam Ravnborg                   2009-09-20 12:28:22 +0200 128) export LDS_START      := $(START)
51b563fc93c8c (Sam Ravnborg                   2009-09-20 12:28:22 +0200 129) export LDS_ELF_ARCH   := $(ELF_ARCH)
51b563fc93c8c (Sam Ravnborg                   2009-09-20 12:28:22 +0200 130) export LDS_ELF_FORMAT := $(ELF_FORMAT)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 131) 
4c9e13851315a (Jeff Dike                      2007-10-16 01:26:54 -0700 132) # The wrappers will select whether using "malloc" or the kernel allocator.
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 133) LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 134) 
d503ac531a524 (Masahiro Yamada                2018-08-24 08:20:39 +0900 135) LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
0ba7fe03b638a (Jeff Dike                      2008-02-04 22:30:45 -0800 136) 
1f2bfbd00e466 (Sam Ravnborg                   2012-05-05 10:18:41 +0200 137) # Used by link-vmlinux.sh which has special support for um link
1f2bfbd00e466 (Sam Ravnborg                   2012-05-05 10:18:41 +0200 138) export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 139) 
4c9e13851315a (Jeff Dike                      2007-10-16 01:26:54 -0700 140) # When cleaning we don't include .config, so we don't include
4c9e13851315a (Jeff Dike                      2007-10-16 01:26:54 -0700 141) # TT or skas makefiles and don't clean skas_ptregs.h.
9e636452d0714 (Al Viro                        2011-08-18 20:01:49 +0100 142) CLEAN_FILES += linux x.i gmon.out
0663c68c4d2d3 (Masahiro Yamada                2020-05-04 17:08:07 +0900 143) MRPROPER_FILES += arch/$(SUBARCH)/include/generated
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 144) 
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 145) archclean:
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 146) 	@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 147) 		-o -name '*.gcov' \) -type f -print | xargs rm -f
^1da177e4c3f4 (Linus Torvalds                 2005-04-16 15:20:36 -0700 148) 
79b05c1f31e2e (Christoph Hellwig              2018-07-31 13:39:26 +0200 149) export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH