Cooking Windows Mobile ROM for dummies


Introduction to cooking

We are all very familiar with setting up a new operating system in our PC or notebook. Doing so on our Windows mobile device, is however, not so straight forward. The only way is to setup the operating system, along with the desired applications, into an image, which will then be flashed into the mobile device. The process of building the image, is also known as cooking.  The person who involves in cooking, is known as chef.

Ins and Outs of a Windows Mobile ROM

An ROMimage contains 1 or more image chunks, such as Radio, Splash, Bootloader, OS, etc. In this blog, I would be focusing on OS image, which is made up of 4 sections, namely XIP, SYS, OEM and EXT.

XIP, which stands for “Execute in Place”, is a method of executing programs directly from the persistent storage, instead of copying it to and running it from RAM. The files in this section, are essentially the kernel of the OS, and it follows very closely to the version & build of the Windows Mobile operating system that you are planning to build upon. You should not be trying to exclude any of the files in this section, although in some cases, you may need to modify the NK.EXE file to customize the version number to be displayed on your device’s splash screen.

SYS, is where you would find the rest of the default Windows Mobile operating system files, including all the default WM software and the resource files such as images or data files. This is the section, where you can disable some of the applications and their corresponding resources to reduce the OS footprint. For example. you can disable “Autoupdate” since we almost would not be getting any update from Microsoft over the air (OTA). Another example, if you do not use CHome, the new Windows Mobile home interface, you can disable it.

OEM section, contains all the drivers and configurations developed by the phone manufacturer for the specific device. Please careful of using a different driver set (possibly from another device) as it may render your device unbootable if the driver conflicts. In the OEM section, there is one file known as “initflashfiles.dat”, usually found in OEM_Lang_XXXX folder (where XXXX is the language identifier represented in numeric term), which is used to define how the files will be copied to the phone after a hard reset. By default, a file cooked in a ROM goes to \Windows folder, and the initflashfiles.dat will copy it (not move) to a different folder, such as “\Program Files\XXX”

Lastly, the EXT refers to the set of application packages that are added usually by the phone manufacturer to fulfill certain functionalities of the phone. If you would like an application to be setup automatically after each hard reset, this is the section where you add the application package.

Tools you need to cook

We all know a kitchen is where a chef would whip up some nice crusine dishes. Similiarly, in order for one to cook the rom, he would need a set of utility tools which are also known as kitchen. In the early days of cooking era, chefs (i.e. those who cook) had to build their ROM image via command line utility. These days, we have developers building visual kitchen, which makes the whole cooking process much easier and convenient. There are a few visual kitchens (Ervius, Vistang, etc) floating around in the xda-developers, and they are mostly based on Bepe’s platformbuilder tool. For the remaining of this guide, I would be using visual kitchen to describe the process. For beginner, I find Vistang‘s kitchen pretty much idiot proof, whereas Ervius have more comprehensive features.

Process of cooking


Firstly, look for a kitchen that has all the 4 sections (i.e. XIP, OEM, EXT, SYS) pre configured. This way, you have a good base to start with. Then you can easily select or  unselect packages that you would like to include/exclude to the rom that you eventually create. If you have to create the kitchen from scratch, you would then need to extract the applications and files from the official ROM (see step 1).

1. Extracting packages from official ROM

The easiest way is to use the kitchen tool, to interactively dump the files out from the original ROM image. Ervius Kitchen would have this feature.  Otherwise, you need a set of command line utilities to break the original ROM image (nbh format) into several chunk (nb format), and then further extract the application files from the nb files. You can find the detail of the tools you need from this link

2. Remove or Add/Update packages in OEM, SYS or EXT

Once you have all the files in your kitchen, you can start configuring your ROM according to your preference. I find this tutorial very useful, in guiding, from start to end, on the various configurations that can happen on your ROM. If you have new application that you want to add to the ROM, and they are not part of the existing package, you need to ensure that you create a package for it, which this link has described very well on how you do so. In some kitchens like Vistang, all you need to do is to create a folder and have the files stored in the sub folder named “files”, without the need to create the dsm or rgu configuration files.  If there’s any need to update the registry, you can create a registry file “app.reg” in the folder. The most effective way to get familiarised is to look at some of the existing packages.

Lastly, if you would like to include new build of the Windows Mobile to your kitchen, you need to ensure that you have the SYS and ROM folder updated.

Once you are done with the file dump, make sure all the files are placed in the appropiate section of your kitchen. Different kitchens may have different folder structure, but by and large, they are organised by the 4 sections which I have described earlier.

3. Customise the shortcuts and other file initialisation

Since all the cooked files are by default copied to \Windows directory, you need to configure initflashfiles.dat if you need to copy the files to other folder such as Start Menu or Program Files. The syntax of the command in initflashfiles.dat are basically as follow;

  • Directory(“\Windows”):-Directory(“Help”)

Creates a new sub folder “Help” in “\Windows” directory

  • Directory(“\My Documents\My Pictures”):-File(“Destination.jpg”,”\Windows\Source.jpg”)

Copy a new file named “Destination.jpg” from “\Windows\Source.jpg” to “\My Documents\My Pictures” directory.

The initflashfiles.dat only create new sub folder or copy files from one place to another. If you need to delete a file outside of \Windows directory, you need to use the Configuration Service Provider to execute the deletion command. The configurations are maintained in provisioning xml file (or known as provxml file)  You can also use this method to set up other items such as your Activesync configuration, Registry update, etc.

4. Build & Flash your ROM

If you want to ensure that your ROM version is reflected correctly in the RUU utility program, you may need to modify htcrtproj in the Tools folder of the kitchen. For Ervius kitchen, the file is Leo.htcrtproj (for Leo kitchen) and for Vistang, it’s os.htcrtproj

For some kitchen, such as Vistang’s kitchen, you can also include other part of the ROM image, such as radio image, to your final cook ROM. Usually these features require you to have a registered copy of the kitchen software though.

Now that you have your ROM built, you can then start flashing it to your device.


Useful Links

4 thoughts on “Cooking Windows Mobile ROM for dummies

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s