[APP][UTIL]nbImageTool .4 (Partition Dumper) support .nbh .nb .dio .fat .nb0 .payload

Search This thread

Da_G

Inactive Senior RD / Moderator Emeritus
Aug 20, 2007
3,332
1,563
Riverside, CA
Samsung Galaxy S22 Ultra
Hey everyone :)

I've been working on learning C++, so I can refresh some of the existing tools, add some nice features, make them adhere more to the standards, etc.

This is the first fruits of my labor, this program analyzes an .dio, .fat, .nbh, .nb, .nb0, or .payload, reads out partition info to the screen, and dumps the uldr.bin, xip.bin, and imgfs.bin partitions. It should be compatible with any HTC ROM, and any other ROM that does not need to be run through nbsplit.

It does so without generating an intermediate .extra or .payload like the mamaich/tadzio toolset, and i've tried to keep an eye on speed, so it should be pretty fast.

Usage is "nbimagetool.exe -c filename.nb" - alternatively you can run the program with no parameters for some help output.

-c switch is optional, it strips the leading free space from imgfs.bin, so that it is compatible with imgfstodump (most IMGFS partitions have free space at the beginning, and the imgfsfromnb tool strips this automatically)

The idea for this tool is mostly to be used in a Kitchen, during the dumping process, for a nice fast dump :) Please let me know any errors you might run into!

UPDATED! Added .dio and .fat support
.5pre3 here, new support for asus roms

DONE:
* Added .nbh support
* Added .dio support

TODO:
* Add support for .bin
* Fix whatever bugs you might find

CHANGELOG:
.1 Initial Release - supports .nb .payload .nb0
.2 Added .nbh support
.3 Added output of .nbh info when dumping
.4 Added support for .dio and .fat, fixed a bug that might trigger in rare circumstances

Please no feature requests at this time, thanks :)

Visual example of program usage:

program.png


Sample .nbh output:

program2k.png
 

Attachments

  • nbImageTool.zip
    8.2 KB · Views: 1,247
  • nbImageTool-ver-point-two.zip
    9.2 KB · Views: 431
  • nbImageTool-ver-point-three.zip
    9.4 KB · Views: 443
  • nbImageTool-ver-point-four.zip
    9.4 KB · Views: 1,953
Last edited:

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
Very nice, except, that we DO need nbsplit in most cases (nbsplit -kaiser) -> kaiser, diamond, topaz, blackstone, raphael etc...
 
Last edited:

Da_G

Inactive Senior RD / Moderator Emeritus
Aug 20, 2007
3,332
1,563
Riverside, CA
Samsung Galaxy S22 Ultra
@CRACING:

You tell me! :)

@adwinp:

I think you misunderstand, when I say it doesn't need nbsplit I mean as a seperate program, it has algorithms to handle the 'nbsplit' process internally, without generating intermediate files :) and, it automatically detects the 'extra' data so you don't need to feed it parameters like -kaiser, -hermes, etc. :)
 

ther-amm

Senior Member
Nov 3, 2008
194
0
It's work!!, I have already try with my modified MBR from old Eten M600 ROM payload.

Compatibility Mode: ACTIVE
os.fat opened for reading, size 45914624 bytes.
MBR Signature is a match! Valid .nb

Size of Data Chunk: 512 bytes
Size of Extra Chunk: 0 bytes

Partition 1: BootInd : 0
Partition 1: FirstHead : 2
Partition 1: FirstSector : 1
Partition 1: FirstTrack : 0
Partition 1: FileSystem : 32 (ULDR)
Partition 1: LastHead : 31
Partition 1: LastSector : 1
Partition 1: LastTrack : 71
Partition 1: StartSector(L) : 2
Partition 1: TotalSectors(L): 2302 (1178624 bytes)
Partition 2: BootInd : 0
Partition 2: FirstHead : 0
Partition 2: FirstSector : 1
Partition 2: FirstTrack : 72
Partition 2: FileSystem : 35 (XIP RAMIMAGE)
Partition 2: LastHead : 31
Partition 2: LastSector : 1
Partition 2: LastTrack : 159
Partition 2: StartSector(L) : 2304
Partition 2: TotalSectors(L): 2816 (1441792 bytes)
Partition 3: BootInd : 0
Partition 3: FirstHead : 0
Partition 3: FirstSector : 1
Partition 3: FirstTrack : 160
Partition 3: FileSystem : 37 (IMGFS)
Partition 3: LastHead : 31
Partition 3: LastSector : 129
Partition 3: LastTrack : 39
Partition 3: StartSector(L) : 5120
Partition 3: TotalSectors(L): 78080 (39976960 bytes)
Partition 4: BootInd : 0
Partition 4: FirstHead : 0
Partition 4: FirstSector : 129
Partition 4: FirstTrack : 40
Partition 4: FileSystem : 4 (MS-DOS 16-bit FAT)
Partition 4: LastHead : 31
Partition 4: LastSector : 1
Partition 4: LastTrack : 127
Partition 4: StartSector(L) : 83200
Partition 4: TotalSectors(L): 412416 (211156992 bytes)
Total Number of Logical Sectors: 495614
Total Size of Image in bytes: 253754368
Writing uldr.bin
Writing xip.bin
Writing imgfs.bin


