PPCGeeks

PPCGeeks (http://forum.ppcgeeks.com/index.php)
-   HTC Apache (http://forum.ppcgeeks.com/forumdisplay.php?f=14)
-   -   How To: Build your own Custom ROM! (http://forum.ppcgeeks.com/showthread.php?t=1904)

Wideawake 01-18-2007 05:07 AM

How To: Build your own Custom ROM!
 
4 Attachment(s)
First let me say that Im a novice at this, so take what I have said below with a pinch of salt. As its all done from my head and not recreating the steps myself. And if anyone wants to correct me on any point that Im wrong, feel free to do so. I took a simple method in which you had to use the command prompt and made .bat files to enter everything for ya. So this makes it quicker and easier than having to remember that to decode you use the command "prepare_imgfs.exe nk.nba -nosplit" and so on. I will post the advance/command prompt method when I get time. Big thanks always goes out to XDA-Developers, Buzzdev.net, and all others who helped in creation of these tools used. Detailed credits and links on the installer. ;)
Have fun!
Mike

Note: You will need both parts of my custom package attached. And you have to be logged in to see and download the files.


Files you need to work on and how to get them.


1. You will need to download the Custom ROM package I put together. It includes almost every tool that I myself personally use in the making of my Custom ROM and other development tools. Once you have downloaded the package, extract the .exe file from the .zip. Run the .exe. This will create a new folder located at C:\Custom ROM Tools. It will also place a shortcut to the folder on your desktop.

2. Now we have the toolkit you can begin work. You will need a Offical (and/or unoffical) ROM and/or complete upgrade package. You can download that from the UTStarCom site.

3. Install winrar (located in the Apps folder) if you dont have it installed already. Extract the .exe downloaded by right-clicking on it and extract anywhere you like. (Just remember the location ;) )

4. Once extracted you will have a folder that contains two folders. One will have 3 files in it. (nk.nbf, ms_.nbf, and radio.nbf) The two you want are the nk.nbf (the core OS) and the ms_.nbf (the ExtROM).


Decoding the .nbf to a .nba.


1. To decode you .nbf to a .nba open the Custom ROM Tools folder and cut and paste your nk.nbf into the 1. De-Encode .nbf folder.

2. Run the HTC64 Tool, select Decode. In the browse box find the nk.nbf. Click next, It will give you a warning that you CAN ignore. On the next screen, in the FAT16 File box, change the extension from .fat to .nba. Then click decode. This will decode the ROM to a nk.prj (Project File) and a .nba file which can be dumped.

3. Now you wanna cut you nk.nba from this folder and move over to the folder named 2. IMGFS Tools. Once you have the nbf in the folder you can run the nba_to_dump.bat. This will convert your nbf file into a DUMP folder. This folder contains both files (ones not in folders) and modules (the ones in folders). You can modify this folder as needed for your custom Rom.


Modifing the registry (hv files)

1. You have 3 main files that contain registry entries. (boot.hv, default.hv, and user.hv) boot.hv has been included (XIP Tools folder). The other two you can retreve from the DUMP folder. Make sure you set your folder options to view hidden/system files. Boot.hv is loaded on first boot I do believe and contains HKLM values. Default.hv also contains values for HKLM. User.hv contains values for HKCU. These files have to be as close to matching in values as possible. If one says it then the other should also. ;)

2. Converting the files to txt files to edit. To do so just place whichever you would like to work on, in the folder named 3. HV Tools. Run the appropriate *blank*_hv_to_txt.bat and it will convert it to a txt file, that can be edited.

3. Once you have the txt file, open it and add the following line to the very top. "REGEDIT4" no quotes. And save as a unicode file. If the txt moves and becomes unformatted, disregard the txt file and start over. I would add the line to the top and save as unicode first BEFORE modifing the file, to cut down on issues.

4. Edit the file as you like.

5. Then just run the correct make_*blank*_hv.bat and this will convert it back into default.hv and so on.

