On Aug 12, 2025, at 8:54 PM, Dave Young <[email protected]> wrote:

> Hi, The #ifdef CONFIG_* which can be replaced by #if defined(), but I
> do not have a strong opinion.  other than that do you have kexec-tools
> patch ready? It would be better to provide a link so that people can
> try and test it.

Hi Dave,

Thanks for looking at this! The #ifdef CONFIG_* is used, as it matches
the style of other ifdefs in this file. I'd like to keep it as-is for
consistency.

I do have a prototype kexec-tools patch ready for testing. The changes
can be found at this repo:

https://github.com/makb-juniper/kexec-tools.git

I've also placed the diff below.

Thanks,
Brian

diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 9b17578..8419b23 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -124,6 +124,8 @@ static inline long kexec_file_load(int kernel_fd, int 
initrd_fd,
 #define KEXEC_FILE_ON_CRASH    0x00000002
 #define KEXEC_FILE_NO_INITRAMFS        0x00000004
 #define KEXEC_FILE_DEBUG       0x00000008
+#define KEXEC_FILE_NO_CMA      0x00000010
+#define KEXEC_FILE_FORCE_DTB   0x00000020
 
 /* 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 6bf12d7..0e13b6b 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1102,6 +1102,7 @@ void usage(void)
               " --hotplug            Do in-kernel update of kexec segments on 
CPU/Memory\n"
               "                      hot add/remove events, avoiding the need 
to reload\n"
               "                      kdump kernel on online/offline events.\n"
+              " --force-dtb          Carry over the current boot's device tree 
blob (x86 only).\n"
               " -d, --debug          Enable debugging to help spot a 
failure.\n"
               " -S, --status         Return 1 if the type (by default crash) 
is loaded,\n"
               "                      0 if not.\n"
@@ -1640,6 +1641,9 @@ int main(int argc, char *argv[])
                case OPT_HOTPLUG:
                        do_hotplug = 1;
                        break;
+               case OPT_FORCE_DTB:
+                       kexec_file_flags |= KEXEC_FILE_FORCE_DTB;
+                       break;
                default:
                        break;
                }
diff --git a/kexec/kexec.h b/kexec/kexec.h
index a2e19c4..2235aa2 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -235,7 +235,8 @@ extern int file_types;
 #define OPT_LOAD_LIVE_UPDATE   263
 #define OPT_EXEC_LIVE_UPDATE   264
 #define OPT_HOTPLUG                    265
-#define OPT_MAX                266
+#define OPT_FORCE_DTB          266
+#define OPT_MAX                267
 #define KEXEC_OPTIONS \
        { "help",               0, 0, OPT_HELP }, \
        { "version",            0, 0, OPT_VERSION }, \
@@ -263,6 +264,7 @@ extern int file_types;
        { "status",             0, 0, OPT_STATUS }, \
        { "print-ckr-size",     0, 0, OPT_PRINT_CKR_SIZE }, \
        { "hotplug",                0, 0, OPT_HOTPLUG }, \
+       { "force-dtb",          0, 0, OPT_FORCE_DTB }, \
 
 #define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
 

base-commit: daa29443819d3045338792b5ba950ed90e79d7a5
-- 
2.25.1

Reply via email to