Flush mtdblock buffer after writes to hnvram
The mtdblock driver in Linux caches erase blocks indefinitely until the
last file descriptor to /dev/mtdblockX has been closed. This is not
acceptable because we assume that data has been flushed to flash storage
when the hnvram tool returns.
Steps to reproduce:
Open a fd to /dev/mtdblockX and leave it open:
cat > /dev/mtd/hnvram
On a different tty, run
hnvram -w ACTIVATED_KERNEL_NAME=kernel7 ; reboot
On the next boot, the main parition of HNVRAM will contain
ACTIVATED_KERNEL_NAME=kernel7, but the backup partition still has the
old value. Hence, the main and backup HNVRAM partition are inconsistent.
Hint: The hnvram tool internally subdivides the HNVRAM partition in the
NOR into a main and backup partition. (Look for NVRAM_RW_OFFSET and
NVRAM_RWB_OFFSET in hmx_upgrade_nvram.c)
Change-Id: Ifd3c095a5bfe966b3e512ded81164b710f506fd2
1 file changed