2015年8月17日 星期一

Ubuntu 14.04 編譯 Android4.4 SDK A31

編譯Android source code,依照Installing required packages (Ubuntu 14.04)需安裝相關的套件。

Android Build

Once you have unpacked the SDK (the lichee directory in particular)

Configuring the Build

The SDK can build android or linux flavor images, and may target different boards. Running ./build.sh will list the options.
先至lichee下build linex kernel 產品所要選定的chip版本
lichee$ ./build.sh -p sun6i_fiber
I found that this failed silently when generating the rootfs(see gen_rootfs_log.txt). The reason for this was that the treat warning as errors flag was set in makedevs.mk. By removing this then everything worked as expected. Running build.sh will produce binaries and images underout/<platform>/{linux,android}.

Building Android

android4.4$ source build/envsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/softwinner/fiber-common/vendorsetup.sh
including device/softwinner/fiber-a31st512m/vendorsetup.sh
including device/softwinner/fiber-w02/vendorsetup.sh
including device/softwinner/fiber-a31st/vendorsetup.sh
including device/softwinner/fiber-3g/vendorsetup.sh
including device/softwinner/fiber-a31stm/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including sdk/bash_completion/adb.bash

android4.4$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_x86-eng
     3. aosp_mips-eng
     4. vbox_x86-eng
     5. aosp_tilapia-userdebug
     6. aosp_grouper-userdebug
     7. aosp_flo-userdebug
     8. aosp_deb-userdebug
     9. aosp_hammerhead-userdebug
     10. aosp_mako-userdebug
     11. aosp_manta-userdebug
     12. fiber_a31st512m-eng
     13. fiber_a31st512m-user
     14. fiber_w02-eng
     15. fiber_w02-user
     16. fiber_a31st-eng
     17. fiber_a31st-user
     18. fiber_3g-eng
     19. fiber_3g-user
     20. fiber_a31stm-eng
     21. fiber_a31stm-user
     22. mini_armv7a_neon-userdebug
     23. mini_mips-userdebug
     24. mini_x86-userdebug

Which would you like? [aosp_arm-eng] 18

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=fiber_3g
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-61-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_DIR=out
============================================

android4.4$ extract-bsp 
android4.4/device/*/fiber-3g/bImage copied!
android4.4/device/*/fiber-3g/modules copied

android4.4$ make –j4
This should create the image files that are needed for packing.

Packing the Image

經過漫長的等待,在android4.4/out/target/product/fiber-3g/產生這些檔案
boot.img
ramdisk.img
ramdisk-recovery.img
recovery.img
system.img
將build好的檔案打包成一個image(.img)檔
lichee$ ./build.sh pack
pack 完的image會輸出至 lichee/tools/pack_brandy/sun6i_android_fiber-3g.img,檔名會依照當初lunch選擇的項目稍有變動。

Notes

在build linux kernel與android4.4 一定要分兩個Terminal,不然在build的過程中會有一些warning而進入了Werror的錯誤。目前猜測應該是
lichee$ ./build.sh -p sun6i_fiber
android4.4$ source build/envsetup.sh
這兩個個別執行時會有些環境變數,或include path 互相影響了。

Ref:
http://linux-sunxi.org/SDK_build_howto_A31

沒有留言:

張貼留言