yashsingh1/xdaforums huggingface dataset:
[Kindle Fire Android Development] JackpotClavin:
It was almost exactly this time last year that I got my first Android device. I had absolutely no development experience whatsoever, so if anybody told me that I'd make a Cyanogenmod 7 Gingerbread ROM for the Kindle Fire in 11 months from that time, I would've thought they were crazy.

Android is the easiest to build on Linux, primarily Ubuntu. This guide is designed around building on Ubuntu as well. The first thing you need to build from source is to actually get the source. For Cyanogenmod 9 (Ice Cream Sandwich) you'll have to pull from the Cyanogenmod repository. You'll also have to download a few packages for Linux like Java, and they will have to be put in a PATH folder. In the guide here (which is meant to build CM7 for the Droid X) it's identical for the Kindle Fire. You can follow that guide up until you do this command "cd ~/android/system/" The next step of that guide would pull the CM7 repository, but we want CM9 (ICS). Instead of pulling Gingerbread, you'll want to pull ICS copy this:

repo init -u git://github.com/CyanogenMod/android.git -b ics

It may ask you for your name and email address. Once that's done, you can "repo sync -j16" and it will start downloading the source. This will take a very long time ~2 hours here, but once that's done, you can move on :-)

Each device has its own device configuration and vendor files for building. Luckily for you, I've already setup the necessary stuff to get ICS to build for the Fire. You can download my source from my github here https://github.com/jackpotclavin You'll have to download the ICS-Kindle-Fire-Device and ICS-Kindle-Fire-Vendor files and place them in specific spots. For the vendor files, they go into /android/system/vendor/amazon/otter

You'll have to make the amazon and otter folders, but the vendor files should go in them so any random file, say, otter-vendor.mk will be placed so it's like this

/android/system/vendor/amazon/otter/otter-vendor.mk, with the proprietary folder inside /amazon/otter/.

It's almost the same with the device files. Once you download those, you place them into the /android/system/device/amazon/otter/ folder that you'll have to make, so any random file, say, system.prop goes would be located at /android/system/device/amazon/otter/system.prop

Once that's all done, you can download the prebuilts. For this you'll have to navigate into /android/system/vendor/cm and execute the get-prebuilts file. This will download a few files needed for building that will halt the build process if they're missing. Once those are done, it's building time. In the terminal, navigate to your /android/system/ folder, and type the command:

. build/envsetup.sh && brunch otter

That should be it! If somebody gets stuck, reply in this thread and I'll tell them where to go, and I'll update the post to help out :-) happy building
[Kindle Fire Android Development] ttabbal:
Thanks for getting the code up! And the post I'm sure will be very useful for people to get started building.
[Kindle Fire Android Development] Sad Panda:
(Place holder for later)

Thanks for this post, hoping to start my first aneroid programming contribution soon. This should help get me started. I am assuming though we still need to build drivers to get all the hardware working right? Unless. We can somehow rip drivers from the stock kindle and edit them. Any guide on that type of work, or examples to get started?
[Kindle Fire Android Development] teookie:
Kewl. Going to try this tonight.
[Kindle Fire Android Development] foxdog66:
could you do something like this https://gist.github.com/908477 or maby make a extract-files.sh that pulls the proprietary files from the device please? :) or would doing a git clone https://github.com/JackpotClavin/ICS-Kindle-Fire-Vendor.git set everything up to build?
[Kindle Fire Android Development] JackpotClavin:
Yeah sure I'll do that. Right now the the prop files in the vendor folder come from 6.2.1 so there won't be any new files or features you're missing out on

So yeah, cloning the vendor files will get you same files, but once amazon releases a new revision it will be needed so I'll get on that
[Kindle Fire Android Development] ytt3r:
excited to see this :D I have a lot of catching up to do, but I'll be of what help I can to this project...
[Kindle Fire Android Development] teookie:
I've tried to sync that repo twice now and it's failed both times. I have successfully synced the CM7 repo in another directory so I'm pretty sure my computer is set up correctly.

It goes for about and hour and then stops with an error. Said something like "unable to fetch objects" or something. So, I just did repo sync again and it errored out almost immediately.

