1. Android Build
Android 는 envsetup.sh이라는 shell script 이용하여, 전체빌드 및 부분빌드, 다양한 shell 기능을 제공한다.
1.1 Android 전체빌드의 예제 (ODROID X2 )
- envsetup을 설정
- lunch로 환경설정
- make
$ . build/envsetup.sh or $ source build/envsetup.sh
$ lunch odroidx2-eng
$ make -j4
- odroidx2-user : 최종제품으로 엑세스를 제한
- odroidx2-userdebug: user 기능에 디버깅기능을 추가 및 root 액세스가 가능하여 디버깅용
- odroidx2-eng : 디버깅 추가 도구
Google Android Build
2. build/envsetup.sh 의 기능
envsetup.sh는 android에서 제공하는 shell script로 안에 기본 function들을 제공하고 있으며, vendorsetup 관련부분도 봐야한다.
- source build/envsetup.sh 실행시
odroidx2를 vendor를 등록한 것을 확인이 가능 (lollipop version)
$ . build/envsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/hardkernel/odroidx2/vendorsetup.sh
including device/hardkernel/odroidu/vendorsetup.sh
including device/hardkernel/odroidx/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including sdk/bash_completion/adb.bash
lunch에 등록시 odroidx2-userdebug 와 odroidx2-eng 설정등록다름
$ cat device/hardkernel/odroidx2/vendorsetup.sh
add_lunch_combo odroidx2-userdebug
add_lunch_combo odroidx2-eng
1.1 빌드환경 설정 (choosecombo, lunch)
Android의 빌드환경을 설정해주는 도구로, choosecombo는 아직 사용못해봄.
등록된 vendor 정보로 나의 환경을 설정
$ lunch odroidx2-eng
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1
TARGET_PRODUCT=odroidx2
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.2.0-67-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=LMY47I
OUT_DIR=out
============================================
cgrep/jgrep/lunch 등 관련부분 설명
http://chlrbgh0.tistory.com/207
세부동작은 build/envsetup.sh 개별 function을 참고
- lunch function 참조
- choosecombo function 참조
1.2 build 방법
부분빌드 사용법은 전체빌드와 동일하며, build /envsetup 설정 한 후 각 function을 이용가능하다.
세부동작은 build/envsetup.sh 개별 function을 참고
- m - 현재 경로를 기준으로 소스 트리의 최상위 경로로 이동한 후 make를 실행해준다.
- mm - 현재 경로를 기준으로 가장 가까운 단위 모듈을 찾아서 그 모듈만 build 해준다.
- mmm - 파라미터로 주어진 경로들에 대해 단위 모듈 build를 해준다. 마지막에 snod를 추가할 경우 System image 파일까지 새로 생성해준다
$ hmm
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch -
- tapas: tapas [ ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
- 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, but not their dependencies.
- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Builds all of the modules in the current directory, and their dependencies.
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
- cgrep: Greps on all local C/C++ files.
- ggrep: Greps on all local Gradle files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
아래내용참조.
http://www.kaisyu.com/notes/google-android/android-envsetupsh
http://www.kaisyu.com/notes/google-android/android-partial-module-build
- 먼저 관련 directory 이동
- build/envsetup.sh 위치를 찾고 source envsetup.sh 설정 (source 대신 . 사용가능)
- 부분빌드 시도. (mm)
$ . ../../build/envsetup.sh
$ mm
make: *** No rule to make target `out/target/product/generic/obj/SHARED_LIBRARIES/libc_intermediates/export_includes', needed by `out/target/product/generic/obj/SHARED_LIBRARIES/libiw_intermediates/import_includes'. Stop.
$ find out -name libc_intermediates
out/target/product/odroidx2/obj/SHARED_LIBRARIES/libc_intermediates
out/target/product/odroidx2/obj/STATIC_LIBRARIES/libc_intermediates
- ODROID는 에러가 나서, Main root에서 아래와 같이 실행
$ source build/envsetup.sh
$ export TARGET_PRODUCT=odroidx2
$ mmm /external/wireless-tools
http://com.odroid.com/sigong/nf_board/nboard_view.php?brd_id=freeboard&kind=&bid=104