cboot ver32.2 failed to fit for jetpack4.3

Followed https://devtalk.nvidia.com/default/topic/1068852/jetson-agx-xavier/latest-cboot-source-code/post/5414317/#5414317

Legacy jetpack4.3 bootup ok, while using cboot src code ver32.2, bootup failed!

Traced it, I found at loading kernel, the tail of heap free block list might be modified by fault.

========log begin==========
[0015.090] I> Loading kernel from partition …
[0015.090] W> No valid slot number is found in scratch register
[0015.091] W> Return default slot: _a
[0015.091] I> A/B: bin_type (37) slot 0

[0015.147] I> temp=0xa068f6d0, temp->size=3728
[0015.151] I> temp=0xa0692078, temp->size=32
[0015.155] I> temp=0xa0692ed8, temp->size=1600
[0015.160] I> temp=0xa0693558, temp->size=2704
[0015.164] I> temp=0xa0696008, temp->size=504
[0015.168] I> temp=0xa0e99378, temp->size=3184
[0015.172] I> temp=0xa0e9c818, temp->size=71016
[0015.176] I> temp=0xa4aadd98, temp->size=80
[0015.180] I> temp=0xa8ad0000, temp->size=38993920
[0015.185] I> temp=0xa068f6d0, temp->magic=3740253934, temp->size=3728
[0015.191] I> temp=0xa0692078, temp->magic=3740253934, temp->size=32
[0015.197] I> temp=0xa0692ed8, temp->magic=3740253934, temp->size=1600
[0015.204] I> temp=0xa0693558, temp->magic=3740253934, temp->size=2704
[0015.210] I> temp=0xa0696008, temp->magic=3740253934, temp->size=504
[0015.216] I> temp=0xa0e99378, temp->magic=3740253934, temp->size=3184
[0015.222] I> temp=0xa0e9c818, temp->magic=3740253934, temp->size=71016
[0015.229] I> temp=0xa4aadd98, temp->magic=3740253934, temp->size=80
[0015.235] I> temp=0xa4acce00, temp->magic=3740253934, temp->size=12776
[0015.241] I> temp=0xa8ad0000, temp->magic=3740253934, temp->size=38993920

[0015.248] I> Loading partition kernel at 0xa4ad0000 from device(0x1)
[0015.723] I> T19x: Authenticate kernel (bin_type: 37), max size 0x4000000
[0015.724] I> heap_type=1, size=32
[0015.724] I> size=32, max_heap_size[TEGRABL_HEAP_DEFAULT]=177675152
[0015.724] I> alloc_size=56
[0015.724] I> free_block=0xa068f6d0, magic=3740253934, free_block->size=3728
[0015.725] I> free_block=0xa0692078, magic=3740253934, free_block->size=32
[0015.730] I> free_block=0xa0692ed8, magic=3740253934, free_block->size=1600
[0015.737] I> free_block=0xa0693558, magic=3740253934, free_block->size=2704
[0015.744] I> free_block=0xa0696008, magic=3740253934, free_block->size=504
[0015.750] I> free_block=0xa0e99378, magic=3740253934, free_block->size=3184
[0015.757] I> free_block=0xa0e9c818, magic=3740253934, free_block->size=71016
[0015.764] I> free_block=0xa4aadd98, magic=3740253934, free_block->size=80
[0015.771] I> free_block=0xa4acce00, magic=3740253934, free_block->size=12776
[0015.778] I> free_block=0xa8ad0000, magic=0, free_block->size=0
========log end==========

As shown above, 0xa8ad0000 block should be a free block, but seemed to be overwritten???

later, the bootup HALT due to lack of memory.
Please help to check it and reply to me.

If there’s new cboot source code, when would it be available?

By the way, I found a small bug,
in tegrabl_malloc.c, the FREE_MAGIC and MALLOC_MAGIC are both defined as UL, while in the structures, uint32_t is used!
However, it never shows up for the sake of 8bytes-alignment


Some changes are merged into rel-32.3 cboot so maybe it is not compatible. I will check when new cboot src will be released.

Hi Wayne,
Thanks a lot for your reply.
For this problem, I’m puzzled and also curious.
To load the kernel image, the max size is limited to be 0x4000000. The memory size allocated is right. and the memcpy byte count is also set to not exceed the max size.
I also checked the kernel image size is absolutely smaller than 0x4000000.
So why the next free block node is modified?
“free_block=0xa8ad0000, magic=0, free_block->size=0”

It’s really strange.
I’ll appreciate if you would have some idea and explain it.

If new cboot src is to be released, please help to notify me the time.