Giter VIP home page Giter VIP logo

eimgfs's Introduction

eimgfs

eimgfs is a tool for creating, decoding, viewing and modifying Windows CE firmware images.

I am re-releasing it here on github. Originally this was posted as part of the itsutils package on xda-developers.

These formats are supported:

  • motorola flash.bin
  • htc (signed) .nbh
  • partitiontable with xips+imgfs
  • plain xip
  • compressed xip
  • plain imgfs

To be able to compress/decompress files it must either run on windows, or as a 32bit binary on osx.

This used to be part of the itsutils distribution.

History

I started developing this tool as dumprom in 2003 for xda-developers. Later converted to perl. And Later again, when WindowsCE started using the imgfs filesystem, converted to c++, now named eimgfs. Which stads for 'Edit imgfs'.

Several older tools with similar functionality: dumpxip.pl, makexip.pl, editimgfs.pl.

Usage

Usage: editimgfs imgfile [operations]

You can specify as many operations as needed.

main options:

option arguments description
-v verbose
-r readonly
-d path where to save extrated files to
-s SIZE specify totalsize ( for motorola FLASH )
-extractall extract all to '-d' path
-list list all files
-info list available readers/filesystems
-filter <EXE SIGNED>
-resign update nbh sigs after modifications
-keyfile KeyFile nbh key file
-extractnbh extract SPL/IPL/OS images from nbh

READER operations:

option arguments description
-rd RdName specify reader to operate upon
-saveas Outfile save entire rd section
-getbytes offset size Outfile
-putbytes offset size Infile
-hexdump offset size
-chexdump {XPR XPH
-hexedit offset bytes...

FILESYSTEM operations:

option arguments description
-fs FsName specify fs to operate upon
-add RomName[=srcfile] ... adds a list of files
you can also add all files from a directory
-del RomName
-ren RomName=NEWNAME
-extract RomName=dstfile
-fileinfo RomName print detailed info about file
-dirhexdump for debugging

Example

An example, how i have used this tool:

eimgfs -s 0x10000000  therom.nb \
       -fs imgfs -del delfiles -add files \
       -fs xip23 -del delfiles-xip23 -add files-xip23 \
       -fs xip20 -del delfiles-xip20 -add files-xip20

This will alter therom.nb, increasing its maximum size to 256Mbyte, deleting files from the imgfs, xip20, xip23 partition for the names found in the respective delfiles-... directories, and adding files from the files-... directories.

Building

There are makefiles for OSX and Windows. Both depend on the presence of 32 bit libraries for boost and openssl.

Make sure the dlls from the dlls directory are somewhere in the search path. They are needed for decompression.

You can build eimgfs with OSX SDK up to version 10.13, version 10.14 no longer includes the 32 bit libraries needed.

Docker is supported. Multistage building is used. Stage run should be used for actual executing the application. Entrypoint is configured as well.

docker build --target run .
docker run -v /home/user/images:/app/data --rm -ti ef7b7abd7b4d -fs xip -fileinfo /app/data/FILENAME

On linux, you may need to install g++-multilib and 32bit binaries for openssl.

author

(C) 2003-2013 Willem Hengeveld [email protected]

eimgfs's People

Contributors

nlitsme avatar scif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eimgfs's Issues

PE section truncated if data compressed

If section is compressed only psize bytes written to PE section.

XipFile::tostream() compsize 44581, fullsize 146597
XipFile::tostream(() decompress 146597 23CA5, fullsize 146597
o32exe::o32exe() o32exe psize 44581, rom->psize 44581

EXCEPTION: b000ff before start of map

I have a WinCE bin file that's reporting the "EXCEPTION: b000ff before start of map" error.

map=88, off=00000800
EXCEPTION: b000ff before start of map

Where would I start on fixing this? I can provide the bin file.

Seg fault on GPS firmware

Hi !
Thanks a lot for this tool.
I have a 1GB firmware image of a GPS that contains WinCE files and programs.
The firmware extracted may be partially corrupted (less than 20 bits over 1GB may be flipped).
My goal is to extract all files from the firmware image.
eimgfs is detecting an xip filesystem and then crashing on a seg fault (on Linux and on Windows as well).

$ eimgfs img.bin -r -v -o 0x200000
ERROR: not found
0000007e: failed to load dll4
ERROR: not found
0000007e: failed to load dll3
no fffb: blk:  ea0003fe 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ee110f10 e0000001
          mg:  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 e59f114c e59f1148
found xip
8c0441ec: romhdr dll:4001c001-4001c001, phys:8c01a000-8c045fd8, ram:8c045fc8-00000000, copy:0, profile:00000000-80808080, drvglob:00000000-00000000, track:01cb1344-01cdd144
Segmentation fault (core dumped)

I believe the first 4 lines are only missing libraries on Linux and does not appear on Windows.
On both platform eimgfs crashes.
I found the offset by using binwalk on the file :

2097152       0x200000        Windows CE memory segment header, TOC address: 0x0
2116520       0x204BA8        Windows CE image header, image start: 0x30305800, image length: 172377648
8849408       0x870800        Windows CE memory segment header, TOC address: 0x4005BE34

Any idea ?

Thanks.

Instruction on how to build on Windows?

Hello. Could you please provide a little more details on how to build eimgfs on Windows with modern PSDK? I guess I will need mingw + openssl/boost, right? Because Makefile.win32 seems not to be in mssdk nmake format. Thanks in advance.

Windows Embedded Automotive 7 - Filesystem?

Just want to say thank you for all of your work over the years; it's been ~15 years (Wizard era!) since I last delved into wince/wm, having recently returned due to a project, I see the community (what's left) is still heavily reliant upon your hard work!

I'm working on a car radio running Windows Embedded Automotive 7 - a very limited environment to start with.

I managed to get serial access and then get to one of the test modes in the bootloader for memory read/write/test and from there slowly dump over serial.

eimgfs finds the 2 bootloaders (XIPs with a single nk in each) and the traditional xip which extracted perfectly (thank you!) however there's some kind of filesystem I can't identify; looking at the dump the strings marry up with a series of PEs but no recognisable PE header.

Appreciate this is not an issue/bug, but any help or pointers would be greatly appreciated!

BL 0x00000000
BL2(?) 0x00060000
XIP 0x001c0000

Believed filesystem start is around 0x00AC0000

Dump:
https://filebin.net/1fxqva7tx40iths5/0xa0000000.bin

List of files shown, but -extractall doesn't work

$ docker run -v ~/avic/:/app/1 --rm -ti ef7b7abd7b4d  /app/1/test/1.prg -info -list

ERROR: not found
0000007e: failed to load dll4
ERROR: not found
0000007e: failed to load dll3
found xip
imgfs: partition table not found
readers: ( total = 1 )
{
    file 0x33fb934
}
filesystems: ( total = 1 )
    xip         39 files, 235 modules
-------- xip
033fa6d0 2012-07-19 02:24:30  1470976 M:[00000007] 1SegCore.dll
033f9f30 2012-07-19 05:13:33    95744 M:[00000007] afd.dll
033fa7d0 2012-09-28 01:52:31   753664 M:[00001007] AIPI.dll
033fa7b0 2012-09-28 01:52:47   870912 M:[00001007] AplLib.dll
…

And tried to extract files:

$ docker run -v /home/scif/avic/:/app/1 --rm -ti ef7b7abd7b4d  /app/1/test/1.prg -extractall -d /app/1/test/22 -v

ERROR: not found
0000007e: failed to load dll4
ERROR: not found
0000007e: failed to load dll3
ERROR(00000011): CreateDirectory(/app/1/test/22)
no fffb: blk:  00090009 0009402b 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          mg:  0009d001 884a76c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 5007a089 00000002
found xip
8b89a73c: romhdr dll:4001c001-4177c0db, phys:884a1000-8b89c934, ram:8b89d000-8e8a1000, copy:2, profile:00000000-00000000, drvglob:00000000-00000000, track:00000000-00000000
imgfs: partition table not found
033fa6d0 2012-07-19 02:24:30  1470976 M:[00000007] 1SegCore.dll

I cant install it in linux

I cant run the program in linux... Can u put here the steps for install it?

I cant install docker too...

Thanks!!!

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.