I deleted the source directory and tried again but failed in the same spot. Any ideas?
[Kindle Fire Android Development] romified:
Yes, I had the same error last night and again early this morning. Will try it later to see if it was a temporary server or network issue.
[Kindle Fire Android Development] JackpotClavin:
It's not an issue with your setup. Google has reported some syncing issues for some including myself (took me over 20 times yesterday to sync)
[Kindle Fire Android Development] Icetech3:
Just curious.. since we all use the same exact hardware why not just 1 person build it and post the rom? Or is there something special that needs to be done?
[Kindle Fire Android Development] thrasherht:
So I feel like a tard. I am trying to setup my copy of ubuntu so I can hopefully learn some devving skills. But when i try and install this stuff I get errors.

git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
[Kindle Fire Android Development] teookie:
You are typing "sudo apt-get install" in front of that, right?
[Kindle Fire Android Development] thrasherht:
Yea, and it says it can't find some of the packages. I mean i don't think I am that bad at linux, but this is just annoying that there is stuff not working.
[Kindle Fire Android Development] ttabbal:
It's probably java causing the problem. Oracle changed the license and ubuntu can't distribute it anymore. There might be a ppa, but if not you will need to get it from oracle.
[Kindle Fire Android Development] thrasherht:
So how am I suppose to get java jdk installed? I am at a loss. I downloaded the tar, but I didn't understand what they wanted me to do from the instructions on the oracle website.
[Kindle Fire Android Development] teookie:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

I set mine up with this guide:

http://source.android.com/source/initializing.html
[Kindle Fire Android Development] thrasherht:
thanks man.
[Kindle Fire Android Development] HeWhoWas:
This is Android Development, I'm assuming it's intended as a 'how to get started' guide for aspiring Android Devs.
[Kindle Fire Android Development] zone23:
It doesn't "need" to be done but some of us like doing it ourselves IF possible. Honestly your statement comes off as "I'm lazy" but I'm sure you just don't have time. Besides the more people you teach the stronger the development will become. You want more ROMs don't you?

-----------------------------------

I found the information on the following page very useful if your running Ubuntu 11.10 like I am.

http://mjanja.co.ke/2011/11/building-android-4-0-on-ubuntu-11-10/

-----------------------------------

I'm hoping to modify the source so no matter what device I compile for they will all have the same look. That will be sweet.

Thanks OP I love posts like this and hope you can add more useful information in the future. I used to do these "how to"s on the HTC Touch Pro before I actually started modding entire ROMs.
[Kindle Fire Android Development] zone23:
Anyone else having this issue with the sync?

Fetching projects: 93% (226/243) fatal: The remote end hung up unexpectedly

Fetching projects: 99% (241/243) fatal: The remote end hung up unexpectedly

error: Cannot fetch CyanogenMod/android_prebuilt

error: Exited sync due to fetch errors
[Kindle Fire Android Development] foxdog66:
Yeah i can't get past that either
[Kindle Fire Android Development] JackpotClavin:
I have the same problem while syncing too
[Kindle Fire Android Development] zone23:
I tried using the vendor files from CM with the code from Google but it didn't like that.
[Kindle Fire Android Development] Icetech3:
Actually... i was just being lazy.. but yeah i should just learn..
[Kindle Fire Android Development] ghost_og:
Still having problems

I've been having problems getting the gingerbread branch to sync since yesterday. This is my first time trying to compile from source so I wasn't sure if it was something that I was doing wrong or not; after hours it would just stop without any type of error message. I've actually gotten further than this, but it was the only copy/paste job I saved:

From git://github.com/CyanogenMod/android_vendor_cyanogen
* [new branch] donut -> github/donut
* [new branch] eclair -> github/eclair
* [new branch] froyo -> github/froyo
* [new branch] froyo-kernel -> github/froyo-kernel
* [new branch] froyo-stable -> github/froyo-stable
* [new branch] gingerbread -> github/gingerbread
* [new branch] gingerbread-release -> github/gingerbread-release
* [new branch] master -> github/master
* [new branch] themes-exp -> github/themes-exp
* [new tag] cm-7.0.0 -> cm-7.0.0
* [new tag] cm-7.0.1 -> cm-7.0.1
* [new tag] cm-7.0.2.1 -> cm-7.0.2.1
* [new tag] cm-7.0.3 -> cm-7.0.3
* [new tag] cm-7.1.0 -> cm-7.1.0

After some searching I found that VM's have issues when the Network Adapter is set to NAT. I switched mine to Bridged Adapter (on Win7 using Virtual Box) and this seemed to help, but I have still not been able to sync successfully. It still just stops after a few hours. I'm currently trying to sync the CM kernel, just to see if I can get something to finish successfully.

