2022-05-31 10:04:11 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
#
|
|
|
|
# Makefile for the Linux/LoongArch kernel.
|
|
|
|
#
|
|
|
|
|
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,)
|
|
|
|
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
|
|
|
|
|
2022-10-12 08:36:19 +00: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 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
|
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)
|