blob: 82d77f4b0d0832b92891899aff9f1b797114d37c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
2# parisc/Makefile
3#
4# This file is included by the global makefile so that you can add your own
Masahiro Yamada8212f892021-10-13 15:36:22 +09005# architecture-specific flags and dependencies.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#
7# This file is subject to the terms and conditions of the GNU General Public
8# License. See the file "COPYING" in the main directory of this archive
9# for more details.
10#
11# Copyright (C) 1994 by Linus Torvalds
12# Portions Copyright (C) 1999 The Puffin Group
13#
14# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
15# Mike Shaver, Helge Deller and Martin K. Petersen
16#
Adrian Bunkc04f7ae2008-02-26 21:55:17 +020017
Helge Deller1d7c29b2021-11-26 22:35:45 +010018ifdef CONFIG_PARISC_SELF_EXTRACT
19boot := arch/parisc/boot
20KBUILD_IMAGE := $(boot)/bzImage
21else
Helge Deller594174d2013-06-29 13:31:24 +020022KBUILD_IMAGE := vmlinuz
Helge Deller1d7c29b2021-11-26 22:35:45 +010023endif
Helge Deller594174d2013-06-29 13:31:24 +020024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025NM = sh $(srctree)/arch/parisc/nm
Luc Van Oostenryck145167652018-05-28 20:27:35 +020026CHECKFLAGS += -D__hppa__=1
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070029UTS_MACHINE := parisc64
Luc Van Oostenryck1f2f01b2018-05-30 22:48:38 +020030CHECKFLAGS += -D__LP64__=1
Helge Dellerb6adc162017-08-20 10:52:22 +020031LD_BFD := elf64-hppa-linux
Kyle McMartin991b7d62007-10-18 13:54:51 -070032else # 32-bit
Helge Dellerb6adc162017-08-20 10:52:22 +020033LD_BFD := elf32-hppa-linux
Linus Torvalds1da177e2005-04-16 15:20:36 -070034endif
35
Helge Dellerededa082020-03-26 23:31:43 +010036# select defconfig based on actual architecture
Masahiro Yamada5f6e0fe2021-06-10 11:03:31 +090037ifeq ($(ARCH),parisc64)
Helge Dellerededa082020-03-26 23:31:43 +010038 KBUILD_DEFCONFIG := generic-64bit_defconfig
Masahiro Yamada5f6e0fe2021-06-10 11:03:31 +090039 CC_ARCHES := hppa64
Helge Dellerededa082020-03-26 23:31:43 +010040else
41 KBUILD_DEFCONFIG := generic-32bit_defconfig
Masahiro Yamada5f6e0fe2021-06-10 11:03:31 +090042 CC_ARCHES := hppa hppa2.0 hppa1.1
Helge Dellerededa082020-03-26 23:31:43 +010043endif
44
Helge Dellerb6adc162017-08-20 10:52:22 +020045export LD_BFD
46
Masahiro Yamada23243c12021-05-02 02:24:36 +090047ifdef cross_compiling
Helge Deller6880b012013-05-11 19:04:09 +000048 ifeq ($(CROSS_COMPILE),)
49 CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
50 CROSS_COMPILE := $(call cc-cross-prefix, \
51 $(foreach a,$(CC_ARCHES), \
52 $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
53 endif
Kyle McMartin991b7d62007-10-18 13:54:51 -070054endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Sven Schnelle6ca63662019-06-05 22:32:22 +020056ifdef CONFIG_DYNAMIC_FTRACE
57ifdef CONFIG_64BIT
58NOP_COUNT := 8
59else
60NOP_COUNT := 5
61endif
62
63export CC_USING_RECORD_MCOUNT:=1
64export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
65
66KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
67KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
68 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
69
70CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
Sven Schnelle6ca63662019-06-05 22:32:22 +020071endif
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
74
75cflags-y := -pipe
76
77# These flags should be implied by an hppa-linux configuration, but they
78# are not in gcc 3.2.
John David Anglind26a7732014-09-22 20:54:50 -040079cflags-y += -mno-space-regs
80
81# -mfast-indirect-calls is only relevant for 32-bit kernels.
82ifndef CONFIG_64BIT
83cflags-y += -mfast-indirect-calls
84endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86# Currently we save and restore fpregs on all kernel entry/interruption paths.
87# If that gets optimized, we might need to disable the use of fpregs in the
88# kernel.
Randolph Chungfa681a12005-10-21 22:48:34 -040089cflags-y += -mdisable-fpregs
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Helge Dellerec758f92013-01-31 21:44:28 +000091# Use long jumps instead of long branches (needed if your linker fails to
Helge Dellercf711302013-04-23 21:29:03 +020092# link a too big vmlinux executable). Not enabled for building modules.
93ifdef CONFIG_MLONGCALLS
94KBUILD_CFLAGS_KERNEL += -mlong-calls
95endif
Helge Dellerec758f92013-01-31 21:44:28 +000096
Helge Deller1e8249b2018-11-29 17:05:47 +010097# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
98# for branches to reach stubs. And multiple .text sections trigger a warning
99# when creating the sysfs module information section.
100ifndef CONFIG_64BIT
101KBUILD_CFLAGS_MODULE += -ffunction-sections
102endif
103
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104# select which processor to optimise for
Paul Bolle76603902013-05-29 09:56:58 +0000105cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
107cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC
108cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300
109cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000
110
111head-y := arch/parisc/kernel/head.o
112
Sam Ravnborga0f97e02007-10-14 22:21:35 +0200113KBUILD_CFLAGS += $(cflags-y)
Helge Deller0d341e02020-05-10 22:43:33 +0200114LIBGCC := $(shell $(CC) -print-libgcc-file-name)
115export LIBGCC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
James Bottomley4c01acc2012-06-05 13:54:09 +0900117libs-y += arch/parisc/lib/ $(LIBGCC)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Helge Dellerb6adc162017-08-20 10:52:22 +0200119boot := arch/parisc/boot
120
Kyle McMartin6525ee52008-12-08 09:43:08 +0000121PALO := $(shell if (which palo 2>&1); then : ; \
Kyle McMartin5feb4f32007-10-18 15:09:59 -0700122 elif [ -x /sbin/palo ]; then echo /sbin/palo; \
123 fi)
124
Masahiro Yamada75dd4742019-07-06 12:07:11 +0900125PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
126 else echo $(objtree)/palo.conf; \
Kyle McMartinf67d4032007-10-20 09:31:33 -0700127 fi)
128
Helge Dellerb0756b52013-10-18 21:18:46 +0200129palo lifimage: vmlinuz
Kyle McMartinf67d4032007-10-20 09:31:33 -0700130 @if test ! -x "$(PALO)"; then \
Kyle McMartin5feb4f32007-10-18 15:09:59 -0700131 echo 'ERROR: Please install palo first (apt-get install palo)';\
132 echo 'or build it from source and install it somewhere in your $$PATH';\
133 false; \
134 fi
Kyle McMartinf67d4032007-10-20 09:31:33 -0700135 @if test ! -f "$(PALOCONF)"; then \
Masahiro Yamada75dd4742019-07-06 12:07:11 +0900136 cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
137 echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
Kyle McMartin5feb4f32007-10-18 15:09:59 -0700138 echo 'You should check it and re-run "make palo".'; \
139 echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
140 false; \
141 fi
Kyle McMartinf67d4032007-10-20 09:31:33 -0700142 $(PALO) -f $(PALOCONF)
Kyle McMartin5feb4f32007-10-18 15:09:59 -0700143
Helge Dellerb0756b52013-10-18 21:18:46 +0200144BOOT_TARGETS = zImage Image palo lifimage
145INSTALL_TARGETS = zinstall install
146
147PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
148
Helge Deller89e050c2018-04-18 07:49:19 +0200149# Default kernel to build
150all: bzImage
151
Helge Dellerb6adc162017-08-20 10:52:22 +0200152zImage: vmlinuz
Helge Deller594174d2013-06-29 13:31:24 +0200153Image: vmlinux
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
Helge Dellerb6adc162017-08-20 10:52:22 +0200155bzImage: vmlinux
156 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
157
Helge Delleraf21b012017-09-22 22:24:02 +0200158ifdef CONFIG_PARISC_SELF_EXTRACT
Helge Dellerb6adc162017-08-20 10:52:22 +0200159vmlinuz: bzImage
160 $(OBJCOPY) $(boot)/bzImage $@
Helge Delleraf21b012017-09-22 22:24:02 +0200161else
162vmlinuz: vmlinux
Denis Efremove4a42c82020-06-08 12:59:44 +0300163 @$(KGZIP) -cf -9 $< > $@
Helge Delleraf21b012017-09-22 22:24:02 +0200164endif
Helge Deller594174d2013-06-29 13:31:24 +0200165
Helge Dellerb0756b52013-10-18 21:18:46 +0200166install:
Masahiro Yamada75dd4742019-07-06 12:07:11 +0900167 $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
Helge Dellerb0756b52013-10-18 21:18:46 +0200168 $(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
169zinstall:
Masahiro Yamada75dd4742019-07-06 12:07:11 +0900170 $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
Helge Dellerb0756b52013-10-18 21:18:46 +0200171 $(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
Sam Ravnborg0013a852005-09-09 20:57:26 +0200173CLEAN_FILES += lifimage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174MRPROPER_FILES += palo.conf
175
176define archhelp
177 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
Helge Deller594174d2013-06-29 13:31:24 +0200178 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
Kyle McMartin5feb4f32007-10-18 15:09:59 -0700179 @echo ' palo - Bootable image (./lifimage)'
Helge Dellerb0756b52013-10-18 21:18:46 +0200180 @echo ' install - Install uncompressed vmlinux kernel using'
Sam Ravnborgcaa27b62009-07-20 21:37:11 +0200181 @echo ' (your) ~/bin/$(INSTALLKERNEL) or'
182 @echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 @echo ' copy to $$(INSTALL_PATH)'
Helge Dellerb0756b52013-10-18 21:18:46 +0200184 @echo ' zinstall - Install compressed vmlinuz kernel'
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185endef
Firoz Khan575afc42018-11-19 12:04:36 +0530186
187archheaders:
188 $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all