]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/kwbimage.c
tpm: Move the I2C TPM code into one file
[karo-tx-uboot.git] / tools / kwbimage.c
index 807d46668be78ee90b1103b2e5b56460dbc6afe0..3fa90d3a758ab407206773fa3fd932d696794a8d 100644 (file)
@@ -115,6 +115,7 @@ struct boot_mode boot_modes[] = {
        { 0x78, "sata" },
        { 0x9C, "pex"  },
        { 0x69, "uart" },
+       { 0xAE, "sdio" },
        {},
 };
 
@@ -420,6 +421,18 @@ static size_t image_headersz_v1(struct image_tool_params *params,
                        *hasext = 1;
        }
 
+#if defined(CONFIG_SYS_U_BOOT_OFFS)
+       if (headersz > CONFIG_SYS_U_BOOT_OFFS) {
+               fprintf(stderr, "Error: Image header (incl. SPL image) too big!\n");
+               fprintf(stderr, "header=0x%x CONFIG_SYS_U_BOOT_OFFS=0x%x!\n",
+                       (int)headersz, CONFIG_SYS_U_BOOT_OFFS);
+               fprintf(stderr, "Increase CONFIG_SYS_U_BOOT_OFFS!\n");
+               return 0;
+       } else {
+               headersz = CONFIG_SYS_U_BOOT_OFFS;
+       }
+#endif
+
        /*
         * The payload should be aligned on some reasonable
         * boundary
@@ -498,6 +511,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
                binhdrsz = sizeof(struct opt_hdr_v1) +
                        (binarye->binary.nargs + 1) * sizeof(unsigned int) +
                        s.st_size;
+               binhdrsz = ALIGN_SUP(binhdrsz, 32);
                hdr->headersz_lsb = binhdrsz & 0xFFFF;
                hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
 
@@ -905,19 +919,17 @@ static int kwbimage_check_params(struct image_tool_params *params)
 /*
  * kwbimage type parameters definition
  */
-static struct image_type_params kwbimage_params = {
-       .name           = "Marvell MVEBU Boot Image support",
-       .header_size    = 0,            /* no fixed header size */
-       .hdr            = NULL,
-       .vrec_header    = kwbimage_generate,
-       .check_image_type = kwbimage_check_image_types,
-       .verify_header  = kwbimage_verify_header,
-       .print_header   = kwbimage_print_header,
-       .set_header     = kwbimage_set_header,
-       .check_params   = kwbimage_check_params,
-};
-
-void init_kwb_image_type (void)
-{
-       register_image_type(&kwbimage_params);
-}
+U_BOOT_IMAGE_TYPE(
+       kwbimage,
+       "Marvell MVEBU Boot Image support",
+       0,
+       NULL,
+       kwbimage_check_params,
+       kwbimage_verify_header,
+       kwbimage_print_header,
+       kwbimage_set_header,
+       NULL,
+       kwbimage_check_image_types,
+       NULL,
+       kwbimage_generate
+);