[Touch GSM ROM Development] kokotas:
B2 Kitchen

I. Once you download the archive from rapidshare extract it's content (a folder named B2_Kitchen) to any location you want. Avoid extracting the Kitchen to your Desktop - Advisable location is \Program Files or C:\ .

II. Before continuing respect some prerequisites :

Microsoft Visual C++ 2010 Redistributable Package (x86) or Microsoft Visual C++ 2010 Redistributable Package (x64) ,

Microsoft Visual J#® 2.0 Redistributable Package &

Microsoft .NET Framework 3.5 (Windows Vista / Windows 7 have it pre-installed)

are required!

IF you're using Windows Vista / Windows 7, make sure USER ACCESS CONTROL is turned OFF!

DO NOT change the structure of the kitchen (see below)!

|___[Autorun.mscr]
| |_[Elfin]
|
|___[BaseRom]
|
|___[EXT]
| |_[Elfin]
|
|___[OEM]
| |_[Elfin]
| |_[0409]
| |
| |_[COMMON]
| |
| |_[dpi_96]
| |
| |_[Pkgs]
|
|___[RELEASE]
| |_[Elfin]
| |_[Myroms]
| |
| |_ElfinCustomRUU.exe
|
|___[ROM]
| |_[23545]
| | |_[MSXIPKernel]
| |
| |_[Elfin]
| |_[6.1Kernel]
| |
| |_[6.5Kernel]
| |
| |_[Extendir_OEMXIP]
| |
| |_[OEMXIP]
| |
| |_OS.nb.payload
| |
| |_romhdr.bin
|
|___[SYS]
| |_[23545]
| |_[dpi_96]
| | |_[0409]
| | |
| | |_[COMMON]
| |
| |_[dpi_96_resh_240_resv_320]
| | |_[0409]
| | |
| | |_[COMMON]
| |
| |_[SHARED]
| |_[0409]
| |
| |_[COMMON]
|
|___[TOOLS]
|_[addons]
|
|_[CORE]
| |_[Saved]
| |_[Elfin]
|
|_[mod]
|
|_[mytools]
|
|_[opt]
|
|_[pkg]
| |_[EXT.bak]
| |
| |_[EXTPackagesCreator]
| |
| |_[SYS.bak]
|
|_[Radios]
| |_[Elfin]
|
|_[rgu-hv]
|
|_[rgu-xml]
|
|_[splash]
|_[SplashScreens]
| |_[Elfin]
|
|_nbimg.exe

23545 is just an example (all folders are empty) I provide with the kitchen as shown above in order to help you put your files in the correct way.

III. When you enter for first time into the kitchen's folder you'll see something like this :

Autorun.mscr\Elfin is the folder where you can put your mortscript file that runs at first boot(i.e. ARMS.mscr).

This mscr must include a line "#INSERTPOINT" !!!

This line is required so that all "app.mscr" (read below) will be added at that exact point of your script!

If you want to use another name for your ARMS.mscr then you should edit the build_rom.bat @ line :

TOOLS\CORE\all_mscr_2_one.exe -ext EXT\%DEVICE% -mscrpath Autorun.mscr\%DEVICE% -mscr [I]ARMS[/I] -out %EXTPath1% -%ARType%

and replace ARMS with your file's name.

BaseRom is the folder where you can put any rom you want to dump. You are able to use almost any format, meaning

RUU_SomeDevice_HTC_SomeVersion_Signed_Ship.exe

RUU_Signed.nbh

Flash.dio

OS.nbf

OS.nb.payload

OS.nb

nk.fat

Imgfs.bin

xip.bin

Part01.raw and Part02.raw

EXT is the folder where you store all your EXT Packages that you want to try in your ROM.

Here you can put any application,utility,todayitem,etc. and choose whether to include it or not, having in mind if it is or not essential for the windows to work!

You must place those Packages inside the subfolder Elfin!

OEM is the folder where you have OEMApps, OEMDrivers and other OEMFolders (Device Specific). Check out trueg's posts for more information about these folders.

You must place those OEMFolders inside the subfolder Elfin like it is shown below otherwise the kitchen will not work :

*If you are cooking a rom in a different language than WWE, then create that subfolder.

For example if I want to cook a greek rom I'll create a subfolder 0408 along with 0409 inside OEM\Elfin and place my local.files in 0408.

