[HOW-TO] Compile AOSP Froyo + [ROM] Latest AOSP Froyo for Sapphire

Search This thread

Dominating

Senior Member
Aug 11, 2009
215
46
Hobart
Google Pixel 6a
Battery Drain

Anyone else having a huge battery life problem?, compiled and done a few fixes to the aosp source, although i'm using pershoots 2.6.35.9 kernel is that the issue??? but other then that wicked guide dferreira and i'd love to know if anyone else is having battery problems :)
 

Dominating

Senior Member
Aug 11, 2009
215
46
Hobart
Google Pixel 6a
Anyone know why busybox wont compile?

target Strip: libnetlink (out/target/product/dream/obj/lib/libnetlink.so)
target Strip: libc_malloc_debug_leak (out/target/product/dream/obj/lib/libc_malloc_debug_leak.so)
target Strip: libc_malloc_debug_qemu (out/target/product/dream/obj/lib/libc_malloc_debug_qemu.so)
target SharedLib: libctest (out/target/product/dream/obj/SHARED_LIBRARIES/libctest_intermediates/LINKED/libctest.so)
target SharedLib: libpagemap (out/target/product/dream/obj/SHARED_LIBRARIES/libpagemap_intermediates/LINKED/libpagemap.so)
target SharedLib: libstlport (out/target/product/dream/obj/SHARED_LIBRARIES/libstlport_intermediates/LINKED/libstlport.so)
target Executable: busybox (out/target/product/dream/obj/EXECUTABLES/busybox_intermediates/LINKED/busybox)
target StaticExecutable: add-property-tag (out/target/product/dream/obj/EXECUTABLES/add-property-tag_intermediates/LINKED/add-property-tag)
target StaticExecutable: check-lost+found (out/target/product/dream/obj/EXECUTABLES/check-lost+found_intermediates/LINKED/check-lost+found)
out/target/product/dream/obj/EXECUTABLES/busybox_intermediates/networking/nslookup.o: In function `server_print':
/home/pryon-desktop/dreamDroid/external/busybox/networking/nslookup.c:129: undefined reference to `_nres'
out/target/product/dream/obj/EXECUTABLES/busybox_intermediates/networking/nslookup.o: In function `nslookup_main':
/home/pryon-desktop/dreamDroid/external/busybox/networking/nslookup.c:185: undefined reference to `_nres'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(stime.o): In function `stime':
/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/stime.S:18: undefined reference to `__set_syscall_errno'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(swapon.o): In function `swapon':
/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/swapon.S:18: undefined reference to `__set_syscall_errno'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(swapoff.o): In function `swapoff':
/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/swapoff.S:18: undefined reference to `__set_syscall_errno'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(sysinfo.o): In function `sysinfo':
/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/sysinfo.S:18: undefined reference to `__set_syscall_errno'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(adjtimex.o): In function `adjtimex':
/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/adjtimex.S:18: undefined reference to `__set_syscall_errno'
out/target/product/dream/obj/STATIC_LIBRARIES/libc-ext_intermediates/libc-ext.a(getsid.o):/home/pryon-desktop/dreamDroid/external/libc-ext/arch-arm/syscalls/getsid.S:18: more undefined references to `__set_syscall_errno' follow
collect2: ld returned 1 exit status
make: *** [out/target/product/dream/obj/EXECUTABLES/busybox_intermediates/LINKED/busybox] Error 1
make: *** Waiting for unfinished jobs....


getting this error when I try and add busybox any ideas?
 

cougar694u

Senior Member
Apr 30, 2008
167
10
44
San Antonio, TX
Hi everyone,
I'll keep an eye for this thread of course, as I'll probably update the script for adding Nexus One to it.

I recently acquired a Nexus One and wanted to see if you had found how to get this to work for it. I looked at the script and don't know which kernel to use, or where to point the wget to get the update.zip.

Any updates? Since Gingerbread has been added to AOSP, is it possible to pull that one, or just FRG83D?

TIA!
 

dferreira

Senior Member
Jan 26, 2007
1,798
423
41
Oulu
www.denzilferreira.com
I recently acquired a Nexus One and wanted to see if you had found how to get this to work for it. I looked at the script and don't know which kernel to use, or where to point the wget to get the update.zip.

Any updates? Since Gingerbread has been added to AOSP, is it possible to pull that one, or just FRG83D?

