
21 May
2013
21 May
'13
7:34 p.m.
Hi Wolfgang Denx,
Closing a file descriptor does not guarantee that the data has been successfully saved to disk, as the kernel might defer the write.
What is the exact problem you are trying to fix?
I mean, when exactly does adding the sync play a role?
I'm using fw_setenv during system update process. The sequence of such a shell script is something like (much simplified):
... fw_setenv state=2 dd if=... of=/dev/mmcblk0... fw_setenv state=1 ... reboot
The (redundant) environment is stored in a eMMC flash. The env var 'state' gives a hint to U-Boot whether/where the process was interrupted.
So my intension is to be absolutely sure, that when fw_setenv returns, the environment is written out to disk.
Best regards, Michael