blob: 18ff07a5dc233a4ef2e8224d61b1ec8aed30e0f3 [file] [log] [blame]
Steve Raee6ca1ad2014-09-03 10:05:54 -07001/*
2 * Copyright 2014 Broadcom Corporation.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <part.h>
8#include <sparse_format.h>
9
10#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
11
Steve Raee6ca1ad2014-09-03 10:05:54 -070012static inline int is_sparse_image(void *buf)
13{
14 sparse_header_t *s_header = (sparse_header_t *)buf;
15
16 if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) &&
17 (le16_to_cpu(s_header->major_version) == 1))
18 return 1;
19
20 return 0;
21}
22
Maxime Ripard3c8f98f2015-10-15 14:34:13 +020023int write_sparse_image(block_dev_desc_t *dev_desc,
24 disk_partition_t *info, const char *part_name,
25 void *data, unsigned sz);