On Fri, Jul 25, 2025 at 06:14:38PM +0530, Sourabh Jain wrote: > Kexec with the -d option prints extra logs about the kexec/kdump kernel > that help debug kexec and kdump. For example, it shows what kexec > segments are loaded, their locations, and sizes. > > One key piece of information still missing is the kernel command line > configured for the kexec/kdump kernel. > > With this patch included, the kernel will print the kernel command line > configured for the kexec/kdump kernel as shown below: > > kexec --initrd=./initrd ./kernel -lspd --command-line="test1 test2" > > Loaded elf core header at 0x22e30000, bufsz=0x2000 memsz=0x80000 > kexec_elf: Command line: elfcorehdr=0x22e30000 test1 test2 <--- New > kexec_elf: Loaded initrd at 0x22eb0000 > > Cc: Madhavan Srinivasan <[email protected]> > Cc: Michael Ellerman <[email protected]> > Signed-off-by: Sourabh Jain <[email protected]> > --- > arch/powerpc/kexec/elf_64.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c > index 5d6d616404cf..db0af790c784 100644 > --- a/arch/powerpc/kexec/elf_64.c > +++ b/arch/powerpc/kexec/elf_64.c > @@ -90,6 +90,8 @@ static void *elf64_load(struct kimage *image, char > *kernel_buf, > cmdline = modified_cmdline; > } > > + kexec_dprintk("Command line: %s", cmdline ? cmdline : ""); > + > if (initrd != NULL) { > kbuf.buffer = initrd; > kbuf.bufsz = kbuf.memsz = initrd_len; > -- > 2.50.1 > > Tested this on P11 LPAR.
[ 485.755942] kexec_file: kernel: 00000000cb90aae7 kernel_size: 0x1d1531d0 [ 485.762870] kexec_elf: Loaded the kernel at 0x80000000 [ 485.762930] kexec_elf: Loaded purgatory at 0x9fff0000 [ 485.762944] Loaded the backup region at 0x84160000 [ 485.763088] crash_core: Crash PT_LOAD ELF header. phdr=00000000364832a7 vaddr=0xc000000000000000, paddr=0x0, sz=0x10000 e_phnum=178 p_offset=0x0 [ 485.763095] crash_core: Crash PT_LOAD ELF header. phdr=000000009122d5f0 vaddr=0xc000000000010000, paddr=0x10000, sz=0x7fff0000 e_phnum=179 p_offset=0x10000 [ 485.763099] crash_core: Crash PT_LOAD ELF header. phdr=000000007ead431b vaddr=0xc0000000a0000000, paddr=0xa0000000, sz=0xb10000000 e_phnum=180 p_offset=0xa0000000 [ 485.763103] crash_core: Crash PT_LOAD ELF header. phdr=0000000001ee8e6f vaddr=0xc000000bb0000000, paddr=0xbb0000000, sz=0x5d0000000 e_phnum=181 p_offset=0xbb0000000 [ 485.763108] crash_core: Crash PT_LOAD ELF header. phdr=000000004566b315 vaddr=0xc000001180000000, paddr=0x1180000000, sz=0x1d20000000 e_phnum=182 p_offset=0x1180000000 [ 485.763112] crash_core: Crash PT_LOAD ELF header. phdr=00000000a9df7c03 vaddr=0xc000002ea0000000, paddr=0x2ea0000000, sz=0x1d10000000 e_phnum=183 p_offset=0x2ea0000000 [ 485.763116] crash_core: Crash PT_LOAD ELF header. phdr=0000000077ee5d4c vaddr=0xc000004bb0000000, paddr=0x4bb0000000, sz=0x1d10000000 e_phnum=184 p_offset=0x4bb0000000 [ 485.763119] crash_core: Crash PT_LOAD ELF header. phdr=000000000ea82932 vaddr=0xc0000068c0000000, paddr=0x68c0000000, sz=0x1740000000 e_phnum=185 p_offset=0x68c0000000 [ 485.763124] Backup region offset updated to 0x84160000 [ 485.763130] Loaded elf core header at 0x84170000, bufsz=0x3000 memsz=0x80000 [ 485.763134] No dm-crypt keys [ 485.763139] kexec_elf: Command line: elfcorehdr=0x84170000 BOOT_IMAGE=(ieee1275//vdevice/v-scsi@30000065/disk@8100000000000000,gpt2)/vmlinuz-6.19.7-200.fc43.ppc64le root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root crashkernel=512M@2G test1 test2 [ 485.763145] kexec_elf: Loaded initrd at 0x841f0000 [ 485.763678] Memory node path: /memory@0 [ 485.795492] kexec_elf: Loaded device tree at 0x9ffd0000 [ 486.417820] kexec_file: nr_segments = 6 [ 486.417839] kexec_file: segment[0]: buf=0x00000000ac04377b bufsz=0x3f74bc4 mem=0x80000000 memsz=0x4160000 [ 486.424367] kexec_file: segment[1]: buf=0x00000000b22938ec bufsz=0x310 mem=0x9fff0000 memsz=0x10000 [ 486.424403] kexec_file: segment[2]: buf=0x0000000043b34bd4 bufsz=0x10000 mem=0x84160000 memsz=0x10000 [ 486.424417] kexec_file: segment[3]: buf=0x00000000421e955d bufsz=0x3000 mem=0x84170000 memsz=0x80000 [ 486.424450] kexec_file: segment[4]: buf=0x000000009a7ce2c9 bufsz=0x4ed96f8 mem=0x841f0000 memsz=0x4ee0000 [ 486.432514] kexec_file: segment[5]: buf=0x0000000023a3b280 bufsz=0x1553b mem=0x9ffd0000 memsz=0x20000 [ 486.432558] kexec_file: kexec_file_load: type:1, start:0x9fff0000 head:0x4 flags:0xa Tested-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]> Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>
