How to create a custom rom for Hero from Android sources

UPDATE1[27.01.2010] If you search on the Internet you can find a lot of custom roms for android phones but when you start searching for an tutorial on how to create one your self it gets confusing. You need to look very well and learn by trail and error to find all the stuff you need to create an rom of your own. That’s why I decided to show you how to create an rom for HTC Hero from scratch.

Creating your work environment and getting the Android sources version 1.5

I already have an automated script (already posted), but because we need Android 1.5 sources and not the master I made an small adjustment. You can download an altered version HERE
Adjustment is downloading the cupcake branch by adding -b cupcake at the repo initializing command.

Create an generic build

This is an optional step but this way you can see if your environment can compile the default build.

cd ~/myandroid
. build/

After waiting for a long time (depending on your machine) and if the compilation goes well you will have the following files:

Test the generic build

This is also an optional step, here I will try to show you how you can test your generic build or some other build on the emulator.

cd ~/myandroid/out/host/linux-x86/bin
./emulator -system ~/myandroid/out/target/product/generic/ -kernel ~/myandroid/prebuilt/android-arm/kernel/kernel-qemu -data ~/myandroid/out/target/product/generic/userdata.img

You should get a window with text “ANDROID”, if so please be patience and wait for the emulator to startup. After the emulator has booted you will have your fresh compiled android running. You can play around with it to see if it works, also check “Menu → Settings → About phone” to see some info about your build.

Create settings for Hero

You have tested your work environment and saw your build work it’s time to create setting for the Hero. When you want to compile an image for an specific phone you need the correct settings for it. All configuration files regarding an device go in to vendor/…. Explaining and finding information about all those configuration files would take a lot of time so I will skip that for now, maybe some other time I will try to explain what every file does and what you can do with it. For now the fastest way to get your configuration files is to use the ones that “loxK” has made, you can find them here.

To make this how to easier I created an zip file for you to download, this zip file contains configuration files (from loxK) but also proprietary files needed by Hero to work properly. I did needed to change some settings to get it to work for me so there is some small difference between my configuration files and the loxK files. Download my configuration files HERE

cd ~/myandroid/vednor/htc
chmod 755 proprietary/akm8973

I forgat to tell you that you need a deodexd in the proprietery folder. Here I made an post on how to do this.

Compile your first Hero rom
Now that we have prepared everything for our Hero it’s time to compile your Hero rom.

cd ~/myandroid
. build/
lunch htc_hero-eng

Again after waiting for some time if everything goes right you will have your own fresh Hero rom ready to use.

Test your Hero rom on an emulator
Sure you can go and install your rom directly on your phone but most of the time it’s easier to look if the rom is working or not and if the changes you made are there correct by running it on the emulator.

cd ~/myandroid/out/host/linux-x86/bin
./emulator -system ~/myandroid/out/target/product/hero/ -kernel ~/myandroid/prebuilt/android-arm/kernel/kernel-qemu -data ~/myandroid/out/target/product/hero/userdata.img

Test your Hero rom on an actual Hero phone

WARNING: Do a backup of your phone(nandroid) before doing anything. PLEASE if you don’t know what you are doing then don’t do it. I am not responsible for any damages you do on your own device!!!

If you are sure and know what you are doing then please proceed.

To test your build on Hero you need fastboot that is containd in ~/myandroid/out/host/linux-x86/bin or you can download it HERE. Other way of flashing your Hero is by using an file. In this how to I will explain to you how to use fastboot. I will explain how to create an from your build in some other future post of my.

My own Hero does not allow me to use fastboot so I need to use As I have heard there are some different versions of Hero (some with different HBOOT), some of these versions allow fastboot and some of the don’t.

This is how you use fastboot:
Connect your phone to your PC, shut down your phone, press and hold the “Back” button and press “power on”. Your Hero should boot in fastboot mode now. Only thing left to do now is flash our new images to the phone. Be aware you need to get an response output from fastboot after every command if not then it’s not working. Also if you get “FAILED (remote: signature verify fail)” you need to use instead of fastboot.

cd out/host/linux-x86/bin/fastboot
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot reboot

If everything went well your Hero will boot with your own cupcake build, have fun.