One question for those who are more experienced with this. After my failed attempts I would go into ~/android/system and delete the hidden .repo file. I would then restart the process from here:

repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync -j16

Is this ok? Or should I completely start over after a failed attempt? As in, delete ~/bin and ~/android/system and re-set everything backup?
[Kindle Fire Android Development] JackpotClavin:
okay let's try this

if you have a prebuilt folder in the device tree, delete it so it's gone. then make a new folder anywhere not in your device tree, cd into that directory and type this command

git clone https://android.googlesource.com/platform/prebuilt.git -b 4.0.3_r1

after those files download<project path="prebuilt" name="CyanogenMod/android_prebuilt" /> (will take a long time) make a new prebuilt folder in your device tree, and copy the files you just cloned into your new prebuilt folder so the structure of the folder looks like this https://github.com/CyanogenMod/android_prebuilt/

then go to the root of your source tree (probably /android/system and open the .repo folder (you may have to enable hidden folders) and go into the manifests folder, then open the default.xml and delete the string

<project path="prebuilt" name="CyanogenMod/android_prebuilt" />

the next time you sync, it will skip over grabbing the prebuilts folder, and it shouldn't get hung up trying to get it
[Kindle Fire Android Development] CptanPanic:
Cm tweeted that they are having problems with github and have an open issue.
[Kindle Fire Android Development] ghost_og:
A few questions...

Sorry to be off topic, but I've been using this guide in hopes of compiling CM7 for my Atrix. I'm doubtful my PC can even do GB, so ICS is most likely not even an option for me at the moment. I've been substituting where necessary. Since I'm doing GB instead of ICS would this:

git clone https://android.googlesource.com/platform/prebuilt.git -b 2.3.7_r1

be the correct workaround? I'm using this page to determine the branch, but had no idea if that was correct. It seems to be working, as of right now it's 1.7gb.

*update: didn't work. Certain things were missing or outdated. Will wait for the cm repo. I was so close!
[Kindle Fire Android Development] rukin5197:
When you get random stops, just press ctrl-z and it will stop. Then do

repo sync

once again and it will continue where it left off. That's the amazingness of git, lol.

PS. From the above, you may have noticed that I did repo sync instead of repo sync -j16. I did this because when you get so far with -j16, you can just do repo sync. When I was building ics for my Optimus V, I ran into this same problem, and when I stopped and did repo sync -j16, I kept getting errors. So I just ran repo sync and let it sit over night and voila! Hope that wasn't too detailed and unwanted ;)
[Kindle Fire Android Development] whistlestop:
Yep, saw the same and found a post that said to edit .repo/manifests/defaults.xml and change git to https for the repos. Worked for me.
[Kindle Fire Android Development] HeWhoWas:
Jackpot: I've managed to get my build env set up, and fought my way through a multitude of github issues, and I actually have a ROM! How would you suggest going about debugging/locating problems?
[Kindle Fire Android Development] whistlestop:
Are you on a recent linux? If so, try dropping the -j 16 or putting in -j 1. There is evidently a bug in the recent version of python's threading library on Ubuntu (the OS I'm using) that causes a deadlock when you give it a bunch of threads. I went to -j 1 and while it's slower it always completes.
[Kindle Fire Android Development] intersectRaven:
If you're going to go for a single thread you can just omit the -jN altogether. Also, you don't need to do repeated repo init commands. Just issue a repo sync if ever you fail (just don't delete the .repo folder). :)
[Kindle Fire Android Development] avary:
about the prebuilt problem there is a temporary fix

https://github.com/CyanogenMod/android/commit/86da05c57f010fb717ea9d027a374f497bc597ba
[Kindle Fire Android Development] simmeone:
When I try to sync, suddenly it stops and nothing happens. My sync stands at "Fetching projects: 20% (49/242) ... :(
[Kindle Fire Android Development] whistlestop:
Sounds like the thread deadlock problem. Are you adding the optional thread pool arguments (e.g. -j 16) to the repo sync command? If so, drop the -j option and you should be set.
[Kindle Fire Android Development] ghost_og:
Almost there...

This fix seemed to work at first but I kept getting connection errors for certain tags. What ended up working for me was changing the default.xml back to git:// and removing the prebuilt fetch. I then used this:

git clone https://github.com/CyanogenMod/android_prebuilt.git -b gingerbread

It took a couple of failed attempts, but eventually the transfer started. Currently at 470mb so hopefully it completes successfully. Thanks for everyone's input/suggestions. :)
[Kindle Fire Android Development] jakaka:
So I actually downloaded and built successfully but it kinda doesn't boot :)

EDIT: OK, looks like it maybe boots because I can get adb but screen is black.
[Kindle Fire Android Development] randallu:
Is it stuck initializing SurfaceFlinger (i.e.: system server crashes when bringing up surfaceflinger)? I built one that does that, too...
[Kindle Fire Android Development] JackpotClavin:
Get me a log cat and put it on pastebin.com and I'll help debug
[Kindle Fire Android Development] jakaka:
The same as randallu.

http://pastebin.com/e2zvd3GM

Is there some git existing for kernel?
[Kindle Fire Android Development] JackpotClavin:
Crap! I think it's because it built the hwcomposer.omap4.so. I never told you guys it didn't have to be built ><

You can adb shell and go into system/vendor/lib/hw/ and rm the file and reboot and it should boot up :-)
[Kindle Fire Android Development] jakaka:
Thanks, removing hwcomposer worked and I am booting :)
[Kindle Fire Android Development] randallu:
Cool, thanks, I'll try that later today. Do you know if Hashcode got hwcomposer working? I tried to build from his tree a few days ago but the device never came up on adb -- looked like the kernel wasn't booting.
[Kindle Fire Android Development] jakaka:
Is the source for this kernel somewhere on git?
[Kindle Fire Android Development] HeWhoWas:
So, how do we go about creating the ROM withouth hwcomposer? Obviously deleting it from the resulting .zip isn't going to help - it would break the MD5 for starters, and I'm not sure if the zip compression used wouldn't be broken by recompressing it.
[Kindle Fire Android Development] randallu:
You can rename hardware/ti/omap4xxx/hwc/Android.mk and it then won't be included.
[Kindle Fire Android Development] marty331:
Edit - Too dumb to read.
[Kindle Fire Android Development] teookie:
Looks like the repo is working normally again.

