[PATCH 3/7] ppc64: detect zImage files and load the uncompressed vmlinux

Cedric Le Goater clg at fr.ibm.com
Mon May 12 08:58:05 PDT 2014


Hi Laurent,

[ ... ]

>> +int zImage_ppc64_unzip(struct mem_ehdr *ehdr, void **buf, int *len)
>> +{
>> +	struct mem_shdr *shdr;
>> +	void *vmlinuz_addr;
>> +	unsigned long vmlinuz_size;
>> +	unsigned int *vmlinux_sizep;
>> +
>> +	void *vmlinux_addr;
>> +	int vmlinux_size;
>> +
>> +	shdr = elf_rel_find_section(ehdr, ".kernel:vmlinux.strip");
>> +	if (!shdr)
>> +		return -1;
>> +
>> +	vmlinuz_addr = (void *) shdr->sh_data;
>> +	vmlinuz_size = shdr->sh_size;
>> +
>> +	 /* The size of the uncompressed file is stored in the last 4
>> +	  * bytes. The vmlinux size should be less than 4G ... */
>> +	vmlinux_sizep = (vmlinuz_addr + vmlinuz_size) - 4;
>> +
>> +	fprintf(stderr, "Found vmlinuz at %p, unzipping %d bytes\n",
>> +		vmlinuz_addr, *vmlinux_sizep);
> 
> Hi Cédric,
> 
> I'd rather use dbgprintf instead of directly call fprintf here.

Sure. Thanks for the review. I have a new version of this patch which 
also fixes the way the uncompressed size is read, as it is stored as 
a little endian uint.

Simon, do you want a resend of the patchset or a fix on top of it ? 

Cheers, 

C.




More information about the kexec mailing list