TIA!
I have compiled yesterday Gingerbread for my Nexus One. Everything works except for white screen on transitions and the camera. The camera seems to be fixable by using Samsung's camera code, which I'll attempt to do today. The white screen cyanogen has fixed but I can't find how to fix it... I just wished he would have a development blog where he could share how he fixes some stuff :)
 

jroid

Senior Member
Jan 8, 2009
1,365
77
I have compiled 2.3.1 for the nexus S with
Code:
make -j4 otapackage

however,when I flash it just bootloops.. if I fastboot flash all the images it boots just fine though.
Any ideas?.. I'm also trying to find the url to sync gingerbread gapps but I can't find it.
 

dferreira

Senior Member
Jan 26, 2007
1,798
423
41
Oulu
www.denzilferreira.com

muasif80

Member
Jan 13, 2011
7
0
When I run the android.sh after doing all the above tasks on Ubuntu 10.04 I got this

I believe that the following output is giving errors. I request you to please help in understanding what has gone wrong with this. Why the instructions those you have given have not worked for me. I will be really thankful for any help.
************************************************************************************************************
I believe that the following output is giving errors. I request you to please help in understanding what has gone wrong with this. Why the instructions those you have given have not worked for me. I will be really thankful for any help.
************************************************************************************************************
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version "1.5.0_19".
The correct version is: 1.6.

Please follow the machine setup instructions at
http : // source . android . com / source / download . html
************************************************************
build/core/main.mk:129: *** stop. Stop.
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version "1.5.0_19".
The correct version is: 1.6.

Please follow the machine setup instructions at
http : // source . android . com / source / download . html
************************************************************
build/core/main.mk:129: *** stop. Stop.
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (12/12), done.
From git : // android . git . kernel . org / platform / manifest
3a78eff..9c07982 donut -> origin/donut
0bfe26a..b66d057 eclair -> origin/eclair
a5153b0..2872cdf froyo -> origin/froyo
7b52216..ad4d4d6 gingerbread -> origin/gingerbread

Your Name [Muhammad Asif]: Muhammad Asif
Your Email [muasif80 at gmail dot com]: muasif80 at gmail dot com

Your identity is: Muhammad Asif <muasif80 at gmail dot com>
is this correct [y/n]? y

repo initialized in /home/asif/magicDroid
fatal: destination path 'msm' already exists and is not an empty directory.
Already up-to-date.
Fetching projects: 3% (6/168) remote: Counting objects: 29, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 18 (delta 11), reused 3 (delta 0)
Unpacking objects: 100% (18/18), done.
From git : // android . git . kernel . org / build
1840de5..9ac1e65 gingerbread -> korg/gingerbread
7e27c8e..755bed4 master -> korg/master
Fetching projects: 4% (7/168) remote: Counting objects: 26, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From git : // android . git . kernel . org / platform / cts
c94170d..5766f49 froyo -> korg/froyo
remote: Counting objects: 298, done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 193 (delta 74), reused 0 (delta 0)
Receiving objects: 100% (193/193), 14.71 KiB, done.
Resolving deltas: 100% (74/74), completed with 25 local objects.
From git : // android . git . kernel . org /platform/dalvik
b81fac3..d3046dd cupcake -> korg/cupcake
32f8982..b37eb51 donut -> korg/donut
2ca8eb9..9a69c6d eclair -> korg/eclair
886130b..70b130f froyo -> korg/froyo
Fetching projects: 46% (78/168) remote: Counting objects: 22, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 10), reused 0 (delta 0)
Unpacking objects: 100% (12/12), done.
From git : // android . git . kernel . org /platform/external/qemu
f979c58..3bf6efc master -> korg/master
3fd4433..3bf6efc tools_r9 -> korg/tools_r9
Fetching projects: 59% (100/168) remote: Counting objects: 143, done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 101 (delta 41), reused 30 (delta 2)
Receiving objects: 100% (101/101), 130.87 KiB | 111 KiB/s, done.
Resolving deltas: 100% (41/41), completed with 21 local objects.
From git : // android . git . kernel . org /platform/frameworks/base
bdb7aee..7d234fa master -> korg/master
Fetching projects: 66% (111/168) remote: Counting objects: 131, done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 86 (delta 43), reused 22 (delta 11)
Unpacking objects: 100% (86/86), done.
From git : // android . git . kernel . org /platform/libcore
5bcbe1c..2891830 gingerbread -> korg/gingerbread
27020e1..a16bf8b master -> korg/master
Fetching projects: 95% (160/168) remote: Counting objects: 928, done.
remote: Compressing objects: 100% (542/542), done.
remote: Total 736 (delta 406), reused 27 (delta 9)
Receiving objects: 100% (736/736), 115.65 KiB | 45 KiB/s, done.
Resolving deltas: 100% (406/406), completed with 78 local objects.
From git : // android . git . kernel . org /platform/sdk
8f5a0e4..f03c4ab master -> korg/master
af9a91e..798d453 tools_r9 -> korg/tools_r9
Fetching projects: 100% (168/168), done.
Syncing work tree: 100% (167/167), done.

