]> git.sur5r.net Git - u-boot/commitdiff
rockchip: mkimage: force 2KB alignment for init_size
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tue, 30 May 2017 21:32:09 +0000 (23:32 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 7 Jun 2017 13:29:22 +0000 (07:29 -0600)
The Rockchip BootROM relies on init_size being aligned to 2KB
(see https://lists.denx.de/pipermail/u-boot/2017-May/293268.html).

This pads the image to 2KB both for SD card images and SPI images
and uses a common symbolic constant for the alignment.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/rkcommon.h
tools/rksd.c
tools/rkspi.c

index 75a4ed653f5a65b179c2719c28247c40a1605de6..8790f1ceab070b3a4bd9c1d2f4df069d7e80e54a 100644 (file)
@@ -10,6 +10,7 @@
 
 enum {
        RK_BLK_SIZE             = 512,
+       RK_INIT_SIZE_ALIGN      = 2048,
        RK_INIT_OFFSET          = 4,
        RK_MAX_BOOT_SIZE        = 512 << 10,
        RK_SPL_HDR_START        = RK_INIT_OFFSET * RK_BLK_SIZE,
index a880a26ccb79831fdbf366d5172f06bf43c3726c..c56153d2ca607dddbeb9a5a8b6593b70b6717068 100644 (file)
@@ -46,10 +46,10 @@ static int rksd_vrec_header(struct image_tool_params *params,
                            struct image_type_params *tparams)
 {
        /*
-        * Pad to the RK_BLK_SIZE (512 bytes) to be consistent with init_size
-        * being encoded in RK_BLK_SIZE units in header0 (see rkcommon.c).
+        * Pad to a 2KB alignment, as required for init_size by the ROM
+        * (see https://lists.denx.de/pipermail/u-boot/2017-May/293268.html)
         */
-       return rkcommon_vrec_header(params, tparams, RK_BLK_SIZE);
+       return rkcommon_vrec_header(params, tparams, RK_INIT_SIZE_ALIGN);
 }
 
 /*
index f8a565d31268d62c6dc8f8f702367b0f6c48ca88..4332ce17652172f7c43a6cb5eb3107791b3bee87 100644 (file)
@@ -63,7 +63,7 @@ static int rkspi_check_image_type(uint8_t type)
 static int rkspi_vrec_header(struct image_tool_params *params,
                             struct image_type_params *tparams)
 {
-       int padding = rkcommon_vrec_header(params, tparams, 2048);
+       int padding = rkcommon_vrec_header(params, tparams, RK_INIT_SIZE_ALIGN);
        /*
         * The file size has not been adjusted at this point (our caller will
         * eventually add the header/padding to the file_size), so we need to