]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - tools/rkspi.c
Rename aes.h to uboot_aes.h
[people/ms/u-boot.git] / tools / rkspi.c
index 800e235168ff5d041469c4c57bc0b5a7c44bc781..d2d3fdda424eadc545aac09253d65ae574268ec7 100644 (file)
@@ -17,8 +17,6 @@ enum {
        RKSPI_SECT_LEN          = RK_BLK_SIZE * 4,
 };
 
-static char dummy_hdr[RK_IMAGE_HEADER_LEN];
-
 static int rkspi_verify_header(unsigned char *buf, int size,
                               struct image_tool_params *params)
 {
@@ -45,16 +43,13 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd,
                       size);
        }
 
-       memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
-              RK_SPL_HDR_SIZE);
-
        /*
         * Spread the image out so we only use the first 2KB of each 4KB
         * region. This is a feature of the SPI format required by the Rockchip
         * boot ROM. Its rationale is unknown.
         */
        for (sector = size / RKSPI_SECT_LEN - 1; sector >= 0; sector--) {
-               printf("sector %u\n", sector);
+               debug("sector %u\n", sector);
                memmove(buf + sector * RKSPI_SECT_LEN * 2,
                        buf + sector * RKSPI_SECT_LEN,
                        RKSPI_SECT_LEN);
@@ -82,6 +77,8 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 {
        int pad_size;
 
+       rkcommon_vrec_header(params, tparams);
+
        pad_size = (rkcommon_get_spl_size(params) + 0x7ff) / 0x800 * 0x800;
        params->orig_file_size = pad_size;
 
@@ -90,7 +87,7 @@ static int rkspi_vrec_header(struct image_tool_params *params,
        pad_size += RK_SPL_HDR_START;
        debug("pad_size %x\n", pad_size);
 
-       return pad_size - params->file_size;
+       return pad_size - params->file_size - tparams->header_size;
 }
 
 /*
@@ -99,8 +96,8 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 U_BOOT_IMAGE_TYPE(
        rkspi,
        "Rockchip SPI Boot Image support",
-       RK_IMAGE_HEADER_LEN,
-       dummy_hdr,
+       0,
+       NULL,
        rkcommon_check_params,
        rkspi_verify_header,
        rkspi_print_header,