Giter VIP home page Giter VIP logo

Comments (1)

Ionic avatar Ionic commented on June 20, 2024 6

You probably don't care about this any longer, but for posterity...

Try ReFirmLabs/binwalk to get the actual starting location of the file system after using simg2img on it.

Example:

% binwalk system.raw.img                                                                                                                           
                                                                                                                                                                                                          
DECIMAL       HEXADECIMAL     DESCRIPTION                                                                                                                                                                 
--------------------------------------------------------------------------------                                                                                                                          
131072        0x20000         Linux EXT filesystem, blocks count: 604807, image size: 619322368, rev 2.0, ext4 filesystem data, UUID=da594c53-9beb-f85c-85c5-cedf76547654, volume name "system"
[...]
% mount -o loop,ro,offset=0x20000 system.raw.img mount
%

Also explained on Android SE.

There's nothing wrong with simg2img, it's just that Motorola likes to prepend some data that is not part of the actual file system.

[Imaginary quote]
Okay, but I tried to get the offset using grep, as suggested in the links I provided and this didn't give me the correct offset.

Yes, that's true. Let me give an example:

% LANG=C grep -aobP -m1 '\x53\xEF' ../system.raw.img | head -1 | gawk '{print $1 - 1080}'
228906959

Looks weird. The offset is huge, that can't be right.

The reason for this is... encodings! If your locale is UTF-8 based (which should typically be the case), then the input will be parsed as UTF-8. \x53\xEF isn't valid UTF-8, though (\xEF indicates a three-byte sequence, but no more bytes follow), so all bets are off.

Execute grep in byte mode and it'll work correctly:

% LANG=C LC_ALL=C grep -aobP -m1 '\x53\xEF' ../system.raw.img | head -1 | gawk '{print $1 - 1080}'
131072

This offset looks much better!

If this solves your issue, please remember to close this report.

from android-simg2img.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.