image.h 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. /*
  2. * (C) Copyright 2008 Semihalf
  3. *
  4. * (C) Copyright 2000-2005
  5. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. ********************************************************************
  9. * NOTE: This header file defines an interface to U-Boot. Including
  10. * this (unmodified) header file in another file is considered normal
  11. * use of U-Boot, and does *not* fall under the heading of "derived
  12. * work".
  13. ********************************************************************
  14. */
  15. #ifndef __IMAGE_H__
  16. #define __IMAGE_H__
  17. #include "compiler.h"
  18. #include <asm/byteorder.h>
  19. /* Define this to avoid #ifdefs later on */
  20. struct lmb;
  21. #ifdef USE_HOSTCC
  22. #include <sys/types.h>
  23. /* new uImage format support enabled on host */
  24. #define CONFIG_FIT 1
  25. #define CONFIG_OF_LIBFDT 1
  26. #define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */
  27. #define IMAGE_ENABLE_IGNORE 0
  28. #define IMAGE_INDENT_STRING ""
  29. #else
  30. #include <lmb.h>
  31. #include <asm/u-boot.h>
  32. #include <command.h>
  33. /* Take notice of the 'ignore' property for hashes */
  34. #define IMAGE_ENABLE_IGNORE 1
  35. #define IMAGE_INDENT_STRING " "
  36. #endif /* USE_HOSTCC */
  37. #if defined(CONFIG_FIT)
  38. #include <hash.h>
  39. #include <libfdt.h>
  40. #include <fdt_support.h>
  41. # ifdef CONFIG_SPL_BUILD
  42. # ifdef CONFIG_SPL_CRC32_SUPPORT
  43. # define IMAGE_ENABLE_CRC32 1
  44. # endif
  45. # ifdef CONFIG_SPL_MD5_SUPPORT
  46. # define IMAGE_ENABLE_MD5 1
  47. # endif
  48. # ifdef CONFIG_SPL_SHA1_SUPPORT
  49. # define IMAGE_ENABLE_SHA1 1
  50. # endif
  51. # ifdef CONFIG_SPL_SHA256_SUPPORT
  52. # define IMAGE_ENABLE_SHA256 1
  53. # endif
  54. # else
  55. # define CONFIG_CRC32 /* FIT images need CRC32 support */
  56. # define CONFIG_MD5 /* and MD5 */
  57. # define CONFIG_SHA1 /* and SHA1 */
  58. # define CONFIG_SHA256 /* and SHA256 */
  59. # define IMAGE_ENABLE_CRC32 1
  60. # define IMAGE_ENABLE_MD5 1
  61. # define IMAGE_ENABLE_SHA1 1
  62. # define IMAGE_ENABLE_SHA256 1
  63. # endif
  64. #ifdef CONFIG_FIT_DISABLE_SHA256
  65. #undef CONFIG_SHA256
  66. #undef IMAGE_ENABLE_SHA256
  67. #endif
  68. #ifndef IMAGE_ENABLE_CRC32
  69. #define IMAGE_ENABLE_CRC32 0
  70. #endif
  71. #ifndef IMAGE_ENABLE_MD5
  72. #define IMAGE_ENABLE_MD5 0
  73. #endif
  74. #ifndef IMAGE_ENABLE_SHA1
  75. #define IMAGE_ENABLE_SHA1 0
  76. #endif
  77. #ifndef IMAGE_ENABLE_SHA256
  78. #define IMAGE_ENABLE_SHA256 0
  79. #endif
  80. #endif /* CONFIG_FIT */
  81. #ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
  82. # define IMAGE_ENABLE_RAMDISK_HIGH 1
  83. #else
  84. # define IMAGE_ENABLE_RAMDISK_HIGH 0
  85. #endif
  86. #ifdef CONFIG_OF_LIBFDT
  87. # define IMAGE_ENABLE_OF_LIBFDT 1
  88. #else
  89. # define IMAGE_ENABLE_OF_LIBFDT 0
  90. #endif
  91. #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
  92. # define IMAGE_BOOT_GET_CMDLINE 1
  93. #else
  94. # define IMAGE_BOOT_GET_CMDLINE 0
  95. #endif
  96. #ifdef CONFIG_OF_BOARD_SETUP
  97. # define IMAGE_OF_BOARD_SETUP 1
  98. #else
  99. # define IMAGE_OF_BOARD_SETUP 0
  100. #endif
  101. #ifdef CONFIG_OF_SYSTEM_SETUP
  102. # define IMAGE_OF_SYSTEM_SETUP 1
  103. #else
  104. # define IMAGE_OF_SYSTEM_SETUP 0
  105. #endif
  106. /*
  107. * Operating System Codes
  108. */
  109. #define IH_OS_INVALID 0 /* Invalid OS */
  110. #define IH_OS_OPENBSD 1 /* OpenBSD */
  111. #define IH_OS_NETBSD 2 /* NetBSD */
  112. #define IH_OS_FREEBSD 3 /* FreeBSD */
  113. #define IH_OS_4_4BSD 4 /* 4.4BSD */
  114. #define IH_OS_LINUX 5 /* Linux */
  115. #define IH_OS_SVR4 6 /* SVR4 */
  116. #define IH_OS_ESIX 7 /* Esix */
  117. #define IH_OS_SOLARIS 8 /* Solaris */
  118. #define IH_OS_IRIX 9 /* Irix */
  119. #define IH_OS_SCO 10 /* SCO */
  120. #define IH_OS_DELL 11 /* Dell */
  121. #define IH_OS_NCR 12 /* NCR */
  122. #define IH_OS_LYNXOS 13 /* LynxOS */
  123. #define IH_OS_VXWORKS 14 /* VxWorks */
  124. #define IH_OS_PSOS 15 /* pSOS */
  125. #define IH_OS_QNX 16 /* QNX */
  126. #define IH_OS_U_BOOT 17 /* Firmware */
  127. #define IH_OS_RTEMS 18 /* RTEMS */
  128. #define IH_OS_ARTOS 19 /* ARTOS */
  129. #define IH_OS_UNITY 20 /* Unity OS */
  130. #define IH_OS_INTEGRITY 21 /* INTEGRITY */
  131. #define IH_OS_OSE 22 /* OSE */
  132. #define IH_OS_PLAN9 23 /* Plan 9 */
  133. #define IH_OS_OPENRTOS 24 /* OpenRTOS */
  134. /*
  135. * CPU Architecture Codes (supported by Linux)
  136. */
  137. #define IH_ARCH_INVALID 0 /* Invalid CPU */
  138. #define IH_ARCH_ALPHA 1 /* Alpha */
  139. #define IH_ARCH_ARM 2 /* ARM */
  140. #define IH_ARCH_I386 3 /* Intel x86 */
  141. #define IH_ARCH_IA64 4 /* IA64 */
  142. #define IH_ARCH_MIPS 5 /* MIPS */
  143. #define IH_ARCH_MIPS64 6 /* MIPS 64 Bit */
  144. #define IH_ARCH_PPC 7 /* PowerPC */
  145. #define IH_ARCH_S390 8 /* IBM S390 */
  146. #define IH_ARCH_SH 9 /* SuperH */
  147. #define IH_ARCH_SPARC 10 /* Sparc */
  148. #define IH_ARCH_SPARC64 11 /* Sparc 64 Bit */
  149. #define IH_ARCH_M68K 12 /* M68K */
  150. #define IH_ARCH_MICROBLAZE 14 /* MicroBlaze */
  151. #define IH_ARCH_NIOS2 15 /* Nios-II */
  152. #define IH_ARCH_BLACKFIN 16 /* Blackfin */
  153. #define IH_ARCH_AVR32 17 /* AVR32 */
  154. #define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */
  155. #define IH_ARCH_SANDBOX 19 /* Sandbox architecture (test only) */
  156. #define IH_ARCH_NDS32 20 /* ANDES Technology - NDS32 */
  157. #define IH_ARCH_OPENRISC 21 /* OpenRISC 1000 */
  158. #define IH_ARCH_ARM64 22 /* ARM64 */
  159. #define IH_ARCH_ARC 23 /* Synopsys DesignWare ARC */
  160. #define IH_ARCH_X86_64 24 /* AMD x86_64, Intel and Via */
  161. /*
  162. * Image Types
  163. *
  164. * "Standalone Programs" are directly runnable in the environment
  165. * provided by U-Boot; it is expected that (if they behave
  166. * well) you can continue to work in U-Boot after return from
  167. * the Standalone Program.
  168. * "OS Kernel Images" are usually images of some Embedded OS which
  169. * will take over control completely. Usually these programs
  170. * will install their own set of exception handlers, device
  171. * drivers, set up the MMU, etc. - this means, that you cannot
  172. * expect to re-enter U-Boot except by resetting the CPU.
  173. * "RAMDisk Images" are more or less just data blocks, and their
  174. * parameters (address, size) are passed to an OS kernel that is
  175. * being started.
  176. * "Multi-File Images" contain several images, typically an OS
  177. * (Linux) kernel image and one or more data images like
  178. * RAMDisks. This construct is useful for instance when you want
  179. * to boot over the network using BOOTP etc., where the boot
  180. * server provides just a single image file, but you want to get
  181. * for instance an OS kernel and a RAMDisk image.
  182. *
  183. * "Multi-File Images" start with a list of image sizes, each
  184. * image size (in bytes) specified by an "uint32_t" in network
  185. * byte order. This list is terminated by an "(uint32_t)0".
  186. * Immediately after the terminating 0 follow the images, one by
  187. * one, all aligned on "uint32_t" boundaries (size rounded up to
  188. * a multiple of 4 bytes - except for the last file).
  189. *
  190. * "Firmware Images" are binary images containing firmware (like
  191. * U-Boot or FPGA images) which usually will be programmed to
  192. * flash memory.
  193. *
  194. * "Script files" are command sequences that will be executed by
  195. * U-Boot's command interpreter; this feature is especially
  196. * useful when you configure U-Boot to use a real shell (hush)
  197. * as command interpreter (=> Shell Scripts).
  198. */
  199. #define IH_TYPE_INVALID 0 /* Invalid Image */
  200. #define IH_TYPE_STANDALONE 1 /* Standalone Program */
  201. #define IH_TYPE_KERNEL 2 /* OS Kernel Image */
  202. #define IH_TYPE_RAMDISK 3 /* RAMDisk Image */
  203. #define IH_TYPE_MULTI 4 /* Multi-File Image */
  204. #define IH_TYPE_FIRMWARE 5 /* Firmware Image */
  205. #define IH_TYPE_SCRIPT 6 /* Script file */
  206. #define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
  207. #define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */
  208. #define IH_TYPE_KWBIMAGE 9 /* Kirkwood Boot Image */
  209. #define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */
  210. #define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
  211. #define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
  212. #define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
  213. #define IH_TYPE_KERNEL_NOLOAD 14 /* OS Kernel Image, can run from any load address */
  214. #define IH_TYPE_PBLIMAGE 15 /* Freescale PBL Boot Image */
  215. #define IH_TYPE_MXSIMAGE 16 /* Freescale MXSBoot Image */
  216. #define IH_TYPE_GPIMAGE 17 /* TI Keystone GPHeader Image */
  217. #define IH_TYPE_ATMELIMAGE 18 /* ATMEL ROM bootable Image */
  218. #define IH_TYPE_SOCFPGAIMAGE 19 /* Altera SOCFPGA Preloader */
  219. #define IH_TYPE_X86_SETUP 20 /* x86 setup.bin Image */
  220. #define IH_TYPE_LPC32XXIMAGE 21 /* x86 setup.bin Image */
  221. #define IH_TYPE_LOADABLE 22 /* A list of typeless images */
  222. #define IH_TYPE_RKIMAGE 23 /* Rockchip Boot Image */
  223. #define IH_TYPE_COUNT 24 /* Number of image types */
  224. /*
  225. * Compression Types
  226. */
  227. #define IH_COMP_NONE 0 /* No Compression Used */
  228. #define IH_COMP_GZIP 1 /* gzip Compression Used */
  229. #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
  230. #define IH_COMP_LZMA 3 /* lzma Compression Used */
  231. #define IH_COMP_LZO 4 /* lzo Compression Used */
  232. #define IH_MAGIC 0x27051956 /* Image Magic Number */
  233. #define IH_NMLEN 32 /* Image Name Length */
  234. /* Reused from common.h */
  235. #define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
  236. /*
  237. * Legacy format image header,
  238. * all data in network byte order (aka natural aka bigendian).
  239. */
  240. typedef struct image_header {
  241. __be32 ih_magic; /* Image Header Magic Number */
  242. __be32 ih_hcrc; /* Image Header CRC Checksum */
  243. __be32 ih_time; /* Image Creation Timestamp */
  244. __be32 ih_size; /* Image Data Size */
  245. __be32 ih_load; /* Data Load Address */
  246. __be32 ih_ep; /* Entry Point Address */
  247. __be32 ih_dcrc; /* Image Data CRC Checksum */
  248. uint8_t ih_os; /* Operating System */
  249. uint8_t ih_arch; /* CPU architecture */
  250. uint8_t ih_type; /* Image Type */
  251. uint8_t ih_comp; /* Compression Type */
  252. uint8_t ih_name[IH_NMLEN]; /* Image Name */
  253. } image_header_t;
  254. typedef struct image_info {
  255. ulong start, end; /* start/end of blob */
  256. ulong image_start, image_len; /* start of image within blob, len of image */
  257. ulong load; /* load addr for the image */
  258. uint8_t comp, type, os; /* compression, type of image, os type */
  259. uint8_t arch; /* CPU architecture */
  260. } image_info_t;
  261. /*
  262. * Legacy and FIT format headers used by do_bootm() and do_bootm_<os>()
  263. * routines.
  264. */
  265. typedef struct bootm_headers {
  266. /*
  267. * Legacy os image header, if it is a multi component image
  268. * then boot_get_ramdisk() and get_fdt() will attempt to get
  269. * data from second and third component accordingly.
  270. */
  271. image_header_t *legacy_hdr_os; /* image header pointer */
  272. image_header_t legacy_hdr_os_copy; /* header copy */
  273. ulong legacy_hdr_valid;
  274. #if defined(CONFIG_FIT)
  275. const char *fit_uname_cfg; /* configuration node unit name */
  276. void *fit_hdr_os; /* os FIT image header */
  277. const char *fit_uname_os; /* os subimage node unit name */
  278. int fit_noffset_os; /* os subimage node offset */
  279. void *fit_hdr_rd; /* init ramdisk FIT image header */
  280. const char *fit_uname_rd; /* init ramdisk subimage node unit name */
  281. int fit_noffset_rd; /* init ramdisk subimage node offset */
  282. void *fit_hdr_fdt; /* FDT blob FIT image header */
  283. const char *fit_uname_fdt; /* FDT blob subimage node unit name */
  284. int fit_noffset_fdt;/* FDT blob subimage node offset */
  285. void *fit_hdr_setup; /* x86 setup FIT image header */
  286. const char *fit_uname_setup; /* x86 setup subimage node name */
  287. int fit_noffset_setup;/* x86 setup subimage node offset */
  288. #endif
  289. #ifndef USE_HOSTCC
  290. image_info_t os; /* os image info */
  291. ulong ep; /* entry point of OS */
  292. ulong rd_start, rd_end;/* ramdisk start/end */
  293. char *ft_addr; /* flat dev tree address */
  294. ulong ft_len; /* length of flat device tree */
  295. ulong initrd_start;
  296. ulong initrd_end;
  297. ulong cmdline_start;
  298. ulong cmdline_end;
  299. bd_t *kbd;
  300. #endif
  301. int verify; /* getenv("verify")[0] != 'n' */
  302. #define BOOTM_STATE_START (0x00000001)
  303. #define BOOTM_STATE_FINDOS (0x00000002)
  304. #define BOOTM_STATE_FINDOTHER (0x00000004)
  305. #define BOOTM_STATE_LOADOS (0x00000008)
  306. #define BOOTM_STATE_RAMDISK (0x00000010)
  307. #define BOOTM_STATE_FDT (0x00000020)
  308. #define BOOTM_STATE_OS_CMDLINE (0x00000040)
  309. #define BOOTM_STATE_OS_BD_T (0x00000080)
  310. #define BOOTM_STATE_OS_PREP (0x00000100)
  311. #define BOOTM_STATE_OS_FAKE_GO (0x00000200) /* 'Almost' run the OS */
  312. #define BOOTM_STATE_OS_GO (0x00000400)
  313. int state;
  314. #ifdef CONFIG_LMB
  315. struct lmb lmb; /* for memory mgmt */
  316. #endif
  317. } bootm_headers_t;
  318. extern bootm_headers_t images;
  319. /*
  320. * Some systems (for example LWMON) have very short watchdog periods;
  321. * we must make sure to split long operations like memmove() or
  322. * checksum calculations into reasonable chunks.
  323. */
  324. #ifndef CHUNKSZ
  325. #define CHUNKSZ (64 * 1024)
  326. #endif
  327. #ifndef CHUNKSZ_CRC32
  328. #define CHUNKSZ_CRC32 (64 * 1024)
  329. #endif
  330. #ifndef CHUNKSZ_MD5
  331. #define CHUNKSZ_MD5 (64 * 1024)
  332. #endif
  333. #ifndef CHUNKSZ_SHA1
  334. #define CHUNKSZ_SHA1 (64 * 1024)
  335. #endif
  336. #define uimage_to_cpu(x) be32_to_cpu(x)
  337. #define cpu_to_uimage(x) cpu_to_be32(x)
  338. /*
  339. * Translation table for entries of a specific type; used by
  340. * get_table_entry_id() and get_table_entry_name().
  341. */
  342. typedef struct table_entry {
  343. int id;
  344. char *sname; /* short (input) name to find table entry */
  345. char *lname; /* long (output) name to print for messages */
  346. } table_entry_t;
  347. /*
  348. * get_table_entry_id() scans the translation table trying to find an
  349. * entry that matches the given short name. If a matching entry is
  350. * found, it's id is returned to the caller.
  351. */
  352. int get_table_entry_id(const table_entry_t *table,
  353. const char *table_name, const char *name);
  354. /*
  355. * get_table_entry_name() scans the translation table trying to find
  356. * an entry that matches the given id. If a matching entry is found,
  357. * its long name is returned to the caller.
  358. */
  359. char *get_table_entry_name(const table_entry_t *table, char *msg, int id);
  360. const char *genimg_get_os_name(uint8_t os);
  361. const char *genimg_get_arch_name(uint8_t arch);
  362. const char *genimg_get_type_name(uint8_t type);
  363. /**
  364. * genimg_get_type_short_name() - get the short name for an image type
  365. *
  366. * @param type Image type (IH_TYPE_...)
  367. * @return image short name, or "unknown" if unknown
  368. */
  369. const char *genimg_get_type_short_name(uint8_t type);
  370. const char *genimg_get_comp_name(uint8_t comp);
  371. int genimg_get_os_id(const char *name);
  372. int genimg_get_arch_id(const char *name);
  373. int genimg_get_type_id(const char *name);
  374. int genimg_get_comp_id(const char *name);
  375. void genimg_print_size(uint32_t size);
  376. #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || \
  377. defined(USE_HOSTCC)
  378. #define IMAGE_ENABLE_TIMESTAMP 1
  379. #else
  380. #define IMAGE_ENABLE_TIMESTAMP 0
  381. #endif
  382. void genimg_print_time(time_t timestamp);
  383. /* What to do with a image load address ('load = <> 'in the FIT) */
  384. enum fit_load_op {
  385. FIT_LOAD_IGNORED, /* Ignore load address */
  386. FIT_LOAD_OPTIONAL, /* Can be provided, but optional */
  387. FIT_LOAD_OPTIONAL_NON_ZERO, /* Optional, a value of 0 is ignored */
  388. FIT_LOAD_REQUIRED, /* Must be provided */
  389. };
  390. int boot_get_setup(bootm_headers_t *images, uint8_t arch, ulong *setup_start,
  391. ulong *setup_len);
  392. #ifndef USE_HOSTCC
  393. /* Image format types, returned by _get_format() routine */
  394. #define IMAGE_FORMAT_INVALID 0x00
  395. #if defined(CONFIG_IMAGE_FORMAT_LEGACY)
  396. #define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */
  397. #endif
  398. #define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */
  399. #define IMAGE_FORMAT_ANDROID 0x03 /* Android boot image */
  400. ulong genimg_get_kernel_addr_fit(char * const img_addr,
  401. const char **fit_uname_config,
  402. const char **fit_uname_kernel);
  403. ulong genimg_get_kernel_addr(char * const img_addr);
  404. int genimg_get_format(const void *img_addr);
  405. int genimg_has_config(bootm_headers_t *images);
  406. ulong genimg_get_image(ulong img_addr);
  407. int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
  408. uint8_t arch, ulong *rd_start, ulong *rd_end);
  409. /**
  410. * boot_get_loadable - routine to load a list of binaries to memory
  411. * @argc: Ignored Argument
  412. * @argv: Ignored Argument
  413. * @images: pointer to the bootm images structure
  414. * @arch: expected architecture for the image
  415. * @ld_start: Ignored Argument
  416. * @ld_len: Ignored Argument
  417. *
  418. * boot_get_loadable() will take the given FIT configuration, and look
  419. * for a field named "loadables". Loadables, is a list of elements in
  420. * the FIT given as strings. exe:
  421. * loadables = "linux_kernel@1", "fdt@2";
  422. * this function will attempt to parse each string, and load the
  423. * corresponding element from the FIT into memory. Once placed,
  424. * no aditional actions are taken.
  425. *
  426. * @return:
  427. * 0, if only valid images or no images are found
  428. * error code, if an error occurs during fit_image_load
  429. */
  430. int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
  431. uint8_t arch, const ulong *ld_start, ulong * const ld_len);
  432. #endif /* !USE_HOSTCC */
  433. int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,
  434. ulong *setup_start, ulong *setup_len);
  435. /**
  436. * fit_image_load() - load an image from a FIT
  437. *
  438. * This deals with all aspects of loading an image from a FIT, including
  439. * selecting the right image based on configuration, verifying it, printing
  440. * out progress messages, checking the type/arch/os and optionally copying it
  441. * to the right load address.
  442. *
  443. * The property to look up is defined by image_type.
  444. *
  445. * @param images Boot images structure
  446. * @param addr Address of FIT in memory
  447. * @param fit_unamep On entry this is the requested image name
  448. * (e.g. "kernel@1") or NULL to use the default. On exit
  449. * points to the selected image name
  450. * @param fit_uname_configp On entry this is the requested configuration
  451. * name (e.g. "conf@1") or NULL to use the default. On
  452. * exit points to the selected configuration name.
  453. * @param arch Expected architecture (IH_ARCH_...)
  454. * @param image_type Required image type (IH_TYPE_...). If this is
  455. * IH_TYPE_KERNEL then we allow IH_TYPE_KERNEL_NOLOAD
  456. * also.
  457. * @param bootstage_id ID of starting bootstage to use for progress updates.
  458. * This will be added to the BOOTSTAGE_SUB values when
  459. * calling bootstage_mark()
  460. * @param load_op Decribes what to do with the load address
  461. * @param datap Returns address of loaded image
  462. * @param lenp Returns length of loaded image
  463. * @return node offset of image, or -ve error code on error
  464. */
  465. int fit_image_load(bootm_headers_t *images, ulong addr,
  466. const char **fit_unamep, const char **fit_uname_configp,
  467. int arch, int image_type, int bootstage_id,
  468. enum fit_load_op load_op, ulong *datap, ulong *lenp);
  469. #ifndef USE_HOSTCC
  470. /**
  471. * fit_get_node_from_config() - Look up an image a FIT by type
  472. *
  473. * This looks in the selected conf@ node (images->fit_uname_cfg) for a
  474. * particular image type (e.g. "kernel") and then finds the image that is
  475. * referred to.
  476. *
  477. * For example, for something like:
  478. *
  479. * images {
  480. * kernel@1 {
  481. * ...
  482. * };
  483. * };
  484. * configurations {
  485. * conf@1 {
  486. * kernel = "kernel@1";
  487. * };
  488. * };
  489. *
  490. * the function will return the node offset of the kernel@1 node, assuming
  491. * that conf@1 is the chosen configuration.
  492. *
  493. * @param images Boot images structure
  494. * @param prop_name Property name to look up (FIT_..._PROP)
  495. * @param addr Address of FIT in memory
  496. */
  497. int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
  498. ulong addr);
  499. int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
  500. bootm_headers_t *images,
  501. char **of_flat_tree, ulong *of_size);
  502. void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);
  503. int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size);
  504. int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
  505. ulong *initrd_start, ulong *initrd_end);
  506. int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end);
  507. #ifdef CONFIG_SYS_BOOT_GET_KBD
  508. int boot_get_kbd(struct lmb *lmb, bd_t **kbd);
  509. #endif /* CONFIG_SYS_BOOT_GET_KBD */
  510. #endif /* !USE_HOSTCC */
  511. /*******************************************************************/
  512. /* Legacy format specific code (prefixed with image_) */
  513. /*******************************************************************/
  514. static inline uint32_t image_get_header_size(void)
  515. {
  516. return (sizeof(image_header_t));
  517. }
  518. #define image_get_hdr_l(f) \
  519. static inline uint32_t image_get_##f(const image_header_t *hdr) \
  520. { \
  521. return uimage_to_cpu(hdr->ih_##f); \
  522. }
  523. image_get_hdr_l(magic) /* image_get_magic */
  524. image_get_hdr_l(hcrc) /* image_get_hcrc */
  525. image_get_hdr_l(time) /* image_get_time */
  526. image_get_hdr_l(size) /* image_get_size */
  527. image_get_hdr_l(load) /* image_get_load */
  528. image_get_hdr_l(ep) /* image_get_ep */
  529. image_get_hdr_l(dcrc) /* image_get_dcrc */
  530. #define image_get_hdr_b(f) \
  531. static inline uint8_t image_get_##f(const image_header_t *hdr) \
  532. { \
  533. return hdr->ih_##f; \
  534. }
  535. image_get_hdr_b(os) /* image_get_os */
  536. image_get_hdr_b(arch) /* image_get_arch */
  537. image_get_hdr_b(type) /* image_get_type */
  538. image_get_hdr_b(comp) /* image_get_comp */
  539. static inline char *image_get_name(const image_header_t *hdr)
  540. {
  541. return (char *)hdr->ih_name;
  542. }
  543. static inline uint32_t image_get_data_size(const image_header_t *hdr)
  544. {
  545. return image_get_size(hdr);
  546. }
  547. /**
  548. * image_get_data - get image payload start address
  549. * @hdr: image header
  550. *
  551. * image_get_data() returns address of the image payload. For single
  552. * component images it is image data start. For multi component
  553. * images it points to the null terminated table of sub-images sizes.
  554. *
  555. * returns:
  556. * image payload data start address
  557. */
  558. static inline ulong image_get_data(const image_header_t *hdr)
  559. {
  560. return ((ulong)hdr + image_get_header_size());
  561. }
  562. static inline uint32_t image_get_image_size(const image_header_t *hdr)
  563. {
  564. return (image_get_size(hdr) + image_get_header_size());
  565. }
  566. static inline ulong image_get_image_end(const image_header_t *hdr)
  567. {
  568. return ((ulong)hdr + image_get_image_size(hdr));
  569. }
  570. #define image_set_hdr_l(f) \
  571. static inline void image_set_##f(image_header_t *hdr, uint32_t val) \
  572. { \
  573. hdr->ih_##f = cpu_to_uimage(val); \
  574. }
  575. image_set_hdr_l(magic) /* image_set_magic */
  576. image_set_hdr_l(hcrc) /* image_set_hcrc */
  577. image_set_hdr_l(time) /* image_set_time */
  578. image_set_hdr_l(size) /* image_set_size */
  579. image_set_hdr_l(load) /* image_set_load */
  580. image_set_hdr_l(ep) /* image_set_ep */
  581. image_set_hdr_l(dcrc) /* image_set_dcrc */
  582. #define image_set_hdr_b(f) \
  583. static inline void image_set_##f(image_header_t *hdr, uint8_t val) \
  584. { \
  585. hdr->ih_##f = val; \
  586. }
  587. image_set_hdr_b(os) /* image_set_os */
  588. image_set_hdr_b(arch) /* image_set_arch */
  589. image_set_hdr_b(type) /* image_set_type */
  590. image_set_hdr_b(comp) /* image_set_comp */
  591. static inline void image_set_name(image_header_t *hdr, const char *name)
  592. {
  593. strncpy(image_get_name(hdr), name, IH_NMLEN);
  594. }
  595. int image_check_hcrc(const image_header_t *hdr);
  596. int image_check_dcrc(const image_header_t *hdr);
  597. #ifndef USE_HOSTCC
  598. ulong getenv_bootm_low(void);
  599. phys_size_t getenv_bootm_size(void);
  600. phys_size_t getenv_bootm_mapsize(void);
  601. #endif
  602. void memmove_wd(void *to, void *from, size_t len, ulong chunksz);
  603. static inline int image_check_magic(const image_header_t *hdr)
  604. {
  605. return (image_get_magic(hdr) == IH_MAGIC);
  606. }
  607. static inline int image_check_type(const image_header_t *hdr, uint8_t type)
  608. {
  609. return (image_get_type(hdr) == type);
  610. }
  611. static inline int image_check_arch(const image_header_t *hdr, uint8_t arch)
  612. {
  613. return (image_get_arch(hdr) == arch);
  614. }
  615. static inline int image_check_os(const image_header_t *hdr, uint8_t os)
  616. {
  617. return (image_get_os(hdr) == os);
  618. }
  619. ulong image_multi_count(const image_header_t *hdr);
  620. void image_multi_getimg(const image_header_t *hdr, ulong idx,
  621. ulong *data, ulong *len);
  622. void image_print_contents(const void *hdr);
  623. #ifndef USE_HOSTCC
  624. static inline int image_check_target_arch(const image_header_t *hdr)
  625. {
  626. #ifndef IH_ARCH_DEFAULT
  627. # error "please define IH_ARCH_DEFAULT in your arch asm/u-boot.h"
  628. #endif
  629. return image_check_arch(hdr, IH_ARCH_DEFAULT);
  630. }
  631. #endif /* USE_HOSTCC */
  632. /**
  633. * Set up properties in the FDT
  634. *
  635. * This sets up properties in the FDT that is to be passed to linux.
  636. *
  637. * @images: Images information
  638. * @blob: FDT to update
  639. * @of_size: Size of the FDT
  640. * @lmb: Points to logical memory block structure
  641. * @return 0 if ok, <0 on failure
  642. */
  643. int image_setup_libfdt(bootm_headers_t *images, void *blob,
  644. int of_size, struct lmb *lmb);
  645. /**
  646. * Set up the FDT to use for booting a kernel
  647. *
  648. * This performs ramdisk setup, sets up the FDT if required, and adds
  649. * paramters to the FDT if libfdt is available.
  650. *
  651. * @param images Images information
  652. * @return 0 if ok, <0 on failure
  653. */
  654. int image_setup_linux(bootm_headers_t *images);
  655. /**
  656. * bootz_setup() - Extract stat and size of a Linux xImage
  657. *
  658. * @image: Address of image
  659. * @start: Returns start address of image
  660. * @end : Returns end address of image
  661. * @return 0 if OK, 1 if the image was not recognised
  662. */
  663. int bootz_setup(ulong image, ulong *start, ulong *end);
  664. /*******************************************************************/
  665. /* New uImage format specific code (prefixed with fit_) */
  666. /*******************************************************************/
  667. #if defined(CONFIG_FIT)
  668. #define FIT_IMAGES_PATH "/images"
  669. #define FIT_CONFS_PATH "/configurations"
  670. /* hash/signature node */
  671. #define FIT_HASH_NODENAME "hash"
  672. #define FIT_ALGO_PROP "algo"
  673. #define FIT_VALUE_PROP "value"
  674. #define FIT_IGNORE_PROP "uboot-ignore"
  675. #define FIT_SIG_NODENAME "signature"
  676. /* image node */
  677. #define FIT_DATA_PROP "data"
  678. #define FIT_TIMESTAMP_PROP "timestamp"
  679. #define FIT_DESC_PROP "description"
  680. #define FIT_ARCH_PROP "arch"
  681. #define FIT_TYPE_PROP "type"
  682. #define FIT_OS_PROP "os"
  683. #define FIT_COMP_PROP "compression"
  684. #define FIT_ENTRY_PROP "entry"
  685. #define FIT_LOAD_PROP "load"
  686. /* configuration node */
  687. #define FIT_KERNEL_PROP "kernel"
  688. #define FIT_RAMDISK_PROP "ramdisk"
  689. #define FIT_FDT_PROP "fdt"
  690. #define FIT_LOADABLE_PROP "loadables"
  691. #define FIT_DEFAULT_PROP "default"
  692. #define FIT_SETUP_PROP "setup"
  693. #define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
  694. /* cmdline argument format parsing */
  695. int fit_parse_conf(const char *spec, ulong addr_curr,
  696. ulong *addr, const char **conf_name);
  697. int fit_parse_subimage(const char *spec, ulong addr_curr,
  698. ulong *addr, const char **image_name);
  699. int fit_get_subimage_count(const void *fit, int images_noffset);
  700. void fit_print_contents(const void *fit);
  701. void fit_image_print(const void *fit, int noffset, const char *p);
  702. /**
  703. * fit_get_end - get FIT image size
  704. * @fit: pointer to the FIT format image header
  705. *
  706. * returns:
  707. * size of the FIT image (blob) in memory
  708. */
  709. static inline ulong fit_get_size(const void *fit)
  710. {
  711. return fdt_totalsize(fit);
  712. }
  713. /**
  714. * fit_get_end - get FIT image end
  715. * @fit: pointer to the FIT format image header
  716. *
  717. * returns:
  718. * end address of the FIT image (blob) in memory
  719. */
  720. static inline ulong fit_get_end(const void *fit)
  721. {
  722. return (ulong)fit + fdt_totalsize(fit);
  723. }
  724. /**
  725. * fit_get_name - get FIT node name
  726. * @fit: pointer to the FIT format image header
  727. *
  728. * returns:
  729. * NULL, on error
  730. * pointer to node name, on success
  731. */
  732. static inline const char *fit_get_name(const void *fit_hdr,
  733. int noffset, int *len)
  734. {
  735. return fdt_get_name(fit_hdr, noffset, len);
  736. }
  737. int fit_get_desc(const void *fit, int noffset, char **desc);
  738. int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp);
  739. int fit_image_get_node(const void *fit, const char *image_uname);
  740. int fit_image_get_os(const void *fit, int noffset, uint8_t *os);
  741. int fit_image_get_arch(const void *fit, int noffset, uint8_t *arch);
  742. int fit_image_get_type(const void *fit, int noffset, uint8_t *type);
  743. int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp);
  744. int fit_image_get_load(const void *fit, int noffset, ulong *load);
  745. int fit_image_get_entry(const void *fit, int noffset, ulong *entry);
  746. int fit_image_get_data(const void *fit, int noffset,
  747. const void **data, size_t *size);
  748. int fit_image_hash_get_algo(const void *fit, int noffset, char **algo);
  749. int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
  750. int *value_len);
  751. int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
  752. /**
  753. * fit_add_verification_data() - add verification data to FIT image nodes
  754. *
  755. * @keydir: Directory containing keys
  756. * @kwydest: FDT blob to write public key information to
  757. * @fit: Pointer to the FIT format image header
  758. * @comment: Comment to add to signature nodes
  759. * @require_keys: Mark all keys as 'required'
  760. *
  761. * Adds hash values for all component images in the FIT blob.
  762. * Hashes are calculated for all component images which have hash subnodes
  763. * with algorithm property set to one of the supported hash algorithms.
  764. *
  765. * Also add signatures if signature nodes are present.
  766. *
  767. * returns
  768. * 0, on success
  769. * libfdt error code, on failure
  770. */
  771. int fit_add_verification_data(const char *keydir, void *keydest, void *fit,
  772. const char *comment, int require_keys);
  773. int fit_image_verify(const void *fit, int noffset);
  774. int fit_config_verify(const void *fit, int conf_noffset);
  775. int fit_all_image_verify(const void *fit);
  776. int fit_image_check_os(const void *fit, int noffset, uint8_t os);
  777. int fit_image_check_arch(const void *fit, int noffset, uint8_t arch);
  778. int fit_image_check_type(const void *fit, int noffset, uint8_t type);
  779. int fit_image_check_comp(const void *fit, int noffset, uint8_t comp);
  780. int fit_check_format(const void *fit);
  781. int fit_conf_find_compat(const void *fit, const void *fdt);
  782. int fit_conf_get_node(const void *fit, const char *conf_uname);
  783. /**
  784. * fit_conf_get_prop_node() - Get node refered to by a configuration
  785. * @fit: FIT to check
  786. * @noffset: Offset of conf@xxx node to check
  787. * @prop_name: Property to read from the conf node
  788. *
  789. * The conf@ nodes contain references to other nodes, using properties
  790. * like 'kernel = "kernel@1"'. Given such a property name (e.g. "kernel"),
  791. * return the offset of the node referred to (e.g. offset of node
  792. * "/images/kernel@1".
  793. */
  794. int fit_conf_get_prop_node(const void *fit, int noffset,
  795. const char *prop_name);
  796. void fit_conf_print(const void *fit, int noffset, const char *p);
  797. int fit_check_ramdisk(const void *fit, int os_noffset,
  798. uint8_t arch, int verify);
  799. int calculate_hash(const void *data, int data_len, const char *algo,
  800. uint8_t *value, int *value_len);
  801. /*
  802. * At present we only support signing on the host, and verification on the
  803. * device
  804. */
  805. #if defined(CONFIG_FIT_SIGNATURE)
  806. # ifdef USE_HOSTCC
  807. # define IMAGE_ENABLE_SIGN 1
  808. # define IMAGE_ENABLE_VERIFY 1
  809. # include <openssl/evp.h>
  810. #else
  811. # define IMAGE_ENABLE_SIGN 0
  812. # define IMAGE_ENABLE_VERIFY 1
  813. # endif
  814. #else
  815. # define IMAGE_ENABLE_SIGN 0
  816. # define IMAGE_ENABLE_VERIFY 0
  817. #endif
  818. #ifdef USE_HOSTCC
  819. void *image_get_host_blob(void);
  820. void image_set_host_blob(void *host_blob);
  821. # define gd_fdt_blob() image_get_host_blob()
  822. #else
  823. # define gd_fdt_blob() (gd->fdt_blob)
  824. #endif
  825. #ifdef CONFIG_FIT_BEST_MATCH
  826. #define IMAGE_ENABLE_BEST_MATCH 1
  827. #else
  828. #define IMAGE_ENABLE_BEST_MATCH 0
  829. #endif
  830. /* Information passed to the signing routines */
  831. struct image_sign_info {
  832. const char *keydir; /* Directory conaining keys */
  833. const char *keyname; /* Name of key to use */
  834. void *fit; /* Pointer to FIT blob */
  835. int node_offset; /* Offset of signature node */
  836. struct image_sig_algo *algo; /* Algorithm information */
  837. const void *fdt_blob; /* FDT containing public keys */
  838. int required_keynode; /* Node offset of key to use: -1=any */
  839. const char *require_keys; /* Value for 'required' property */
  840. };
  841. /* A part of an image, used for hashing */
  842. struct image_region {
  843. const void *data;
  844. int size;
  845. };
  846. #if IMAGE_ENABLE_VERIFY
  847. # include <u-boot/rsa-checksum.h>
  848. #endif
  849. struct checksum_algo {
  850. const char *name;
  851. const int checksum_len;
  852. const int pad_len;
  853. #if IMAGE_ENABLE_SIGN
  854. const EVP_MD *(*calculate_sign)(void);
  855. #endif
  856. int (*calculate)(const char *name,
  857. const struct image_region region[],
  858. int region_count, uint8_t *checksum);
  859. const uint8_t *rsa_padding;
  860. };
  861. struct image_sig_algo {
  862. const char *name; /* Name of algorithm */
  863. /**
  864. * sign() - calculate and return signature for given input data
  865. *
  866. * @info: Specifies key and FIT information
  867. * @data: Pointer to the input data
  868. * @data_len: Data length
  869. * @sigp: Set to an allocated buffer holding the signature
  870. * @sig_len: Set to length of the calculated hash
  871. *
  872. * This computes input data signature according to selected algorithm.
  873. * Resulting signature value is placed in an allocated buffer, the
  874. * pointer is returned as *sigp. The length of the calculated
  875. * signature is returned via the sig_len pointer argument. The caller
  876. * should free *sigp.
  877. *
  878. * @return: 0, on success, -ve on error
  879. */
  880. int (*sign)(struct image_sign_info *info,
  881. const struct image_region region[],
  882. int region_count, uint8_t **sigp, uint *sig_len);
  883. /**
  884. * add_verify_data() - Add verification information to FDT
  885. *
  886. * Add public key information to the FDT node, suitable for
  887. * verification at run-time. The information added depends on the
  888. * algorithm being used.
  889. *
  890. * @info: Specifies key and FIT information
  891. * @keydest: Destination FDT blob for public key data
  892. * @return: 0, on success, -ve on error
  893. */
  894. int (*add_verify_data)(struct image_sign_info *info, void *keydest);
  895. /**
  896. * verify() - Verify a signature against some data
  897. *
  898. * @info: Specifies key and FIT information
  899. * @data: Pointer to the input data
  900. * @data_len: Data length
  901. * @sig: Signature
  902. * @sig_len: Number of bytes in signature
  903. * @return 0 if verified, -ve on error
  904. */
  905. int (*verify)(struct image_sign_info *info,
  906. const struct image_region region[], int region_count,
  907. uint8_t *sig, uint sig_len);
  908. /* pointer to checksum algorithm */
  909. struct checksum_algo *checksum;
  910. };
  911. /**
  912. * image_get_sig_algo() - Look up a signature algortihm
  913. *
  914. * @param name Name of algorithm
  915. * @return pointer to algorithm information, or NULL if not found
  916. */
  917. struct image_sig_algo *image_get_sig_algo(const char *name);
  918. /**
  919. * fit_image_verify_required_sigs() - Verify signatures marked as 'required'
  920. *
  921. * @fit: FIT to check
  922. * @image_noffset: Offset of image node to check
  923. * @data: Image data to check
  924. * @size: Size of image data
  925. * @sig_blob: FDT containing public keys
  926. * @no_sigsp: Returns 1 if no signatures were required, and
  927. * therefore nothing was checked. The caller may wish
  928. * to fall back to other mechanisms, or refuse to
  929. * boot.
  930. * @return 0 if all verified ok, <0 on error
  931. */
  932. int fit_image_verify_required_sigs(const void *fit, int image_noffset,
  933. const char *data, size_t size, const void *sig_blob,
  934. int *no_sigsp);
  935. /**
  936. * fit_image_check_sig() - Check a single image signature node
  937. *
  938. * @fit: FIT to check
  939. * @noffset: Offset of signature node to check
  940. * @data: Image data to check
  941. * @size: Size of image data
  942. * @required_keynode: Offset in the control FDT of the required key node,
  943. * if any. If this is given, then the image wil not
  944. * pass verification unless that key is used. If this is
  945. * -1 then any signature will do.
  946. * @err_msgp: In the event of an error, this will be pointed to a
  947. * help error string to display to the user.
  948. * @return 0 if all verified ok, <0 on error
  949. */
  950. int fit_image_check_sig(const void *fit, int noffset, const void *data,
  951. size_t size, int required_keynode, char **err_msgp);
  952. /**
  953. * fit_region_make_list() - Make a list of regions to hash
  954. *
  955. * Given a list of FIT regions (offset, size) provided by libfdt, create
  956. * a list of regions (void *, size) for use by the signature creationg
  957. * and verification code.
  958. *
  959. * @fit: FIT image to process
  960. * @fdt_regions: Regions as returned by libfdt
  961. * @count: Number of regions returned by libfdt
  962. * @region: Place to put list of regions (NULL to allocate it)
  963. * @return pointer to list of regions, or NULL if out of memory
  964. */
  965. struct image_region *fit_region_make_list(const void *fit,
  966. struct fdt_region *fdt_regions, int count,
  967. struct image_region *region);
  968. static inline int fit_image_check_target_arch(const void *fdt, int node)
  969. {
  970. #ifndef USE_HOSTCC
  971. return fit_image_check_arch(fdt, node, IH_ARCH_DEFAULT);
  972. #else
  973. return 0;
  974. #endif
  975. }
  976. #ifdef CONFIG_FIT_VERBOSE
  977. #define fit_unsupported(msg) printf("! %s:%d " \
  978. "FIT images not supported for '%s'\n", \
  979. __FILE__, __LINE__, (msg))
  980. #define fit_unsupported_reset(msg) printf("! %s:%d " \
  981. "FIT images not supported for '%s' " \
  982. "- must reset board to recover!\n", \
  983. __FILE__, __LINE__, (msg))
  984. #else
  985. #define fit_unsupported(msg)
  986. #define fit_unsupported_reset(msg)
  987. #endif /* CONFIG_FIT_VERBOSE */
  988. #endif /* CONFIG_FIT */
  989. #if defined(CONFIG_ANDROID_BOOT_IMAGE)
  990. struct andr_img_hdr;
  991. int android_image_check_header(const struct andr_img_hdr *hdr);
  992. int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
  993. ulong *os_data, ulong *os_len);
  994. int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
  995. ulong *rd_data, ulong *rd_len);
  996. ulong android_image_get_end(const struct andr_img_hdr *hdr);
  997. ulong android_image_get_kload(const struct andr_img_hdr *hdr);
  998. #endif /* CONFIG_ANDROID_BOOT_IMAGE */
  999. #endif /* __IMAGE_H__ */