okenido wrote: ↑
Fri Jun 05, 2020 4:48 pm
I'm only changing one byte from the file, leaving its size untouched so it should be fine to prevent corruptions (eg. kernel8.img => kernel9.img)
That isn't how it works, I'm afraid. Your uSD card has a small CPU on it -- probably an ARM -- to do wear-levelling, so it can remap 'hot' blocks to ones which haven't been touched in some time, to make the whole device statistically more reliable over time.
Copy it to a different file, call 'sync' to ensure it's on the card, then move it over the top of the old one. mv is atomic -- as much as anything can be on an SD card -- so that should be about as safe as you can get.