2011年3月4日 星期五

建立AOSP (Dream/Sapphire by Gingerbread for example)

http://forum.xda-developers.com/showthread.php?t=882356


As some of you may know I've been working on a open source build for a near AOSP version of Gingerbread for the Dream/Sapphire.

Unless a better name is conceived I'll call it ezGingerbread!

The idea is to do this mostly in the open; and I'm sure this will be forked into various builds in the future. Here however we can discuss this repository; and make recommendations for maintaining a base stable, and fast install for out phones.

I'll make a new thread for initial release candidates and releases when we are ready. This thread will remain even after said releases for the ongoing development.

NOTICE this thread is to help build & develop gingerbread roms for the Dream/Sapphire platform; no binaries on this page are supported at this point in time; and no rom installation support will be provided.

Help with the build system will be provided within reason.

(FYI: if you are looking for testing binaries they are in post 2)

To Build,

The following is based off CyanogenMod wiki and explains how to build on:
Ubuntu 10.04 (Lucid) & Ubuntu 10.10a3 (Meerkat) and ideally a AMD64 compatible computer

I personally (mostly following the same instructions) use Debian squeeze and others have succeeded with 32bit systems.

Computer Setup (only if you have not made an android build environment before):

1) It is not 100% needed but highly recommended to install the Android SDK
2) Install the build packages
Originally Posted by cmwiki
Install using the package manager of your choice:

For 32-bit & 64-bit systems:

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

For 64-bit only systems:

g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

Note: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:

add-apt-repository "deb http://archive.canonical.com/ maverick partner"
3) make a directory for you android work say 'mkdir ~/android'
4) download repo: 'curl http://android.git.kernel.org/repo > ~/android/repo'
5) symlink repo to somewhere on your path (Optional but will make things easier) example 'sudo ln -s ~/android/repo /usr/local/bin/repo'

if you do not add repo to the path remember to replace any calls to repo with a calling path.. in all cases below it will be '../repo'

Getting the code

6) cd into your android directory you created above: 'cd ~/android'
7) create a directory for ezGingerbread: 'mkdir ezGingerbread'
8) cd ezGingerbread
9) init the repo: 
Code:
repo init -u git://github.com/ezterry/manifest-gingerbread-DS.git -b gingerbread
it will ask for your name+gmail, answer real or fake
10) sync to download the code: 
Code:
repo sync
(go out and enjoy the day.. this will take a while)

Proprietary files

Extract the proprietary files, historically the extract_files script is used, but requires your phone to already have the rom installed, so we will use unzip_files instead.

11) download the most recent version of the nighties (usually the proprietary files don't change but sometimes we swap them):
Code:
curl http://sandbox.devnull.name/android/gingerbread/GINGERBREAD-DS-Alpha-20110129-1.zip > sapphire_update.zip
12) 'cd device/htc/sapphire/'
13) run './unzip-files.sh'
14) return to the root directory: 'cd ~/android/ezGingerbread'

Note: if you have been asked to re-build the proprietary files, either because an autogenerated make script was updated, or a change in the files: run 'rm -rf vendor;repo sync;' before re-running the above.

Building:

15) run '. build/envsetup.sh'
16) run 'lunch' and select full_sapphire-userdebug (shortcuts you will find are 'lunch full_sapphire-userdebug' or just 'lunch 3' but these may change if the target name is changed in future, the menu will always list all the options)
17) run 'make -j otapackage'
for example if you have a quad code CPU: 'make -j5 otapackage'
a dual core is 'make -j3 otapackage'

The -jN indicates the number of parallel threads make will run, but using -j5 I assure all 4 cores are at 100% utilization .. important as it can take 3-4h to build on a single core.

18) after you realize the build is done (ie fan on computer stopped working overtime) the flashable image will be:
ls out/target/product/sapphire/full_sapphire-ota-eng..zip

so 'ls -l out/target/product/sapphire/full_sapphire-ota-eng*zip'

The resulting image will be an EBI0/EBI1/2708+ anykernel installer

Updating and Rebuilding:

Usually you only need to run the following for a updated clean build:
19) run 'repo sync'
20) make clobber
21) make -j otapackage

In some cases you may wish to re-generate the proprietary files if something changed:

in that case:
* Run 'rm -rf vendor'
* Run 'repo sync'
* pick up with 'Proprietary files' section above.

Last if you are doing active development in the build tree its easy to be confused about the trees state, to restore to the clean tree:

* cd ~/android/ezGingerbread
* run: (note this will delete everything but the .repo (or other hidden) directories, be careful.
Code:
rm -rf `ls -a | grep -v "^\." `
* run 'repo sync' this will not take too long, its just extracting the files, the data has mostly been downloaded from your original sync.
* Continue with the 'Proprietary files' section above.

To Fix,

If you have a patch give me a push on github, a message here, or send me a PM I'll review it and include it if appropriate.

Known issues and status,

I'm currently tracking issues on github:
https://github.com/ezterry/manifest-...read-DS/issues

若在建立aosp遇到無法compile

如果遇到git server有新的程式更新導致無法build, 可以用以下方法退回去:


repo forall -c "git checkout android-2.3.2_r1"
repo sync ezterry/GB-build
repo sync ezterry/GB-platform_dalvik
repo sync ezterry/GB-device_htc_dream-sapphire
repo sync ezterry/GB-device_htc_sapphire
repo sync ezterry/GB-external_clearsilver
repo sync ezterry/GB-android_external_skia
repo sync ezterry/GB-external_webkit
repo sync ezterry/GB-framework_base
repo sync ezterry/GB-hardware_qcom_gpsshim
repo sync ezterry/GB-hardware_qcom_media
repo sync ezterry/GB-packages_inputmethods_LatinIME
repo sync ezterry/GB-system_core
repo sync ezterry/GB-system_extras