aboot.h 804 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright 2014 Broadcom Corporation.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <part.h>
  7. #include <sparse_format.h>
  8. #define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
  9. typedef struct sparse_storage {
  10. unsigned int block_sz;
  11. unsigned int start;
  12. unsigned int size;
  13. const char *name;
  14. int (*write)(struct sparse_storage *storage, void *priv,
  15. unsigned int offset, unsigned int size,
  16. char *data);
  17. } sparse_storage_t;
  18. static inline int is_sparse_image(void *buf)
  19. {
  20. sparse_header_t *s_header = (sparse_header_t *)buf;
  21. if ((le32_to_cpu(s_header->magic) == SPARSE_HEADER_MAGIC) &&
  22. (le16_to_cpu(s_header->major_version) == 1))
  23. return 1;
  24. return 0;
  25. }
  26. int store_sparse_image(sparse_storage_t *storage, void *storage_priv,
  27. unsigned int session_id, void *data);