[How to] Rom cooking

Search This thread

kia1349

Senior Member
Jul 2, 2010
190
12
TEHRAN
hi to all
how to add a new language to rom for full persian/arabic interface?
which file/files should be edited?
 
J

jj_95nano

Guest
Very Inspiriational....

You're amazing! I know this isn't related to HTC Hero, but I ported a hero ROM for the HTC Tatto!!!!!! All b'coz of your post. Thank You!!!!!
 

narell

Senior Member
Oct 23, 2012
61
1
Rio Claro
Androsign script (linux)[/SIZE][/B]
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.

After using the Androsign tool can roms be flashed via stock recovery or do i need a custom recovery?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Original post:

    Hello,

    I am new to android but not to linux. I used to tweak my winmo phone rom.

    I have backed up my device with nandroid. I just need some explanations:

    - why isn't the radio extracted?
    - how can I "extract" does .img files to modify and then rebuild them?

    I found some informations of what the .img files contain here: ROM Partitions it should be the same for Hero

    I have found some informations on how to push updates to the rom by looking at modaco updates. It seems quite simple to delete/copy files on the hero rom using an update-sript file. I am however curious about the RSA cert and if some files need to be signed.

    Any information welcomed.

    Regards

    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 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 find
    - how to dump radio from device
    - how to build a custom hero kernel (waiting for HTC sources)

    To come
    How to prepare your own kitchen and useful scripts (linux)
    1
    I am new to android but not to linux.

    Same here. I do lots of tweeking on my linux machine, so i know quite a lot of linux. If there would be anyone to answer those questions by gecka, I might start tweeking the rom (maybe someday cook one up)

    Best regards
    1
    Hello,

    First post edited, but still some ignorances... Please share if you know anything.

    Best regards
    1
    unpack and pack boot.img and recovery.img

    First you need utilities such as mkbootfs and mkbootimg. maybe you can find them online (i can upload them later compiled for linux x86-64) but i suggest you download android source (http://source.android.com) and do a generic make. In this way you have these and other utilities(tools to pack system.img too, but if you haven't an engineering bootloader you can't flash it directly) in /out/host/... (it's better if you add this in your PATH)

    To unpack and pack boot and recovery, read here:
    http://xdaforums.com/showthread.php?t=443994
    or here:
    http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images


    ...or...
    (I have attached extract-kernel and extract-ramdisk scripts from JF build environment) :

    to unpack (boot.img or recovery.img, i'm writing the commands with boot.img):
    Code:
    extract-kernel boot.img
    extract-ramdisk boot.img
    at this point you have

    • boot.img-kernel
    • boot.img-ramdisk

    to repack (boot.img or recovery.img):
    For hero you need to specify the base address because it's different (0x19200000). For more information: http://xdaforums.com/showthread.php?t=541522.

    Code:
    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

    Useful resources for android modding are the dream forums (most of the concepts/hacks works for hero too):
    http://xdaforums.com/forumdisplay.php?f=448
    (informative thread here: http://xdaforums.com/showthread.php?t=519523)

    note: mkbootimg with --base support is in donut and master (or find the patch on gerrit and apply it to cupcake)

    :D
    1
    First of all, the reason you cant unyaffs anything other than system.img is because they aren't YAFFS images. boot/recovery is kernel+initrd like in any normal linux bootimage scenario (see more below).

    Tofind
    - how to dump radio from device
    Haven't gotten into that myself yet, but I know modaco posted an update.zip with radio image included on this very forum. Look for it.

    - how to extract NAND images other than system.img
    http://xdaforums.com/showthread.php?t=443994
    - rebuild NAND images such as system.img
    This isn't hard, just loopback mount an image on your linux box and format it with YAFFS.