2022-05-31 18:04:11 +08:00
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Linux/LoongArch kernel.
#
2022-09-25 03:19:14 +09:00
extra-y := vmlinux.lds
2022-05-31 18:04:11 +08:00
2022-09-25 03:19:14 +09:00
obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
2022-05-31 18:04:11 +08:00
traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \
2022-12-10 22:39:59 +08:00
elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \
2023-02-25 15:52:56 +08:00
alternative.o unwind.o
2022-05-31 18:04:11 +08:00
obj-$(CONFIG_ACPI) += acpi.o
obj-$(CONFIG_EFI) += efi.o
obj-$(CONFIG_CPU_HAS_FPU) += fpu.o
2023-02-25 15:52:56 +08:00
obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
2022-12-10 22:40:15 +08:00
i f d e f C O N F I G _ F U N C T I O N _ T R A C E R
2022-12-10 22:40:15 +08: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)
2022-12-10 22:40:15 +08:00
e n d i f
2022-05-31 18:04:11 +08:00
obj-$(CONFIG_MODULES) += module.o module-sections.o
2022-08-06 16:10:04 +08:00
obj-$(CONFIG_STACKTRACE) += stacktrace.o
2022-05-31 18:04:11 +08:00
obj-$(CONFIG_PROC_FS) += proc.o
2022-05-31 18:04:12 +08:00
obj-$(CONFIG_SMP) += smp.o
2022-05-31 18:04:12 +08:00
obj-$(CONFIG_NUMA) += numa.o
2022-10-12 16:36:14 +08:00
obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
2023-02-25 15:52:56 +08:00
obj-$(CONFIG_RELOCATABLE) += relocate.o
2022-10-12 16:36:19 +08:00
obj-$(CONFIG_KEXEC) += 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 16:36:19 +08:00
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
2022-10-12 16:36:19 +08:00
2022-08-06 16:10:02 +08:00
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
2022-08-06 16:10:03 +08:00
obj-$(CONFIG_UNWINDER_PROLOGUE) += unwind_prologue.o
2022-08-06 16:10:02 +08:00
2022-10-12 16:36:14 +08:00
obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_regs.o
2023-02-25 15:52:57 +08:00
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
2022-10-12 16:36:14 +08:00
2023-02-25 15:52:57 +08:00
obj-$(CONFIG_KPROBES) += kprobes.o kprobes_trampoline.o
2023-02-25 15:52:57 +08:00
2022-05-31 18:04:11 +08:00
CPPFLAGS_vmlinux.lds := $( KBUILD_CFLAGS)