Android 模組編譯


src錄執行:


cd ~/android/src
. build/envsetup.sh

envsetup.sh 提供了一些的bash當執行了envsetup.sh后就可以使用help 來檢視


help

得到令的輔助說明資訊


Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory.
- mmm: Builds all of the modules in the supplied directories.
- cgrep: Greps on all local C/C++ files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.

Look at the source to view more functions. The complete list is:
add_lunch_combo cgrep check_product check_variant choosecombo chooseproduct choosetype choosevariant croot findmakefile gd
bclient get_abs_build_var getbugreports get_build_var getprebuilt gettop help isviewserverstarted jgrep lunch m mm mmm pid
printconfig print_lunch_menu resgrep runhat runtest setpaths set_sequence_number set_stuff_for_environment settitle smoke
test startviewserver stopviewserver tapas tracedmdump

其中編譯輔助說明的是tapasmmmmmm這幾個指令。



立模建構指




  • m: Makes from the top of the tree.



  • mm: Builds all of the modules in the current directory.



  • mmm: Builds all of the modules in the supplied directories.



其中mmm后面要跟模的根目,不是所有的目下都有子模,那些含有Android.mk檔案才是模的根目,模名可以Android.mkLOCAL_MODULE或者LOCAL_PACKAGE_NAME變數中得到。


單獨編譯某模,需要在mmm后面指定模,例如編譯external 中的jpeg


root@ubuntu:/home/android/src# mmm external/jpeg/
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.1-update1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ECLAIR
============================================

make: Entering directory `/home/android/src'
Target buildinfo: out/target/product/generic/root/default.prop
Target buildinfo: out/target/product/generic/system/build.prop
Copy: out/target/product/generic/system/etc/apns-conf.xml
make: Leaving directory `/home/android/src'

root@ubuntu:/home/android/src#
或者可用 mm 再欲編譯的模組目錄下執行
root@ubuntu:/home/android/src/external/jpeg# mm
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.1-update1
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ECLAIR
============================================

make: Entering directory `/home/android/src'
Copy: out/target/product/generic/system/etc/apns-conf.xml
make: Leaving directory `/home/android/src'
root@ubuntu:/home/android/src/external/jpeg#

或者可用 m 編譯全部的模組
root@ubuntu:/home/android/src# m

你也可以在src下直接make module name


打開看 ./external/jpeg/Android.mk


看到裡面模組名稱為 libjpeg


LOCAL_MODULE:= libjpeg


這樣你就可以直接打模組名稱編譯


cd ~/android/src
make libjpeg

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 立你斯 的頭像
    立你斯

    立你斯學習記錄

    立你斯 發表在 痞客邦 留言(0) 人氣()