[Kindle Fire Android Development] lovejoy777:
BUILDING CM9 FROM SOURCE FOR THE KINDLE-FIRE

This is a guide to help with building a rom from Hashcodes source for the kindle fire.

I am no Dev so please go easy, and if you see any mistakes let me know and I will amend them, It took me a week of reading and asking numerous questions (to proper :angel:Dev's:angel:) with lot's of mistakes to build my first rom.

Below is what worked for me in the end, (but from what I have learnt, every setup is different).

I'm posting this guide hoping it may help in someway, but please read and research as much as possible before starting:-)

Please follow this guide at your own risk.

Please don't blame me if anything in this thread messes with your system.

I tried lot's of things and in the end I installed a new ubuntu 11.10 x64bit on a external 500gb hdd, (the nice thing now is that all my building etc is all done on a external hdd so I can not mess up my pc AGAIN:-)

I tried 32 bit (but java didn't like that)

I tried ubuntu 12.04 (which is what I dual boot on my laptop)

and the one that worked for the following info was ubuntu 11.10 x64bit.

So here goes.

First you need the following installed.

sun-java6-jdk

android sdk (adb etc) (setup as normal for the kindle fire).

eclipse classic.

Then you set up extra build-essentials

Install the Build Packages

sudo apt-get install*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

sudo apt-get install*g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

Install the repo

mkdir -p $HOME/bin

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > $HOME/bin/repo

Then add the following to your path (e.g. in $HOME/.bashrc)

export PATH=$HOME/bin:$PATH

Then onto the build setup.

mkdir -p $HOME/otter/cm9

cd $HOME/otter/cm9

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

download the local_manifest to .repo

curl -L -o .repo/local_manifest.xml -O -L https://raw.github.com/KFire-Android/android_local_manifest/ics/local_manifest.xml

at this point you should have a folder called otter inside your home folder and inside this a folder called cm9.

If you show hidden folders in cm9 you should also find a folder called .repo, inside you should have your local manifest, open with a text editor (ie. gedit) and make sure it looks like this.

(hashcodes manifest as of 07/03/2012)

**

****

****

****

****

****

****

****

**

Then sync your repo

repo sync -j4 (duel core)

(this can take a while (mine took 6 hours) (I have a laptop with dual core but only 1.3ghz).

this script uses ccache which will make subsequent builds at least two times faster.

#!/bin/bash

if [ -z "$1" ]; then
echo "usage: build.sh "
exit 1
fi
device=$1

# ensure ccache is in the path
export PATH="$PATH:$PWD/prebuilt/$(uname|awk '{print tolower($0)}')-x86/ccache"

setup()
{
USE_CCACHE=1
CCACHE=ccache
CCACHE_BASEDIR="$PWD"
CCACHE_DIR="$PWD/.ccache"
#export CCACHE_COMPRESS=1
export USE_CCACHE CCACHE_DIR CCACHE_BASEDIR
if [ ! "$(ccache -s|grep -E 'max cache size'|awk '{print $4}')" = "10.0" ]; then
ccache -M 10G
fi
source build/envsetup.sh
#lunch cm_$1-userdebug
}

setup $device

LOGFILE=build_${device}_$(date +%Y%m%d_%H%M).log

START=$(date +%s)

#make -j`cat /proc/cpuinfo| grep processor | wc -l` bacon 2>&1 | tee $LOGFILE
brunch $device 2>&1 | tee $LOGFILE

END=$(date +%s)
ELAPSED=$((END - START))
E_MIN=$((ELAPSED / 60))
E_SEC=$((ELAPSED - E_MIN * 60))
printf "Time to compile: " >> $LOGFILE
[ $E_MIN != 0 ] && printf "%d min(s) " $E_MIN >> $LOGFILE
printf "%d sec(s)\n" $E_SEC >> $LOGFILE

grep "Time to compile" $LOGFILE

copy/paste the text in a file called $HOME/build.sh, make it executable (chmod 775 build.sh). The script also saves the build output to a file called build_otter_.log.

then onto the build.

cd vendor/cm

./get-prebuilts

cd ../../

then onto buiding

source build/envsetup.sh

then this is the build command

brunch otter (this starts build)

Enjoy:D

To start over and wipe "out" folder

(from within /otter/cm9)

make clobber

or

rm -rf out/target

build.sh otter

(this can take awhile (mine took another 6 hours)

I had a few things missing and at various times throughout the setup/build I had to download some missing libs. etc (I was prompted all the way through, it would tell me I had so & so file missing and I just used the software centre to dl the missing files).

By all means ask me questions but don't be offended if I answer back “sorry I don't know” as I've already mentioned I am learning myself.

Cheers

Steve

:good:Thanks to Twa_priv & Hashcode with helping me with my rom and this guide:-):good:

If there are any mistakes/updates to change/modify please let me know.

:D:D:DPLEASE PRESS THE THANKS BUTTON IF YOU FOUND THIS THREAD HELPFULL AND HAPPY ROM BUILDING :D:D:D