uimage.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * *** IMPORTANT ***
  4. * This file is not only included from C-code but also from devicetree source
  5. * files. As such this file MUST only contain comments and defines.
  6. *
  7. * Based on image.h from U-Boot which is
  8. * (C) Copyright 2008 Semihalf
  9. * (C) Copyright 2000-2005 Wolfgang Denk, DENX Software Engineering, [email protected].
  10. */
  11. #ifndef __UIMAGE_H__
  12. #define __UIMAGE_H__
  13. /*
  14. * Operating System Codes
  15. *
  16. * The following are exposed to uImage header.
  17. * New IDs *MUST* be appended at the end of the list and *NEVER*
  18. * inserted for backward compatibility.
  19. */
  20. #define IH_OS_INVALID 0 /* Invalid OS */
  21. #define IH_OS_OPENBSD 1 /* OpenBSD */
  22. #define IH_OS_NETBSD 2 /* NetBSD */
  23. #define IH_OS_FREEBSD 3 /* FreeBSD */
  24. #define IH_OS_4_4BSD 4 /* 4.4BSD */
  25. #define IH_OS_LINUX 5 /* Linux */
  26. #define IH_OS_SVR4 6 /* SVR4 */
  27. #define IH_OS_ESIX 7 /* Esix */
  28. #define IH_OS_SOLARIS 8 /* Solaris */
  29. #define IH_OS_IRIX 9 /* Irix */
  30. #define IH_OS_SCO 10 /* SCO */
  31. #define IH_OS_DELL 11 /* Dell */
  32. #define IH_OS_NCR 12 /* NCR */
  33. #define IH_OS_LYNXOS 13 /* LynxOS */
  34. #define IH_OS_VXWORKS 14 /* VxWorks */
  35. #define IH_OS_PSOS 15 /* pSOS */
  36. #define IH_OS_QNX 16 /* QNX */
  37. #define IH_OS_U_BOOT 17 /* Firmware */
  38. #define IH_OS_RTEMS 18 /* RTEMS */
  39. #define IH_OS_ARTOS 19 /* ARTOS */
  40. #define IH_OS_UNITY 20 /* Unity OS */
  41. #define IH_OS_INTEGRITY 21 /* INTEGRITY */
  42. #define IH_OS_OSE 22 /* OSE */
  43. #define IH_OS_PLAN9 23 /* Plan 9 */
  44. #define IH_OS_OPENRTOS 24 /* OpenRTOS */
  45. #define IH_OS_ARM_TRUSTED_FIRMWARE 25 /* ARM Trusted Firmware */
  46. #define IH_OS_TEE 26 /* Trusted Execution Environment */
  47. #define IH_OS_OPENSBI 27 /* RISC-V OpenSBI */
  48. #define IH_OS_EFI 28 /* EFI Firmware (e.g. GRUB2) */
  49. /*
  50. * CPU Architecture Codes (supported by Linux)
  51. *
  52. * The following are exposed to uImage header.
  53. * New IDs *MUST* be appended at the end of the list and *NEVER*
  54. * inserted for backward compatibility.
  55. */
  56. #define IH_ARCH_INVALID 0 /* Invalid CPU */
  57. #define IH_ARCH_ALPHA 1 /* Alpha */
  58. #define IH_ARCH_ARM 2 /* ARM */
  59. #define IH_ARCH_I386 3 /* Intel x86 */
  60. #define IH_ARCH_IA64 4 /* IA64 */
  61. #define IH_ARCH_MIPS 5 /* MIPS */
  62. #define IH_ARCH_MIPS64 6 /* MIPS 64 Bit */
  63. #define IH_ARCH_PPC 7 /* PowerPC */
  64. #define IH_ARCH_S390 8 /* IBM S390 */
  65. #define IH_ARCH_SH 9 /* SuperH */
  66. #define IH_ARCH_SPARC 10 /* Sparc */
  67. #define IH_ARCH_SPARC64 11 /* Sparc 64 Bit */
  68. #define IH_ARCH_M68K 12 /* M68K */
  69. #define IH_ARCH_NIOS 13 /* Nios-32 */
  70. #define IH_ARCH_MICROBLAZE 14 /* MicroBlaze */
  71. #define IH_ARCH_NIOS2 15 /* Nios-II */
  72. #define IH_ARCH_BLACKFIN 16 /* Blackfin */
  73. #define IH_ARCH_AVR32 17 /* AVR32 */
  74. #define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */
  75. #define IH_ARCH_SANDBOX 19 /* Sandbox architecture (test only) */
  76. #define IH_ARCH_NDS32 20 /* ANDES Technology - NDS32 */
  77. #define IH_ARCH_OPENRISC 21 /* OpenRISC 1000 */
  78. #define IH_ARCH_ARM64 22 /* ARM64 */
  79. #define IH_ARCH_ARC 23 /* Synopsys DesignWare ARC */
  80. #define IH_ARCH_X86_64 24 /* AMD x86_64, Intel and Via */
  81. #define IH_ARCH_XTENSA 25 /* Xtensa */
  82. #define IH_ARCH_RISCV 26 /* RISC-V */
  83. /*
  84. * Image Types
  85. *
  86. * "Standalone Programs" are directly runnable in the environment
  87. * provided by U-Boot; it is expected that (if they behave
  88. * well) you can continue to work in U-Boot after return from
  89. * the Standalone Program.
  90. * "OS Kernel Images" are usually images of some Embedded OS which
  91. * will take over control completely. Usually these programs
  92. * will install their own set of exception handlers, device
  93. * drivers, set up the MMU, etc. - this means, that you cannot
  94. * expect to re-enter U-Boot except by resetting the CPU.
  95. * "RAMDisk Images" are more or less just data blocks, and their
  96. * parameters (address, size) are passed to an OS kernel that is
  97. * being started.
  98. * "Multi-File Images" contain several images, typically an OS
  99. * (Linux) kernel image and one or more data images like
  100. * RAMDisks. This construct is useful for instance when you want
  101. * to boot over the network using BOOTP etc., where the boot
  102. * server provides just a single image file, but you want to get
  103. * for instance an OS kernel and a RAMDisk image.
  104. *
  105. * "Multi-File Images" start with a list of image sizes, each
  106. * image size (in bytes) specified by an "uint32_t" in network
  107. * byte order. This list is terminated by an "(uint32_t)0".
  108. * Immediately after the terminating 0 follow the images, one by
  109. * one, all aligned on "uint32_t" boundaries (size rounded up to
  110. * a multiple of 4 bytes - except for the last file).
  111. *
  112. * "Firmware Images" are binary images containing firmware (like
  113. * U-Boot or FPGA images) which usually will be programmed to
  114. * flash memory.
  115. *
  116. * "Script files" are command sequences that will be executed by
  117. * U-Boot's command interpreter; this feature is especially
  118. * useful when you configure U-Boot to use a real shell (hush)
  119. * as command interpreter (=> Shell Scripts).
  120. *
  121. * The following are exposed to uImage header.
  122. * New IDs *MUST* be appended at the end of the list and *NEVER*
  123. * inserted for backward compatibility.
  124. */
  125. #define IH_TYPE_INVALID 0 /* Invalid Image */
  126. #define IH_TYPE_STANDALONE 1 /* Standalone Program */
  127. #define IH_TYPE_KERNEL 2 /* OS Kernel Image */
  128. #define IH_TYPE_RAMDISK 3 /* RAMDisk Image */
  129. #define IH_TYPE_MULTI 4 /* Multi-File Image */
  130. #define IH_TYPE_FIRMWARE 5 /* Firmware Image */
  131. #define IH_TYPE_SCRIPT 6 /* Script file */
  132. #define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
  133. #define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */
  134. #define IH_TYPE_KWBIMAGE 9 /* Kirkwood Boot Image */
  135. #define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */
  136. #define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
  137. #define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
  138. #define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
  139. /* OS Kernel Image, can run from any load address */
  140. #define IH_TYPE_KERNEL_NOLOAD 14
  141. #define IH_TYPE_PBLIMAGE 15 /* Freescale PBL Boot Image */
  142. #define IH_TYPE_MXSIMAGE 16 /* Freescale MXSBoot Image */
  143. #define IH_TYPE_GPIMAGE 17 /* TI Keystone GPHeader Image */
  144. #define IH_TYPE_ATMELIMAGE 18 /* ATMEL ROM bootable Image */
  145. #define IH_TYPE_SOCFPGAIMAGE 19 /* Altera SOCFPGA CV/AV Preloader */
  146. #define IH_TYPE_X86_SETUP 20 /* x86 setup.bin Image */
  147. #define IH_TYPE_LPC32XXIMAGE 21 /* x86 setup.bin Image */
  148. #define IH_TYPE_LOADABLE 22 /* A list of typeless images */
  149. #define IH_TYPE_RKIMAGE 23 /* Rockchip Boot Image */
  150. #define IH_TYPE_RKSD 24 /* Rockchip SD card */
  151. #define IH_TYPE_RKSPI 25 /* Rockchip SPI image */
  152. #define IH_TYPE_ZYNQIMAGE 26 /* Xilinx Zynq Boot Image */
  153. #define IH_TYPE_ZYNQMPIMAGE 27 /* Xilinx ZynqMP Boot Image */
  154. #define IH_TYPE_ZYNQMPBIF 28 /* Xilinx ZynqMP Boot Image (bif) */
  155. #define IH_TYPE_FPGA 29 /* FPGA Image */
  156. #define IH_TYPE_VYBRIDIMAGE 30 /* VYBRID .vyb Image */
  157. #define IH_TYPE_TEE 31 /* Trusted Execution Environment OS Image */
  158. #define IH_TYPE_FIRMWARE_IVT 32 /* Firmware Image with HABv4 IVT */
  159. #define IH_TYPE_PMMC 33 /* TI Power Management Micro-Controller Firmware */
  160. #define IH_TYPE_STM32IMAGE 34 /* STMicroelectronics STM32 Image */
  161. #define IH_TYPE_SOCFPGAIMAGE_V1 35 /* Altera SOCFPGA A10 Preloader */
  162. #define IH_TYPE_MTKIMAGE 36 /* MediaTek BootROM loadable Image */
  163. #define IH_TYPE_IMX8MIMAGE 37 /* Freescale IMX8MBoot Image */
  164. #define IH_TYPE_IMX8IMAGE 38 /* Freescale IMX8Boot Image */
  165. #define IH_TYPE_COPRO 39 /* Coprocessor Image for remoteproc*/
  166. /*
  167. * Compression Types
  168. *
  169. * The following are exposed to uImage header.
  170. * New IDs *MUST* be appended at the end of the list and *NEVER*
  171. * inserted for backward compatibility.
  172. */
  173. #define IH_COMP_NONE 0 /* No Compression Used */
  174. #define IH_COMP_GZIP 1 /* gzip Compression Used */
  175. #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
  176. #define IH_COMP_LZMA 3 /* lzma Compression Used */
  177. #define IH_COMP_LZO 4 /* lzo Compression Used */
  178. #define IH_COMP_LZ4 5 /* lz4 Compression Used */
  179. #define LZ4F_MAGIC 0x184D2204 /* LZ4 Magic Number */
  180. #define IH_MAGIC 0x27051956 /* Image Magic Number */
  181. #define IH_NMLEN 32 /* Image Name Length */
  182. /*
  183. * Magic values specific to "openwrt,uimage" partitions
  184. */
  185. #define IH_MAGIC_OKLI 0x4f4b4c49 /* 'OKLI' */
  186. #define FW_EDIMAX_OFFSET 20 /* Edimax Firmware Offset */
  187. #define FW_MAGIC_EDIMAX 0x43535953 /* Edimax Firmware Magic Number */
  188. #endif /* __UIMAGE_H__ */