Add support for forcing the carryover of the current boot's device tree blob on x86. This is enabled via the --force-dtb flag.
Signed-off-by: Brian Mak <[email protected]> --- kexec/kexec-syscall.h | 1 + kexec/kexec.c | 5 +++++ kexec/kexec.h | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h index 77e6b81..d66bd82 100644 --- a/kexec/kexec-syscall.h +++ b/kexec/kexec-syscall.h @@ -129,6 +129,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd, #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 ccdf4cd..acf9699 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -1103,6 +1103,8 @@ void usage(void) " hot add/remove events, avoiding the need to reload\n" " kdump kernel on online/offline events.\n" " --no-cma Don't use CMA for placing kexec payloads.\n" + " --force-dtb Carry over the current boot's device tree blob (x86\n" + " only, this is forced on ARM64 and PPC).\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" @@ -1679,6 +1681,9 @@ int main(int argc, char *argv[]) case OPT_NO_CMA: kexec_file_flags |= KEXEC_FILE_NO_CMA; 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 a1edc1e..1489ec3 100644 --- a/kexec/kexec.h +++ b/kexec/kexec.h @@ -236,7 +236,8 @@ extern int file_types; #define OPT_EXEC_LIVE_UPDATE 264 #define OPT_HOTPLUG 265 #define OPT_NO_CMA 266 -#define OPT_MAX 267 +#define OPT_FORCE_DTB 267 +#define OPT_MAX 268 #define KEXEC_OPTIONS \ { "help", 0, 0, OPT_HELP }, \ { "version", 0, 0, OPT_VERSION }, \ @@ -265,6 +266,7 @@ extern int file_types; { "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \ { "hotplug", 0, 0, OPT_HOTPLUG }, \ { "no-cma", 0, 0, OPT_NO_CMA }, \ + { "force-dtb", 0, 0, OPT_FORCE_DTB }, \ #define KEXEC_OPT_STR "h?vdfixyluet:pscaS" -- 2.34.1
