2. Build Android on Windows
• 3-Way try to do that.
1.Virtual Machine install Linux(like Ubuntu, or Customer distribution
http://nathanpfry.com/builduntu-virtual-machine-android-rom-compiling/)
Which install VirtualBox and run upside link provide image to build.
2.Using Cygwin, But will encounter a lot of problem
Install all package spend lot of time.
But I try this way to build on Windows 8.1 x64 platform.
3. Using XDA Cygwin + Android Kitchen
http://forum.xda-developers.com/showthread.php?t=2195858
https://github.com/dsixda/Android-Kitchen
3. Install Cygwin
• Install JDK before install Cygwin
• Download from Oracle site. At least Version 6+
• Download Cygwin from: http://cygwin.com/install.html
• Install, Choose JP mirror site will get better download speed.
• Don’t install all package, Exclude Graphic, KDE, Gnome, X11, Game…etc.
Some thing you won’t need in build.
• Minimal install package didn’t try.
• Install all package will cost around 60GB Disk space.
4. Install JDK 6
• Download Windows JDK x64 from Oracle Website.
• http://www.oracle.com/technetwork/java/javase/downloads/java-archive-
downloads-javase6-419409.html
• Remove current JDK you install.(If newer than JDK 6)
Cause system will automatic setting machine register into newest JDK version.
• Install JDK 6, MAKE SURE INSTALL PATH WITHOUT SPACE.
If install in default path like: C:Program Filesjavajdk_1.6.0_45
When #make clean, #make … you will encounter Java version not corrent.
I’m install in D:
You also can install in default path, and copy hole JDK to non-spacing path.
6. Get repo in Gygwin
• Once you install Gygwin completed. You need install Google repo first.
• Google repo help you get Android Source code from Google git site.
• # cd ~ && mkdir bin
• # curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
• # chmod a+x ~/bin/repo
• # mkdir android && cd android
• # ~/bin/repo init –u -u https://android.googlesource.com/platform/manifest -b
android-4.4_r1
• # repo sync
7. Get other necessary file you need.
• # cd ~ && mkdir android_pack_download
• # wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-krt16m-
bf9b8548.tgz
• # wget https://dl.google.com/dl/android/aosp/lge-hammerhead-krt16m-
0efa9c33.tgz
• # wget https://dl.google.com/dl/android/aosp/qcom-hammerhead-krt16m-
53cf1896.tgz
• # for f in *.tgz; do tar xzf $f; done
• # for extractor_script in *.sh; do bash $extractor_script; done
• # cp –r vendor ~/android/
8. Get other necessary file you need.
• # wget https://dl.google.com/dl/android/aosp/hammerhead-krt16m-factory-
bd9c39de.tgz
• # tar xzf hammerhead-krt16m-factory-bd9c39de.tgz
• # cd hammerhead-krt16m
• # unzip image-hammerhead-krt16m.zip
• Get simg2img_win
• # wget
https://github.com/KinglyWayne/simg2img_win/blob/master/simg2img.exe
• # chmod a+x simg2img.exe
• #./simg2img system.img system.img.raw
9. Get other necessary file you need.
• Using “Disk internals Linux Reader” to mount image.
• http://www.diskinternals.com/linux-reader/
• Click Right-up coroner “Drives” -> “Raw Disk Images” -> Select your
system.img.raw to mount.
• Copy missing file from NCKU Android Class slide said.
• Copy those file to ~/android/vendor/lge/hammerhead/proprietary/
~/android/vendor/qcom/hammerhead/proprietary/
15. Change device-partial.mk
• # cd ~/android
• # rm -r -f vendor/lge/hammerhead vendor/qcom/hammerhead
• # git clone https://github.com/jamesonwilliams/vendor_lge_hammerhead.git
vendor/lge/hammerhead
• # git clone
https://github.com/jamesonwilliams/vendor_qcom_hammerhead.git
vendor/qcom/hammerhead
• # sed -i '/^PRODUCT_RESTRICT_VENDOR_FILES/s/true/false/'
device/lge/hammerhead/full_hammerhead.mk #this command will failed,
need modify by manually.
16. Get kernel
• # git clone https://android.googlesource.com/kernel/msm.git -b android-msm-
hammerhead-3.4-kk-r1 kernel
• # sed -i '48,51d' kernel/AndroidKernel.mk
• # sed -i '47s,$, zImage-dtb,' kernel/AndroidKernel.mk
17. Try build in Gygwin
• # . build/envsetup.sh
• # lunch aosp_hammerhead-userdebug #error.
• # make clean
• # make updatepackage # -j10
18. Add leak windows_sdk_whitelist.mk
• Copy https://code.google.com/p/android-source-
browsing/source/browse/build/windows_sdk_whitelist.mk?repo=platform--
development&r=645a29c837ca42016f20d1949127b58c6a105d31
• Name “windows_sdk_whitelist.mk”, copy to ~/android/build/core/
• Edit ~/android/build/core/main.mk
• Line 431
ifeq ($(SDK_ONLY),true)
#include $(TOPDIR)sdk/build/windows_sdk_whitelist.mk
#include $(TOPDIR)development/build/windows_sdk_whitelist.mk
include build/core/windows_sdk_whitelist.mk
include build/core/windows_sdk_whitelist.mk
19. Problem can’t solve 1
$ lunch aosp_hammerhead-userdebug
build/core/product_config.mk:227: ***
_nic.PRODUCTS.[[device/lge/hammerhead/aosp_hammerhead.mk]]:
"frameworks/native/build/phon e-xhdpi-2048-dalvik-heap.mk"
does not exist. Stop.
** Don't have a product spec for: 'aosp_hammerhead'
** Do you have the right repo manifest?
• 2015/03/18 Solve by re-sync repo again.
20. Problem can’t solve 2
$ make updatepackage –j8
…
find: ‘../../../libcore/dex/src/main/java’: No such file or directory
including dalvik/libdex/Android.mk ...
…
including development/apps/BuildWidget/Android.mk ...
build/core/java.mk:23: *** development/apps/BuildWidget: Invalid
LOCAL_SDK_VERSION 'current' Choices are: . Stop.
• 2015/03/18 Solve by re-sync repo again.
21. Problem can’t solve 3
$ make updatepackage –j8
…
including system/extras/ext4_utils/Android.mk ...
PRODUCT_COPY_FILES device/generic/goldfish/data/etc/apns-
conf.xml:system/etc/apns-conf.xml ignored.
make: *** No rule to make target 'out/host/windows-x86/bin/mkbootimg.exe',
needed by 'out/target/product/hammerhead/boot.img'. Stop.
http://forum.xda-developers.com/android/software/experiment-building-cm11-
cygwin-t2858560
Download mkbootimg.exe to solve.
22. Problem can’t solve 4
• make: *** No rule to make target 'out/host/windows-x86/bin/acp', needed by
'out/target/product/hammerhead/kernel'. Stop.
23. Build Android on Ubuntu
• Encounter some problem:
1. Leak libz.so.1
prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-
google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot
open shared object file: No such file or directory
make: *** [out/host/linux-
x86/obj/EXECUTABLES/mkbootimg_intermediates/mkbootimg.o] Error 1
• Soultion:
# sudo apt-get install lib32z1
Note detail @ my blog: http://www.ntex.tw/wordpresas/2175.html
24. Build Android on Ubuntu
2. Leak “flex”
/bin/bash: flex: command not found make: *** [out/host/linux-
x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_scan.cpp] Error 127
Solution:
# sudo apt-get install flex
Note detail @ my blog: http://www.ntex.tw/wordpress/2180.html
• Useful website: http://nosemaj.org/howto-build-android-kitkat-nexus-5
26. systrace
• Find which tags can test performance
gfx – Graphics
wm - Window Manager
am - Activity Manager
res - Resource Loading
dalvik - Dalvik VM
sched - CPU Scheduling
freq - CPU Frequency
membus - Memory Bus Utilization
idle - CPU Idle
disk - Disk input and output
load - CPU Load
27.
28. About
• This slide build by Nathaniel Chen
• 2015/03/19 1522
• ar801112usase@hotmail.com
• http://www.ntex.tw/wordpress