Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | # |
| 2 | # parisc/Makefile |
| 3 | # |
| 4 | # This file is included by the global makefile so that you can add your own |
Masahiro Yamada | 8212f89 | 2021-10-13 15:36:22 +0900 | [diff] [blame] | 5 | # architecture-specific flags and dependencies. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | # |
| 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 Bunk | c04f7ae | 2008-02-26 21:55:17 +0200 | [diff] [blame] | 17 | |
Helge Deller | 1d7c29b | 2021-11-26 22:35:45 +0100 | [diff] [blame] | 18 | ifdef CONFIG_PARISC_SELF_EXTRACT |
| 19 | boot := arch/parisc/boot |
| 20 | KBUILD_IMAGE := $(boot)/bzImage |
| 21 | else |
Helge Deller | 594174d | 2013-06-29 13:31:24 +0200 | [diff] [blame] | 22 | KBUILD_IMAGE := vmlinuz |
Helge Deller | 1d7c29b | 2021-11-26 22:35:45 +0100 | [diff] [blame] | 23 | endif |
Helge Deller | 594174d | 2013-06-29 13:31:24 +0200 | [diff] [blame] | 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | NM = sh $(srctree)/arch/parisc/nm |
Luc Van Oostenryck | 14516765 | 2018-05-28 20:27:35 +0200 | [diff] [blame] | 26 | CHECKFLAGS += -D__hppa__=1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | ifdef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | UTS_MACHINE := parisc64 |
Luc Van Oostenryck | 1f2f01b | 2018-05-30 22:48:38 +0200 | [diff] [blame] | 30 | CHECKFLAGS += -D__LP64__=1 |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 31 | LD_BFD := elf64-hppa-linux |
Kyle McMartin | 991b7d6 | 2007-10-18 13:54:51 -0700 | [diff] [blame] | 32 | else # 32-bit |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 33 | LD_BFD := elf32-hppa-linux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | endif |
| 35 | |
Helge Deller | ededa08 | 2020-03-26 23:31:43 +0100 | [diff] [blame] | 36 | # select defconfig based on actual architecture |
Masahiro Yamada | 5f6e0fe | 2021-06-10 11:03:31 +0900 | [diff] [blame] | 37 | ifeq ($(ARCH),parisc64) |
Helge Deller | ededa08 | 2020-03-26 23:31:43 +0100 | [diff] [blame] | 38 | KBUILD_DEFCONFIG := generic-64bit_defconfig |
Masahiro Yamada | 5f6e0fe | 2021-06-10 11:03:31 +0900 | [diff] [blame] | 39 | CC_ARCHES := hppa64 |
Helge Deller | ededa08 | 2020-03-26 23:31:43 +0100 | [diff] [blame] | 40 | else |
| 41 | KBUILD_DEFCONFIG := generic-32bit_defconfig |
Masahiro Yamada | 5f6e0fe | 2021-06-10 11:03:31 +0900 | [diff] [blame] | 42 | CC_ARCHES := hppa hppa2.0 hppa1.1 |
Helge Deller | ededa08 | 2020-03-26 23:31:43 +0100 | [diff] [blame] | 43 | endif |
| 44 | |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 45 | export LD_BFD |
| 46 | |
Masahiro Yamada | 23243c1 | 2021-05-02 02:24:36 +0900 | [diff] [blame] | 47 | ifdef cross_compiling |
Helge Deller | 6880b01 | 2013-05-11 19:04:09 +0000 | [diff] [blame] | 48 | 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 McMartin | 991b7d6 | 2007-10-18 13:54:51 -0700 | [diff] [blame] | 54 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
Sven Schnelle | 6ca6366 | 2019-06-05 22:32:22 +0200 | [diff] [blame] | 56 | ifdef CONFIG_DYNAMIC_FTRACE |
| 57 | ifdef CONFIG_64BIT |
| 58 | NOP_COUNT := 8 |
| 59 | else |
| 60 | NOP_COUNT := 5 |
| 61 | endif |
| 62 | |
| 63 | export CC_USING_RECORD_MCOUNT:=1 |
| 64 | export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1 |
| 65 | |
| 66 | KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 |
| 67 | KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \ |
| 68 | -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT) |
| 69 | |
| 70 | CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1))) |
Sven Schnelle | 6ca6366 | 2019-06-05 22:32:22 +0200 | [diff] [blame] | 71 | endif |
| 72 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | OBJCOPY_FLAGS =-O binary -R .note -R .comment -S |
| 74 | |
| 75 | cflags-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 Anglin | d26a773 | 2014-09-22 20:54:50 -0400 | [diff] [blame] | 79 | cflags-y += -mno-space-regs |
| 80 | |
| 81 | # -mfast-indirect-calls is only relevant for 32-bit kernels. |
| 82 | ifndef CONFIG_64BIT |
| 83 | cflags-y += -mfast-indirect-calls |
| 84 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 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 Chung | fa681a1 | 2005-10-21 22:48:34 -0400 | [diff] [blame] | 89 | cflags-y += -mdisable-fpregs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
Helge Deller | ec758f9 | 2013-01-31 21:44:28 +0000 | [diff] [blame] | 91 | # Use long jumps instead of long branches (needed if your linker fails to |
Helge Deller | cf71130 | 2013-04-23 21:29:03 +0200 | [diff] [blame] | 92 | # link a too big vmlinux executable). Not enabled for building modules. |
| 93 | ifdef CONFIG_MLONGCALLS |
| 94 | KBUILD_CFLAGS_KERNEL += -mlong-calls |
| 95 | endif |
Helge Deller | ec758f9 | 2013-01-31 21:44:28 +0000 | [diff] [blame] | 96 | |
Helge Deller | 1e8249b | 2018-11-29 17:05:47 +0100 | [diff] [blame] | 97 | # 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. |
| 100 | ifndef CONFIG_64BIT |
| 101 | KBUILD_CFLAGS_MODULE += -ffunction-sections |
| 102 | endif |
| 103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | # select which processor to optimise for |
Paul Bolle | 7660390 | 2013-05-29 09:56:58 +0000 | [diff] [blame] | 105 | cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200 |
| 107 | cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC |
| 108 | cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300 |
| 109 | cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000 |
| 110 | |
| 111 | head-y := arch/parisc/kernel/head.o |
| 112 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 113 | KBUILD_CFLAGS += $(cflags-y) |
Helge Deller | 0d341e0 | 2020-05-10 22:43:33 +0200 | [diff] [blame] | 114 | LIBGCC := $(shell $(CC) -print-libgcc-file-name) |
| 115 | export LIBGCC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | |
James Bottomley | 4c01acc | 2012-06-05 13:54:09 +0900 | [diff] [blame] | 117 | libs-y += arch/parisc/lib/ $(LIBGCC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 119 | boot := arch/parisc/boot |
| 120 | |
Kyle McMartin | 6525ee5 | 2008-12-08 09:43:08 +0000 | [diff] [blame] | 121 | PALO := $(shell if (which palo 2>&1); then : ; \ |
Kyle McMartin | 5feb4f3 | 2007-10-18 15:09:59 -0700 | [diff] [blame] | 122 | elif [ -x /sbin/palo ]; then echo /sbin/palo; \ |
| 123 | fi) |
| 124 | |
Masahiro Yamada | 75dd474 | 2019-07-06 12:07:11 +0900 | [diff] [blame] | 125 | PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \ |
| 126 | else echo $(objtree)/palo.conf; \ |
Kyle McMartin | f67d403 | 2007-10-20 09:31:33 -0700 | [diff] [blame] | 127 | fi) |
| 128 | |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 129 | palo lifimage: vmlinuz |
Kyle McMartin | f67d403 | 2007-10-20 09:31:33 -0700 | [diff] [blame] | 130 | @if test ! -x "$(PALO)"; then \ |
Kyle McMartin | 5feb4f3 | 2007-10-18 15:09:59 -0700 | [diff] [blame] | 131 | 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 McMartin | f67d403 | 2007-10-20 09:31:33 -0700 | [diff] [blame] | 135 | @if test ! -f "$(PALOCONF)"; then \ |
Masahiro Yamada | 75dd474 | 2019-07-06 12:07:11 +0900 | [diff] [blame] | 136 | 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 McMartin | 5feb4f3 | 2007-10-18 15:09:59 -0700 | [diff] [blame] | 138 | 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 McMartin | f67d403 | 2007-10-20 09:31:33 -0700 | [diff] [blame] | 142 | $(PALO) -f $(PALOCONF) |
Kyle McMartin | 5feb4f3 | 2007-10-18 15:09:59 -0700 | [diff] [blame] | 143 | |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 144 | BOOT_TARGETS = zImage Image palo lifimage |
| 145 | INSTALL_TARGETS = zinstall install |
| 146 | |
| 147 | PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) |
| 148 | |
Helge Deller | 89e050c | 2018-04-18 07:49:19 +0200 | [diff] [blame] | 149 | # Default kernel to build |
| 150 | all: bzImage |
| 151 | |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 152 | zImage: vmlinuz |
Helge Deller | 594174d | 2013-06-29 13:31:24 +0200 | [diff] [blame] | 153 | Image: vmlinux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 155 | bzImage: vmlinux |
| 156 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 157 | |
Helge Deller | af21b01 | 2017-09-22 22:24:02 +0200 | [diff] [blame] | 158 | ifdef CONFIG_PARISC_SELF_EXTRACT |
Helge Deller | b6adc16 | 2017-08-20 10:52:22 +0200 | [diff] [blame] | 159 | vmlinuz: bzImage |
| 160 | $(OBJCOPY) $(boot)/bzImage $@ |
Helge Deller | af21b01 | 2017-09-22 22:24:02 +0200 | [diff] [blame] | 161 | else |
| 162 | vmlinuz: vmlinux |
Denis Efremov | e4a42c8 | 2020-06-08 12:59:44 +0300 | [diff] [blame] | 163 | @$(KGZIP) -cf -9 $< > $@ |
Helge Deller | af21b01 | 2017-09-22 22:24:02 +0200 | [diff] [blame] | 164 | endif |
Helge Deller | 594174d | 2013-06-29 13:31:24 +0200 | [diff] [blame] | 165 | |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 166 | install: |
Masahiro Yamada | 75dd474 | 2019-07-06 12:07:11 +0900 | [diff] [blame] | 167 | $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \ |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 168 | $(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)" |
| 169 | zinstall: |
Masahiro Yamada | 75dd474 | 2019-07-06 12:07:11 +0900 | [diff] [blame] | 170 | $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \ |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 171 | $(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 173 | CLEAN_FILES += lifimage |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | MRPROPER_FILES += palo.conf |
| 175 | |
| 176 | define archhelp |
| 177 | @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' |
Helge Deller | 594174d | 2013-06-29 13:31:24 +0200 | [diff] [blame] | 178 | @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' |
Kyle McMartin | 5feb4f3 | 2007-10-18 15:09:59 -0700 | [diff] [blame] | 179 | @echo ' palo - Bootable image (./lifimage)' |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 180 | @echo ' install - Install uncompressed vmlinux kernel using' |
Sam Ravnborg | caa27b6 | 2009-07-20 21:37:11 +0200 | [diff] [blame] | 181 | @echo ' (your) ~/bin/$(INSTALLKERNEL) or' |
| 182 | @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | @echo ' copy to $$(INSTALL_PATH)' |
Helge Deller | b0756b5 | 2013-10-18 21:18:46 +0200 | [diff] [blame] | 184 | @echo ' zinstall - Install compressed vmlinuz kernel' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | endef |
Firoz Khan | 575afc4 | 2018-11-19 12:04:36 +0530 | [diff] [blame] | 186 | |
| 187 | archheaders: |
| 188 | $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all |