Or Continue to Thread: Garmin-Asus M10 dual booting w…
Find Your Device:
28th December 2010, 02:30 PM   |  #24  
Junior Member
Thanks Meter: 0
 
5 posts
Join Date:Joined: Dec 2010
Image extraction tool
Hello,

Here is a small Python script that extracts the files from a raw image:


#!/usr/bin/env python

from struct import *
import re
import sys

if __name__=="__main__":
try:
imageFile = open(sys.argv[1], "r")
except IndexError:
print "Usage:"
print sys.argv[0], "<file>"
print
print "Example:"
print sys.argv[0], "A50_SR2_2_PACKAGE.raw"
sys.exit(1)

OFFSET= 0x1f0
buffer = imageFile.read()
while True:
entry= unpack_from('<24sLL', buffer, OFFSET)
try:
name =re.search(r"(\w+\.\w+)", repr(entry[0])).group(1).strip()
offset= entry[1]
size=entry[2]
print "name=%24s offset=%08d size=%012d" % (name, offset, size)
except AttributeError:
print "Ready!"
break
temp = open(name, "w")
temp.write(buffer[offsetffset+size])
temp.close()
OFFSET=OFFSET + 0x20


Using it I was able toget access to the content of the ext3 image.

My final goal is however not to portAndroid on a WinMo device but rather to install Garmin navigation app on another device. Any hints?

GrumpyHare
Attached Files
File Type: 7z unpackGarminImage.7z - [Click for QR Code] (628 Bytes, 445 views)
Last edited by grumpyhare; 28th December 2010 at 02:52 PM. Reason: Clarify Python syntax