The TOC0 length includes its alignment padding, so the BootROM reads those pages through its NAND ECC and randomizer path even when their logical contents are all FF. Leaving them physically erased does not provide a valid boot-format representation.
Fill the trailing padding with zeros, matching the vendor TOC0 packers, so flash writers that skip all-FF pages still submit the padding for NAND encoding. Keep the existing alignment and item contents; the container checksum already covers the padding. Signed-off-by: James Hilliard <[email protected]> --- tools/sunxi_toc0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c index 76693647a09..6a099045f10 100644 --- a/tools/sunxi_toc0.c +++ b/tools/sunxi_toc0.c @@ -541,10 +541,10 @@ static int toc0_create(uint8_t *buf, uint32_t len, RSA *root_key, RSA *fw_key, item_info->load_addr = cpu_to_le32(fw_addr); memcpy(item_info->end, TOC0_ITEM_INFO_END, sizeof(item_info->end)); - /* Pad to the required block size with 0xff to be flash-friendly. */ + /* Zero-pad so flash writers do not skip the padding pages. */ item_offset = item_offset + item_length; item_length = ALIGN(item_offset, PAD_SIZE) - item_offset; - memset(buf + item_offset, 0xff, item_length); + memset(buf + item_offset, 0, item_length); /* Fill in the total padded file length. */ item_offset = item_offset + item_length; --- base-commit: ece349ade2973e220f524ce59e59711cc919263f change-id: 20261106-submit-sunxi-toc0-padding-v1-c0d84c717dad Best regards, -- James Hilliard <[email protected]>