edit: and I'm building. Wonder if this will make smoke come out of my dual core pentium? :)

I screwed up and accidentally did the repo init and repo sync in my home folder. Doh! I moved all (I think!) the files/folders into my cm9 folder, along with the .repo folder. I guess when it's done building if it doesn't boot I'll start over again.
[Kindle Fire Android Development] marty331:
Any help here? I can't figure out what I've done wrong, I've searched everywhere I can think of.

repo sync -f

Exception in thread Thread-1:

Traceback (most recent call last):

File "/usr/local/lib/python2.7/threading.py", line 552, in __bootstrap_inner

self.run()

File "/usr/local/lib/python2.7/threading.py", line 505, in run

self.__target(*self.__args, **self.__kwargs)

File "/home/marty331/android/system/.repo/repo/subcmds/sync.py", line 186, in _FetchHelper

current_branch_only=opt.current_branch_only)

File "/home/marty331/android/system/.repo/repo/project.py", line 926, in Sync_NetworkHalf

if alt_dir is None and self._ApplyCloneBundle(initial=is_new, quiet=quiet):

File "/home/marty331/android/system/.repo/repo/project.py", line 1463, in _ApplyCloneBundle

exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet)

File "/home/marty331/android/system/.repo/repo/project.py", line 1527, in _FetchBundle

raise DownloadError('%s: %s ' % (req.get_host(), str(e)))

DownloadError: android.googlesource.com: <urlopen error unknown url type: https>

Fetching projects: 1% (4/243)

error: Exited sync due to fetch errors
[Kindle Fire Android Development] jakaka:
I think I got something similar when I was trying to use Ubuntu 11, also some other problems when compiling, in the end I installed 10.04 and everything was fine.
[Kindle Fire Android Development] avary:
hello JackpotClavin

u forgat to setup your git ignore file to ignore backup files (~ files). it's all over your repo ;-) here u go http://sujee.net/tech/articles/gitignore/
[Kindle Fire Android Development] whistlestop:
I'm on the latest source as of yesterday but it's the first time trying a build of CM9 for the KF and getting the following error:

make: *** No rule to make target `out/target/product/otter/obj/STATIC_LIBRARIES/libdumpstate.otter_intermediates/libdumpstate.otter.a', needed by `out/target/product/otter/obj/EXECUTABLES/dumpstate_intermediates/LINKED/dumpstate'. Stop.

