FORUMS
Remove All Ads from XDA
Honor View 10

Beta: WM5 ROM editing tool

1,150 posts
Thanks Meter: 222
 
By mamaich, Retired Recognized Developer on 30th November 2005, 02:25 AM
Post Reply Email Thread
I've made a set of tools that can assist in cooking your own WM5 ROMs. These tools were tested only on BlueAngel devices. They should also work on Himalaya. Universal and Wizard support is also present, but it is untested, so the tools may crash or turn your device into brick. But it is possible to extract files from universal/wizard ROMs and use them on other devices.

I've attached 2 archives - make_hv.rar, a tool from Platform Builder that can be used to recreate .HV files (they contain default and boot registry), and imgfs_tools.rar - these tools should be used to edit WM5 IMGFS partition.
With these tools and http://forum.xda-developers.com/viewtopic.php?t=33321 (it can edit WM5 boot XIP partition) it is possible to replace/add/delete any file in WM5 ROM.

Usage:
Code:
prepare_imgfs.exe
  Splits nk.nba into imgfs_raw_data.bin and imgfs_removed_data.bin.
imgfs_raw_data.bin - contains raw IMGFS data
imgfs_removed_data.bin - contains extra data (something like FAT table).
Usage:
  prepare_imgfs.exe nk.nba [-nosplit] [-mpx200] [-acer]
Use "-nosplit" for HTC Wizard and Universal ROMs that don't contain extra 
blocks of data. In this case imgfs_removed_data.bin would be empty.


make_imgfs.exe
  Reverse of prepare_imgfs. Combines imgfs_raw_data.bin and imgfs_removed_data.bin
into nk.nba file. Use -nosplit if it was specified for prepare_imgfs.exe.
Usage:
  make_imgfs.exe nk.nba [-nosplit]
The nk.nba file would be used as a template, its contents would be overwritten.


viewimgfs.exe
  Dumps the contents of imgfs_raw_data.bin to "dump" subdirectory. Files are 
dumped as is, modules as directories. File time and attributes are preserved.
If RecMod.exe is present in the current directory, all modules are 
reconstructed as working DLLs/EXEs and placed in the corresponding subdirectory.
Tool creates dump_MemoryMap.txt with address ranges occupied by modules.
Usage:
  viewimgfs.exe imgfs_raw_data.bin

RecMod.exe
  Reconstructs a module dumped as directory to a working state. Rebuilds 
relocations information, and tries to guess section names.
Usage:
  RecMod.exe [path to module directory]


BuildImgfs.exe
  Reverse of viewimgfs. Reconstructs imgfs_raw_data.bin and imgfs_removed_data.bin
from files in "dump" directory. Overwrites contents of imgfs_raw_data.bin/imgfs_removed_data.bin
files. Does not check for errors or end of free space. Approximate free space
left is displayed when program is finished. In case of error contents of bin
files is undefined.
Usage:
  BuildImgfs.exe
It would overwrite imgfs_raw_data.bin/imgfs_removed_data.bin in current directory.


DelFile.exe
  Deletes one file or module from imgfs_raw_data.bin. Wildcards are not supported.
Usage:
  DelFile.exe filename.ext
Uses imgfs_raw_data.bin from current directory. Does not check for errors.


AddFile.exe
  Adds one file to imgfs_raw_data.bin. Would reuse space freed by DelFile.
Usage:
  AddFile.exe filename.ext
Uses imgfs_raw_data.bin from current directory. Does not check for errors.


The typical process should be:
prepare_imgfs.exe nk.nba
viewimgfs.exe imgfs_raw_data.bin
...modify "dump" directory as you need...
BuildImgfs.exe
make_imgfs.exe nk.nba

or
prepare_imgfs.exe nk.nba
DelFile.exe filename.ext
AddFile.exe filename.ext
...you may add/delete as many files as you need...
make_imgfs.exe nk.nba


Of cause you'll need a tool to convert NBF<->NBA files. SD-card images can be also used instead of NK.NBA file, but this was not tested!
Troubleshooting.
In case of invalid ROM the tools would crash without saying anything. In this case they may destroy the contents of input files.

Use these tools at your own risk! They may make your device completely unusable! Always make an SD-card backup of your ROM and Extrom!
The worst case I had during tests was complete destroying of DOC partition on my device. I had to flash WM2003 OS, repartition DOC from there and this fixed the device. Of cause this method cannot be used on Wizard or Universal.

I've published these tools so that someone could integrate BA patches into a ROM or play with cooking own ROMs.


edited 12.12.2005. AddFile/BuildImgfs should work on Universal/Wizard ROMS (i.e. roms with empty imgfs_removed_data.bin file).

edited 15.01.2005. Fixed a major bug found by TofClock. Short name of files with filename length 24 chars or longer (like "instmsgrresources.96.dll") was incorrectly generated and in some cases they were inaccessible by OS.

edited 05.02.2005. Added several checks so that viewimgfs.exe does not crash on incorrectly patched ROMs (MPX200). Don't use buildimgfs.exe on such ROMs.

