Hi,
I have two mtdblocks in my flash for two file systems, FS1(current root) and FS2(for backup). If the current root fs is FS1(mtdblock2), and I want to write a new filesystem image (download from network) to FS2(mtdblock3) for next boot up, which means the FS2 would become root fs after reboot. How can I erase the mtdblock3(FS2) before writing to it in a C program?
Currently I use write() to directly write to FS2. But my question is, If the filesystem image is smaller than the target mtdblock size, what should I do for the rest unused space? For example, FS2 has
4MB, and I write only 2MB filesystem image to FS2, what should I do for the rest of the 4-2=2MB? I think I should erase them, but how ? Or can I write() the rest bytes to all a specific byte(0xff, for example)? Or should I erase FS2 before do write(), but How to erase??Could someone give advice? Thanks. Sarick