fit_common.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2014
  4. */
  5. #ifndef _FIT_COMMON_H_
  6. #define _FIT_COMMON_H_
  7. #include "imagetool.h"
  8. #include "mkimage.h"
  9. #include <image.h>
  10. /**
  11. * Verify the format of FIT header pointed to by ptr
  12. *
  13. * @ptr: image header to be verified
  14. * @image_size: size of while image
  15. * @params: mkimage parameters
  16. * @return 0 if OK, -1 on error
  17. */
  18. int fit_verify_header(unsigned char *ptr, int image_size,
  19. struct image_tool_params *params);
  20. int fit_check_image_types(uint8_t type);
  21. /**
  22. * Map an FDT into memory, optionally increasing its size
  23. *
  24. * @cmdname: Tool name (for displaying with error messages)
  25. * @fname: Filename containing FDT
  26. * @size_inc: Amount to increase size by (0 = leave it alone)
  27. * @blobp: Returns pointer to FDT blob
  28. * @sbuf: File status information is stored here
  29. * @delete_on_error: true to delete the file if we get an error
  30. * @read_only: true to open in read-only mode
  31. * @return 0 if OK, -1 on error.
  32. */
  33. int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
  34. void **blobp, struct stat *sbuf, bool delete_on_error,
  35. bool read_only);
  36. #endif /* _FIT_COMMON_H_ */