dfu, nand: add medium specific polltimeout function
[oweals/u-boot.git] / include / image.h
index 540afaaec5c432ab5b4268086d39213180e6b779..e1f92979a460642a1e4c503bd202e8704d9d5eb2 100644 (file)
@@ -412,6 +412,7 @@ enum fit_load_op {
 #define IMAGE_FORMAT_INVALID   0x00
 #define IMAGE_FORMAT_LEGACY    0x01    /* legacy image_header based format */
 #define IMAGE_FORMAT_FIT       0x02    /* new, libfdt based format */
+#define IMAGE_FORMAT_ANDROID   0x03    /* Android boot image */
 
 int genimg_get_format(const void *img_addr);
 int genimg_has_config(bootm_headers_t *images);
@@ -832,7 +833,7 @@ int calculate_hash(const void *data, int data_len, const char *algo,
 #if defined(CONFIG_FIT_SIGNATURE)
 # ifdef USE_HOSTCC
 #  define IMAGE_ENABLE_SIGN    1
-#  define IMAGE_ENABLE_VERIFY  0
+#  define IMAGE_ENABLE_VERIFY  1
 # include  <openssl/evp.h>
 #else
 #  define IMAGE_ENABLE_SIGN    0
@@ -844,7 +845,9 @@ int calculate_hash(const void *data, int data_len, const char *algo,
 #endif
 
 #ifdef USE_HOSTCC
-# define gd_fdt_blob()         NULL
+void *image_get_host_blob(void);
+void image_set_host_blob(void *host_blob);
+# define gd_fdt_blob()         image_get_host_blob()
 #else
 # define gd_fdt_blob()         (gd->fdt_blob)
 #endif
@@ -881,14 +884,11 @@ struct checksum_algo {
        const int checksum_len;
        const int pad_len;
 #if IMAGE_ENABLE_SIGN
-       const EVP_MD *(*calculate)(void);
-#else
-#if IMAGE_ENABLE_VERIFY
+       const EVP_MD *(*calculate_sign)(void);
+#endif
        void (*calculate)(const struct image_region region[],
                          int region_count, uint8_t *checksum);
        const uint8_t *rsa_padding;
-#endif
-#endif
 };
 
 struct image_sig_algo {
@@ -1009,7 +1009,11 @@ struct image_region *fit_region_make_list(const void *fit,
 
 static inline int fit_image_check_target_arch(const void *fdt, int node)
 {
+#ifndef USE_HOSTCC
        return fit_image_check_arch(fdt, node, IH_ARCH_DEFAULT);
+#else
+       return 0;
+#endif
 }
 
 #ifdef CONFIG_FIT_VERBOSE
@@ -1027,4 +1031,16 @@ static inline int fit_image_check_target_arch(const void *fdt, int node)
 #endif /* CONFIG_FIT_VERBOSE */
 #endif /* CONFIG_FIT */
 
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+struct andr_img_hdr;
+int android_image_check_header(const struct andr_img_hdr *hdr);
+int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
+                            ulong *os_data, ulong *os_len);
+int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
+                             ulong *rd_data, ulong *rd_len);
+ulong android_image_get_end(const struct andr_img_hdr *hdr);
+ulong android_image_get_kload(const struct andr_img_hdr *hdr);
+
+#endif /* CONFIG_ANDROID_BOOT_IMAGE */
+
 #endif /* __IMAGE_H__ */