[PATCH v2 0/6] rockchip: Align FIT images to SD/MMC block length
Jonas Karlman
jonas at kwiboo.se
Fri Jan 20 09:26:16 CET 2023
When I was trying to run mainline U-Boot on my new Rockchip RK3568 board
I discovered that one segment of vendor TF-A could not successfully be
loaded into SRAM, validation of the image sha256 hash failed.
The issue with loading the data turned out to be because of how SPL load
FIT images. It reads data aligned to block length. Aligned image data is
read directly to the load address. Unaligned image data is written to an
offset of the load address and then memcpy to the load address.
The segment of the TF-A that failed to load is a 8KiB segment that
should be loaded into the 8KiB PMU SRAM. Because this segment was
unaligned to the SD/MMC block length the segment was written to and
memcpy from beyond the SRAM boundary, in the end this results in invalid
data in SRAM.
Vendor u-boot has worked around this issue by using a bounce buffer for
any load address that is not in the gd->ram_base - gd->ram_top range.
However, by passing -B 200 to mkimage we can work around this issue
because the FIT and its external data ends up being aligned to SD/MMC
block length.
This series adds support for a fit,align property in binman and makes
use of this new property in rockchip-u-boot.dtsi.
It also adds image hash to the FIT images when configured with
CONFIG_SPL_FIT_SIGNATURE=y.
Changes in v2:
- Added tests
- Updated entries.rst
- Collect r-b tags
- Rebased on top of dm-pull-18jan23
- New patch to fix initializing of TF-A
Jonas Karlman (6):
binman: Add support for align argument to mkimage tool
rockchip: Align FIT image data to SD/MMC block length
binman: Add special subnodes to the nodes generated by split-elf
rockchip: Add sha256 hash to FIT images
binman: Add support for prepend loadables with split-elf
rockchip: Use atf as firmware and move u-boot to loadables in FIT
arch/arm/dts/rockchip-u-boot.dtsi | 25 ++++++-
tools/binman/btool/mkimage.py | 5 +-
tools/binman/entries.rst | 24 ++++++-
tools/binman/etype/fit.py | 44 +++++++++++--
tools/binman/ftest.py | 65 ++++++++++++++++++
tools/binman/test/226_fit_split_elf.dts | 6 ++
tools/binman/test/275_fit_align.dts | 59 +++++++++++++++++
tools/binman/test/276_fit_loadables.dts | 87 +++++++++++++++++++++++++
8 files changed, 305 insertions(+), 10 deletions(-)
create mode 100644 tools/binman/test/275_fit_align.dts
create mode 100644 tools/binman/test/276_fit_loadables.dts
--
2.39.1
More information about the U-Boot
mailing list