6. To replace, just cut and paste it back into the DUMP folder with the exception for boot.hv. To replace/edit this one, go to step 7. Note: Dont go to step 7 until you have recompiled your DUMP folder back into a nk.nba file.

7. Editing/Replacing the boot.hv and boot.rgu (both have to be matching files) In folder 4. XIP Tools you will find the files boot.hv and boot.rgu. If you wanna modify your boot.hv then you can right click on boot.rgu, edit it as you like, and save. The boot.rgu then can be converted to a boot.hv by running make_boot_hv.bat. To replace these files, place your nk.nba into the the XIP Tools folder and run the Replace&AddBootXIP.bat. This will replace both files for you.


Setting up file flash directories. (Creating new folders....etc.)


1. You will need to find the file names initflashfiles.dat

2. Open the file with notepad and add any .lnks or new folder directories you want here.
Code:

Directory("\Windows\Start Menu\Programs\Games"):-File("Pocket Chess.lnk","\Windows\Pocket Chess.lnk")
Would add a link to pocket chess to the games folder.

3. After editing, just click file/save.

4. Install Hex Workshop Trial if you havent already. Open initflashfiles.dat in the hex editor. The first 4 digits should say FFFE or something like this. Highlight those first 4 numbers and right click and delete. This is the header written in by notepad. This HAS to be removed for you initflashfiles.dat to work correctly. Then save.

5. Replace the original file with the modified version.


Rebuilding your nk.nbf from your modified DUMP folder.

1. After you are finished with all the above (minus replacing the boot.rgu and boot.hv) and have a "finished" product. You can run the dump_to_nba.bat which will convert your modified DUMP folder back into a working nk.nba file.

2. Now to convert back to a nk.nbf. To do so, just take ur newly created nk.nba and move it over to folder labeled 1. De-Encode nk.nbf. Run HTC64 Tool and select Encode. It will ask for the .prj file. Open it and press encode. You may get a overwrite warning....just ignore and click ok.

3. You now have a nk.nbf thats ready to be flashed onto your device.


Changing bootscreen.

1. copy your nk.nba file into the directory 5. BootScreen, then rename to nk.fat.

2. Run patchlogo.exe, select nk.fat in the first dialog and your preferred .nb file in the second. Note: If you have a 320X240 image you would like to use, you can use the nb_image_converter_859_418.exe to create a custom .nb file

3. Rename the nk.fat back to nk.nba and convert back into a nk.nbf.


Flashing your newly made nk.nbf.

1. Take the nk.nbf and move to the 6. Flash folder. Once there connect your device to the PC in bootloader mode.

2. Run MaUpgradeUt_noID.exe and wait! Your almost there.

3. After it upgrades, Hard Reset. And voila your own Custom ROM!


Making a flashable ExtROM.

1. Take the ms_.nbf we extracted in the beginning and decode using the HTC64 Tool. This time instead of changing the file extension from .fat to .nba we are gonna leave it as a .fat file.

2. Install Extra Drive Pro Trial, if you havent done so already. Now in Extra Drive Pro. Select the option to make a file to drive. In the panel open up the ms_.fat we just created. This will mount the .fat to a editable drive.

3. Open the drive, you will see a folder that says something like TFAT_SOMETHING. Open it and add your cabs and config.txt here making sure that it is READ-ONLY!

4. Close/unmount the drive.

5. Reconvert back into a ms_.nbf using the HTC64 Tool. Drop it in the flash directory and run MaUpgradeUt_noID.exe. Or you could place both the ms_.nbf and the nk.nbf in the flash directory and flash both at the same time.

Other Info.

You can use the included app Resouce Hacker to edit .exe and .dll files. Important if your gonna be replacing icons of programs.

WinCE Cab Mgr is included so that you may learn how to build/make your own .cab files. Can also be used to extract the contents of .cabs.

naigaboy 01-18-2007 12:41 PM

Lot of info, but I am definitely going to test this out over the weekend. Thanks for trying to make all of us PPC gurus. :D

