[P3400 ROM Development] ramersonw:
In this tutorial we'll build our first rom.

Prerequisites: Make your BASE ROM first. If you didn't, see how here.

In our BASE ROM we have 3 folders: ROM, OEM and SYS.

Here is a small explanation of these 3 folders:

ROM: This folder contains modules, rgus and dsms of xip. More explication about xip you can find here.

SYS: is like windows folder on ours PCs. This contains all files from windows. Here is a list of packages that are safe to delete (if you want more space in ROM):

autoupdate
Autoupdate_Lang_0409
Catalog
Catalog_Lang_0409
INTERNETSHARING
Office
Office_DPI_96
Office_Lang_0409
Office_Lang_0409_DPI_96
OneNote
OneNote_lang_0409
ppgprov (if you remove this push e-mail will not work)
SampleMusic
SqlCeMobile
SqlCeMobile_Lang_0409
Transcriber
Transcriber_Lang_0409
Transcriber_Lang_0409_DPI_96
WelcomeCenter
WelcomeCenter_Lang_0409
WindowsLive
WindowsLive_DPI_96
WindowsLive_Lang_0409

OEM: This folder contains device specific files as drivers and operators customizations.

In OEM you cannot delete these folders:

OEM_Lang_0409
OEMAPPS
OEMDRIVERS
OEMMISC
OEMOPERATORS
OEMVERSION

In this tutorial we'll do a small modification to OEM folder only to illustrate the build process. But feel free to do any modifications you want(but I advise you to make only the modification made in this tutorial for you know how it works first).

To learn more about packages read this:

http://xdaforums.com/showthread.php?t=303406

http://wiki.xda-developers.com/index.php?pagename=OEM%20Package%20Tutorial

Now We'll modify the OEM folder.

As a example we'll delete one package from OEM: WM5torage.

So let's begin build our ROM:

1. Move tools folder to BASE_ROM and open a DOS prompt and navigate to BASE_ROM

2. Now to start the building process

type:

start "" /w TOOLS\buildos -auto

It'll create a temp folder with the new files from your rom. it'll also create the windows registry.

It's very important that this process finishes without errors.

3. It's time to execute G'reloc to realoc the addresses of the modified files in the rom

type:

start "" /w TOOLS\G'Reloc.exe -doit -dump

4. Now we'll change attributes of some files. You can skip this step but doing this will increase the speed of your windows folder (when you open it)

type

attrib temp\dump\*.dsm +h +s +r
attrib temp\dump\*.dat +h +s -r
attrib temp\dump\*.dll +h +s -r
attrib temp\dump\*.rgu +h +s +r
attrib temp\dump\*.provxml +h +s -r

5. Move the dump folder, boot.hv and boot.rgu (it's inside temp folder) to tools folder. In MOD_ROM folder move 01_os.nb, imgfs.bin, xip.bin and 00_extrom.nb to tools folder too.

6. Navigate to tools folder and type:

imgfsfromdump imgfs.bin imgfs-new.bin

It'll create the imgfs-new.bin(this file contains all packages compacted ready to integrate in os.nb) using the old imgfs.bin

as a template.

7. create a file xip0.bin (you can use notepad to do this). This is a blank file that nbwork use as a template for bootxip partition.

8. type

nbwork -b 01_OS.nb os-new.nb xip0.bin xip.bin +1 imgfs-new.bin

It'll create the os-new.nb. This file defines the partitions of the rom. It contains 3 partitons: bootxip, xip and imgfs.bin.

You'll use this file to create a new nbh file to flash in your device.

9. Now we'll build our nbh file.

Open htcrt (It's inside tools folder) and click <build>

in device choose <gene>

in <OS> choose the os-new.nb file inside the tools folder

in <Ext. ROm> choose the 00_Extrom.nb inside the tools folder

Click <build>, choose a name to your nbh (usually ruu_signed.nbh) and a location to save and click <save>

10. Copy the contents of romupdateutility folder(it's inside tools folder) to the same place that you saved your nbh and run romupdateutility to flash your device

If everything is correct, your Gene will start your new rom if not review all the steps and try again.

notes: your os-new.nb must be > 50MB. Otherwise RomUpdateUtilityt will give you an error.

In the next tutorial we'll learn how to port xip and sys from other device. But it will take a while because I'm porting the iolite rom to my gene:D