kexec_file: add kexec_file flag to support debug printing

Resolves: https://issues.redhat.com/browse/RHEL-35640
Upstream Status: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflict: None

commit 9d9cf8de8b2ad8273861a30476a46f34cd34871a
Author: Baoquan He <bhe@redhat.com>
Date:   Tue Nov 14 23:20:30 2023 +0800

    kexec_file: add kexec_file flag to support debug printing

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

    Signed-off-by: Baoquan He <bhe@redhat.com>
    Signed-off-by: Simon Horman <horms@kernel.org>

Signed-off-by: Baoquan He <bhe@redhat.com>
This commit is contained in:
Baoquan He 2024-05-07 11:36:04 +08:00
parent 0a09d12d89
commit a2cf60284d
2 changed files with 46 additions and 0 deletions

View File

@ -114,6 +114,7 @@ Requires: systemd-udev%{?_isa}
# Patches 601 onward are generic patches
#
Patch601: kexec-update-manpage-with-explicit-mention-of-clean-.patch
Patch602: kexec_file-add-kexec_file-flag-to-support-debug-prin.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -130,6 +131,7 @@ tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%ifarch ppc
%define archdef ARCH=ppc

View File

@ -0,0 +1,44 @@
From 9d9cf8de8b2ad8273861a30476a46f34cd34871a Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Tue, 14 Nov 2023 23:20:30 +0800
Subject: [PATCH] kexec_file: add kexec_file flag to support debug printing
Content-type: text/plain
This add KEXEC_FILE_DEBUG to kexec_file_flags so that it can be passed
to kernel when '-d' is added with kexec_file_load interface. With that
flag enabled, kernel can enable the debugging message printing.
Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Simon Horman <horms@kernel.org>
---
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 2559bffb93da..73e52543e1b0 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -119,6 +119,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
#define KEXEC_FILE_UNLOAD 0x00000001
#define KEXEC_FILE_ON_CRASH 0x00000002
#define KEXEC_FILE_NO_INITRAMFS 0x00000004
+#define KEXEC_FILE_DEBUG 0x00000008
/* These values match the ELF architecture values.
* Unless there is a good reason that should continue to be the case.
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 9d0ec46e5657..222f79e3112e 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1477,6 +1477,7 @@ int main(int argc, char *argv[])
return 0;
case OPT_DEBUG:
kexec_debug = 1;
+ kexec_file_flags |= KEXEC_FILE_DEBUG;
break;
case OPT_NOIFDOWN:
skip_ifdown = 1;
--
2.41.0