JackSchitt28 01-18-2007 04:54 PM

thanks for all the hard work mike. thats a huge brain overload for me right now. i will have to read it piece by piece over time to grasp the whole concept or else my head might explode.

Wideawake 01-18-2007 04:59 PM

Its actually been dumbed down with the use of the .bat files. And yea I hope to see some user custom ROMs available soon ;)
~Mike

Bushrod 01-18-2007 05:15 PM

How much free space is there in a ROM to add files? For example, if I wanted to create a ROM with something that takes 2.5 MB already installed, would I just copy the files to the directory, create the reg entries and add the link with initflashfiles.dat? This sounds pretty simple!

JackSchitt28 01-18-2007 05:17 PM

i am scared. makes my face tingle thinking about doing this.

MadManX 01-18-2007 05:22 PM

Great work...

Well when I'm done moving and get some time to rest... I think I'll borrow one of your ROMs and start hacking away at my requests :) Anyone know where I can find the old Red Sprint Logo?

-MadManX

JackSchitt28 01-18-2007 05:28 PM

here are 2 variations of it
http://img406.imageshack.us/img406/3...osprintwi7.gif
http://img120.imageshack.us/img120/9...t20logolj7.gif

Wideawake 01-18-2007 05:58 PM

Yea bush that's it, simple as that but it may take a lot of trial and error before u get I completely figured out.

Jack just give a whirl, promise its not as hard as it looks. :D

madmanx feel free too, and enjoy.
~Mike

Bushrod 01-18-2007 06:02 PM

It looks pretty simple, in theory!

How would I put files in \Program Files? I can see all of the decoded files from the \Windows folder. What I'd like to do is start with something simple like TCPMP in ROM. Do you think that is possible?

Wideawake 01-18-2007 06:06 PM

yes tcpmp should be simple. If I'm not mistaken u can set that with the initflash file....but I may be wrong. What I have been doing it editing reg entries to point to the windows directory, and placing files there.
~Mike

Bushrod 01-18-2007 06:07 PM

Aha! Thanks for the tip! I want to put the logmein files there, too!

Wideawake 01-18-2007 06:12 PM

no problem! Enjoy and do u plan on sharing urs once completed or keeping to urself? :D
~Mike

Bushrod 01-18-2007 06:37 PM

I'll gladly share if anyone's interested. I was also planning on adding a browser that shows the "pixels" nicely. Don't know about sharing that one...

I've tracked down the initflashfile syntax to make directories and move file to them. It looks like it just copies the files from \Windows to \Program Files and takes up internal storage after all. I think your changing the Reg entries and pointing everything to \Windows is the way to go to save space!

colonel 01-18-2007 06:40 PM

Just to clarify as I am starting to play.

"3. Now you wanna cut you nk.nba from this folder and move over to the folder named 2. IMGFS Tools. Once you have the nbf in the folder you can run the nba_to_dump.bat. This will convert your nbf file into a DUMP folder. This folder contains both files (ones not in folders) and modules (the ones in folders). You can modify this folder as needed for your custom Rom. "

You start by referencing the .nba file then switch and mention the nbf file twice. I am assuming that this is a typo, but just want to catch things as I am going through this so it doesn't confuse others.

colonel 01-18-2007 06:44 PM

Also, before people go wild with this, should there be some ground rules about what can or cannot be put in the Rom?

More specifically, I am planning on trying to get some apps in that are not freeware. Obviously this can bring about some rights issues if I freely distribute Voice Command, iGuidance, etc. Of course the don't ask don't tell is always an option.

Bushrod 01-18-2007 06:50 PM

I would definitely NOT distribute commercial apps in your rom! I'd say that thing that require serial numbers would be ok as the user could enter their own serial number, like Memmaid or Resco Explorer.

colonel 01-18-2007 07:09 PM

Good points Bushrod. Apps that required serial numbers or had trials would be fine, but could also eat space for people who don't want (want to pay for) them.

Also, saw you on the xda site about WM6. Did you get it running on anything or were you just grabbing it while you could?