28 thoughts on “How to create a custom rom for Hero from Android sources

  1. Cris

    Will this work for the CDMA Hero? They just released the source today and i was curious if this will work for it or are there some adjustments that should be made

  2. admin

    The steps for creating the image should work I think. BUT the configuration files and the proprietary files could be en probably will be different than the ones I have here. Because my files are for the “GSM Hero”.

    What kind of source did they release, kernel? Or some other?

  3. Cris

    they released the cdma hero source as well as the tatoo source. I have built kernels for ubuntu and fedora, but im confused because over at xda they have eclair semi running on the .27 kernel and now that the source is out i want to build a .29 kernel with eclair. i don’t know if it can be done, and i know it will involve porting over some of the code in the .27 kernel but i would like to start by getting a .27 kernel working with eclair.

  4. Cris

    Also how did you make the config files that you have for download. Was that something you made or was it pulled from the phone? As you can probably tell I am just a beginner, but if I don’t start somewhere i will never learn. Also they released the kernel source for the cdma Hero

  5. admin

    You could probably get eclair to run with the new kernel but the problem you face is that the proprietary files can not be recompiled to work with the new kernel because you don’t have source code for it. At least not for the GSM version.

    I did not create the files my self, as I said I used loxK configuration files to start with. But I did look in to this my self, by comparing the configuration for the google dev phones and the configuration for the Hero. Some of the things is just trial and error and some stuff you can find on your phone. (and some of them is leaked stuff). I am still in the process of finding information about all the configuration files, as soon as I have those I will probably post them on my blog and explain what every file is for and how to get/create en edit it.
    Some of the files are just configuration files needed for android to compile, some of them are configuration files for the Hero, some of them are proprietary files that you need to Hero function properly and finally you have some configuration files that tell android to use proprietary files when creating an image.

    You are free to use and edit or redistribute any of the scripts you see on my blog, if you wish you can refer to me but it’s not an must.

  6. Pingback: Blog.Coralic » How to create using your build aka system.img

  7. Karthik

    Thank you for a very detailed post on this topic. I am trying to follow your steps in this post and my progress so far:

    1. I am working on Ubuntu 9.1 operating system.
    2. installed android using your altered version for cupcake script.

    But when I try to create a generic build with-
    cd ~/myandroid
    . build/

    It gives out this message :

    root@xxxxxx-desktop:/home/xxxxxx/myandroid# make .build/
    build/core/ WARNING: adding test OTA key
    frameworks/policies/base/ *** No module defined for the given PRODUCT_POLICY (android.policy_phone). Stop.

    Have you come across this kinda error before. Would really appreciate any suggestion/idea in this case.

  8. admin

    I am sorry to here that it does not work for you. I am not sure what the problem could be. You could try to set generic with lunch:

    . build/
    lunch generic

  9. vlip

    You are attempting to build with the incorrect version
    of java.

    Your version is: java version “1.6.0_0″.
    The correct version is: 1.5.

    Please follow the machine setup instructions at
    build/core/ *** stop. Gestopt.

  10. vlip

    where to download jvm 1.5?

    i seeking deeply inside javaś database.

    and ubuntuś forum say’s it’s not supported anymore,

    end of lifetime
    use 1.6 instead

  11. karthik

    Thanks for the response..I have used ubuntu 8.10 and started the process again .tThis time used lunch command builds without any problem now.

  12. admin

    If you are using Ubuntu 9.10 you will not find java 1.5 in de repo, you need to download it from sun or you need to add older repos like vlip said.

  13. vlip

    J2SE 5.0 End of Service Life Notice

    J2SE 5.0 reached its End of Service Life (EOSL) on November 3, 2009, which is the date of the final publicly available update of version 5.0 (J2SE 5.0 Update 22). Customers interested in learning more about Sun’s Java Technology Support and EOL policy Read More

    Customers interested in continuing to receive critical fixes are encouraged to consider the following options:

    * Migrate to Java for Business 1.5 Read More
    * Migrate to the latest Java SE release Read More

    For developer needs, all products that have completed the EOL transition period, including the last Java SE release of 1.5, have been moved to the Archive area.

  14. vlip

    question : unzip
    what config files do i need from some other device?

    .config i already pulled
    the source of my device i already compiled.

  15. catinred

    I made a hero rom by following your steps. It works in emulator. and I made a, and flash it to my hero, it stuck in the first screen. How to fix it?

  16. admin

    Remove the battery from the phone, and insert it again. Now boot in to nandroid and restore your backup to get an working hero.

  17. Pingback: Anonymous

  18. Pingback: 从源代码编译制作HERO ROM(转) - 拖泥猪

  19. krystal

    im not understanding how do i start making my rom what workspace do i need or how do i get a work space help me figure this out

  20. krystal

    i am running on windows 7 how do i go about starting this because it seems like a different operating system is being used

  21. admin Post author

    This is done from Ubuntu, but you can do it from windows. Some commands should be changed but the process is the same.

  22. Pingback: Link Tutorial Compile Android dari Source | Blog Robot Ijo

  23. Pingback: » How to create using your build aka system.img Ruiman

Comments are closed.