Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].


From XDA-Developers
Jump to: navigation, search


the tool to make your own ROM

Quick tutorial

Making any ROM using mkrom is not for everyone. The process is far from user-friendly in some places, and it takes access to a unix machine, or unix like shell environment, like cygwin| and some basic knowledge of how the world works.

OK, here goes... First download the mkrom distribution archive, and unpack it on a unix-like system that has bash, perl and dd, making sure the sub-directories in the archive stay intact. Then use 'chmod a+x*' in the directory you unpacked to make sure the scripts are executable.

Next, find a ROM image containing the O2 '3.17.03 ENG' ROM (or any ROM file that was based on this ROM after processing by mkrom). Start mkrom by cd'ing to the base directory you unpacked to, and type './mkrom <filename>' ('filename' points to the O2 'NK.nbf' file from the installer's 'english' directory). This will then create an XDA-developers SpecialEditionROM. Your new ROM file will be in the 'out' directory in two formats: '.nbf' for use ith the 'Programme A' update tool, and '.nb1' for use with the XDA ROM Image Tool. If you keep on reading, you'll learn how to create a more personalised ROM.

The directories 'files1' and 'files2' hold files which will be added to the existing files in the Windows directory of the device. The combined size of all files in 'files1' should not exceed around 900 kB, the combined size in 'files2' combined with the files in the 'operator' directory (see below) should not exceed around 5 MB. (no warning yet if the maximum is exceeded, but you will get a screwed up ROM). Most of the time, if a file already exists in the pre-existing parts of the ROM, a file placed in either 'files1' or 'files2' will override and appear instead. Sometimes, for a reason we do not yet understand, this does not happen and the old file appears. You can work around this by copying the file using instructions in the 'initobj.txt' (see below) from an alternative name to a RAM copy of the file you wish to override. A file in the RAM filesystem overrides any copies stored in ROM.

The copy of welcome.exe in the files1 directory is one we brewed ourselves. It does not do the silly tutorial and timezone adjustment, but does let you calibrate the touch screen. Source download link is below, just like the source for our bandswitch tool|.

In the 'cfg' directory is a file called 'default.reg'. It holds the startup registry from the O2 ROM. If you ever want to modify another ROM, you'd need the default registry for it to make sure everything runs correctly. You can make modifications to this file as you wish.

Also in the 'cfg' directory is a file called 'initobj.txt'. This file holds instructions for file copy and directory creation commands which will be executed when the file system has been initialised, immediately after cold boot. The format should be obvious if you take a look at it. The file initdb.ini is used to specify the initial state of the system databases, we haven't changed the file that came with the Qtek ROM, but here you could add new initial database state if you wanted to.

The 'operator' directory holds the information which is read by the AutoConfig program. It contains a binary file called 'customtab.dat' which holds the provider names and numbers (these are the MCC+MNC provider identifier codes). We'll create some tool to help you modify this file later maybe. Then there's a file called operator.cfg in the 'cfg' directory. We parse the contents of that to create the data structure AutoConfig needs. The file contains lines where the first element is the filename in 'operator', the second is the directory it will be copied to on the device. The optional third and fourth element in the line specify the filename that it will be copied to, and the provider number for which this copy will happen. If that number is zero (or arguments 3 and 4 are not present), the file will always be copied when AutoConfig is executed.

Last but not least you can change the boot splash image. Replace the file 'bootimage.bmp' in the 'cfg' directory with a 240x320 pixels, 16-bit BMP file saved using 'R5-G6-B5' and 'Flip row order' options. (That's what PhotoShop calls it, you may need to do some experiments when using other picture editors or conversion tools)

We can;t do it for you, but if you take the EzWap files (anything starting with 'Ez' or 'ez' from the Windows directory of an O2 device, stick them in 'files2', and uncomment the appropriate line in initobj.txt, the new ROM will even support WAP.

How it works

There's a README file included with the mkrom distribution. We're very busy, so for now you'll just have to read the code if you really want to know how it works. We'll get to doing a more thorough explanation once we find some time.

Bugs, known limitations, future plans

The 'modules1' and 'modules2' directories are for parts of the image which are stored in a non-relocatable format. Mkrom currently does not yet support adding your own non-relocatable files, so don't put anything in these directories yet. We need to clean up and release the 'dumprom' tool that takes ROMs apart into separate files. This all needs to be made into nicer and cleaner tools. Some day... There is a known problem affecting users using ActiveSync in combination with serial cable or cradle. We've worked out what this is, and we'll address it in the next release, possibly after a short break...


Source of welcome.exe:

Source of bandswitch.exe:

See RomTools for a detailed per tool description.