./android.sh: line 50: cd: /home/asif/magicDroid/device/htc/sapphire/: No such file or directory
./android.sh: line 51: ./unzip-files.sh: No such file or directory
#
# configuration written to .config
#
scripts/kconfig/conf -s arch/arm/Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm/mach-msm/pm.o
LD ipc/built-in.o
GZIP kernel/config_data.gz
IKCFG kernel/config_data.h
CC kernel/configs.o
CC arch/arm/mach-msm/cpufreq.o
CC arch/arm/mach-msm/htc_battery.o
CC security/commoncap.o
LD kernel/built-in.o
CC security/min_addr.o
arch/arm/mach-msm/pm.c: In function 'msm_pm_init':
arch/arm/mach-msm/pm.c:773: warning: assignment from incompatible pointer type
arch/arm/mach-msm/pm.c:779: error: 'RESET_VECTOR' undeclared (first use in this function)
arch/arm/mach-msm/pm.c:779: error: (Each undeclared identifier is reported only once
arch/arm/mach-msm/pm.c:779: error: for each function it appears in.)
make[1]: *** [arch/arm/mach-msm/pm.o] Error 1
make[1]: *** Waiting for unfinished jobs....
CC crypto/api.o
CC block/elevator.o
make: *** [arch/arm/mach-msm] Error 2
make: *** Waiting for unfinished jobs....
CC block/blk-core.o
CC crypto/cipher.o
LD security/built-in.o
CC crypto/compress.o
CC block/blk-tag.o
CC crypto/algapi.o
CC crypto/scatterwalk.o
CC block/blk-sysfs.o
CC crypto/proc.o
CC block/blk-barrier.o
CC crypto/ablkcipher.o
CC crypto/blkcipher.o
CC block/blk-settings.o
CC block/blk-ioc.o
CC crypto/ahash.o
CC crypto/shash.o
CC block/blk-map.o
CC block/blk-exec.o
CC block/blk-merge.o
CC crypto/algboss.o
CC crypto/testmgr.o
CC block/blk-softirq.o
CC crypto/crypto_wq.o
CC block/blk-timeout.o
CC block/blk-iopoll.o
CC crypto/aead.o
CC block/blk-lib.o
CC block/ioctl.o
CC crypto/chainiv.o
CC block/genhd.o
CC crypto/eseqiv.o
CC block/scsi_ioctl.o
LD crypto/crypto_hash.o
CC crypto/pcompress.o
LD crypto/cryptomgr.o
CC crypto/hmac.o
CC block/noop-iosched.o
CC block/cfq-iosched.o
CC crypto/md5.o
CC crypto/sha1_generic.o
CC crypto/ecb.o
CC crypto/cbc.o
CC crypto/des_generic.o
CC crypto/twofish.o
CC crypto/twofish_common.o
CC crypto/aes_generic.o
CC crypto/arc4.o
CC crypto/deflate.o
CC crypto/crc32c.o
CC crypto/authenc.o
CC crypto/rng.o
LD block/built-in.o
CC crypto/krng.o
LD crypto/crypto.o
LD crypto/crypto_algapi.o
LD crypto/crypto_blkcipher.o
LD crypto/built-in.o
rm -f ./libestadrv.a
make -C /home/asif/magicDroid/msm/ M=`pwd` ARCH=arm CROSS_COMPILE=/home/asif/magicDroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- modules
make[1]: Entering directory `/home/asif/magicDroid/msm'

WARNING: Symbol version dump /home/asif/magicDroid/msm/Module.symvers
is missing; modules will have no dependencies and modversions.

Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/home/asif/magicDroid/msm'
/home/asif/magicDroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-strip --strip-unneeded wlan.ko
cp: cannot create regular file `/home/asif/magicDroid/device/htc/dream-sapphire/wlan.ko': No such file or directory
including device/htc/passion/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh

You're building on Linux

Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. simulator
4. full_passion-userdebug
5. full_crespo-userdebug

Which would you like? [full-eng] full-eng

============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================