*If you are using the kitchen in OEM mode (read below) you can put inside the "Pkgs" subfolder your old-style packages (with *.dsm , *.rgu , etc.). You'll be able to choose whether to include or not each of those from the kitchen's packages selection!

RELEASE(\Elfin\MyRoms) is the folder where your custom ROM (i.e.Elfin_ROM_Lang_0409_Build_21056.nbh) will be placed after cooking in order to flash it to your device using the included ElfinCustomRUU.

That RUU is a SFX archive and no trojan or virus is secretly implanted in it! If your are alerted for this file , ignore the warning!

If you have any problems running this RUU , then extract its contents , delete the ElfinCustomRUU.exe and rename the RomUpdateUtility.exe to ElfinCustomRUU.exe

ROM is the folder where the XIP is placed.

If you enter this folder you'll see :

Elfin folder has essential content (see below) and you shouldn't mess with it.

23545 is again an example (all folders are empty) I provide with the kitchen as shown below in order to help you put your files in the correct way*.

*Here you place the MSXIPKernel from the Build you wish to use in your ROM.

SYS is the folder where all the OS Packages (Not device Specific , but I'd say Screen Resolution Specific) are stored categorized by build number.

*As you can see above you can have various folders named after the build numder.

The OS Packages are placed inside the "Build" folder . Check out trueg's and Da_G's posts for more information about these Packages.

You must place those OS Packages inside the subfolders dpi_96 , dpi_96_resh_240_resv_320 , SHARED like it is shown below otherwise the kitchen will not work :

23545 is again an example (all folders are empty) I provide with the kitchen as shown above in order to help you put your files in the correct way.

TOOLS is obviously the kitchen's "engine". (Each time you build a rom you should find in here a log file from the building process which you can access by clicking on the Process label of the main application :)

Inside Radios(\Elfin) folder (see below) you can store any %radio%_0x300.nb in order to use in your Rom:

03.34.90_0x300.nb and 03.39.90_0x300.nb are just an example I provide with the kitchen as shown above in order to help you put your files in the correct way. You can find all Elf(in) Radios here.

Inside splash(\SplashScreens\Elfin) folder (see below) you can store any

%##splash%_0x600.nb in order to use in your Rom.

%##splash%_0x600.bmp is required for previewing!

00Splash_0x600 and 01Splash_0x600 are just an example I provide with the kitchen as shown above in order to help you put your files in the correct way. You can find more SplashScreens here or you could make your own with the kitchen tools(See Addons below).

BUT, the most important part is

the CORE folder where all the (simple but brilliant) tools are placed.

In there you should find my batch files:

*. dump_rom.bat and build_rom.bat - which are responsible for combining all the tools in order to make all the necessary operations,

along with UserConfig.ini which holds all the necessary parameters for the kitchen to be able to build a rom.

*. prepare_new_device_from_nbh.bat is a batch file that will prepare all the required files and device.list entries from another device's official rom.

Things you could edit(CAREFULLY) are Devices.list , AutoRecMod.list , OptimizeSYS.list & OptimizeXIP.list . Don't change anything else!

Here is a peek inside devices.list :

$DEV=Elfin
<1 for device that has only wm6.1kernel , 2 for device that has wm6.1kernel AND wm6.5kernel , 3 for device that has only wm6.5kernel>
KERNEL=1
dpi=96
resh=240
resv=320
ModelID=ELF0*****
CID=11111111
chunksize=1024
GSMHeaderType=0x300
<" -s" Switch if device's Splash.nb requires smartphone signature , leave blank if device's Splash.nb DOESN'T require smartphone signature>
SplashSwitch= -s
SplashHeaderType=0x600
<Size of device's Splash.nb>
SplashSize=196608
<" -t 0" for 0x00 or " -t 255" for 0xFF>
SplashPaddingType= -t 0
OSHeaderType=0x400
<hermes for Sectorsize=0x208 , kaiser for Sectorsize=0x808 , titan for Sectorsize=0x800 , leave blank for Sectorsize=0x200>
NBMerge=
<reduce for device that ULDR can ONLY be reduced , remove for device that ULDR can be totaly removed>
ULDR=remove

B2_Kitchen_GUI is the Graphical User Interface I created in order to make things easier, faster and more friendly.

I have to say that I am not a programmer but I tried my best to make a shell for the kitchen that works fast and is SIMPLE! There is no need to make things more complex.

So all this application does is:

[Packages Selection]

a. Shows all the SYS Packages from the BUILD & LOCALE you've chosen.

b. Shows all the EXT Packages that are placed inside the EXT\Elfin folder:

You can either have your packages DIRECTLY under EXT\Elfin

or

make subdirs(

limitation

:up to 16!) to organize them better(i.e. EXT\Elfin\Tweaks , EXT\Elfin\TodayItems , EXT\Elfin\Apps , EXT\Elfin\Utilities , etc).For this to work you have to go to EXT Paths and edit them(Read below).

You can select which packages to include in your ROM by ticking the checkbox infront of the package's name.

If you have it unticked then the package will be skipped.

If you

double click the name of the package

you will open that package's folder.

If you

double click inside the selection cell

but not on the checkbox then you can select/deselect ALL packages.

If you

right click the package

then you can directly edit (*if included*) the package's *.rgu , app.reg , app.dat , app.mscr.

Besides that you can upx any included executables , compress any included pngs and recmod any included modules.

You'll also see in the Packages Selection that there are 3 columns "P" , "B" , "L" following the Package's name.These will have an effect ONLY IF you select an edition under Configuration Settings!

If you want "Package1" to be included/excluded in your Premium edition then you must have the checkbox under "P" ticked/unticked.

If you want "Package1" to be included/excluded in your Basic edition then you must have the checkbox under "B" ticked/unticked.

If you want "Package1" to be included/excluded in your Lite edition then you must have the checkbox under "L" ticked/unticked.

There is also a ZIP Column. That Column is used to "mark" which EXT Packages you wish to convert to "Mscr_Packages".

It has three states:

1. If checkbox = unticked then nothing will change.

2. If checkbox = ticked then Selected Package will be converted to a Mscr Package (this is useful ONLY for applications that get installed to Program Files)

3. If checkbox = greyed then Selected Package will be converted to an Extendir Package (this is useful ONLY for applications that get installed to Windows)

When you hit the "ExtToMscr" the kitchen creates an archive(with the extension *.xdaz) from the Package's files and writes the necessary "app.mscr" (something like the equivalent of "app.dat").

For this it needs the "app.dat" inside the EXT Package so that it translates it to "app.mscr".

(This operation doesn't take place each time you hit the build button)

Your (original)EXT Packages will be copied to TOOLS\pkg\EXT.bak as a backup and only the (converted)Mscr Packages will be kept inside EXT[folder].

These new packages will be used ONLY IF you select "mscr" for ARType( = AutoRun Type).

[Main Functions]

FIRST of ALL select device.

Since this is about Elfin you'll be able to see only the "Elfin" in the List!<==Check out Devices.list inside CORE!

a. By clicking the "Dump" button you call the dump_rom.bat from the CORE folder and you can see the output in the "Process" window.

Drag'n'Drop a file on this button works the same way!

Right Click on this button will show you the option to Prepare New Device , meaning use another device's official rom to dump&prepare everything that is required by the kitchen to operate.

When everything is completed you'll be asked whether to auto move files or not!

(Next to this button are 2 icons :

* The folder-icon is a shortcut to BaseRom(folder)

* The first one opens the below form. Drag n' drop works for every button you see there!

)

b. By clicking the "Build" button you call the build_rom.bat from the CORE folder and you can see the output in the "Process" window.

(Next to this button are 2 icons :

* The folder-icon is a menu that includes "ExtToMscr" button and shortcuts to EXT, OEM, SYS and EXT.bak(folders)

* The first one opens the below dialog. From there you can select the operating mode of the kitchen!

If in OEM mode the ROM will be built using only Packages from "Pkgs" subfolder!No EXT packages will be used!

If in EXT mode the ROM will be built using only EXT Packages!No packages from "Pkgs" subfolder will be used!

)

c. By clicking the "Stop" button you stop the process you started.

d. By clicking the "Flash" button you exit the kitchen and start the ElfinCustomRUU in order to flash the ROM you selected to your device.

(Next to this button is a phone-icon :

* If you click this icon you can select from a dropdown list which rom to flash.

* If you double click the icon you open the RELEASE\Elfin(folder))

e. If you tick RecModSYS then during the building process the kitchen will check if SLOT 0 is overfloating with modules and it will try to rebuild the ROM after "RecModing" some modules.<==Check out AutoRecMod.list inside CORE!

f. If you tick -imgstart then the imgfs start-address will be moved up right after xip's end. This is like setting -ImgStart 0 to implantxip's parameters!

If you want to set your own hex address right click the checkbox and enter in the box that will appear what you want for imgfs start address!

g. If you tick -uldr then ULDR partition will be reduced (or if possible removed).

Of course you don't need this if you keep on using the provided OS.nb.payload file.

h. If you tick Extendir then you will be using ShaDrac's driver (Extendir v2) to build your rom. Here is his thread for getting an idea about this driver. Respect the licence agreement!

Any package that is going to be used along with extendir should start with the prefix "Extendir_" (eg: Extendir_Arcsoft_MMS_5_0_70_24_B6_0)

For anything having to do with the driver itself post in the original thread! In this way you'll have better chance in getting help from the developer himself and also help in testing the driver!

i. If you tick -SYSDuplicates then ONLY when you build your rom the kitchen will search and remove any duplicates found inside SYS only.

j. If you tick -EmptyPkgs then then ONLY when you dump a rom the kitchen will remove any empty packages found.

k. If you tick SortRegistry then ONLY when you dump a rom the kitchen will sort each registry file from your dump to make it more readable.

l. The configuration panel lets you choose through locales and builds that you have in your kitchen.

*. If you right click inside the "Locale" box you have the option to edit the initflashfiles.dat of selected language.

*. If you right click inside the "build" box you have the options to :

1. Optimize XIP of selected build. <==Check out OptimizeXIP.list inside CORE!

2. Optimize SYS of selected build. <==Check out OptimizeSYS.list inside CORE!

*. Additionally you can choose PagePool Size(0-20) and Compression(XPR-LZX-None) method.

*. There is also the ability to have 3 editions of your rom (Premium, Basic, Lite).

Selecting an edition is optional, so if you leave "Edition" blank, then the "P" , "B" , "L" selecting doesn't matter!

*. If you are a fan of MortScript like me and you use an "Autorun.mscr" then the following may come in handy. You can put inside Autorun.mscr[folder] your AutoRun.mscr[file] and when you decide to build your rom

with ARType = mscr the Mscr packages inside EXT[folder] will be used and each package's "app.mscr" will be added to your AutoRun.mscr[file] at #INSERTPOINT(this line is required in your script!!!).

If ARType = other then none of these Mscr packages will be used and the rom will be built normally (assuming that you have another way of "AutoRun things"(eg: AutoRun.exe or RunCC.exe ,etc).

*. Finally you can enter some info related to your rom version,language,MID and CID that are required for yang to generate the flashable *.nbh.

*. Adding Radio and Splashscreen during building is supported too.

*. When you close the kitchen, it minimizes to tray from where you can access many functions and browse the kitchen's folders.

If you want to exit the kitchen while it is visible press F1 !

[Addons]

From this set of buttons you can access all the extra tools that come with the kitchen.

I added in place of htc Rom Tool a new Interface I made based on Da_G's NBHImageTool.

Additionally:

Drag'n'Drop works for

"Modules Tools" button (if you drag a module it will be converted to file - if you drag a file it will be converted to modulle),

"splash" button (if you drag a *.bmp it will be converted to *.nb - if you drag a *.nb it will be converted to *.bmp),

"EXT Packages Creator" button (drag your cab(s) and convert it(them) to EXT Package(s)),

"txtEditor" button (If you set a default path for txtEditor then by clicking that button that file opens automatically)

You can see lists of *.mscr , *.xml , *.provxml & *.cpr inside your kitchen by simply clicking the relevant button.

If you click on any file you see in those lists you open it for editing.

Finally you can assign 4 favorites links to the 4 buttons at the bottom!

Those links can be applications, folders, batch files or urls.

In order to set your own you must edit the file TOOLS\addons\myaddons.ini and add 1-4 lines in this format : addon #|Name|Path

For example :

addon 1|CFF Explorer|C:\Program Files (x86)\Explorer Suite\CFF Explorer.exe
addon 2|Tiny Hexer|C:\Program Files (x86)\mirkes.de\Tiny Hexer\mpth.exe
addon 3|Icon Editor|C:\Program Files (x86)\Icon Editor\IcoFX.exe
addon 4|Manila Kitchen|C:\Program Files (x86)\Manila_Kitchen

[EXT Paths]

If you leave the paths empty then by default your EXT Packages should be DIRECTLY under EXT\Elfin folder.

If you make subdirs(i.e. EXT\Elfin\Tweaks , EXT\Elfin\TodayItems , EXT\Elfin\Apps , EXT\Elfin\Utilities , etc) and place your EXT Packages inside them then you should edit the paths accordingly (i.e. EXT\Path1 : Tweaks , EXT\Path2 : TodayItems , EXT\Path3 : Apps , EXT\Path4 : Utilities , etc)

[ Help]

Some URL links that have a lot to do with cooking and customizing roms.

[SAVE_icon]

If you double click this icon then you'll save your current project(its name will be the Edition.build.locale.date&time of saving).

If you click the icon then you can select from a dropdown list which saved project to load.

donation is a URL link that bepe's PRB generates each time you run it. Clicking it is supposed to be a nice way to say thanks to a great developer like him, but unfortunately it gives a "404 Not Found". So the kitchen fixes that URL link too in order to point to bepe's donation link.

VI. This kitchen has started and has been continued for the Elfin, but now can (in theory) support other devices too.

If anyone wants to try this kitchen for another device then she\he should:

1. Place an official rom (Preferably of type RUU_%%%_Signed.exe) for her\his device inside BaseRom folder.

2. Right click the [Dump] button >> Click [Prepare New device].

3. When the process finishes you have the option to let the kitchen do the rest automatically OR you can do them manually, meaning:

a) To edit the (TOOLS\CORE\)devices.list (I have added a couple of devices as examples) and add the generated %DEV%_Entries.

b) Then move the generated folders and files:

-EXT\%DEV%\

-OEM\%DEV%\

-ROM\%DEV%\

-ROM\%DEV%\6.1Kernel\

-ROM\%DEV%\6.5Kernel\

-ROM\%DEV%\Extendir_OEMXIP\

-ROM\%DEV%\OEMXIP\

-ROM\%DEV%\OS.nb.payload

-ROM\%DEV%\romhdr.bin

-TOOLS\CORE\Saved\%DEV%\

-TOOLS\Radios\%DEV%\

-TOOLS\splash\SplashScreens\%DEV%\

c) Only thing left will be to create the folders:

