Header inside firmware partition


I am working on adding a new IPQ40xx device based on qcom_ap-dk01.1-c1 and have run into some issues with this particular device's partitioning scheme. The bootloader expects a 160 byte header before the FIT image in the firmware partition. If I build an OpenWrt image with this header, the kernel starts just fine, but it cannot find the kernel and rootfs (sub-)partitions inside of the firmware partition. The problem is in mtdsplit_fit_parse(), when searching for the FIT image only erase block boundaries are checked, but in my case FIT image is offset due to the 160 byte header.

What is the best way to handle this offset, do you know of examples already doing this?

My current fix is to add a fallback in mtdsplit_fit_parse() and search the whole first erase block if the FIT is not found on any erase block boundary. This solves my problem, and only adds run time in an already failing case.

Comments or better ideas?

Random guess... hdr.magic seems like the hook...

fgrep -r hdr.magic target
fgrep -r 'wrgg' target
1 Like

wrgg seems to be the way to do it, the headers in the file match what i have. Now I just have to make it work on the ipq40xx target as well..

Thanks for the help.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.