where/how 2nd kernel's elfcorehdr_addr comes from

Baoquan He bhe at redhat.com
Fri Nov 4 18:49:44 PDT 2022


On 11/04/22 at 09:03am, lizhijian at fujitsu.com wrote:
> Hi folks,
> 
> I'm trying to add pmem's metadata(located at pmem device) to 
> /proc/vmcore. To accomplish this, I think
> 
> something i need to know is where the contents of /proc/vmcore come 
> from, and then append
> 
> something into it.
> 
> I have read 
> https://opensource.com/article/17/6/kdump-usage-and-internals, and knew 
> /proc/vmcore is a elf file.
> 
> It mentioned that "Creates /proc/vmcore as per elfcorehdr information 
> received", but i don't get how it
> 
> elfcorehdr(maybe elfcorehdr_addr) be assigned in 2nd kernel.
> 
> I tried to grep it in the kernel source, but still no answer.  So i deep 
> hope you guys can give me some hints or answer.

Since you have studied this, so:
crash_prepare_elf64_headers() is the place where elf header of vmcore is
contructed in 1st kernel. And in crash_load_segments() it's prepared to
be passed out. I am talking about x86, and kexec_file load. You should
be able to find the similar thing in user space code.




More information about the kexec mailing list