u-boot/include/aboot.h
Maxime Ripard a5d1e04a53 sparse: Implement storage abstraction
The current sparse image parser relies heavily on the MMC layer, and
doesn't allow any other kind of storage medium to be used.

Rework the parser to support any kind of storage medium, as long as there
is an implementation for it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-11-12 13:17:31 -05:00

36 lines
779 B
C

/*
* Copyright 2014 Broadcom Corporation.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <part.h>
#include <sparse_format.h>
#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
typedef struct sparse_storage {
unsigned int block_sz;
unsigned int start;
unsigned int size;
const char *name;
int (*write)(struct sparse_storage *storage, void *priv,
unsigned int offset, unsigned int size,
char *data);
} sparse_storage_t;
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 store_sparse_image(sparse_storage_t *storage, void *storage_priv,
void *data);