In some case, the rom image contains an invalid file state (I've seen 0x00 or 0xf0 while erase is 0xff) so doing extract then save will regenerate the rom with the only exception that the file state is changed to valid.
I've seen that in the context of nvram where the image contains 2 fv : one with a valid file containing the store and a second one with the file marked as invalid (containing an older version of the store presumably)
In some case, the rom image contains an invalid file state (I've seen 0x00 or 0xf0 while erase is 0xff) so doing
extract
thensave
will regenerate the rom with the only exception that the file state is changed to valid. I've seen that in the context of nvram where the image contains 2 fv : one with a valid file containing the store and a second one with the file marked as invalid (containing an older version of the store presumably)The file state is defined somewhere in UEFI spec but can be found there: https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Pi/PiFirmwareFile.h#L100
Currently the assemble visitor (used by save) always set it to valid: https://github.com/linuxboot/fiano/blob/master/pkg/visitors/assemble.go#L223
Also UTK does not store the current state https://github.com/linuxboot/fiano/blob/master/pkg/uefi/file.go#L156