============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version "1.5.0_19".
The correct version is: 1.6.

Please follow the machine setup instructions at
http : // source . android . com / source / download . html
************************************************************
build/core/main.mk:129: *** stop. Stop.
./android.sh: line 84: cd: /home/asif/magicDroid/out/target/product/sapphire/: No such file or directory
Your files ready for flashing are here:
ls: cannot access *.img: No such file or directory
************************************************************************************************************
************************************************************************************************************
 
Last edited:

cougar694u

Senior Member
Apr 30, 2008
167
10
44
San Antonio, TX
dferreira,

Any idea on how to pull other device specific kernel/drivers and compile? For a tablet, for instance?

Is there a list of devices somewhere?

PS, would something like the extract-files.sh from the Nexus One build work?
 
Last edited:

ldrifta

Senior Member
Mar 15, 2011
1,390
187
35
Lynn, Mass
sorry if this question has been answered... but if follow this guide to compile, is the camera fix already in the source or do i need to still do the fix after puling the source?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    Tired of using someone else wrapped up Android OS? If you are like me, you probably would like to take control over what you are using on your device. There isn't any Market or any Google Applications on this. This is intended for developing applications and have a working phone using the latest Android OS for HTC Magic/Sapphire's.

    The recommended system for downloading and compiling Android OS from source (AOSP - Android Open-Source Project) is Ubuntu. I have a Mac with Snow Leopard, so I use VirtualBox to run a virtual machine that has Ubuntu installed on it. Once you have Ubuntu installed on the virtual machine, you need to prepare it so that you can download and compile successfully AOSP.

    First, make sure your OS is up-to-date, by running the Update Manager from the System>Administration menu. Once that is completed, go to Applications>Accessories and open Terminal.

    Type this command to install all the needed libraries (this is all one line) - Ubuntu 10.04 64Bits:
    Code:
    sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind lib32readline5-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

    Type this command to install all the needed libraries (this is all one line) - Ubuntu 32Bits (thanks to Szusz!):
    Edit your /etc/apt/sources.list and add these lines on the end:
    Code:
    deb pl.archive.ubuntu.com/ubuntu/ jaunty multiverse
    deb pl.archive.ubuntu.com/ubuntu/ jaunty universe
    Code:
    sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline5-dev gcc-multilib g++-multilib libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline5-dev libz-dev

    Prepare the OS to run Java 5.0, which is the only compatible Java version for compiling. Recent versions of Ubuntu don't need this step (10.04+).
    Code:
    sudo update-java-alternatives -s java-1.5.0-sun

    Fix a dependency with X11 (64Bits):
    Code:
    sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so

    Fix a dependency with X11 (32Bits):
    Code:
    sudo ln -s /usr/lib/libX11.so.6 /usr/lib/libX11.so

    That's it for the Operative system. Now the tool that Google uses to control the source files is Repo. To install type this:
    Code:
    cd ~
    mkdir bin
    curl http://android.git.kernel.org/repo >~/bin/repo
    chmod a+x ~/bin/repo
    PATH="$HOME/bin:$PATH"

    Now to download the source files, compile etc, all you need to do is to copy this text to a file in Ubuntu (to create one, just type "gedit android.sh"):
    PHP:
    #!/bin/bash
    #Created by dferreira (lizned.arierref@gmail.com)
    #Checkout and compile master repositories out of source.android.com
    
    SOURCE_FOLDER=~/magicDroid
    BRANCH="master";
    KERNEL="android-msm-2.6.32";
    
    #Check for Repo
    if [ ! -f ~/bin/repo ]
    then
        cd ~
        mkdir bin
        curl http://android.git.kernel.org/repo >~/bin/repo
        chmod a+x ~/bin/repo
        PATH="$HOME/bin:$PATH"
    fi
    
    #Create project folder
    if [ ! -d $SOURCE_FOLDER ]
    then
    	mkdir $SOURCE_FOLDER
    fi
    
    cd $SOURCE_FOLDER
    
    #clean old compiled files, there can be new stuff!
    make installclean
    make clean
    
    #Get updated source files from AOSP
    repo init -u git://android.git.kernel.org/platform/manifest.git -b $BRANCH
    git clone git://android.git.kernel.org/kernel/msm.git -b $KERNEL #clone latest kernel project
    cd $SOURCE_FOLDER/msm 
    git pull #check if anything new
    cd $SOURCE_FOLDER
    repo sync #update repo's
    
    #Get HTC drivers if they don't exist already on folder
    cd ~/magicDroid
    if [ ! -f sapphire_update.zip ]
    then	
    	wget --referer=http://developer.htc.com/google-io-device.html http://member.america.htc.com/download/RomCode/ADP/signed-google_ion-ota-14721.zip?
    	mv signed-google_ion-ota-14721.zip sapphire_update.zip
    fi
    
    #unzip the proprietary files from HTC for Sapphire
    if [ ! -d vendor/htc/sapphire/proprietary ]
    then
    	cd $SOURCE_FOLDER/device/htc/sapphire/
    	./unzip-files.sh
    fi
    
    #Compile latest kernel
    cd $SOURCE_FOLDER/msm
    make ARCH=arm msm_defconfig
    make ARCH=arm CROSS_COMPILE=$SOURCE_FOLDER/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- zImage -j4
    
    #copy kernel to source if success!
    if [ -f $SOURCE_FOLDER/msm/arch/arm/boot/zImage ]
    then
    	cp $SOURCE_FOLDER/msm/arch/arm/boot/zImage $SOURCE_FOLDER/device/htc/dream-sapphire/kernel
    fi
    
    #Compile wifi module to match the kernel
    cd $SOURCE_FOLDER/system/wlan/ti/sta_dk_4_0_4_32
    make KERNEL_DIR=$SOURCE_FOLDER/msm/ ARCH=arm CROSS_COMPILE=$SOURCE_FOLDER/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- -j4
    
    #copy updated wlan.ko that matches the kernel
    if [ -f $SOURCE_FOLDER/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko ]
    then
    	cp $SOURCE_FOLDER/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko $SOURCE_FOLDER/device/htc/dream-sapphire/wlan.ko
    fi
    
    #setup compiling environment and build images
    cd $SOURCE_FOLDER
    . build/envsetup.sh
    
    #cd $SOURCE_FOLDER
    lunch
    make -j4
    
    #get to compiled folder
    cd $SOURCE_FOLDER/out/target/product/sapphire/
    echo 'Your files ready for flashing are here:'
    ls *.img

    Save the file and make it executable with:
    Code:
    chmod 755 android.sh

    To run it, just type:
    Code:
    ./android.sh

    That's it! Now just follow the instructions. It should ask for your name, email and then later to what device are you compiling. The script that you put on the text file is meant for Sapphire, so you should choose option that has sapphire on it, US version or EU version, with ENG on it, which will make the compiled OS with root access.

    In the end, you'll have a set of .img files, ready to be installed on your device.

    Using your favourite recovery, wipe everything before flashing the OS and then boot into fastboot. I'm pretty sure that if you really want to compile your own OS, you already know how to use fastboot. But anyway:
    fastboot flash boot boot.img
    fastboot flash system system.img
    fastboot flash userdata userdata.img

    Reboot your device and enjoy your own OS.

    If you run into trouble, let me know.

    Some fixes you might be interested:
    Enable JIT on DalvikVM
    Edit dalvik/vm/Android.mk
    Code:
    ifeq ($(TARGET_ARCH_VARIANT),armv5te)
        WITH_JIT := true
    endif
    Edit vendor/htc/sapphire/BoardConfigVendor.mk
    Code:
    WITH_JIT := true
    ENABLE_JSC_JIT := true

    Add support for audio+video recording on camera
    Code:
    We need to add BUILD_WITH_FULL_STAGEFRIGHT := true to your vendor's Buildxxx.mk to be able to record audio+video on the camera.
    Another property that needs to be active: Thanks to Jubeh

    If you want to run this on 32A's, you need to replace the kernel for a 32A one and you should be good to go.

    Fix the prelinks issues. Make sure to make a backup of the file (build/core/prelink-linux-arm.map) because I'm almost sure it will get officially fixed in the future.
    PHP:
    # 0xC0000000 - 0xFFFFFFFF Kernel
    # 0xB0100000 - 0xBFFFFFFF Thread 0 Stack
    # 0xB0000000 - 0xB00FFFFF Linker
    # 0xA0000000 - 0xBFFFFFFF Prelinked System Libraries
    # 0x90000000 - 0x9FFFFFFF Prelinked App Libraries
    # 0x80000000 - 0x8FFFFFFF Non-prelinked Libraries
    # 0x40000000 - 0x7FFFFFFF mmap'd stuff
    # 0x10000000 - 0x3FFFFFFF Thread Stacks
    # 0x00000000 - 0x0FFFFFFF .text / .data / heap
    
    # Note: The general rule is that libraries should be aligned on 1MB
    # boundaries. For ease of updating this file, you will find a comment
    # on each line, indicating the observed size of the library, which is
    # one of:
    #
    #     [<64K] observed to be less than 64K
    #     [~1M] rounded up, one megabyte (similarly for other sizes)
    #     [???] no size observed, assumed to be one megabyte
    
    # core system libraries
    libdl.so                0xAFF00000 # [<64K]
    libc.so                 0xAFD00000 # [~2M]
    libstdc++.so            0xAFC00000 # [<64K]
    libm.so                 0xAFB00000 # [~1M]
    liblog.so               0xAFA00000 # [<64K]
    libcutils.so            0xAF900000 # [~1M]
    libthread_db.so         0xAF800000 # [<64K]
    libz.so                 0xAF700000 # [~1M]
    libevent.so             0xAF600000 # [???]
    libssl.so               0xAF400000 # [~2M]
    libcrypto.so            0xAF000000 # [~4M]
    libsysutils.so          0xAEF00000 # [~1M]
    
    # bluetooth
    liba2dp.so              0xAEE00000 # [~1M]
    audio.so                0xAED00000 # [~1M]
    input.so                0xAEC00000 # [~1M]
    libbluetoothd.so        0xAEA00000 # [~2M]
    libbluedroid.so         0xAE900000 # [<64K]
    libbluetooth.so         0xAE800000 # [~1M]
    libdbus.so              0xAE700000 # [~1M]
    
    # extended system libraries
    libril.so               0xAE600000 # [~1M]
    libreference-ril.so     0xAE500000 # [~1M]
    libwpa_client.so        0xAE400000 # [<64K]
    libnetutils.so          0xAE300000 # [~1M]
    
    # core dalvik runtime support
    libandroid_servers.so   0xAE200000 # [~1M]
    libicuuc.so             0xADE00000 # [~4M]
    libicui18n.so           0xAD900000 # [~5M]
    libandroid_runtime.so   0xAD300000 # [~6M]
    libnativehelper.so      0xAD100000 # [~2M]
    libdvm-ARM.so           0xAD000000 # [???]
    libdvm.so               0xACA00000 # [~6M]
    # Note: libicudata.so intentionally omitted
    
    # graphics
    libpixelflinger.so      0xAC900000 # [~1M]
    # libcorecg is for backward-compatibility with donut
    libcorecg.so            0xAC800000 # [???]
    libsurfaceflinger_client.so 0xAC700000 # [~1M]
    libsurfaceflinger.so    0xAC500000 # [~2M]
    libGLES_android.so      0xAC400000 # [~1M]
    libagl.so               0xAC300000 # [???]
    
    libGLESv1_CM.so         0xAC200000 # [~1M]
    libGLESv2.so            0xAC100000 # [~1M]
    libOpenVG_CM.so         0xAC000000 # [???]
    libOpenVGU_CM.so        0xABF00000 # [???]
    libEGL.so               0xABE00000 # [~1M]
    libETC1.so              0xABD00000 # [<64K]
    
    libacc.so               0xABC00000 # [~1M]
    
    libexif.so              0xABB00000 # [~1M]
    libcamera_client.so     0xABA80000 # [~1M]
    libui.so                0xAB900000 # [~1M]
    # libsgl is for backward-compatibility with donut
    libsgl.so               0xAB800000 # [???]
    libskia.so              0xAB100000 # [~7M]
    librs_jni.so            0xAB000000 # [~1M]
    libRS.so                0xA9E00000 # [~2M]
    libjnigraphics.so       0xA9D00000 # [<64K]
    libskiagl.so            0xA9C00000 # [~1M]
    
    # audio
    libFLAC.so              0xA9B00000 # [???]
    libaudiopolicy.so       0xA9A00000 # [~1M]
    libaudiopolicygeneric.so 0xA9900000 # [???]
    libsoundpool.so         0xA9800000 # [~1M]
    libgps.so               0xA9700000 # [~1M]
    libspeech.so            0xA9600000 # [~1M]
    liboemcamera.so         0xA9400000 # [~1M]
    libmedia_jni.so         0xA9300000 # [~1M]
    libmediaplayerservice.so 0xA9200000 # [~1M]
    libmedia.so             0xA9000000 # [~2M]
    libFFTEm.so             0xA8F00000 # [~1M]
    libSR_AudioIn.so        0xA8E00000 # [~1M] for external/srec
    libaudioflinger.so      0xA8D00000 # [~1M]
    
    # assorted system libraries
    libsqlite.so            0xA8B00000 # [~2M]
    libexpat.so             0xA8A00000 # [~1M]
    libwebcore.so           0xA8300000 # [~7M]
    libbinder.so            0xA8200000 # [~1M]
    libutils.so             0xA8100000 # [~1M]
    libcameraservice.so     0xA8000000 # [~1M]
    libhardware.so          0xA7F00000 # [<64K]
    libhardware_legacy.so   0xA7E00000 # [~1M]
    libapp_process.so       0xA7D00000 # [???]
    libsystem_server.so     0xA7C00000 # [~1M]
    libime.so               0xA7B00000 # [???]
    libaudio.so             0xA7A00000 # [~1M]
    libcamera.so            0xA7900000 # [~1M]
    libsonivox.so           0xA7800000 # [~1M]
    libvorbisidec.so        0xA7700000 # [~1M]
    libdiskconfig.so        0xA7600000 # [<64K]
    libemoji.so             0xA7500000 # [<64K]
    libjni_latinime.so      0xA7400000 # [~1M]
    libjni_pinyinime.so     0xA7300000 # [~1M]
    libttssynthproxy.so     0xA7200000 # [~1M] for frameworks/base
    libttspico.so           0xA7000000 # [~2M] for external/svox
    
    # pv libraries
    libpvasf.so                    0xA6F00000 # [???]
    libpvasfreg.so                 0xA6E00000 # [???]
    libomx_sharedlibrary.so        0xA6D00000 # [~1M]
    libopencore_download.so        0xA6C00000 # [~1M]
    libopencore_downloadreg.so     0xA6B00000 # [~1M]
    libopencore_net_support.so     0xA6800000 # [~3M]
    libopencore_rtsp.so            0xA6200000 # [~6M]
    libopencore_rtspreg.so         0xA6100000 # [~1M]
    libopencore_author.so          0xA5D00000 # [~4M]
    libomx_aacdec_sharedlibrary.so 0xA5B00000 # [~2M]
    libomx_amrdec_sharedlibrary.so 0xA5A00000 # [~1M]
    libomx_amrenc_sharedlibrary.so 0xA5900000 # [~1M]
    libomx_avcdec_sharedlibrary.so 0xA5800000 # [~1M]
    libomx_avcenc_sharedlibrary.so 0xA5700000 # [???]
    libomx_m4vdec_sharedlibrary.so 0xA5600000 # [~1M]
    libomx_m4venc_sharedlibrary.so 0xA5500000 # [???]
    libomx_mp3dec_sharedlibrary.so 0xA5400000 # [~1M]
    libopencore_mp4local.so        0xA5200000 # [~2M]
    libopencore_mp4localreg.so     0xA5100000 # [~1M]
    libopencore_player.so          0xA4800000 # [~9M]
    
    # opencore hardware support
    libmm-adspsvc.so              0xA4700000 # [<64K]
    libOmxCore.so                 0xA4600000 # [<64K]
    libOmxMpeg4Dec.so             0xA4500000 # [~1M]
    libOmxH264Dec.so              0xA4400000 # [~1M]
    libOmxVidEnc.so               0xA4300000 # [~1M]
    libopencorehw.so              0xA4200000 # [~1M]
    libOmxVdec.so                 0xA4100000 # [~1M]
    libmm-omxcore.so              0xA4000000 # [<64K]
    
    # pv libraries
    libopencore_common.so         0xA3900000 # [~7M]
    libqcomm_omx.so               0xA3800000 # [<64K]
    
    # stagefright libraries
    libstagefright_amrnb_common.so     0xA3700000 # [~1M]
    libstagefright_avc_common.so       0xA3600000 # [~1M]
    libstagefright_color_conversion.so 0xA3500000 # [<64K]
    libstagefright_omx.so              0xA3400000 # [~1M]
    libstagefrighthw.so                0xA3300000 # [~1M]
    libstagefright.so                  0xA2F00000 # [~4M]
    
    # libraries for specific hardware
    libgsl.so               0xA2E00000 # [~1M]
    libhtc_acoustic.so      0xA2D00000 # [<64K]
    libhtc_ril.so           0xA2C00000 # [~1M]
    liblvmxipc.so           0xA2B00000 # [~1M] for vendor/nxp
    libreference-cdma-sms.so 0xA2A00000 # [<64K] for hardware/ril
    
    # libraries for specific apps or temporary libraries
    libcam_ipl.so           0x9F000000 # [???]
    libwbxml.so             0x9EF00000 # [???]
    libwbxml_jni.so         0x9EE00000 # [~1M]
    libxml2wbxml.so         0x9EB00000 # [~1M]
    libdrm1.so              0x9EA00000 # [~1M]
    libdrm1_jni.so          0x9E900000 # [<64K]
    libwapcore.so           0x9E800000 # [???]
    libstreetview.so        0x9E700000 # [???]
    libwapbrowsertest.so    0x9E600000 # [???]
    libminiglobe.so         0x9E500000 # [???]
    libearth.so             0x9E400000 # [???]
    libembunit.so           0x9E300000 # [<64K]
    libneon.so              0x9E200000 # [???]
    libjni_example.so       0x9E100000 # [???]
    libjni_load_test.so     0x9E000000 # [???]
    libjni_lib_test.so      0x9DF00000 # [???]
    librunperf.so           0x9DE00000 # [???]
    libctest.so             0x9DD00000 # [<64K]
    libUAPI_jni.so          0x9DC00000 # [???]
    librpc.so               0x9DB00000 # [~1M]
    libtrace_test.so        0x9DA00000 # [???]
    libsrec_jni.so          0x9D800000 # [~2M]
    libjpeg.so              0x9D700000 # [~1M]
    libiprouteutil.so       0x9D600000 # [~1M] for external/iproute2
    libnetlink.so           0x9D500000 # [<64K] for external/iproute2
    libpagemap.so           0x9D400000 # [<64K] for system/extras/libpagemap
    libstlport.so           0x9D100000 # [~3M] for external/stlport
    libzxing.so             0x9D000000 # [<64K] for goggles
    libinterstitial.so      0x9CF00000 # [<64K] for goggles
    liblept.so              0x9CA00000 # [~5M] for external/leptonica

    How to fix the camera:
    http://xdaforums.com/showpost.php?p=7405081&postcount=502 Drivers part
    http://xdaforums.com/showpost.php?p=7136150&postcount=447 Kernel part

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

    In case you don't want to do it yourself, you can just download this package, and flash it from recovery.

    AOSP FROYO 2.2 v3.1

    v3.1 - thanks to Jack for debugging it!
    - Bootanimation is working!
    - Wifi + Kernel from Cyanogen, as mine went boggus and I can't test it if it works without a device.
    - Full APN list
    - Known bugs: camera onscreen controls do FC sometimes. Switching from camera to camcorder works, but fc when reverting back.

    v3
    - Live wallpapers support.
    - Sound recorder is now visible to the user to use.
    - All available languages are included.
    - Fixed missing sound files.
    - Cyanogen's camera fixes are included. Really a pleasure to learn from what he has done!

    v2.1
    - Fixed camera - Use v2 and replace the boot.img with this one

    What's on it:
    v2
    - Fixed GPS (was missing gps.conf + libgps.so was being allocated to wrong prelink).
    - Fixed all prelink errors by mapping all the libraries to the correct mmap banks (edited build/core/prelink-linux-arm.map).
    - Replaced Gallery3D (not complete at sources) by old enhanced Gallery (multitouch working!)
    - Added the Text-To-Speech libraries from source (got those from sdk.mk)
    - Fixed missing sounds (Lock.ogg and Unlock.ogg in OriginalSounds.mk)
    - Camera still not working, but now we don't have a prelink error, so should be fixable by replacing liboemcamera.so by one that works - maybe Cyanogen's??)
    - Bootanimation still not working... (i've looked into it and I can't figure out why it doesn't!)

    v1
    - AOSP 2.2 Froyo
    - WiFi + Kernel 2.6.32 up and running.
    - 3D Drivers
    - JIT + JIT JSC enabled
    - Multi-touch zoom on browser

    Doesn't work:
    - No boot animation, screen stays blank while booting but you can check it out using "adb logcat"
    - Camera
    - Gallery has missing mdpi graphics, I'll fix it later
    2
    yeah i know :) gonna mess a bit with it, nice with the linker :)
    1
    So actually everythings work except camera?

    How is this in terms of speed? : D
    The speed is not an issue. All the rest works, orientation, LED's etc. Only the camera doesn't because there is no open-source drivers for it on the repositories.
    1
    Awesome work mate!

    Two questions though.

    1. Which Radio version is required?
    2. Can I install the gapps from Cyanogenmod for instance?

    Cheers,
    Szusz
    Any radio will work. And yes, you can add gapps add-on from Cyanogen if you wish.