Manipulation of mdt firmware images
#unsplit.py:
from pymdt import *
# unsplit the dump into an elf
ELFFile.from_mdt('dump/modem','build/modem.elf')
$ ls dump/
modem.mdt modem.b01 modem.b02 [etc...]
$ mkdir build
$ ./unsplit.py
$ ls build
modem.elf
#patch.py
from pymdt import *
# load an elf
elf = ModemFirmware('build/modem.elf')
# Patch something
elf.put_data(0x89000000, "BREAKTHEBOOT")
# Fix the hash segment
elf.regen()
# Save the patched elf
elf.write("build/modem_patched.elf")
# Save the splitted image
elf.write_mdt("build/modem")
$ ls build/
modem.elf
$ ./patch.py
$ ls build/
modem.elf modem_patched.elf modem.mdt modem.b01 modem.b02 [etc...]