xref: /kernel/linux/linux-6.6/arch/parisc/Makefile (revision 62306a36)
162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# parisc/Makefile
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# This file is included by the global makefile so that you can add your own
562306a36Sopenharmony_ci# architecture-specific flags and dependencies.
662306a36Sopenharmony_ci#
762306a36Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
862306a36Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
962306a36Sopenharmony_ci# for more details.
1062306a36Sopenharmony_ci#
1162306a36Sopenharmony_ci# Copyright (C) 1994 by Linus Torvalds
1262306a36Sopenharmony_ci# Portions Copyright (C) 1999 The Puffin Group
1362306a36Sopenharmony_ci#
1462306a36Sopenharmony_ci# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
1562306a36Sopenharmony_ci# Mike Shaver, Helge Deller and Martin K. Petersen
1662306a36Sopenharmony_ci#
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciboot := arch/parisc/boot
1962306a36Sopenharmony_ciKBUILD_IMAGE := $(boot)/bzImage
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciCHECKFLAGS	+= -D__hppa__=1
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciifdef CONFIG_64BIT
2462306a36Sopenharmony_ciUTS_MACHINE	:= parisc64
2562306a36Sopenharmony_ciCHECKFLAGS	+= -D__LP64__=1
2662306a36Sopenharmony_ciLD_BFD		:= elf64-hppa-linux
2762306a36Sopenharmony_cielse # 32-bit
2862306a36Sopenharmony_ciLD_BFD		:= elf32-hppa-linux
2962306a36Sopenharmony_ciendif
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci# select defconfig based on actual architecture
3262306a36Sopenharmony_ciifeq ($(ARCH),parisc64)
3362306a36Sopenharmony_ci	KBUILD_DEFCONFIG := generic-64bit_defconfig
3462306a36Sopenharmony_ci	CC_ARCHES := hppa64
3562306a36Sopenharmony_cielse
3662306a36Sopenharmony_ci	KBUILD_DEFCONFIG := generic-32bit_defconfig
3762306a36Sopenharmony_ci	CC_ARCHES := hppa hppa2.0 hppa1.1
3862306a36Sopenharmony_ciendif
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciexport LD_BFD
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci# Set default 32 bits cross compilers for vdso
4362306a36Sopenharmony_ciCC_ARCHES_32 = hppa hppa2.0 hppa1.1
4462306a36Sopenharmony_ciCC_SUFFIXES  = linux linux-gnu unknown-linux-gnu suse-linux
4562306a36Sopenharmony_ciCROSS32_COMPILE := $(call cc-cross-prefix, \
4662306a36Sopenharmony_ci	$(foreach a,$(CC_ARCHES_32), \
4762306a36Sopenharmony_ci	$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
4862306a36Sopenharmony_ciCROSS32CC := $(CROSS32_COMPILE)gcc
4962306a36Sopenharmony_ciexport CROSS32CC
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci# Set default cross compiler for kernel build
5262306a36Sopenharmony_ciifdef cross_compiling
5362306a36Sopenharmony_ci	ifeq ($(CROSS_COMPILE),)
5462306a36Sopenharmony_ci		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
5562306a36Sopenharmony_ci		CROSS_COMPILE := $(call cc-cross-prefix, \
5662306a36Sopenharmony_ci			$(foreach a,$(CC_ARCHES), \
5762306a36Sopenharmony_ci			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
5862306a36Sopenharmony_ci	endif
5962306a36Sopenharmony_ciendif
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciifdef CONFIG_DYNAMIC_FTRACE
6262306a36Sopenharmony_ciifdef CONFIG_64BIT
6362306a36Sopenharmony_ciNOP_COUNT := 8
6462306a36Sopenharmony_cielse
6562306a36Sopenharmony_ciNOP_COUNT := 5
6662306a36Sopenharmony_ciendif
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciexport CC_USING_RECORD_MCOUNT:=1
6962306a36Sopenharmony_ciexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
7262306a36Sopenharmony_ciKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
7362306a36Sopenharmony_ci		 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
7662306a36Sopenharmony_ciendif
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciOBJCOPY_FLAGS =-O binary -R .note -R .comment -S
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_cicflags-y	:= -pipe
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci# These flags should be implied by an hppa-linux configuration, but they
8362306a36Sopenharmony_ci# are not in gcc 3.2.
8462306a36Sopenharmony_cicflags-y	+= -mno-space-regs
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci# -mfast-indirect-calls is only relevant for 32-bit kernels.
8762306a36Sopenharmony_ciifndef CONFIG_64BIT
8862306a36Sopenharmony_cicflags-y	+= -mfast-indirect-calls
8962306a36Sopenharmony_ciendif
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci# Currently we save and restore fpregs on all kernel entry/interruption paths.
9262306a36Sopenharmony_ci# If that gets optimized, we might need to disable the use of fpregs in the
9362306a36Sopenharmony_ci# kernel.
9462306a36Sopenharmony_cicflags-y	+= -mdisable-fpregs
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci# Use long jumps instead of long branches (needed if your linker fails to
9762306a36Sopenharmony_ci# link a too big vmlinux executable). Not enabled for building modules.
9862306a36Sopenharmony_ciifdef CONFIG_MLONGCALLS
9962306a36Sopenharmony_ciKBUILD_CFLAGS_KERNEL += -mlong-calls
10062306a36Sopenharmony_ciendif
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
10362306a36Sopenharmony_ci# for branches to reach stubs. And multiple .text sections trigger a warning
10462306a36Sopenharmony_ci# when creating the sysfs module information section.
10562306a36Sopenharmony_ciifndef CONFIG_64BIT
10662306a36Sopenharmony_ciKBUILD_CFLAGS_MODULE += -ffunction-sections
10762306a36Sopenharmony_ciendif
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci# select which processor to optimise for
11062306a36Sopenharmony_cicflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
11162306a36Sopenharmony_cicflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
11262306a36Sopenharmony_cicflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
11362306a36Sopenharmony_cicflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
11462306a36Sopenharmony_cicflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciKBUILD_CFLAGS	+= $(cflags-y)
11762306a36Sopenharmony_ciLIBGCC		:= $(shell $(CC) -print-libgcc-file-name)
11862306a36Sopenharmony_ciexport LIBGCC
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_cilibs-y	+= arch/parisc/lib/ $(LIBGCC)
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_cidrivers-y += arch/parisc/video/
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ciboot	:= arch/parisc/boot
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ciPALO := $(shell if (which palo 2>&1); then : ; \
12762306a36Sopenharmony_ci	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
12862306a36Sopenharmony_ci	fi)
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ciPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
13162306a36Sopenharmony_ci	else echo $(objtree)/palo.conf; \
13262306a36Sopenharmony_ci	fi)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_cipalo lifimage: vmlinuz
13562306a36Sopenharmony_ci	@if test ! -x "$(PALO)"; then \
13662306a36Sopenharmony_ci		echo 'ERROR: Please install palo first (apt-get install palo)';\
13762306a36Sopenharmony_ci		echo 'or build it from source and install it somewhere in your $$PATH';\
13862306a36Sopenharmony_ci		false; \
13962306a36Sopenharmony_ci	fi
14062306a36Sopenharmony_ci	@if test ! -f "$(PALOCONF)"; then \
14162306a36Sopenharmony_ci		cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
14262306a36Sopenharmony_ci		echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
14362306a36Sopenharmony_ci		echo 'You should check it and re-run "make palo".'; \
14462306a36Sopenharmony_ci		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
14562306a36Sopenharmony_ci		false; \
14662306a36Sopenharmony_ci	fi
14762306a36Sopenharmony_ci	$(PALO) -f $(PALOCONF)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ciBOOT_TARGETS    = zImage Image palo lifimage
15062306a36Sopenharmony_ciINSTALL_TARGETS = zinstall install
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ciPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci# Default kernel to build
15562306a36Sopenharmony_ciall: bzImage
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_cizImage: vmlinuz
15862306a36Sopenharmony_ciImage: vmlinux
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_cibzImage: vmlinux
16162306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_civmlinuz: bzImage
16462306a36Sopenharmony_ci	$(OBJCOPY) $(boot)/bzImage $@
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciifeq ($(KBUILD_EXTMOD),)
16762306a36Sopenharmony_ci# We need to generate vdso-offsets.h before compiling certain files in kernel/.
16862306a36Sopenharmony_ci# In order to do that, we should use the archprepare target, but we can't since
16962306a36Sopenharmony_ci# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
17062306a36Sopenharmony_ci# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
17162306a36Sopenharmony_ci# Therefore we need to generate the header after prepare0 has been made, hence
17262306a36Sopenharmony_ci# this hack.
17362306a36Sopenharmony_ciprepare: vdso_prepare
17462306a36Sopenharmony_civdso_prepare: prepare0
17562306a36Sopenharmony_ci	$(if $(CONFIG_64BIT),$(Q)$(MAKE) \
17662306a36Sopenharmony_ci		$(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
17762306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
17862306a36Sopenharmony_ciendif
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciPHONY += vdso_install
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_civdso_install:
18362306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@
18462306a36Sopenharmony_ci	$(if $(CONFIG_COMPAT_VDSO), \
18562306a36Sopenharmony_ci		$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ciinstall: KBUILD_IMAGE := vmlinux
18862306a36Sopenharmony_cizinstall: KBUILD_IMAGE := vmlinuz
18962306a36Sopenharmony_ciinstall zinstall:
19062306a36Sopenharmony_ci	$(call cmd,install)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ciCLEAN_FILES	+= lifimage
19362306a36Sopenharmony_ciMRPROPER_FILES	+= palo.conf
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_cidefine archhelp
19662306a36Sopenharmony_ci	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
19762306a36Sopenharmony_ci	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
19862306a36Sopenharmony_ci	@echo  '  palo		- Bootable image (./lifimage)'
19962306a36Sopenharmony_ci	@echo  '  install	- Install uncompressed vmlinux kernel using'
20062306a36Sopenharmony_ci	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
20162306a36Sopenharmony_ci	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
20262306a36Sopenharmony_ci	@echo  '		  copy to $$(INSTALL_PATH)'
20362306a36Sopenharmony_ci	@echo  '  zinstall	- Install compressed vmlinuz kernel'
20462306a36Sopenharmony_ciendef
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ciarchheaders:
20762306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
208