Skip to content

Instantly share code, notes, and snippets.

@N1kroks
Created January 6, 2026 13:41
Show Gist options
  • Select an option

  • Save N1kroks/83c869199c07dd3a202b3702486da208 to your computer and use it in GitHub Desktop.

Select an option

Save N1kroks/83c869199c07dd3a202b3702486da208 to your computer and use it in GitHub Desktop.
from argparse import ArgumentParser
import struct
if __name__ == "__main__":
arg_parse = ArgumentParser()
arg_parse.add_argument("input")
arg_parse.add_argument("-o", "--output")
args = arg_parse.parse_args()
with open(args.input, "rb") as f:
data = bytearray(f.read())
name_offset = data.find(b"\\_SB_.UFS0")
if name_offset <= 0:
raise Exception("Failed to find \\\\_SB_.UFS0")
cache_coherency_offset = name_offset - 9
struct.pack_into("<I", data, cache_coherency_offset, 1)
with open(args.output, "wb") as f:
f.write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment