I am writing an update utility for an embedded Linux device for which I am responsible.I'm creating a basic side-by-side setup, where updates are applied to a staging partition and then the bootloader is switched to the staging partition, changing the primary partition into the new staging one.However, the embedded device uses a CF card, which are known for sometimes writing data out of order, etc. For this reason, if I mount a file system as read/write, there's a chance of corruption. Therefore, I cannot mount my bootloader partition RW in order to point to the new partition.Is there a location on disk to which I can safely write a single byte, where the byte represents a 0 for the first partition or a 1 for the second? Even a CF card can't screw up a single byte write, which should happen atomically.I'm using a plain-old DOS MBR format disk.
Location on disk to write a byte-flag?
partition;embedded;flash memory;mbr
Create a third, tiny, partition to hold your data. Any other location on your disk will sooner or later bring trouble if indeed you cannot rely on the filesytems.Sometimes the last few clusters of a disk cannot be addressed in the FAT entry, that may be an option but it heavily depends on exact size of the device.Does the embedded CPU / device have EEPROM? That would be an ideal place for a single byte.