Wideawake 01-18-2007 07:17 PM

lets not get off topic here. I would only put freeware actually into the ROM unless its for personal use only and u own a copy. ;)
~Mike

Wideawake 01-18-2007 07:21 PM

Quote:

Originally Posted by colonel
Just to clarify as I am starting to play.

"3. Now you wanna cut you nk.nba from this folder and move over to the folder named 2. IMGFS Tools. Once you have the nbf in the folder you can run the nba_to_dump.bat. This will convert your nbf file into a DUMP folder. This folder contains both files (ones not in folders) and modules (the ones in folders). You can modify this folder as needed for your custom Rom. "

You start by referencing the .nba file then switch and mention the nbf file twice. I am assuming that this is a typo, but just want to catch things as I am going through this so it doesn't confuse others.

yeap typo...it was lae last night :D I will edit. ;)
Thx,
Mike

colonel 01-18-2007 07:26 PM

One more question, where is the initflashfile.dat located?

Wideawake 01-18-2007 07:28 PM

in the DUMP folder, but go to folder options, view and select show all files and uncheck hide protected os files. then u will see a lot more files in the dump folder. ;)
~Mike

colonel 01-18-2007 07:38 PM

Thanks, thought I did that but missed that check box. For reference, on my PC it is under Tools\Folder Options\View. I missed the box that said "Hide Protected Operating System Files". Just in case someone else runs into this.

colonel 01-18-2007 09:28 PM

Quote:

Originally Posted by Bushrod
I'll gladly share if anyone's interested. I was also planning on adding a browser that shows the "pixels" nicely. Don't know about sharing that one...

I've tracked down the initflashfile syntax to make directories and move file to them. It looks like it just copies the files from \Windows to \Program Files and takes up internal storage after all. I think your changing the Reg entries and pointing everything to \Windows is the way to go to save space!

How much internal storage do you think it is taking up? I do not think it is duplicating the files, just moving them, but I may be wrong.

Also, I am pretty sure Faria's 3.3 ROM for the wizard has TCPMP in it. You could extract that rom as a roadmap.

colonel 01-19-2007 06:36 PM

Question, when using FileDrivePro, where do you pull up the ms.fat? I clicked on the file to drive button. At the top it shows all of my existing drives. At the bottom left it shows available drives. I just can't figure out where to open the ms.fat file from.

Wideawake 01-19-2007 06:44 PM

when u click mount file to drive a box should pop up and have two choices the top being chosen. check the bottow circle and browse and find the .fat from there.
~Mike

colonel 01-19-2007 07:08 PM

yeah, just figured it out. Mine didn't automatically pop up, but you can just click on the New Drive button on the bottom left. The choose "Mount virtual drive from existing container".

Wideawake 01-19-2007 07:13 PM

u like exact instructions huh? :D I do mine by memory so forgive my explanations. :P
~Mike

colonel 01-19-2007 07:25 PM

Just figured that I could explain what to do for future readers. :wink: Your instructions are great.

I hate when I am going through a thread and someone has a problem, finds a solution, and then just posts "Figured it out" or something like that.

colonel 01-19-2007 09:42 PM

Another question, how do you control where files are installed. I know how to edit the flash file to create folders (which I guess would work), but what if I just need to get a .dll from \Windows to \Windows\System?

colonel 01-20-2007 10:01 PM

Mike, Bushrod, or anyone else,

This is really becoming frustrating. I am having issues with the dump-to-nba.bat. When I run it, it goes through processing everything which seems to take just under forever. Then it finally finishes and says "Press any key". I do and where it normally says something about the imgfs bin file there is a bunch of jibberish in a foreign font. Then it says press any key. When I do, the box closes, but no nba file is created.

Are we supposed to do something to the imgfs raw data bin? I was under the assumption that this was all done. However, if I remove the bin file that was created during the nba-to-dump, the dump-to-nba has a system failure and will not run.

