Commit a1c29d4b43dc1bdc57878204bf3e4316fdb1b8b0

Authored by Philipp Tomsich
Committed by Simon Glass
1 parent ad972ac3d9

rockchip: mkimage: set init_boot_size to avoid confusing the boot ROM

This change restores the earlier setting of init_boot_size to include
the maximum area covered by the the boot ROM of each chip for resolve
issues with back-to-bootrom functionality reported by Kever and Heiko.

To ensure that we don't run into the same issue again in the future,
I have updated the comments accordingly and added a reference to the
mailing list archive (there's some very helpful info from Andy Yan
that provides background on the BootROM requirements regarding these
fields).

See https://lists.denx.de/pipermail/u-boot/2017-May/293267.html for
some background (by Andy Yan) of how the BootROM processes this field.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 7 additions and 4 deletions Side-by-side Diff

... ... @@ -184,11 +184,14 @@
184 184 */
185 185 hdr->init_size = ROUND(hdr->init_size, 4);
186 186 /*
187   - * The images we create do not contain the stage following the SPL as
188   - * part of the SPL image, so the init_boot_size (which might have been
189   - * read by Rockchip's miniloder) should be the same as the init_size.
  187 + * init_boot_size needs to be set, as it is read by the BootROM
  188 + * to determine the size of the next-stage bootloader (e.g. U-Boot
  189 + * proper), when used with the back-to-bootrom functionality.
  190 + *
  191 + * see https://lists.denx.de/pipermail/u-boot/2017-May/293267.html
  192 + * for a more detailed explanation by Andy Yan
190 193 */
191   - hdr->init_boot_size = hdr->init_size;
  194 + hdr->init_boot_size = hdr->init_size + RK_MAX_BOOT_SIZE / RK_BLK_SIZE;
192 195  
193 196 rc4_encode(buf, RK_BLK_SIZE, rc4_key);
194 197 }