[U-Boot] Query regarding Uboot Bootcount save in RAM
Manas Marwah
manas.marwah at gmail.com
Wed Nov 21 12:28:18 UTC 2018
Hi,
I am trying to understand the uboot support to store the bootcount in RAM
and working on aarch64 platform.
Relevant configuration:
1. CONFIG_BOOTCOUNT_LIMIT
2. CONFIG_BOOTCOUNT_RAM
3. BOOTCOUNT_ADDR <RAM address>
Relevant code:
drivers/bootcount/bootcount_ram.c
>From the code it is clear along with bootcount, uboot writes a MAGIC number
and a BIG pattern.
*Memory writing pattern in Uboot: *(In unsigned long: 8 bytes)
<Bootcount><MAGIC
Number><void><Pattern1><Pattern2><Pattern3><Pattern4><Pattern5>…… Pattern *
1000 times
So effectively to save a counter we would need: 8 (Bootcount) + 8 (MAGIC
Number) + 8 (void) + (8*1000) BIG PATTERN => 8024 bytes => ~8KB contiguous
reserved memory in RAM.
*Queries*:
1. If, I reduce the REPEAT times for pattern from 1000 to 100 the
only consequence I see is the reduction in possibility of detecting bit
errors.
a. Do you see any other consequence if I reduce REPEAT times for
pattern?
2. While reading the boot count Uboot always fail in pattern checking
and reverts the bootcount to 0.
a. It seems a *bug* to me in bootcount_ram.c line 59 where comparison
between tmp and pattern[1] (0xFFFFFFFF) always fails.
b. It works well with cast “if (tmp !=
*(int)* patterns[i % NBR_OF_PATTERNS])”
--
Thanks & Regards,
Manas Marwah
More information about the U-Boot
mailing list