#!/usr/bin/env python3 import sys if len(sys.argv) < 4: print("USAGE: mkfirm.py ") print("WARNING: Currently you cannot install this FIRM, because YOU'LL BRICK YOUR 3DS!") sighax_sig = b'\x00'*256 #TODO insert sighax signature here. import struct import hashlib def get_elf_seg(f): #Return entry,section_beg,section_size,section f.seek(0) if f.read(4) != b"\x7FELF": raise Exception("Not an ELF file!") if f.read(1) != b"\x01": raise Exception("ELF64s are not supported!") if f.read(1) != b"\x01": raise Exception("Little Endian ELF required!") if f.read(1) != b"\x01": raise Exception("Unknown ELF version!") f.read(9) if struct.unpack("