Steve Rae | e6ca1ad | 2014-09-03 10:05:54 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 12 | void fastboot_fail(const char *s); |
| 13 | void fastboot_okay(const char *s); |
| 14 | |
| 15 | static inline int is_sparse_image(void *buf) |
| 16 | { |
| 17 | sparse_header_t *s_header = (sparse_header_t *)buf; |
| 18 | |
| 19 | if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) && |
| 20 | (le16_to_cpu(s_header->major_version) == 1)) |
| 21 | return 1; |
| 22 | |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | void write_sparse_image(block_dev_desc_t *dev_desc, |
| 27 | disk_partition_t *info, const char *part_name, |
| 28 | void *data, unsigned sz); |