At present, initrd information is passed through --initrd args, and handled until image load. But for the UKI case, the initrd may be stored implicitly in the .initrd section. It means that initrd is perceived at the probe stage. And there should be a way to carry this information forward to the load stage. In oder to implement that, introducing a global implicit_initrd_fd. Signed-off-by: Pingfan Liu <piliu@xxxxxxxxxx> Cc: Simon Horman <horms@xxxxxxxxxx> Cc: kexec@xxxxxxxxxxxxxxxxxxx --- kexec/arch/arm64/kexec-image-arm64.c | 3 ++- kexec/arch/x86_64/kexec-bzImage64.c | 3 ++- kexec/kexec.c | 2 ++ kexec/kexec.h | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c index a196747..b6f8912 100644 --- a/kexec/arch/arm64/kexec-image-arm64.c +++ b/kexec/arch/arm64/kexec-image-arm64.c @@ -50,7 +50,8 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf, result = EFAILED; goto exit; } - } + } else if (implicit_initrd_fd != -1) + info->initrd_fd = implicit_initrd_fd; if (arm64_opts.command_line) { info->command_line = (char *)arm64_opts.command_line; diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c index aba4e3b..210bc0a 100644 --- a/kexec/arch/x86_64/kexec-bzImage64.c +++ b/kexec/arch/x86_64/kexec-bzImage64.c @@ -307,7 +307,8 @@ int bzImage64_load_file(int argc, char **argv, struct kexec_info *info) ret = -1; goto out; } - } + } else if (implicit_initrd_fd != -1) + info->initrd_fd = implicit_initrd_fd; info->command_line = command_line; info->command_line_len = command_line_len; diff --git a/kexec/kexec.c b/kexec/kexec.c index 7c614b0..4f51987 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -67,6 +67,8 @@ int do_hotplug = 0; static unsigned long kexec_flags = 0; /* Flags for kexec file (fd) based syscall */ static unsigned long kexec_file_flags = 0; +/* initrd detected in probe phase */ +int implicit_initrd_fd = -1; int kexec_debug = 0; void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr) diff --git a/kexec/kexec.h b/kexec/kexec.h index 31c323f..e70c18d 100644 --- a/kexec/kexec.h +++ b/kexec/kexec.h @@ -114,6 +114,7 @@ do { \ #define _ALIGN(addr, size) _ALIGN_UP(addr, size) extern unsigned long long mem_min, mem_max; +extern int implicit_initrd_fd; extern int kexec_debug; #define dbgprintf(...) \ -- 2.41.0 _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec