cros_write_firmware: support 32K SPL blobs properly

When calculating BL1 + SPL padding size to the nearest 8K boundary,
the code assumed SPL to be of 14K in size. In fact it could be either
14K (potentially coming in a 16K envelope) or 30K (potentially coming
in a 32K).


   . after this fix it is possible to create a flasher for snow (32K
     SPL platform). Both of the below commands produce working
     flashers and the DUTs boot from SPI after flashing.

   $  emerge-daisy chromeos-u-boot chromeos-bootimage  exynos-pre-boot && \
      cros_write_firmware -b daisy -w sd:. -D -M exynos \
      -i /build/daisy/firmware/nv_image-snow.bin \
      --dt /build/daisy/firmware/dtb/exynos5250-snow.dtb \
      -F spi -U /build/daisy/firmware/u-boot.bin

  $  emerge-peach_pit chromeos-u-boot chromeos-bootimage exynos-pre-boot &&\
     sudo cros_write_firmware -b peach -w sd:. -M exynos \
     -i /build/peach_pit/firmware/image-peach_pit.bin \
     --dt /build/peach_pit/firmware/dtb/exynos5420-peach_pit.dtb \
     -F spi -U /build/peach_pit/firmware/u-boot.bin

Change-Id: I5544ce0fb57bd114d096b3007ddf59f0daff42ae
Signed-off-by: Vadim Bendebury <>
Reviewed-by: Simon Glass <>
Commit-Queue: Doug Anderson <>
2 files changed