So some background I was scripting building an SD Card Image for the Anbernic RG350M device.
This involves flashing a boot loader to the image. See below.
dd if="./select_kernel/squashfs-root/gcw0/ubiboot-rg350.bin" of="/dev/loop4" bs='512' seek='1' count='16' conv='notrunc';
The above command works without error, but the image produced isn't bootable.
If however I add sync
to the end of that command it is bootable. As follows.
dd if="./select_kernel/squashfs-root/gcw0/ubiboot-rg350.bin" of="/dev/loop4" bs='512' seek='1' count='16' conv='notrunc'; sync;
For the first command would this have worked if I had waited long enough? Like do the files get properly synced from the cached writes to the storage eventually?
Is it possible to not have the writes cached by default?
Is there a way to make the first command work without the use of sync
?
I'm also not sure I fully understand what sync does the man page states "Synchronize cached writes to persistent storage." which doesn't feel like a very in depth answer as to what is happening under the hood.