Go Back   HTCPedia.com forums > Android Platform > General Android HTC Devices > HTC Hero > HTC Hero Root/Rom Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old December 1st, 2009, 09:23 PM   #1
lox
Retired Staff
 
lox's Avatar
 
My Device: HTC HERO
 
Join Date: Oct 2009
Location: Kanaky-New-Caledonia
Posts: 179
lox is on a distinguished road
Lightbulb [HOWTO] Rom cooking

How to:

Extract NAND image files
To extract .img files, I have found unyaffs from http://code.google.com/p/unyaffs/ I have compiled it under ubuntu 64 (attached). Unyaffs works on system.img but on no other .img file

To extract boot.img use attached extract-kernel.pl and extract-ramdisk.pl
# extract-kernel.pl boot.img
# extract-ramdisk.pl boot.img

Should work for recovery.img but haven't tried as custom recovery images on the forum are great.

Rebuild system.img

Seems you just need "to loopback mount an image on your linux box and format it with YAFFS".

But it is useless as because Hero's SPL does not allow flashing system.img directly. You should use an update.zip package for that. (read below)

Rebuild boot.img

After extracting your boot.img using attached extract-*.pl
To find
- how to dump radio from device
- how to build a custom hero kernel (waiting for HTC sources)and tweaking it, in same folder run:
# mkbootfs boot.img-ramdisk | gzip > ramdisk-boot
# mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-boot --cmdline "no_console_suspend=1 console=null" -o newBoot.img --base 0x19200000

Creating an update.zip package
Creating an update.zip package is quite easy in fact. For example, to add a (valid) test.apk package to your rom:

- create an empty folder <workdir>
- create folder structure for test.apk (<workdir>/system/app) and copy the test.apk
- create folder structure for update-script (<workdir>/META-INF/com/google/android)
- edit <workdir>/META-INF/com/google/android/update-script
- put in it:
Code:
show_progress 0.1 0

copy_dir PACKAGE:system SYSTEM:

set_perm_recursive 0 0 0755 0644 SYSTEM:app

show_progress 0.1 10
- compress the <workdir> content to zip (not the <workdir> folder itself)

Now you are going to sign the zip file. Download attached testsign.zip and copy it in your <SDK>/tools folder. Extract it here. It should create a sign subfolder with a testsign.jar file in it.

Then, from <workdir> folder, do:

java -classpath <SDK>/tools/sign/testsign.jar" testsign file.zip file-signed.zip

Ok, now your zip file is ready to be deployed using cyanogen recovery image.

To find more command to use in update-script, look at other's.

Modify .apk package
Seems it is easy to uncompress an .apk package (zip) an to modify files in it and then compress it. But after all: you must sign it like update.zip packages.

ODEX files

- What are those Odex files? Answer.

- How to get rid of them?

Odex files depend on framework they are made for. To deodex an odex file use that how to
Then you may create a classes.dex file by executing the smali program on the "out" folder. You then rename it to classes.dex and add it to the .apk.

- How to create them?

Use dexopt-wrapper on device.

Porting an other device's rom

