[U-Boot] Size of FDT image

Dears,
I am calculating images check-sum in common/bootm.c (in function do_bootm_states https://git.denx.de/?p=u-boot.git;a=blob;f=common/bootm.c;h=9493a306cd038d86b08575dba7cf97a1238933f6;hb=c253573f3e269fd9a24ee6684d87dd91106018a5#l603) for security reasons. I am using contents of images structure to do so. Code is similar to this:
int os_cs = checksum(images.os.image_start, images.os.image_len); //Always
consistent int initrd_cs = checksum(images.initrd_start, images.initrd_end - images.initrd_start); //Always consistent int ft_cs = checksum(images.ft_addr, images.ft_len); //Changes after power reset
printf("Checksums: OS %d, initrd %d, FTD %d\n", os_cs, initrd_cs, ft_cs);
Both OS, and initrd images are working perfectly. FDT image checksum is the same through software reboots, but it changes after power reset (fully remove power, and connect power again); Which makes me suspect garbage data at end of images.ft_addr.
I tried to do partial checksum for FTD image (only 80% of its size)
int ft_cs = checksum(images.ft_addr, images.ft_len * 0.8); //Always
consistent
Then checksum worked perfectly through power resets. But it is not good idea to check-sum part of image only.
I think there is unused area at the end of image length that changes in power resets.
Is there a way to get actual FDT image length?
Using version v2017.11 https://git.denx.de/?p=u-boot.git;a=shortlog;h=refs/tags/v2017.11
participants (1)
-
Yousf Ateya