futility/vb1_helper.c
/* Returns the size of the 32-bit kernel, or negative on error. */
Returns the size of the 32-bit kernel, or negative on error.
Returns the size of the 32 - bit kernel or negative on error .
static int KernelSize(uint8_t *kernel_buf,
		      uint32_t kernel_size,
		      enum arch_t arch)
{
	uint32_t kernel32_start = 0;
	struct linux_kernel_params *lh;
	if (arch != ARCH_X86)
		return kernel_size;
	lh = (struct linux_kernel_params *)kernel_buf;
	if (lh->header != VMLINUZ_HEADER_SIG) {
		VB2_DEBUG("Not a linux kernel image\n");
		return kernel_size;
	}
	kernel32_start = (lh->setup_sects + 1) << 9;
	if (kernel32_start >= kernel_size) {
		fprintf(stderr, "Malformed kernel\n");
		return -1;
	}
	return kernel_size - kernel32_start;
}
static int KernelSize ( uint8_t * kernel_buf , uint32_t kernel_size , enum arch_t arch ) { uint32_t kernel32_start = 0 ; struct linux_kernel_params * lh ; if ( arch != ARCH_X86 ) return kernel_size ; lh = ( struct linux_kernel_params * ) kernel_buf ; if ( lh -> header != VMLINUZ_HEADER_SIG ) { VB2_DEBUG ( " \n " ) ; return kernel_size ; } kernel32_start = ( lh -> setup_sects + 1 ) << 9 ; if ( kernel32_start >= kernel_size ) { fprintf ( stderr , " \n " ) ; return -1 ; } return kernel_size - kernel32_start ; }
Returns the size of the 32-bit kernel, or negative on error.
Returns the size of the 32 - bit kernel or negative on error .
/* Except for x86, the kernel is the kernel. */ /* The first part of the x86 vmlinuz is a header, followed by
	 * a real-mode boot stub. We only want the 32-bit part. */