2022-05-31 10:04:11 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
#
|
|
|
|
# Makefile for the Linux/LoongArch kernel.
|
|
|
|
#
|
|
|
|
|
2024-03-11 14:23:47 +00:00
|
|
|
OBJECT_FILES_NON_STANDARD_head.o := y
|
|
|
|
|
2022-09-24 18:19:14 +00:00
|
|
|
extra-y := vmlinux.lds
|
2022-05-31 10:04:11 +00:00
|
|
|
|
2022-09-24 18:19:14 +00:00
|
|
|
obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
|
2022-05-31 10:04:11 +00:00
|
|
|
traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \
|
2022-12-10 14:39:59 +00:00
|
|
|
elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \
|
2023-02-25 07:52:56 +00:00
|
|
|
alternative.o unwind.o
|
2022-05-31 10:04:11 +00:00
|
|
|
|
|
|
|
obj-$(CONFIG_ACPI) += acpi.o
|
|
|
|
obj-$(CONFIG_EFI) += efi.o
|
|
|
|
|
2023-05-01 09:19:27 +00:00
|
|
|
obj-$(CONFIG_CPU_HAS_FPU) += fpu.o kfpu.o
|
2022-05-31 10:04:11 +00:00
|
|
|
|
2023-09-06 14:53:55 +00:00
|
|
|
obj-$(CONFIG_CPU_HAS_LBT) += lbt.o
|
|
|
|
|
2023-02-25 07:52:56 +00:00
|
|
|
obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
|
|
|
|
|
2023-09-20 06:26:28 +00:00
|
|
|
CFLAGS_module.o += $(call cc-option,-Wno-override-init,)
|
|
|
|
CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,)
|
2024-03-11 14:23:47 +00:00
|
|
|
CFLAGS_traps.o += $(call cc-option,-Wno-override-init,)
|
2023-09-20 06:26:28 +00:00
|
|
|
CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,)
|
|
|
|
|
2022-12-10 14:40:15 +00:00
|
|
|
ifdef CONFIG_FUNCTION_TRACER
|
2022-12-10 14:40:15 +00:00
|
|
|
ifndef CONFIG_DYNAMIC_FTRACE
|
|
|
|
obj-y += mcount.o ftrace.o
|
|
|
|
CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
|
|
|
|
else
|
|
|
|
obj-y += mcount_dyn.o ftrace_dyn.o
|
|
|
|
CFLAGS_REMOVE_ftrace_dyn.o = $(CC_FLAGS_FTRACE)
|
|
|
|
endif
|
|
|
|
CFLAGS_REMOVE_inst.o = $(CC_FLAGS_FTRACE)
|
|
|
|
CFLAGS_REMOVE_time.o = $(CC_FLAGS_FTRACE)
|
|
|
|
CFLAGS_REMOVE_perf_event.o = $(CC_FLAGS_FTRACE)
|
2023-06-29 12:58:44 +00:00
|
|
|
CFLAGS_REMOVE_rethook.o = $(CC_FLAGS_FTRACE)
|
|
|
|
CFLAGS_REMOVE_rethook_trampoline.o = $(CC_FLAGS_FTRACE)
|
2022-12-10 14:40:15 +00:00
|
|
|
endif
|
|
|
|
|
2023-09-06 14:54:16 +00:00
|
|
|
KASAN_SANITIZE_efi.o := n
|
|
|
|
KASAN_SANITIZE_cpu-probe.o := n
|
|
|
|
KASAN_SANITIZE_traps.o := n
|
|
|
|
KASAN_SANITIZE_smp.o := n
|
|
|
|
KASAN_SANITIZE_vdso.o := n
|
|
|
|
|
2022-05-31 10:04:11 +00:00
|
|
|
obj-$(CONFIG_MODULES) += module.o module-sections.o
|
2022-08-06 08:10:04 +00:00
|
|
|
obj-$(CONFIG_STACKTRACE) += stacktrace.o
|
2022-05-31 10:04:11 +00:00
|
|
|
|
|
|
|
obj-$(CONFIG_PROC_FS) += proc.o
|
|
|
|
|
2022-05-31 10:04:12 +00:00
|
|
|
obj-$(CONFIG_SMP) += smp.o
|
|
|
|
|
2022-05-31 10:04:12 +00:00
|
|
|
obj-$(CONFIG_NUMA) += numa.o
|
|
|
|
|
2022-10-12 08:36:14 +00:00
|
|
|
obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
|
|
|
|
|
2023-02-25 07:52:56 +00:00
|
|
|
obj-$(CONFIG_RELOCATABLE) += relocate.o
|
|
|
|
|
loongarch, kexec: change dependency of object files
Patch series "kexec: fix the incorrect ifdeffery and dependency of
CONFIG_KEXEC".
The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
dropped, then compiling errors will be triggered if below config items are
set:
===
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
===
E.g on mips, below link error are seen:
--------------------------------------------------------------------
mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
--------------------------------------------------------------------
Here, change the incorrect dependency of building kexec_core related
object files, and the ifdeffery on architectures from CONFIG_KEXEC to
CONFIG_KEXEC_CORE.
Testing:
========
Passed on mips and loognarch with the LKP reproducer.
This patch (of 5):
Currently, in arch/loongarch/kernel/Makefile, building machine_kexec.o
relocate_kernel.o depends on CONFIG_KEXEC.
Whereas, since we will drop the select of KEXEC for CRASH_DUMP in
kernel/Kconfig.kexec, compiling error will be triggered if below config
items are set:
===
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
===
---------------------------------------------------------------
loongarch64-linux-ld: kernel/kexec_core.o: in function `.L209':
>> kexec_core.c:(.text+0x1660): undefined reference to `machine_kexec_cleanup'
loongarch64-linux-ld: kernel/kexec_core.o: in function `.L287':
>> kexec_core.c:(.text+0x1c5c): undefined reference to `machine_crash_shutdown'
>> loongarch64-linux-ld: kexec_core.c:(.text+0x1c64): undefined reference to `machine_kexec'
loongarch64-linux-ld: kernel/kexec_core.o: in function `.L2^B5':
>> kexec_core.c:(.text+0x2090): undefined reference to `machine_shutdown'
loongarch64-linux-ld: kexec_core.c:(.text+0x20a0): undefined reference to `machine_kexec'
---------------------------------------------------------------
Here, change the dependency of machine_kexec.o relocate_kernel.o to
CONFIG_KEXEC_CORE can fix above building error.
Link: https://lkml.kernel.org/r/20231208073036.7884-1-bhe@redhat.com
Link: https://lkml.kernel.org/r/20231208073036.7884-2-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311300946.kHE9Iu71-lkp@intel.com/
Cc: Eric DeVolder <eric_devolder@yahoo.com>
Cc: Ignat Korchagin <ignat@cloudflare.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-08 07:30:32 +00:00
|
|
|
obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o
|
LoongArch: Add kdump support
This patch adds support for kdump. In kdump case the normal kernel will
reserve a region for the crash kernel and jump there on panic.
Arch-specific functions are added to allow for implementing a crash dump
file interface, /proc/vmcore, which can be viewed as a ELF file.
A user-space tool, such as kexec-tools, is responsible for allocating a
separate region for the core's ELF header within the crash kdump kernel
memory and filling it in when executing kexec_load().
Then, its location will be advertised to the crash dump kernel via a
command line argument "elfcorehdr=", and the crash dump kernel will
preserve this region for later use with arch_reserve_vmcore() at boot
time.
At the same time, the crash kdump kernel is also limited within the
"crashkernel" area via a command line argument "mem=", so as not to
destroy the original kernel dump data.
In the crash dump kernel environment, /proc/vmcore is used to access the
primary kernel's memory with copy_oldmem_page().
I tested kdump on LoongArch machines (Loongson-3A5000) and it works as
expected (suggested crashkernel parameter is "crashkernel=512M@2560M"),
you may test it by triggering a crash through /proc/sysrq-trigger:
$ sudo kexec -p /boot/vmlinux-kdump --reuse-cmdline --append="nr_cpus=1"
# echo c > /proc/sysrq-trigger
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2022-10-12 08:36:19 +00:00
|
|
|
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
|
2022-10-12 08:36:19 +00:00
|
|
|
|
2022-08-06 08:10:02 +00:00
|
|
|
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
|
2022-08-06 08:10:03 +00:00
|
|
|
obj-$(CONFIG_UNWINDER_PROLOGUE) += unwind_prologue.o
|
2024-03-11 14:23:47 +00:00
|
|
|
obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o
|
2022-08-06 08:10:02 +00:00
|
|
|
|
2022-10-12 08:36:14 +00:00
|
|
|
obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_regs.o
|
2023-02-25 07:52:57 +00:00
|
|
|
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
|
2022-10-12 08:36:14 +00:00
|
|
|
|
2023-09-06 14:53:55 +00:00
|
|
|
obj-$(CONFIG_KGDB) += kgdb.o
|
2023-06-29 12:58:44 +00:00
|
|
|
obj-$(CONFIG_KPROBES) += kprobes.o
|
|
|
|
obj-$(CONFIG_RETHOOK) += rethook.o rethook_trampoline.o
|
2023-06-29 12:58:44 +00:00
|
|
|
obj-$(CONFIG_UPROBES) += uprobes.o
|
2023-02-25 07:52:57 +00:00
|
|
|
|
2023-06-29 12:58:44 +00:00
|
|
|
obj-$(CONFIG_JUMP_LABEL) += jump_label.o
|
|
|
|
|
2022-05-31 10:04:11 +00:00
|
|
|
CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
|