-Autorun.mscr\%DEV%\

and put inside your ARMS script

-RELEASE\%DEV%\

-RELEASE\%DEV%\MyRoms\

and grab your device's CustomRUU from xda and place it correctly:

-RELEASE\%DEV%\%DEV%CustomRUU.exe

(Name is sensitive : i.e. Elfin => ElfinCustomRUU.exe , LEO => LEOCustomRUU.exe , Diamond => DiamondCustomRUU.exe , etc.)

VII. Points that require ATTENTION:

1. In order to add a new build you must add the necessary folders to the correct locations.

(i.e. To add Build 23545 you must add the folder 23545 with the SYS Packages under SYS\

and

the folder 23545 with the MSXIPKernel Package under ROM\)

2. In order to add a Language you must add the localization's files under each required location.

(i.e. To add Greek Language in Build 23545 you must add the folder 0408 with the corresponding files to various locations:

under OEM\Elfin\

under SYS\23545\dpi_96\

under SYS\23545\dpi_96_resh_240_resv_320\

under SYS\23545\SHARED\)

3. Each Radio(*.nb file) and each Splash(*.nb file) must be named like the provided with the kitchen examples.

Meaning that the name of each radio file must end with "_0x300" and the name of each splash file must end with "_0x600" (This is for Elfins!)

4. Converting EXT Packages to MortScript Packages is useful for two types of applications:

(a) Applications that are installed to Program Files\

(b) Applications that are installed to Windows\

Converting type (a) to Mscr_Package

has the following result:

Instead of having the application's files inside Windows and then copying them with a *.dat file to Program Files\,

you just have one archive inside Windows which gets extracted to Program Files\.

This way:

(i) You avoid having duplicates files in your rom,

(ii) You avoid having too many files inside Windows that slow down your device,

(iii) In some occasions you have faster booting

Converting type (b) to Extendir_Package

has the following result:

Instead of having the application's file inside Windows or in a cab file that gets installed during booting

you just have one archive inside windows which gets extracted to Extendir\Windir\

and gain all the benefits of the Extendir driver.

This is free to use or edit but at your own risk, I take no responsibility for any damage caused to your phone!​