Bin file format: find custom header sources

Hello. How do i understand to which custom firmware header belongs to?
As i understand there is no common trx header described here but rather custom header for bin
from here with sources somewhere here. How do i locate appropriate lines in source of build system?

My problem is that i want extract 'real' mtd mirror from file before flashing it. In particular i want to know how much space will never used because of erase blocks padding. I already know it at runtime but want to know at build time as well