Thanks Da_G for all your hard work.
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
@adwinp:

I think you misunderstand, when I say it doesn't need nbsplit I mean as a seperate program, it has algorithms to handle the 'nbsplit' process internally, without generating intermediate files :) and, it automatically detects the 'extra' data so you don't need to feed it parameters like -kaiser, -hermes, etc. :)


Yes I did.
Just tested. Very nice piece of work. Except that xip size doesn't match.
Dumps fine, but is bigger than original.
I might've screwed my partition signature.

Anyways, the natural path to follow would be to write
uldr+ xip + imgfs header + imgfs (+extra) --> nb?

Apart from nbh support, you might want to ADD the code into the nbimagetool instead of coding a separate tool.
Why 2 tools when we can have 1?
Everything can be managed via switches, for example
nbimagetool -o outfile.nb(h) -x xip.bin -u uldr.bin -i imgfs.bin ...
;]

If you're really bored, you can also add other sections, like radio, splash.
It's basically the same code, except for different offsets (0x600)
 

Da_G

Inactive Senior RD / Moderator Emeritus
Aug 20, 2007
3,332
1,563
Riverside, CA
Samsung Galaxy S22 Ultra
What was the difference in xip.bin's? (Aside from the size) - was it just free space at the end (FF's evenly divisble by sector size) - if so, the existing toolset strips free space from things. I can make the -c switch strip it from xip.bin as well if necessary (although xipport.exe dumps fine with free space left at the end...)

Re: .nbh/.bin support, yeah, I plan to add it into the tool rather than a seperate tool :)
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
What was the difference in xip.bin's? (Aside from the size) - was it just free space at the end (FF's evenly divisble by sector size) - if so, the existing toolset strips free space from things. I can make the -c switch strip it from xip.bin as well if necessary (although xipport.exe dumps fine with free space left at the end...)

Re: .nbh/.bin support, yeah, I plan to add it into the tool rather than a seperate tool :)


Yes, it's just free space.
I've checked every file's hash and it's consistent, so no worries.
 

X1iser

Senior Member
Apr 5, 2009
293
54
I try to use this tool with OS.nb :confused:

OS.nb from X1i official rom

Code:
nbImageTool.exe OS.nb
CreateFileMapping() error: 5
Press the enter key to exit.
 

CRACING

Inactive Recognized Developer
Jun 10, 2008
4,599
616
125 Miles From Sea
@CRACING:

You tell me! :)

Works perfect for Wizard's official OS.nb ( Extracted both imgfs.bin and XIP.bin ) but as of protected OS.nb, only the XIP.bin will be useful. :)

Extraction of imgfs.bin worked fine using ELF(in) Hybrid Kitchen ( My Fav ).
Extraction of XIP.bin worked fine using bepe's XIP dumping tool.

Thanks....

Best Regards
 

Da_G

Inactive Senior RD / Moderator Emeritus
Aug 20, 2007
3,332
1,563
Riverside, CA
Samsung Galaxy S22 Ultra
X1iser:

Are you running in vista/windows 7 with UAC on? It sounds like the OS isn't allowing my app access to the file in the location you have it in. Try running it in administrator mode :)
 

X1iser

Senior Member
Apr 5, 2009
293
54
It work in administrator mode thanks:)

Simple question: do you planning to create a multidevice kitchen ?
 
Last edited: