ROMs For Dummies: Part Two
From AllShadow.com Wiki
Contents |
Introduction
Welcome to Part 2 of ROMs for Dummies. This part will deal with extracting ROM images and taking a look of their structure. This will also deal with taking raw ROM images directly from your phone.
Tools you will need
For this part, you will need the following tools:
NBHUtil - Splits apart the ROM image into individuals parts.
ImgfsFromNb (Part of Tadzio tools) - Extracts the OS part of the ROM image and stores it in a .bin binary file.
ImgfsToDump (Part of Tadzio tools) - Extracts files and folders of OS into a dump folder for you to view.
PkgToolsBuild0s-4.3b1 - Packages the OS and related files into manageable software packages.
All of these tools are available in the package in the first part of ROMs For Dummies. You will need to get these tools from here.
Choosing the source
To start with ROM image editing, it is much easier to simply take apart an image that a provider has given. There is also the option of pulling the image from the device, but that is more tedious and for the most part is unneccessary unless you are trying to get the ROM image of a new phone that doesn't have a software update.
Extracting a ROM image directly from the phone
Since the T-Mobile Shadow uses a chip system different from the M-Systems DiskOnChip (DOC) chip that most HTC devices use, dumping ROMs directly from devices is not possible with the current tools available that have been specifically designed for DOC chips.
Extracting a ROM image from a Software Update package
Install WinRAR from RAR Labs. This will allow you to extract the ROM image from the Update package. Create a new folder called Shadow Kitchen. In this, save the official Software Update from T-Mobile. This is where we will be doing all of our work to mod the ROM image.
Once the Update has been downloaded, right-click on the update file and click on the option "Extract Files". A prompt will come up asking you for the directory to extract to. Make sure it's the Shadow Kitchen folder and then press extract.
A new folder should pop up in your kitchen folder with the same name as the update file once the extraction is complete. In here, you'll find a file called RUU_Signed.nbh. This is what we're looking for: the ROM Image. Cut the file out of the Update folder and paste it directly into your Shadow Kitchen folder.
We're done here! Get ready for the actual extraction below...
Extraction
Prepping the Kitchen
Like in any real life kitchen, things can get really messy if we don't organize it properly. In order to do so, prepare the Shadow Kitchen folder similar to the following:
Create a Dump folder: This will contain the extracted ROM image and all the split parts of it.
Create an IMGFS folder: This will contain all of the OS components.
Create a Tools folder: This will store all of the tools that we will be using to manipulate the ROM. Make sure that you have at least one copy of each of the tools you use in this folder as a backup.
Create a Build folder: This will contain the built and completed ROM.
Rename the official Update folder as Flash: This will ensure we can flash our completed ROM back to the device.
Once you're done, your kitchen should look like this:
Using the command prompt
Throughout the rom editing process, you will need to use the command prompt to enter in commands. If you are running Windows Vista or Windows 7, hold shift while right-clicking and select "Open command prompt here". If you're running Windows XP, copy the cmd.exe (Command Prompt) from <Disk letter>\Windows\System32 folder to the Shadow Kitchen folder.
Splitting the ROM
Let's start getting our hands dirty. To start off, we'll be splitting the ROM image into .nb parts. ".NB" is the file extension for each different component of the ROM image. From the official T-Mobile ROM, there will be an IPL, a SPL, a Radio, and OS, and a Splashscreen. We're just worried about the OS part for now.
To extract the OS, start off by moving the RUU_Signed.nbh file into the Dump folder. Copy ImgfsFromNb, ImgfsToDump, PkgToolsBuildOS4.3b1 and pkgcommon.dll as well. Start by running the NBHUtil.exe. Select the Extract tab and then browse for the RUU_Signed.nbh file.
Click "Go" and you should see a list of parts you can extract on your right. Dump just the OS part since that is what we're interested in. Wait for a message to pop-up on your screen saying that it's finished. If you look in the folder, you should find a OS.nb file in the Dump folder. Once you confirm that, you're ready to move on to the IMGFS conversion.
Converting to IMGFS
In the OS.nb, there are multiple parts. On the T-Mobile Shadow/HTC Juno, there are three parts, the XIP (eXecute In Place) sector, the read-only unknown sector, and the OS sector called the IMGFS. For this part, you'll be dumping just the IMGFS sector, and that's where the ImgfsFromNb tool comes in.
To do so, open up the command line and type in the following command:
- ImgfsFromNb OS.nb imgfs-old.bin
When it's complete, should be see a new file in the Dump folder called imgfs-old.bin. Now let's take apart convert the binary file into something meaningful...
Converting to ROM dump
From the command line, type the following command:
- ImgfsToDump imgfs-old.bin
You'll start to see tons of hex values and numbers scrolling down in the command line. This is just the tool finding each file in the binary .nb file and storing information about each file or module. This process should go for a few minutes, so hang tight until it's done. Once it's complete, you should see a folder called dump in your Dump folder. If you take a look in this, you'll see all of the modules and files that make up the OS. Pretty cool magic trick, eh?
Packaging
This is the final step that you'll need to do for extraction. Packaging the ROM into meaningful and understandable bits really helps when you are trying to locate specific software to replace/delete/add. To do so, open up PkgToolsBuildOS4.3b1. If you're running Vista or 7, you'll need to right click on the program and click "Run as Administrator" in order to be able to run the program.
Click open and browse for the dump folder. Note that this is the dump folder created by the ImgfsToDump program, not your Dump folder!
Click on Build Packages. The program should run through a list of different packages on your screen and show information about the OS. Once it's done, hit cancel to any other prompts that come up. Close out of the program and take another look at the dump folder. You'll notice that there are only two folder, OEM and SYS. In each one, the OS components have been packaged up into different folder containing specific software. This is very convenient if you just want to swap out some software or add/remove software.
You've completed the first big milestone in making your own custom ROM! Take a breath and relax while you wait for Part 3 of ROMs For Dummies.
On to the Next Part
If you are done with Part 2, click here for Part 3 of 5: Understanding the ROM and Fixing the OEM mess.
Or if you are looking for other parts, Part 1 of 5: Answering basic questions, Part 4 of 5: Creating Registry Edits, adding Provisioning XML and 3rd party Applications, Part 5 of 5: Rebuilding and Flashing your ROM.