edited 30.03.2006. Added RecMod tool that reconstructs modules dumped as directories to a working DLL. So reusing modules from other ROMs is now much easier. Added updated prepare_imgfs.exe with support of ACER N300 ROM (thanks to Tuatara).

edited 12.07.2006. Added source code of prepare_imgfs/make_imgfs tools, so anyone can add the support of new devices.

edited 25.10.2006. Published the source code on my site. The code is ugly and is not commented at all. Don't ask me how to compile or use it!


I've stopped working on this project. There would be no updates.
Complete source code is available on my site.
Attached Files
File Type: rar make_hv_111.rar - [Click for QR Code] (54.2 KB, 18644 views)
File Type: rar imgfs_tools_182.rar - [Click for QR Code] (123.1 KB, 108872 views)
File Type: rar prepare_imgfs_src.rar - [Click for QR Code] (1.4 KB, 11284 views)
 
 
30th November 2005, 02:47 AM |#2  
clustered's Avatar
Senior Member
Flag Kuala Lumpur
Thanks Meter: 74
 
More
mamaich,

can this be done on Alpine device??? Alpine that known as faster Himalaya also should be running WM5.....

thanks
1st December 2005, 12:47 PM |#3  
baniaczek's Avatar
Senior Member
Flag Warsaw
Thanks Meter: 2
 
More
Looks nice :)

Some questions:

1. AddFile:
Can I add single file like
Code:
AddFile something.exe
or have I use 'modules as directories' [like directories dumped with ViewImgfs]

2. AddFile:
Is it possible to add files into directories not in \Windows? For example: "\Program Files\Something\something.exe"

3. Is it possible to modify the kernel? Can I extract and replace \Windows\fatfsd.dll?

Thanks in advance.
1st December 2005, 02:36 PM |#4  
Senior Member
Thanks Meter: 64
 
More
mamaich, would for example replacing the internet explorer exe be enough to get it to render gifs correctly? Or are extra dll needed? Also is it necessary to use the other tool you linked to as it appears your tool can add and delete files itself? thanks

Edit: Forgot to add, thanks for your hard work.
1st December 2005, 03:12 PM |#5  
ramram's Avatar
Senior Member
Flag Beirut
Thanks Meter: 2
 
More
mamaiiiiichhhhh I was waiting those tools gr8 work mate, can you upload the modified rom that you already customized for testing it?
2nd December 2005, 07:17 AM |#6  
OP Retired Recognized Developer
Thanks Meter: 222
 
Donate to Me
More
Quote:
Originally Posted by baniaczek

1. AddFile:
Can I add single file like

Code:
AddFile something.exe

You can use both methods, but subdirs can be used only if you are really know what you are doing (i.e. you know all addresses of each section and 100% sure that they don't overlap some other modules and you've edited .VM and .ROM files). In most cases you should add EXE/DLL files as normal files.
Quote:

Is it possible to add files into directories not in \Windows? For example: "\Program Files\Something\something.exe"

All files are placed into \windows dir and then moved by coldinit to subdirs according to instructions in initflashfiles.dat. Of cause you can modify that file as you like.
Quote:

3. Is it possible to modify the kernel? Can I extract and replace \Windows\fatfsd.dll?

Boot part can be edited with http://forum.xda-developers.com/viewtopic.php?t=33321

ramram
There is no ROM I can release for public testing. I would not integrate my patches into the ROM, I'm working on adopting Wizard's ROM for our devices. But everything is on too early stage, I have to combine registry settings, ROM files, find and patch drivers for ROMs to work, etc. And Wizard's ROM is larger than ours, some files should be removed.
2nd December 2005, 07:18 AM |#7  
OP Retired Recognized Developer
Thanks Meter: 222
 
Donate to Me
More
Quote:
Originally Posted by efjay

mamaich, would for example replacing the internet explorer exe be enough to get it to render gifs correctly? ...

I don't have any problems with IE.
2nd December 2005, 10:42 AM |#8  
ramram's Avatar
Senior Member
Flag Beirut
Thanks Meter: 2
 
More
Ic
mamaich,
I'll wait you then until you finish the wizard rom adoptation, I'll be glad trying it on the BA if you don't mind, consider my device for development purpose and beta testing if needed.

Concernig the IE, I have the same problems as Efjay mentioned earlier.
Thank you
2nd December 2005, 02:09 PM |#9  
baniaczek's Avatar
Senior Member
Flag Warsaw
Thanks Meter: 2
 
More
@mamaich

Thank you for the answer. And thank you for your hard work [sinze Siemens SL45i].
2nd December 2005, 07:11 PM |#10  
Senior Member
Thanks Meter: 64
 
More
Quote:
Originally Posted by mamaich

Quote:
Originally Posted by efjay

mamaich, would for example replacing the internet explorer exe be enough to get it to render gifs correctly? ...

I don't have any problems with IE.

mamaich, the problem is with viewing gif files. On this site using PIE i cannot see the quote button and other buttons below a post. Even manually opening a gif file on the BA opens PIE with a blank page.
2nd December 2005, 08:00 PM |#11  
buzz_lightyear's Avatar
Retired Moderator
Slovakia
Thanks Meter: 10
 
More
go mamaich!!!

;o)))
buzz
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes