Building the Android source and Deploying it to your G1 or Dev Phone

mycupcake 

I have no idea why this is not well documented anywhere... I figured most of this out by scouring posts and through trial and error.

This process will create a build of the Android source tree with the Maps application included. Note that this does not have Gmail, YouTube, Market, or IM. These are third party applications to which source is not included. I tried to patch them in, but at the time of writing, their versions were too old to work with the new framework/build. As such, I would not say this is a really usable build by any means.

Installation prerequisites:

  • You must have a rooted (or a dev) phone.

Installation of the provided Android image files (see the end of the post for how to build them manually):
  1. Install the JesusFreke's RC30 V1.3+. This will give you a root shell root access in recovery mode. A root adb shell is required for the next step.
  2. Install the engineering boot loader.
  3. Download the prebuilt cupcake installation images to your computer. Extract them to a folder somewhere. (Note: I will probably not be keeping this image up to date, so you are better of learning how to build from source. See the do-it-yourself instructions at the end.)
  4. Get Fastboot for your computer.
  5. Start your phone up into fastboot mode. You can do this by shutting your phone off, and holding camera and power. You will see Androids on skateboards.
  6. Connect your phone to your computer. Press the back button on your phone until your screen says FASTBOOT.
  7. Go to a terminal on your computer and navigate to your extracted (or built) files and type:
    • chmod a+x fastboot
    • (If you are building from source, make sure the built /out/host/platform/bin directory is in your PATH. Additionally, type "fastboot" rather than "./fastboot")
    • ./fastboot flash system system.img
    • ./fastboot flash boot boot.img
    • ./fastboot flash userdata userdata.img
    • ./fastboot reboot
    • If your phone hangs for a long time while flashing or rebooting, unplug and reconnect your phone. I run into this issue, and that is how I work around it. This may be an issue with the phone being connected to a VM.

Congratulations! You are done!

Reverting Back to the G1/Dev Image

  1. Reflash the modified RC30 image from your SD card. If you start up now, your phone will not start up (it will stay hung at the flashing robot). No big deal though.
  2. Start up in recovery mode (turn on the phone using home and power). Press Alt-L to show the menu, and press Alt-W to wipe the phone.


Do it Yourself Instructions For Building from Source

At the time of writing, the Android Dream build was broken. I needed to do the following to make it work:
  • Several (relatively minor) changes in the Dream audio driver code to fix compilation issues.
  • Copied libOmxCore.so to mydroid/out/target/product/dream/system/lib (this was a missing step in the Building for Dream documentation, and something that should be in the HTC provided script)
Patching in Maps
  1. Copy Maps.apk from a Android Dev Phone 1 into mydroid/out/target/product/dream/system/app
  2. Copy com.google.android.maps.jar from a from a Android Dev Phone 1 into mydroid/out/target/product/dream/system/framework
  3. Delete mydroid\out\target\product\dream\obj\PACKAGING\systemimage_unopt_intermediates\system.img
  4. Delete mydroid\out\target\product\dream\system.img
  5. make

22 comments:

Pham Nuwen said...

Nice work! How does Cupcake taste? Speed improvements in Browser drawing (panning, scrolling zooming)? Etc.

Thanks!

Anonymous said...

Hi,

where can i find libOmxCore.so

Koush said...

Pham Nuwen:
Cupcake is pretty nice, lot of new stuff. Browser is noticeably faster, but has more bugs as well. But it's very much a development build. I've already flashed back to RC30.

Anonymous:
You can find libOmxCore.so at /system/lib/libOmxCore.so on your phone.

homestah said...

nice post! i've been looking for something like this to aid me in the building process.

just one question though, what were the code changes that you made to get it to build?

thanks!

Anarchj said...

in this update, is there only a full qwerty keyboard or there's also an alphanumeric one with T9?

Droid said...

When you run the maps binary from the G1 dev phone against the source-built base OS, do you see an ugly gold box in the lower left corner of the map view? Did you figure out a way to get rid of it?

Koush said...

Yeah, I noticed that gold box too... no idea what that is about.

Droid said...

OK, and are IM/Calendar broken for you too? Does trying to login to gmail in browser tell you you need to enable cookies, even if they're on?

benderamp said...

Thank's very much for the post!

The only addition here:

If your phone hangs for a long time while flashing or rebooting, unplug and reconnect your phone. I run into this issue, and that is how I work around it. This may be an issue with the phone being connected to a VM.


In my case when I have ran
./fastboot flash system system.img

I have received the message which did not disappear for a long time.
< waiting for device >

Running the fastboot as root did solve this - the phone started flashing:

sudo ./fastboot flash system system.img
root's password:
sending 'system' (57236 KB)... OKAY
writing 'system'... OKAY

Anonymous said...

the link for how to fo it on windows isnt working can you get it to work?
Thanks

tony said...

ok so i have everything downloaded vmware but when i try to install ubuntu it always forecloses idk wat to do and is ubuntu supposed to b 694mb????

Anonymous said...

Hey, I'm assuming that doing the firmware update as you described will essentially reset the phone to factory settings?

Is there a way to load a new Android OS without wiping out user data?

david said...

hahah no clue how to do this dont get it at all please help davidodams176y@gmail.com

Anonymous said...

On Fastbboot, my phone is hung up. I ran sudo ./flashboot... and still no response from my phone. I disconnected USB and reconnected. No success. Any ideas? More info needed? Any help will be greatly appreciated.

Antonovich said...

anon,
I would recommend just suing. Debian based systems seem to need extra permissions for usb devices, and that may be true for your distro. fastboot just seems to work under root. It's not beautiful but it works.

Anonymous said...

hmm, Maps.apk and the maps framework .jar didn't make it into the images. Is there any other way to install these into the images?

matt said...

I did what you said about the Maps.apk and the com.google.android.maps.jar. The files made it into the system.img, I can see the files on the device using adb shell. However, the Maps app didn't get installed onto the phone. As well when I tried to upload a test.apk that needs the maps.jar file, it says the shared file is missing.

Is there other steps that I am not doing to get the Maps support working?

管理員 said...

./fastboot flash system system.img
< waiting for device >


longtime no response :(

i am use ubuntu ..........

masterjam said...

2 questions... is the mod rc33 sufficient to continue or is the rc30 required? and what do you mean by installing the bootloader? to what? do I copy it to the sd card or open the zip on my computer?

Sebastian said...

I would love to build it myself, but the audio problems still remain. Can you provide a patch here? that would be great!

Joshua said...

Can you tell please if this instruction can also be tested on Samsung Galaxy ?

android developer said...

Thanks for writing such a nice post. After reading your post I can say that you have done lot of research on this topic and I really liked the way of your writing and how you have thrown the light on unhidden facts.