Firmware of Silead Touchscreen Controller for Jumper EZpad 6 Pro.
Rev. | e37af9626c6a634ca568bb08c4290f72a76c9da6 |
---|---|
大小 | 899 字节 |
时间 | 2021-01-14 19:51:56 |
作者 | Fuhito Suguri |
Log Message | update mssl1680-firmware-jumper-ezpad6pro.spec
|
#! /usr/bin/python
from subprocess import *
import sys
import os
if len(sys.argv) != 2:
print "Firware extractor.\n"
print "Requires elf file (driver) argument"
sys.exit(1)
filename = sys.argv[1]
p = Popen(['/bin/sh', '-c', 'readelf -S '+ filename + ' | grep \ \.rodata\ | sed \'s/\\[ *//g\''], stdout=PIPE)
args = p.stdout.readlines()
if len(args) != 1:
print "No simple .rodata section found"
sys.exit(1)
rodata = args[0]
args = rodata.split(']')
args = args[1].split()
offset = int(args[3], 16)
print ".rodata offset is ", offset, "\n"
p = Popen(['/bin/sh', '-c', 'readelf -s '+ filename +' | grep -i fw'], stdout=PIPE)
for line in p.stdout:
args = line.split()
print "Found", args[7], "offset", offset + int(args[1],16), "count", args[2]
call(['dd','if='+filename,'bs=1','count='+args[2], 'skip='+str(offset + int(args[1],16)),'of='+args[7] + ".fw"])