u-boot-brain/include/image-sparse.h
Alex Kiernan c4ded03ef6 fastboot: Refactor fastboot_okay/fail to take response
Add the response string as a parameter to fastboot_okay/fail, instead
of modifying a global, to match the contract expected by the AOSP
U-Boot code.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30 11:59:21 +02:00

42 lines
894 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2014 Broadcom Corporation.
*/
#include <part.h>
#include <sparse_format.h>
#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
struct sparse_storage {
lbaint_t blksz;
lbaint_t start;
lbaint_t size;
void *priv;
lbaint_t (*write)(struct sparse_storage *info,
lbaint_t blk,
lbaint_t blkcnt,
const void *buffer);
lbaint_t (*reserve)(struct sparse_storage *info,
lbaint_t blk,
lbaint_t blkcnt);
void (*mssg)(const char *str, char *response);
};
static inline int is_sparse_image(void *buf)
{
sparse_header_t *s_header = (sparse_header_t *)buf;
if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) &&
(le16_to_cpu(s_header->major_version) == 1))
return 1;
return 0;
}
int write_sparse_image(struct sparse_storage *info, const char *part_name,
void *data, char *response);