[PATCH v3 4/4] kexec, x86_64: Load bzImage64 above 4G

Vivek Goyal vgoyal at redhat.com
Wed Nov 21 09:50:23 EST 2012


On Tue, Nov 20, 2012 at 11:31:38PM -0800, Yinghai Lu wrote:

[..]
> +int bzImage64_probe(const char *buf, off_t len)
> +{
> +	const struct x86_linux_header *header;
> +	if ((uintmax_t)len < (uintmax_t)(2 * 512)) {
> +		if (probe_debug) {
> +			fprintf(stderr, "File is too short to be a bzImage!\n");
> +		}
> +		return -1;
> +	}
> +	header = (const struct x86_linux_header *)buf;
> +	if (memcmp(header->header_magic, "HdrS", 4) != 0) {
> +		if (probe_debug) {
> +			fprintf(stderr, "Not a bzImage\n");
> +		}
> +		return -1;
> +	}
> +	if (header->boot_sector_magic != 0xAA55) {
> +		if (probe_debug) {
> +			fprintf(stderr, "No x86 boot sector present\n");
> +		}
> +		/* No x86 boot sector present */
> +		return -1;
> +	}
> +	if (header->protocol_version < 0x020C) {
> +		if (probe_debug) {
> +			fprintf(stderr, "Must be at least protocol version 2.12\n");
> +		}
> +		/* Must be at least protocol version 2.12 */
> +		return -1;
> +	}
> +	if ((header->loadflags & 1) == 0) {
> +		if (probe_debug) {
> +			fprintf(stderr, "zImage not a bzImage\n");
> +		}
> +		/* Not a bzImage */
> +		return -1;
> +	}
> +	if (!(header->xloadflags & 1)) {
> +		if (probe_debug) {
> +			fprintf(stderr, "Not a bzImage64\n");
> +		}
> +		/* Must be LOADED_ABOVE_4G */
> +		return -1;
> +	}

So how do I force a 16bit or 32bit entry using a bzImage64?

Thanks
Vivek



More information about the kexec mailing list