ROMs For Dummies: Part Five
From AllShadow.com Wiki
Contents |
Introduction
Welcome to part 5 of ROMs For Dummies. This section will deal with recreating the ROM image and flashing it back to the phone.
Tools you will need
The following tools are needed in order to finish this part:
PackageToolsBuildOS4.3b1 - This processes the OEM packages and recreates the ROM dump.
ImgfsFromDump (Part of Tadzio Tools) - This will recreate the binary from the ROM dump.
ImgfsToNb (Part of Tadzio Tools) - This will recreate the OS ROM part file from the binary file.
HTC Rom Tool - Recreates the NBH file to flash to the phone
Rebuilding the OS
At this point, you should have already dumped the ROM image added in all customizations that you want. Though you can still change the ROM image afterwards, you won't be able to do so easily after the first step in this process.
Unpackaging the ROM
In order for you to create the ROM image, you'll need to unpack the ROM image from the OEM folders so that in can be converted back into a binary file. Copy packagetoolsBuildOS4.3b1 and pkgcommon.dll to your IMGFS folder. Run it from there and select the Build tab.
Click load ROM. You should see all of the packages in your OEM folder listed here. Instead of having to delete all of those files when you were customizing and then realizing that you needed some files after all, you can simply select the software packages you want in the ROM image by checking the checkbox next to each package that you want.
Once you've finished with that, click create ROM. The program will then process all of the packages. This will take about 5 minutes or more to finish. Once it's done, you should have a temp folder with the new dump inside of it. This dump folder should not have a SYS nor an OEM folder. Instead, you should be able to see all of the files that make up the ROM image.
Recreating the binary file
From here on out, you'll just be reversing the process of what you did to extract the ROM. Instead of running ImgfsToDump, you'll now have to run the ImgfsFromDump. You'll need to copy this to the temp folder in your IMGFS folder along with the imgfs-old.bin you created while extracting the ROM.
In the command window, run in the following command:
- ImgfsFromDump imgfs-old.bin imgfs-new.bin
Do not try running other programs or even touch your computer while this is running. Because of the way the Shadow ROM was originally packaged, this process takes up most of your computer's memory. Running other programs actively and interacting will make this process move at a snail's pace. Once this command has completed, you should have an imgfs-new.bin file sitting in your IMGFS folder.
*Note: If there is a problem and the program crashes, it means that there is too much stuff in the ROM image. Because of the way the official ROM is structured, there doesn't seem to be way to get around it. You'll need to uncheck a few more of your packages and rebuild the dump file (Instructions above).
Recreating the OS part file
Now that the binary file has been recreated successfully, the binary file needs to be re-inserted into the OS part file. To do so, copy ImgfsToNb into the temp folder along with the OS.nb file that was made during extraction. The following command overwrites the old IMGFS partition and uses the OS.nb as a template to create a new OS ROM part file.
In the command window, run the following command:
- ImgfsToNb imgfs-new.bin OS.nb OS-new.nb -conservative
It is VERY important to have the "-conservative" handle added to the command. If you don't the XIP partition and the IMGFS partition will overlap and your phone won't boot when you flash the ROM image. Once the command has completed, you should see a OS-new.nb file in the temp folder.
Recreating the ROM Image
Go to your Tools folder and run htccrt.exe. This program will allow you to recreate the NBH file that you can flash to your phone. Select the Build tab.
In the "Device" drop down menu, select the Excalibur. Make sure all of the settings match up with the screenshot below:
Once you've done that, click the "..." on the right side for the OS part and look for the OS-new.nb file that you created. Click OK and then click the Build! button. In the prompt that shows up, name the new file "PHOEIMG.nbh" and then click OK. A popup should show the progress of the NBH encoding. Once it's done, click OK and close out of the HTC ROM Tool.
Nice job! You've just built a custom ROM image for the HTC Juno/Phoebus! Sit back and relax...the next step will make the phone do most of the work. :D
Flashing the ROM image
Almost there! Copy the PHOEIMG.nbh you created to the RUU folder and run the ROM Upgrade Utility with your phone plugged in and connected to ActiveSync or Windows Mobile Device Center. This process should be familiar to you from the official ROM Update and will lead you through the steps to flashing the device.
If you phone boots after the flash, congratulations! You've just flashed your own custom ROM image to your phone! Give yourself a pat on the back and get away from that computer while you admire your own work.
If not, make sure you've followed all of the steps above and in previous parts of this tutorial. Usually it is one small thing that throws off all of the work you've done, but can be fixed easily. If you still have problems, PM me in the AllShadow or XDA-Developer forums and I'll be ready to help you.
On to the Next Part
Congrats on making it through the tutorial. If you need to review, click here for Part 1 of 5: Answering basic questions, here for Part 2 of 5: Choosing your source and Extraction, here for Part 3 of 5: Understanding the ROM and Fixing the OEM mess, and here for Part 4 of 5: Creating Registry Edits, adding Provisioning XML and 3rd party Applications.



