image.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Derived from U-Boot include/image.h:
  4. *
  5. * (C) Copyright 2008 Semihalf
  6. *
  7. * (C) Copyright 2000-2005
  8. * Wolfgang Denk, DENX Software Engineering, [email protected].
  9. ********************************************************************
  10. * NOTE: This header file defines an interface to U-Boot. Including
  11. * this (unmodified) header file in another file is considered normal
  12. * use of U-Boot, and does *not* fall under the heading of "derived
  13. * work".
  14. ********************************************************************
  15. */
  16. #pragma once
  17. #include <types.h>
  18. /*
  19. * Compression Types
  20. *
  21. * The following are exposed to uImage header.
  22. * New IDs *MUST* be appended at the end of the list and *NEVER*
  23. * inserted for backward compatibility.
  24. */
  25. enum {
  26. IH_COMP_NONE = 0, /* No Compression Used */
  27. IH_COMP_GZIP, /* gzip Compression Used */
  28. IH_COMP_BZIP2, /* bzip2 Compression Used */
  29. IH_COMP_LZMA, /* lzma Compression Used */
  30. IH_COMP_LZO, /* lzo Compression Used */
  31. IH_COMP_LZ4, /* lz4 Compression Used */
  32. IH_COMP_ZSTD, /* zstd Compression Used */
  33. IH_COMP_COUNT,
  34. };
  35. #define IH_MAGIC 0x27051956 /* Image Magic Number */
  36. #define IH_MAGIC_OKLI 0x4f4b4c49 /* 'OKLI' Magic Number */
  37. #define IH_NMLEN 32 /* Image Name Length */
  38. /*
  39. * Legacy format image header,
  40. * all data in network byte order (aka natural aka bigendian).
  41. */
  42. typedef struct image_header {
  43. uint32_t ih_magic; /* Image Header Magic Number */
  44. uint32_t ih_hcrc; /* Image Header CRC Checksum */
  45. uint32_t ih_time; /* Image Creation Timestamp */
  46. uint32_t ih_size; /* Image Data Size */
  47. uint32_t ih_load; /* Data Load Address */
  48. uint32_t ih_ep; /* Entry Point Address */
  49. uint32_t ih_dcrc; /* Image Data CRC Checksum */
  50. uint8_t ih_os; /* Operating System */
  51. uint8_t ih_arch; /* CPU architecture */
  52. uint8_t ih_type; /* Image Type */
  53. uint8_t ih_comp; /* Compression Type */
  54. uint8_t ih_name[IH_NMLEN]; /* Image Name */
  55. } image_header_t;