blob: 79511e2759454de6d8dce3cd6cd951c633e1ea5a [file] [log] [blame]
/*
* Copyright (c) 2018 The Fuchsia Authors
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <image.h>
#include <zbi/zbi.h>
#include <zircon/boot/image.h>
/*
* zircon_image_get_kernel() - processes kernel part of Zircon bootdata
* @bootdata: Pointer to bootdata.
* @verify: Checksum verification flag. Currently unimplemented.
* @os_data: Pointer to a ulong variable, will hold os data start
* address.
* @os_len: Pointer to a ulong variable, will hold os data length.
*
* This function returns the os image's start address and length.
*
* Return: Zero, os start address and length on success,
* otherwise on failure.
*/
int zircon_image_get_kernel(const void *hdr, int verify,
ulong *os_data, ulong *os_len)
{
if (zbi_check_bootable(hdr, NULL) != ZBI_RESULT_OK) {
return -1;
}
const zbi_header_t *zbi = hdr;
*os_data = (ulong)zbi;
*os_len = zbi->length + sizeof(*zbi);
return 0;
}
ulong zircon_image_get_end(const void *hdr)
{
const zbi_header_t *zbi = hdr;
return (ulong)hdr + zbi->length + sizeof(*zbi);
}
ulong zircon_image_get_kload(const void *hdr)
{
return 0x1080000;
}
ulong zircon_image_get_comp(const void *hdr)
{
return IH_COMP_NONE;
}