2005-04-17 06:20:36 +08:00
|
|
|
#
|
|
|
|
# parisc/Makefile
|
|
|
|
#
|
|
|
|
# This file is included by the global makefile so that you can add your own
|
|
|
|
# architecture-specific flags and dependencies. Remember to do have actions
|
|
|
|
# for "archclean" and "archdep" for cleaning up and making dependencies for
|
|
|
|
# this architecture
|
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
# License. See the file "COPYING" in the main directory of this archive
|
|
|
|
# for more details.
|
|
|
|
#
|
|
|
|
# Copyright (C) 1994 by Linus Torvalds
|
|
|
|
# Portions Copyright (C) 1999 The Puffin Group
|
|
|
|
#
|
|
|
|
# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
|
|
|
|
# Mike Shaver, Helge Deller and Martin K. Petersen
|
|
|
|
#
|
2008-02-27 03:55:17 +08:00
|
|
|
|
2013-06-29 19:31:24 +08:00
|
|
|
KBUILD_IMAGE := vmlinuz
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
NM = sh $(srctree)/arch/parisc/nm
|
2018-05-29 02:27:35 +08:00
|
|
|
CHECKFLAGS += -D__hppa__=1
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
ifdef CONFIG_64BIT
|
|
|
|
UTS_MACHINE := parisc64
|
2018-05-31 04:48:38 +08:00
|
|
|
CHECKFLAGS += -D__LP64__=1
|
2013-05-12 03:04:09 +08:00
|
|
|
CC_ARCHES = hppa64
|
2017-08-20 16:52:22 +08:00
|
|
|
LD_BFD := elf64-hppa-linux
|
2007-10-19 04:54:51 +08:00
|
|
|
else # 32-bit
|
2013-05-12 03:04:09 +08:00
|
|
|
CC_ARCHES = hppa hppa2.0 hppa1.1
|
2017-08-20 16:52:22 +08:00
|
|
|
LD_BFD := elf32-hppa-linux
|
2005-04-17 06:20:36 +08:00
|
|
|
endif
|
|
|
|
|
2020-03-27 06:31:43 +08:00
|
|
|
# select defconfig based on actual architecture
|
|
|
|
ifeq ($(shell uname -m),parisc64)
|
|
|
|
KBUILD_DEFCONFIG := generic-64bit_defconfig
|
|
|
|
else
|
|
|
|
KBUILD_DEFCONFIG := generic-32bit_defconfig
|
|
|
|
endif
|
|
|
|
|
2017-08-20 16:52:22 +08:00
|
|
|
export LD_BFD
|
|
|
|
|
2013-05-12 03:04:09 +08:00
|
|
|
ifneq ($(SUBARCH),$(UTS_MACHINE))
|
|
|
|
ifeq ($(CROSS_COMPILE),)
|
|
|
|
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
|
|
|
|
CROSS_COMPILE := $(call cc-cross-prefix, \
|
|
|
|
$(foreach a,$(CC_ARCHES), \
|
|
|
|
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
|
|
|
|
endif
|
2007-10-19 04:54:51 +08:00
|
|
|
endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-06 04:32:22 +08:00
|
|
|
ifdef CONFIG_DYNAMIC_FTRACE
|
|
|
|
ifdef CONFIG_64BIT
|
|
|
|
NOP_COUNT := 8
|
|
|
|
else
|
|
|
|
NOP_COUNT := 5
|
|
|
|
endif
|
|
|
|
|
|
|
|
export CC_USING_RECORD_MCOUNT:=1
|
|
|
|
export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
|
|
|
|
|
|
|
|
KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
|
|
|
|
KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
|
|
|
|
-DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
|
|
|
|
|
|
|
|
CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
|
|
|
|
endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
|
|
|
|
|
|
|
|
cflags-y := -pipe
|
|
|
|
|
|
|
|
# These flags should be implied by an hppa-linux configuration, but they
|
|
|
|
# are not in gcc 3.2.
|
2014-09-23 08:54:50 +08:00
|
|
|
cflags-y += -mno-space-regs
|
|
|
|
|
|
|
|
# -mfast-indirect-calls is only relevant for 32-bit kernels.
|
|
|
|
ifndef CONFIG_64BIT
|
|
|
|
cflags-y += -mfast-indirect-calls
|
|
|
|
endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
# Currently we save and restore fpregs on all kernel entry/interruption paths.
|
|
|
|
# If that gets optimized, we might need to disable the use of fpregs in the
|
|
|
|
# kernel.
|
2005-10-22 10:48:34 +08:00
|
|
|
cflags-y += -mdisable-fpregs
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-02-01 05:44:28 +08:00
|
|
|
# Use long jumps instead of long branches (needed if your linker fails to
|
2013-04-24 03:29:03 +08:00
|
|
|
# link a too big vmlinux executable). Not enabled for building modules.
|
|
|
|
ifdef CONFIG_MLONGCALLS
|
|
|
|
KBUILD_CFLAGS_KERNEL += -mlong-calls
|
|
|
|
endif
|
2013-02-01 05:44:28 +08:00
|
|
|
|
2018-11-30 00:05:47 +08:00
|
|
|
# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
|
|
|
|
# for branches to reach stubs. And multiple .text sections trigger a warning
|
|
|
|
# when creating the sysfs module information section.
|
|
|
|
ifndef CONFIG_64BIT
|
|
|
|
KBUILD_CFLAGS_MODULE += -ffunction-sections
|
|
|
|
endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
# select which processor to optimise for
|
2013-05-29 17:56:58 +08:00
|
|
|
cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100
|
2005-04-17 06:20:36 +08:00
|
|
|
cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
|
|
|
|
cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC
|
|
|
|
cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300
|
|
|
|
cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000
|
|
|
|
|
|
|
|
head-y := arch/parisc/kernel/head.o
|
|
|
|
|
2007-10-15 04:21:35 +08:00
|
|
|
KBUILD_CFLAGS += $(cflags-y)
|
2020-05-11 04:43:33 +08:00
|
|
|
LIBGCC := $(shell $(CC) -print-libgcc-file-name)
|
|
|
|
export LIBGCC
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-05-07 17:28:13 +08:00
|
|
|
kernel-y := mm/ kernel/ math-emu/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
core-y += $(addprefix arch/parisc/, $(kernel-y))
|
2012-06-05 12:54:09 +08:00
|
|
|
libs-y += arch/parisc/lib/ $(LIBGCC)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
drivers-$(CONFIG_OPROFILE) += arch/parisc/oprofile/
|
|
|
|
|
2017-08-20 16:52:22 +08:00
|
|
|
boot := arch/parisc/boot
|
|
|
|
|
2008-12-08 17:43:08 +08:00
|
|
|
PALO := $(shell if (which palo 2>&1); then : ; \
|
2007-10-19 06:09:59 +08:00
|
|
|
elif [ -x /sbin/palo ]; then echo /sbin/palo; \
|
|
|
|
fi)
|
|
|
|
|
2019-07-06 11:07:11 +08:00
|
|
|
PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
|
|
|
|
else echo $(objtree)/palo.conf; \
|
2007-10-21 00:31:33 +08:00
|
|
|
fi)
|
|
|
|
|
2013-10-19 03:18:46 +08:00
|
|
|
palo lifimage: vmlinuz
|
2007-10-21 00:31:33 +08:00
|
|
|
@if test ! -x "$(PALO)"; then \
|
2007-10-19 06:09:59 +08:00
|
|
|
echo 'ERROR: Please install palo first (apt-get install palo)';\
|
|
|
|
echo 'or build it from source and install it somewhere in your $$PATH';\
|
|
|
|
false; \
|
|
|
|
fi
|
2007-10-21 00:31:33 +08:00
|
|
|
@if test ! -f "$(PALOCONF)"; then \
|
2019-07-06 11:07:11 +08:00
|
|
|
cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
|
|
|
|
echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
|
2007-10-19 06:09:59 +08:00
|
|
|
echo 'You should check it and re-run "make palo".'; \
|
|
|
|
echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
|
|
|
|
false; \
|
|
|
|
fi
|
2007-10-21 00:31:33 +08:00
|
|
|
$(PALO) -f $(PALOCONF)
|
2007-10-19 06:09:59 +08:00
|
|
|
|
2013-10-19 03:18:46 +08:00
|
|
|
BOOT_TARGETS = zImage Image palo lifimage
|
|
|
|
INSTALL_TARGETS = zinstall install
|
|
|
|
|
|
|
|
PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
|
|
|
|
|
2018-04-18 13:49:19 +08:00
|
|
|
# Default kernel to build
|
|
|
|
all: bzImage
|
|
|
|
|
2017-08-20 16:52:22 +08:00
|
|
|
zImage: vmlinuz
|
2013-06-29 19:31:24 +08:00
|
|
|
Image: vmlinux
|
|
|
|
|
2017-08-20 16:52:22 +08:00
|
|
|
bzImage: vmlinux
|
|
|
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
|
|
|
|
2017-09-23 04:24:02 +08:00
|
|
|
ifdef CONFIG_PARISC_SELF_EXTRACT
|
2017-08-20 16:52:22 +08:00
|
|
|
vmlinuz: bzImage
|
|
|
|
$(OBJCOPY) $(boot)/bzImage $@
|
2017-09-23 04:24:02 +08:00
|
|
|
else
|
|
|
|
vmlinuz: vmlinux
|
kbuild: add variables for compression tools
Allow user to use alternative implementations of compression tools,
such as pigz, pbzip2, pxz. For example, multi-threaded tools to
speed up the build:
$ make GZIP=pigz BZIP2=pbzip2
Variables _GZIP, _BZIP2, _LZOP are used internally because original env
vars are reserved by the tools. The use of GZIP in gzip tool is obsolete
since 2015. However, alternative implementations (e.g., pigz) still rely
on it. BZIP2, BZIP, LZOP vars are not obsolescent.
The credit goes to @grsecurity.
As a sidenote, for multi-threaded lzma, xz compression one can use:
$ export XZ_OPT="--threads=0"
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-05 15:39:55 +08:00
|
|
|
@$(_GZIP) -cf -9 $< > $@
|
2017-09-23 04:24:02 +08:00
|
|
|
endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-10-19 03:18:46 +08:00
|
|
|
install:
|
2019-07-06 11:07:11 +08:00
|
|
|
$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
|
2013-10-19 03:18:46 +08:00
|
|
|
$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
|
|
|
|
zinstall:
|
2019-07-06 11:07:11 +08:00
|
|
|
$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
|
2013-10-19 03:18:46 +08:00
|
|
|
$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-09-10 02:57:26 +08:00
|
|
|
CLEAN_FILES += lifimage
|
2005-04-17 06:20:36 +08:00
|
|
|
MRPROPER_FILES += palo.conf
|
|
|
|
|
|
|
|
define archhelp
|
|
|
|
@echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
|
2013-06-29 19:31:24 +08:00
|
|
|
@echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
|
2007-10-19 06:09:59 +08:00
|
|
|
@echo ' palo - Bootable image (./lifimage)'
|
2013-10-19 03:18:46 +08:00
|
|
|
@echo ' install - Install uncompressed vmlinux kernel using'
|
2009-07-21 03:37:11 +08:00
|
|
|
@echo ' (your) ~/bin/$(INSTALLKERNEL) or'
|
|
|
|
@echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
|
2005-04-17 06:20:36 +08:00
|
|
|
@echo ' copy to $$(INSTALL_PATH)'
|
2013-10-19 03:18:46 +08:00
|
|
|
@echo ' zinstall - Install compressed vmlinuz kernel'
|
2005-04-17 06:20:36 +08:00
|
|
|
endef
|
2018-11-19 14:34:36 +08:00
|
|
|
|
2019-08-01 19:47:03 +08:00
|
|
|
archclean:
|
|
|
|
$(Q)$(MAKE) $(clean)=$(boot)
|
|
|
|
|
2018-11-19 14:34:36 +08:00
|
|
|
archheaders:
|
|
|
|
$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
|