Can you help me test the flashrom v1.7 binary build?
It’s enough if you just confirm whether you can read and write the SPI flash chips you have on hand. If there’s any problem, let me know and I’ll check whether there’s an issue in the BP-firmware or whatever. Thank you very much.
#!/usr/bin/env python3
"""Overwrite every byte of a .bin file with random data. File size never changes."""
import argparse, os, sys
def randomize(path):
with open(path, "r+b") as f:
data = f.read()
unique = set(data)
state = "all 0xFF" if unique == {0xFF} else "all 0x00" if unique == {0x00} else "mixed"
print(f"Original content: {state}.")
f.seek(0)
f.write(os.urandom(len(data)))
print(f"Done: '{path}' randomized ({len(data)} bytes, size unchanged).")
if __name__ == "__main__":
p = argparse.ArgumentParser(description="Overwrite every byte of a .bin file with random data, keeping its size.")
p.add_argument("file", help="Path to the .bin file to randomize")
args = p.parse_args()
if not os.path.isfile(args.file):
sys.exit(f"Error: '{args.file}' does not exist or is not a file.")
randomize(args.file)