So, now I am at a point of real frustration because I keep trying to get it to work, but each run is 10-15 minutes. Then I get the same error everytime. Hopefully someone can point me in the right direction.

indoe 01-21-2007 05:20 AM

i replaced a bunch of drivers on WM6 crossbow WWE 5.2.318 INDRA and that dont work to bad there no doc on doing somthing like this ill keep trying

indoe 01-21-2007 05:33 AM

Wideawake do you have a list of drivers? and if so can you post them

Wideawake 01-21-2007 09:24 AM

I have a list somewhere I made of every driver file I could find. But I think u have to hybrid registrys too to port akus. But I'm not sure.

colonel is ur nk.nba not in the imgfs tools folder? when u run dump to nba it will first patch the imgfs_raw and then patch the nba file from there but they both have to be in that directory for this to happen ;)
~Mike

indoe 01-21-2007 09:56 AM

Quote:

Originally Posted by Wideawake
I have a list somewhere I made of every driver file I could find. But I think u have to hybrid registrys too to port akus. But I'm not sure.

colonel is ur nk.nba not in the imgfs tools folder? when u run dump to nba it will first patch the imgfs_raw and then patch the nba file from there but they both have to be in that directory for this to happen ;)
~Mike

were you able to get ROM Kitchen working?

also can you only get a "boot.rgu" off a rom dump?

Wideawake 01-21-2007 10:03 AM

Didn't try a ROM kitchen and I will see if I can't find the syntax to get boot.rgu from the ROM. I think u will have to use ROMMaster which is in the XIP tools folder.
~Mike

colonel 01-21-2007 11:32 AM

Quote:

Originally Posted by Wideawake
I have a list somewhere I made of every driver file I could find. But I think u have to hybrid registrys too to port akus. But I'm not sure.

colonel is ur nk.nba not in the imgfs tools folder? when u run dump to nba it will first patch the imgfs_raw and then patch the nba file from there but they both have to be in that directory for this to happen ;)
~Mike

Yep, everything is there. That is why I cannot figure it out. It seems to work fine if all I do is add one little .exe, but once I do a bit of work it goes haywire. I noticed that when it works correctly, at the end, the .bat says something about searching for the imgfs then something about fixing it. This is where the jibberish is so that is why I was wondering if I was missing something. I guess I will keep at it.

Wideawake 01-21-2007 03:58 PM

what kind of jibberish? have u removed somethings to clear space before adding a lot? Maybe a few screenies of what u get?

colonel 01-21-2007 06:06 PM

Seems to be rolling along fine now. It could have been a problem with adding too much. I notice that all the .nba files are 63.2MB or something close to that. Is there a limit on how large the dump file can be?

Also, one other thing that has come up while tweaking the registry is that once I flash, it does not boot. I assume that I am not doing something correctly when replacing the .hv files. Here are my steps:

1. Convert .hv to text
2. add REGEDIT4 (still not sure why) and save as Unicode
3. make changes and save
4. convert back to .hv
5. copy back into dump
6. dump back to .nba
7. add boot.hv to .nba
8. convert to nbf and flash

Three things rattling around my head. Am I supposed to remove the REGEDIT4 before converting back to .hv and what is that for? When converting back to .hv a boot.hv and boot.rgu are created. Am I supposed to disregard these (are they trash) and use the ones in the XIP folder? Finally, do you need to do this whole boot.hv add&replace bat everytime, everytime there is a registry change, or only when the boot.hv is altered?

Thanks again for the help

Wideawake 01-21-2007 06:13 PM

only replace if u change the boot.hv. (in xip folder) Boot.hv and boot.rgu made in hv folder have to be named that but are NOT really boot.hv or .rgu it just has to name them that to convert back to hv form. Won't boot? Souns like ur .txt file is getting rearranged when u save as? does the format mess up? are u saving first then editing? unicode?
~Mike


All times are GMT -4. The time now is 07:29 PM.

Powered by vBulletin® ©2000 - 2024, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com


Content Relevant URLs by vBSEO 3.6.0