[PATCH] kexec: add kexec flag to support debug printing

Qiang Ma maqianga at uniontech.com
Mon Nov 3 18:59:59 PST 2025


This add KEXEC_DEBUG to kexec_flags so that it can be passed
to kernel when '-d' is added with kexec_load interface. With that
flag enabled, kernel can enable the debugging message printing.

This patch requires support from the kexec_load debugging message
of the Linux kernel[1].

[1]: https://lore.kernel.org/kexec/20251103063440.1681657-1-maqianga@uniontech.com/

Signed-off-by: Qiang Ma <maqianga at uniontech.com>
---
 kexec/kexec-syscall.h | 1 +
 kexec/kexec.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index e9bb7de..b60804f 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -120,6 +120,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
 #define KEXEC_PRESERVE_CONTEXT	0x00000002
 #define KEXEC_UPDATE_ELFCOREHDR	0x00000004
 #define KEXEC_CRASH_HOTPLUG_SUPPORT	0x00000008
+#define KEXEC_DEBUG		0x00000010
 #define KEXEC_ARCH_MASK		0xffff0000
 
 /* Flags for kexec file based system call */
diff --git a/kexec/kexec.c b/kexec/kexec.c
index c9e4bcb..f425422 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1518,6 +1518,7 @@ int main(int argc, char *argv[])
 			return 0;
 		case OPT_DEBUG:
 			kexec_debug = 1;
+			kexec_flags |= KEXEC_DEBUG;
 			kexec_file_flags |= KEXEC_FILE_DEBUG;
 			break;
 		case OPT_NOIFDOWN:
-- 
2.20.1




More information about the kexec mailing list