[MDA III, XDA III, PDA2k, 9090 Software Upgrading] GerardNL:
Building your own kitchen (Part 2)

(continued from above port)

Step 6a: Changing the registry

After you’ve followed step 1 to 5, you also extracted the default.hv and user.hv and can be found in SYS\Metadata directory. This is the registry that also contain all the bits and pieces of registry files that are in the packages (the .RGU files)

To modify these 2 files, use these commands:

SET _FLATRELEASEDIR=.

rgucomp -o default.hv -nologo > default.txt

rgucomp -o user.hv -nologo > user.txt

Add "REGEDIT4" in the beginning of the files and leave a blank line at the end of the file. Save the file as UTF-16 or Unicode format. (Ultra-Edit is very good editor for this)

After you have made the changes, you will need to covert them back to a format your PPC will understand. Use these commands:

SET _FLATRELEASEDIR=.

copy default.txt boot.rgu

rgucomp -b

ren boot.hv default.hv

copy user.txt boot.rgu

rgucomp -b

ren boot.hv user.hv

---------------

The next steps are basically the reverse from the first 5 steps: After taking the files apart, they now need to be put back into place.

----------------------------------

Step 7: Building the ROM up again.

To start building the ROM now, the first command you execute is BuildOS.exe.

This program will create the dump directory again and will copy the directories and files from SYS and OEM to the directory.

Remark: There are several versions of BuildOS on this forum. Xplode’s kitchen is using a more advanced version where you can easily select the packages you want to be included (instead of moving them in and out the directory). This is a much nicer approach and will make ROM building as simple as installing a regular piece of software on your PC. However, to keep it a bit more simple for this how-to, I’m assuming an older version of BuildOS.exe that will not ask for any user input. (The more advanced version will require you to modify XML files to add packages. It’s not too difficult, but does require a bit more background knowledge)

Step 8: Building the file image system

Now you have all the files and directories that make up the ROM, you’ll need to convert it back into a file image.

For this, you run the program BUILDIMGFS (without any parameters)

Remark: For some reason, but this program is very memory intensive. If you don’t have that much internal memory, or your swap file is too small, this program is never able to completely run. I’ve noticed this problem on more then 1 computer. (I have the source code of this program and tried if I could do something about this. However, the program is heavily relying on a DLL called “cecompr_nt.dll” and I expect that that DLL is the culprit. I’ve been searching for more information on this DLL, but have not found anything on the internet about it)

Important note: If you have added to many modules to your own ROM, the BUILDIMGFS process may crash. So, if this happens, you’ll need to go back to step 6 and remove some of the packages you’ve added. If you go back to step 6, you’ll need to delete the “dump” directory first.

This program will convert the dump directory back in the file “imgfs_raw_data.bin”.

Once the program has run, the file should be something like 27 mb again.

If the program does not crash and runs to completion, there is still a chance that you have added to many packages to your ROM. When the BUILDIMGFS is ready, it will show the number of free sectors at the end of file system image. If it is showing something like ffffef that means that it’s too big, since it should show a small (hexadecimal) number like 1e or something like that.

Since/If you want to add as many packages as possible to the ROM (instead of installing them in RAM) you may need to repeat step 6, 7 and 8 several times. To make your life a bit easier, make a screen shot of the OEM directory and keep track which one worked and which one didn’t). If you go back to step 6, you’ll need to delete the “dump” directory first.

Step 9: Building the nk.nba

To create the nk.nba file again, you need the file you just created in step 8, but also the other file created in step 2: imgfs_removed_data.bin (maybe this file is created by buildimgfs??)

When you have these 2 files in a directory together, run this command:

MAKE_IMGFS nk.nba

Once the program is complete, the nk.nba file should be something 32 mb again.

Important remark: For other HTC platforms (like HTC Uni), the above command is executed with an extra parameter “-nosplit”. However, if that parameter is added the output is unusable when performed on the BA ROM.

Step 10: Convert the nk.nba back into nk.nbf

The final step of the process: creating the file that our BA understands: nk.nbf

This step is into 2 pieces:

A: Update the check-sum of the nk.nha file with this command:

XDA3NBFTOOL -c -u nk.nba

B: Convert the file:

XDA3NBFTOOL -x nk.nba nk.nbf 0x20040521

As you can see, the last parameter is the same as in step 1. This is some sort of password that is needed to encode the file with.

Now, the ROM is complete and you’re ready to flash it on your BA. I assume that you know how to do that part :-)