Anyone else seeing this? I'm trying to see if it's a code/build issue for the KF or something wrong with my environment (this happens after about 30min of building so it's a fair ways into the process before it blows)

Thanks for any help
[Kindle Fire Android Development] whistlestop:
Got a PM from another person who said he's seeing the same error.

Jackpot, any chance you missed a file on checkin?

I'm off rebuilding from a clean to make sure that one of my previosus failures didn't cause this one.
[Kindle Fire Android Development] treo750ii:
CM9 on the KF... THAT WOULD GREAT!!! Good luck guys!!! Keeping my eyes on this thread!!!
[Kindle Fire Android Development] HeWhoWas:
I deleted my /device and /vendor files, re-downloaded the GIT snapshot and replaced them, still compiles alright. Are you sure you have 100% synced repos?
[Kindle Fire Android Development] teookie:
I was able to build succesfully a couple days ago. Was able to flash and boot the zip and everything. I don't really know what I'm doing though, I just followed the instructions in the first post.

One thing I noticed (but don't understand), is that i built with the "brunch" command instead of "lunch" or "make". I don't know what the difference is though...
[Kindle Fire Android Development] HeWhoWas:
I can't really help with the above problems, but one of the issues I encountered was

device/amazon/otter/overlay/frameworks/base/core/res/res/values/config.xml:72: error: Resource at config_usesLegacyUsbDeviceManager appears in overlay but not in the base package; use <add-resource> to add.

To fix this, simply open up the file

/android/system/device/amazon/otter/overlay/frameworks/base/core/res/res/values/config.xml

And delete the line at the end which refers to "LegacyUsbDeviceManager".
[Kindle Fire Android Development] marty331:
I am NOT enjoying this!!! git has become my Nemesis.

Anyone know how to get this working:

~/android/prebuilt$ git clone https://android.googlesource.com/platform/prebuilt.git -b 4.0.3_r1

Cloning into 'prebuilt'...

fatal: Unable to find remote helper for 'https'
[Kindle Fire Android Development] HeWhoWas:
I haven't had to use git at all for this process, just a repo sync -j16 and then copy Jackpots files to the /vendor & /device folders. Then compile.
[Kindle Fire Android Development] ghost_og:
Were you doing this as a workaround due to repo sync stalling on prebuilt? Have you tried making changes to the manifest instead? This was driving me crazy too. I followed these instructions from a comment at this link, which was posted a few pages back:

This worked for me, although I was trying to get the GB branch not ICS.
[Kindle Fire Android Development] marty331:
I've actually tried both of those solutions. I'm on Ubuntu 11.10 and I think that must be the problem. I recently had to re-install my os, before I had upgraded from 11.04 and did not have this issue. I am thinking now that I will add 10.10 into a virtualbox and try building from there.

Which version are you on?
[Kindle Fire Android Development] ghost_og:
Heh, I nuked my 11.10 and installed 10.10. Completed my first build last night. Only took 14 hours to finish. :D I was surprised my old desktop was able to do it at all. Just waiting for a full charge before I try flashing it.
[Kindle Fire Android Development] whistlestop:
make sure to hand remove the omap compose library from /system/vendor/lib/hw or it wont boot.

Also, I'm now building on latest 11.10 without issue. ROM seems to work ok, no video hw codec support, sounds a bit flakey and make sure you get the new 4.0.3 gapps or you'll get stuck in the startup wizard.

I'm off poking at getting the omap dsp loaded with the firmware to see if I can get the hardware decoding going for video.
[Kindle Fire Android Development] HeWhoWas:
14 Hours!? What were you compiling on?
[Kindle Fire Android Development] marty331:
I repo sync in progress now. I installed Ubuntu 10.10 in Virtualbox and now I'm sitting back watching it run.....FINALLY!
[Kindle Fire Android Development] marty331:
Where do we get the 4.0.3 gaaps?
[Kindle Fire Android Development] ghost_og:
Lol, a really old dell desktop with an AMD dual core running 32-bit Win7. It only has 3 gigs of ram (1.5 for the VM), but it kept on trucking along. I was shocked when I got home from work yesterday and it was still going. It got there though; just successfully flashed my kang this morning. :)
[Kindle Fire Android Development] whistlestop:
I'm pretty sure this is the link I got them from DOWNLOAD 4.0.3 GAPPS
[Kindle Fire Android Development] marty331:
Thanks! Pulled them straight on the kindle.