Well, that part is easy
- extract the system.img
- extract boot.img
- replace boot.img-kernel with the one from your stock Hero rom one.
- rebuild boot.img
- build update.zip package (look someone's hero custom rom to see how to do it)
- sign and flash

It should run place and make calls but probably won't have Wifi, BT, trackball support. If you make those work: tell me, but I think we should wait to be able to compile a 2.6.29 kernel to have those.

Tools

Androsign script (linux)
I wrote that androsign script to quick sign zip files. Just put it in your <SDK>/tools folder, then chmod +x. If you have put the tools folder in your PATH, you can call it directly like this:

androsign /dev/folder1/folder2/update.zip (or any zip/apk file)

It will output an update-signed.zip (or app-signed.apk etc) in the same folder than original file was in.

Notes

Note1: thanks
Thanks to every guy that helped me found all that.

Note1: sharing
I searched for hours, so I am more than happy to share it to save someone's time. I am just disappointed than some people here do not have that spirit: I could have use those hours for development instead of research...

Note3: corrections
So, if you found anything incorrect, would like to supply more informations or want to correct my bad english: just PM me.

To come
How to prepare your own kitchen and useful scripts (linux)
Attached Files
File Type: zip androsign.zip (432 Bytes, 501 views)
File Type: zip extract-*.zip (1.2 KB, 667 views)
File Type: zip mkboot*-linux.zip (21.3 KB, 506 views)
File Type: zip unyaffs.zip (4.5 KB, 399 views)
File Type: zip testsign.zip (12.9 KB, 461 views)
__________________
Lox
"I make things for me and I am just sharing them"

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
lox is offline   Reply With Quote
Sponsored Links
Old December 1st, 2009, 09:29 PM   #2
Senior Member
 
tom_codon's Avatar
 
My Device: Topaz , Rhodium , HD2 , G1
 
Join Date: Jul 2009
Location: Russia
Posts: 566
tom_codon is on a distinguished road
Default

very nice tutorial !

Well done lox

Stuck thread !

Tom
__________________
If you like my work and want to offer some support please click on the Paypal button

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

tom_codon is offline   Reply With Quote
Old December 2nd, 2009, 05:56 PM   #3
VIP Member
 
Ark_N's Avatar
 
My Device: HTC TP2, HTC TP2 CDMA. TMO HD2
 
Join Date: Jul 2009
Location: Portugal
Posts: 1,127
Ark_N is on a distinguished road
Default

Nice one Lox, nice set of tools.

Cheers.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Ark_N is offline   Reply With Quote
Old December 3rd, 2009, 04:06 PM   #4
New Member
 
My Device: htc magic
 
Join Date: Oct 2009
Posts: 3
sitimber is infamous around these parts
Default

im trying to get dex file from extracted odex on my pc not phone and keep getting errors

any help
sitimber is offline   Reply With Quote
Old December 3rd, 2009, 06:27 PM   #5
lox
Retired Staff
 
lox's Avatar
 
My Device: HTC HERO
 
Join Date: Oct 2009
Location: Kanaky-New-Caledonia
Posts: 179
lox is on a distinguished road
Default

Quote:
Originally Posted by sitimber View Post
im trying to get dex file from extracted odex on my pc not phone and keep getting errors

any help
How do you want me to help if you do not give any piece of the errors you get?
__________________
Lox
"I make things for me and I am just sharing them"

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
lox is offline   Reply With Quote
Old December 9th, 2009, 08:29 PM   #6
New Member
 
My Device: HTC Hero
 
Join Date: Dec 2009
Location: VNM
Posts: 3
vuna209 is infamous around these parts
Default

Can we cook ROM on windows! As I read your post, you said that all things were made on Linux, right? Is there anyway to do these things on windows !?
vuna209 is offline   Reply With Quote
Old December 9th, 2009, 11:23 PM   #7
lox
Retired Staff
 
lox's Avatar
 
My Device: HTC HERO
 
Join Date: Oct 2009
Location: Kanaky-New-Caledonia
Posts: 179
lox is on a distinguished road
Default

Quote:
Originally Posted by vuna209 View Post
Can we cook ROM on windows! As I read your post, you said that all things were made on Linux, right? Is there anyway to do these things on windows !?
If Windows is your environment, extract-*.pl scripts are written in Perl. Find how to execute perl scripts under windows.

mkbootfs and mkbootimg may be run using Cywin. Or, maby, windows alternatives exists.

Unyaffs is available for windows (first result)

For signing update.zip packages, you need Java in your PATH.

I have not used windows for years so I won't be much help. But Linux and Macosx (unix based) are the preferred environments for that sort of things. Do you now that Ubuntu has a nice way to install it like a software in windows? Just download, burn the cd, and follow autorun from windows.
__________________
Lox
"I make things for me and I am just sharing them"

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
lox is offline   Reply With Quote
Old December 12th, 2009, 11:30 AM   #8
New Member
 
My Device: X1
 
Join Date: Nov 2009
Posts: 17
Persian-Xboy is infamous around these parts
Default

nice share thanks bro
Persian-Xboy is offline   Reply With Quote
Old December 12th, 2009, 11:32 AM   #9
New Member
 
My Device: X1
 
Join Date: Nov 2009
Posts: 17
Persian-Xboy is infamous around these parts
Default

nice share thanks bro
Persian-Xboy is offline   Reply With Quote
Old December 14th, 2009, 04:37 AM   #10
New Member
 
My Device: HTC Hero
 
Join Date: Dec 2009
Posts: 13
kroosh is infamous around these parts
Default

Hi Lox

I'm trying to port a Magic ROM to hero. I've followed your instructions, they were clear enough.

Though I got stuck when flashing the ROM where I get an error message that starts from line #4 of the update-script. I'm using the update-script attached... I'm using Amon RA 1.5 recovery image.

would greatly appreciate your help.
Attached Files
File Type: txt update-script.txt (2.5 KB, 73 views)
kroosh is offline   Reply With Quote
Reply

Tags
android, rom cooking, tutorial

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUIDE] 56 Universal Tutorials for Customizing any Device and Cooking |23 Jan 09| MrMakk Development and Hacking 16 April 1st, 2010 06:36 AM


All times are GMT -4. The time now is 02:09 AM.

vBulletin® Copyright ©2000-2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.1

2009-2012 htcpedia.com. All rights reserved.