Fix hi3516av200 malloc size for cold NAND boot + UBI write - #8
Merged
Conversation
The previous fix used CONFIG_ENV_SIZE in the malloc definition, but hi-common.h redefines CONFIG_ENV_SIZE from 0x40000 to 0x10000 after hi3516av200.h, silently shrinking the heap from 768KB to 576KB. Use a literal 0x40000 + 768KB = 1MB total heap. This value: - Fits UBI's 124KB vmalloc after TFTP (issue #5) - Stays within SPL MMU page table limits for cold NAND boot (issue #7) Tested on hardware: cold NAND boot OK, full 7-partition UBI restore OK. Closes #7 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
widgetii
force-pushed
the
fix/ubi-write-after-tftp
branch
from
April 22, 2026 14:48
d964e29 to
c547251
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hi-common.halso silently overridesCONFIG_ENV_SIZEfrom 0x40000 to 0x10000, shrinking the effective heap from the intended 768KB to 576KB — not enough for UBI's 124KB vmalloc0x40000 + 768*1024(1MB total) that avoids both theCONFIG_ENV_SIZEoverride and the MMU conflictRoot cause
hi3516av200.hdefinesCONFIG_SYS_MALLOC_LEN = CONFIG_ENV_SIZE + N, then#includeshi-common.hwhich redefinesCONFIG_ENV_SIZEfrom0x40000to0x10000. Since C macros are expanded at point of use (not definition), the effective heap was always smaller than intended.Test plan
System startup → Uncompress...Ok → U-Boot 2010.06in 2.5sdefib restorewith all 7 MTD partitions — all UBI writes succeed after TFTP, zero errorsCloses #7
🤖 Generated with Claude Code