• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Pf部2011年10月勉強会.1@androidsola
 

Pf部2011年10月勉強会.1@androidsola

on

  • 5,088 views

 

Statistics

Views

Total Views
5,088
Views on SlideShare
5,078
Embed Views
10

Actions

Likes
2
Downloads
52
Comments
0

4 Embeds 10

http://paper.li 4
https://twitter.com 4
http://a0.twimg.com 1
https://si0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Pf部2011年10月勉強会.1@androidsola Pf部2011年10月勉強会.1@androidsola Presentation Transcript

    • Android のビルドシステムsola 1
    • 自己紹介 – sola ( twitter は @androidsola ) – 最近は G+ と FB にもいますsola 2
    • Android のビルド手順1. ソースコードのダウンロード$ repo init -u https://android.googlesource.com/platform/ manifest -b android-2.3.7_r1※1 行です$ repo sync -j82. ビルド$ source build/envsetup.sh$ lunch generic-eng$ make -j8sola 3
    • ============================================PLATFORM_VERSION_CODENAME=REL Android のビルド手順PLATFORM_VERSION=2.3.7TARGET_PRODUCT=genericTARGET_BUILD_VARIANT=engTARGET_SIMULATOR=TARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armHOST_ARCH=x86HOST_OS=linuxHOST_BUILD_TYPE=releaseBUILD_ID=GWK74============================================Checking build tools versions...(中略)Finding NOTICE files: out/target/product/generic/obj/NOTICE_FILES/hash-timestampCombining NOTICE files: out/target/product/generic/obj/NOTICE.htmlTarget system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediaInstall system fs image: out/target/product/generic/system.imgInstalled file list: out/target/product/generic/installed-files.txtDroidDoc took 112 sec. to write docs to out/target/common/docs/doc-comment-check sola 4
    • 概要1. 今回・基本的な内容・ターゲットの追加方法・今回扱う Android は、 android-2.3.7_r12. 次回・ビルドシステムの詳細※Ice Cream Sandwich で遊びすぎてまとめられませんでした。sola 5
    • make で行われることの調査● make の実行で行われる色々な設定● 対象は拡張子が .mk のファイルsola 6
    • Makefilebuild/core/main.mk Android のビルド手順build/core/config.mkbuild/core/pathmap.mkbuild/core/envsetup.mkbuild/core/version_defaults.mkbuild/core/build_id.mkbuild/core/product_config.mkbuild/core/node_fns.mkbuild/core/product.mkbuild/core/device.mkdevice/sample/products/AndroidProducts.mkdevice/htc/passion/AndroidProducts.mkdevice/samsung/crespo/AndroidProducts.mkdevice/samsung/crespo4g/AndroidProducts.mkbuild/target/product/AndroidProducts.mkbuild/target/product/core.mkbuild/target/product/full.mkbuild/target/product/generic.mkbuild/target/product/core.mkbuild/target/product/languages_small.mkexternal/svox/pico/lang/all_pico_languages.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mk sola 7
    • external/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mk Android のビルド手順external/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mkexternal/svox/pico/lang/PicoLangItItInSystem.mkframeworks/base/data/sounds/OriginalAudio.mkbuild/target/product/generic.mkbuild/target/product/core.mkbuild/target/product/generic_x86.mkbuild/target/product/core.mkbuild/target/product/sdk.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mkexternal/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mkexternal/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mkexternal/svox/pico/lang/PicoLangItItInSystem.mkbuild/target/product/core.mkbuild/target/product/sim.mkbuild/target/product/generic.mkbuild/target/product/core.mkdevice/htc/passion/full_passion.mkbuild/target/product/full.mk sola 8
    • build/target/product/generic.mkbuild/target/product/core.mk Android のビルド手順build/target/product/languages_small.mkexternal/svox/pico/lang/all_pico_languages.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mkexternal/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mkexternal/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mkexternal/svox/pico/lang/PicoLangItItInSystem.mkframeworks/base/data/sounds/OriginalAudio.mkbuild/target/product/languages_full.mkdevice/htc/passion/passion_us.mkdevice/common/gps/gps_us_supl.mkdevice/htc/passion/passion.mkdevice/htc/passion-common/passion.mkdevice/htc/common/common.mkdevice/htc/passion-common/media_a1026.mkdevice/sample/products/sample_addon.mkbuild/target/product/sdk.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mkexternal/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mk sola 9
    • external/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mk Android のビルド手順external/svox/pico/lang/PicoLangItItInSystem.mkbuild/target/product/core.mkdevice/samsung/crespo/full_crespo.mkbuild/target/product/full.mkbuild/target/product/generic.mkbuild/target/product/core.mkbuild/target/product/languages_small.mkexternal/svox/pico/lang/all_pico_languages.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mkexternal/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mkexternal/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mkexternal/svox/pico/lang/PicoLangItItInSystem.mkframeworks/base/data/sounds/OriginalAudio.mkbuild/target/product/languages_full.mkdevice/samsung/crespo/device.mkdevice/samsung/crespo/device_base.mkdevice/samsung/crespo4g/full_crespo4g.mkbuild/target/product/full.mkbuild/target/product/generic.mk sola 10
    • build/target/product/core.mkbuild/target/product/languages_small.mk Android のビルド手順external/svox/pico/lang/all_pico_languages.mkexternal/svox/pico/lang/PicoLangDeDeInSystem.mkexternal/svox/pico/lang/PicoLangEnGBInSystem.mkexternal/svox/pico/lang/PicoLangEnUsInSystem.mkexternal/svox/pico/lang/PicoLangEsEsInSystem.mkexternal/svox/pico/lang/PicoLangFrFrInSystem.mkexternal/svox/pico/lang/PicoLangItItInSystem.mkframeworks/base/data/sounds/OriginalAudio.mkbuild/target/product/languages_full.mkdevice/samsung/crespo4g/device.mkdevice/samsung/crespo/device_base.mkbuild/target/board/generic/BoardConfig.mkbuild/core/combo/select.mkbuild/core/combo/HOST_linux-x86.mkbuild/core/combo/select.mkbuild/core/combo/TARGET_linux-arm.mkbuild/core/combo/arch/arm/armv5te.mkbuild/core/combo/javac.mkbuild/core/cleanbuild.mkbuild/core/cleanspec.mkexternal/freetype/CleanSpec.mk sola 11
    • packages/apps/Phone/CleanSpec.mkexternal/bouncycastle/CleanSpec.mk Android のビルド手順system/extras/CleanSpec.mkexternal/bluetooth/hcidump/CleanSpec.mkbootable/recovery/CleanSpec.mksystem/vold/CleanSpec.mkexternal/dnsmasq/CleanSpec.mkpackages/wallpapers/Basic/CleanSpec.mkexternal/esd/CleanSpec.mkexternal/netperf/CleanSpec.mkhardware/libhardware_legacy/CleanSpec.mkexternal/icu4c/CleanSpec.mkexternal/svox/CleanSpec.mkexternal/jhead/CleanSpec.mkpackages/apps/Camera/CleanSpec.mkpackages/wallpapers/MusicVisualization/CleanSpec.mkhardware/libhardware/CleanSpec.mkpackages/apps/DeskClock/CleanSpec.mkpackages/apps/Nfc/CleanSpec.mkhardware/broadcom/wlan/CleanSpec.mkexternal/nist-sip/CleanSpec.mkdevice/htc/passion/CleanSpec.mkpackages/inputmethods/LatinIME/CleanSpec.mk sola 12
    • packages/providers/CalendarProvider/CleanSpec.mkdevice/sample/CleanSpec.mksdk/CleanSpec.mk Android のビルド手順external/zlib/CleanSpec.mkexternal/junit/CleanSpec.mkbionic/CleanSpec.mkexternal/dropbear/CleanSpec.mkpackages/apps/CertInstaller/CleanSpec.mkpackages/providers/ApplicationsProvider/CleanSpec.mkprebuilt/CleanSpec.mkexternal/ppp/CleanSpec.mkexternal/tinyxml/CleanSpec.mkpackages/apps/Music/CleanSpec.mkpackages/experimental/CleanSpec.mkexternal/bluetooth/bluez/CleanSpec.mkpackages/apps/Launcher2/CleanSpec.mkexternal/bluetooth/glib/CleanSpec.mksystem/wlan/ti/CleanSpec.mkexternal/genext2fs/CleanSpec.mkexternal/oprofile/CleanSpec.mkpackages/providers/DrmProvider/CleanSpec.mkcts/CleanSpec.mkexternal/tcpdump/CleanSpec.mk sola 13
    • external/apache-http/CleanSpec.mkexternal/giflib/CleanSpec.mk Android のビルド手順device/samsung/crespo4g/CleanSpec.mkexternal/libpcap/CleanSpec.mkdevelopment/CleanSpec.mkdevice/htc/passion-common/CleanSpec.mkexternal/elfcopy/CleanSpec.mkexternal/jdiff/CleanSpec.mkndk/CleanSpec.mkframeworks/ex/CleanSpec.mkexternal/expat/CleanSpec.mkexternal/oauth/CleanSpec.mkexternal/gtest/CleanSpec.mkexternal/proguard/CleanSpec.mkexternal/elfutils/CleanSpec.mkframeworks/opt/emoji/CleanSpec.mkpackages/apps/Provision/CleanSpec.mkhardware/qcom/gps/CleanSpec.mkexternal/dhcpcd/CleanSpec.mkexternal/strace/CleanSpec.mkframeworks/base/CleanSpec.mkhardware/msm7k/CleanSpec.mkexternal/protobuf/CleanSpec.mk sola 14
    • external/speex/CleanSpec.mkhardware/ril/CleanSpec.mk Android のビルド手順external/wpa_supplicant/CleanSpec.mkexternal/libxml2/CleanSpec.mkexternal/quake/CleanSpec.mkbootable/diskinstaller/CleanSpec.mkexternal/skia/CleanSpec.mkpackages/apps/Stk/CleanSpec.mkexternal/fdlibm/CleanSpec.mkexternal/e2fsprogs/CleanSpec.mkexternal/fsck_msdos/CleanSpec.mkpackages/apps/Protips/CleanSpec.mkexternal/neven/CleanSpec.mklibcore/CleanSpec.mkexternal/astl/CleanSpec.mksystem/bluetooth/CleanSpec.mkexternal/wpa_supplicant_6/CleanSpec.mkhardware/ti/omap3/CleanSpec.mkexternal/sqlite/CleanSpec.mkpackages/apps/Gallery/CleanSpec.mksystem/media/CleanSpec.mkexternal/jpeg/CleanSpec.mkexternal/stlport/CleanSpec.mk sola 15
    • system/netd/CleanSpec.mkexternal/iproute2/CleanSpec.mk Android のビルド手順external/netcat/CleanSpec.mkexternal/libffi/CleanSpec.mkexternal/mtpd/CleanSpec.mkpackages/providers/GoogleContactsProvider/CleanSpec.mkpackages/apps/Gallery3D/CleanSpec.mkexternal/kernel-headers/CleanSpec.mkpackages/apps/Browser/CleanSpec.mkexternal/srec/CleanSpec.mkexternal/sonivox/CleanSpec.mkpackages/inputmethods/OpenWnn/CleanSpec.mkexternal/ping/CleanSpec.mkpackages/apps/SoundRecorder/CleanSpec.mkpackages/apps/SpeechRecorder/CleanSpec.mkpackages/apps/PackageInstaller/CleanSpec.mkexternal/webkit/CleanSpec.mkexternal/tremolo/CleanSpec.mkhardware/qcom/media/CleanSpec.mkpackages/apps/Mms/CleanSpec.mkexternal/emma/CleanSpec.mkexternal/jsr305/CleanSpec.mkexternal/clearsilver/CleanSpec.mk sola 16
    • packages/apps/AccountsAndSyncSettings/CleanSpec.mkpackages/apps/HTMLViewer/CleanSpec.mk Android のビルド手順packages/apps/QuickSearchBox/CleanSpec.mkpackages/apps/Calendar/CleanSpec.mkpackages/apps/VoiceDialer/CleanSpec.mkpackages/providers/TelephonyProvider/CleanSpec.mkexternal/bison/CleanSpec.mkexternal/guava/CleanSpec.mkpackages/apps/CellBroadcastReceiver/CleanSpec.mkexternal/libgsm/CleanSpec.mkexternal/easymock/CleanSpec.mkdevice/htc/common/CleanSpec.mkpackages/apps/Bluetooth/CleanSpec.mkexternal/grub/CleanSpec.mkexternal/safe-iop/CleanSpec.mkexternal/ipsec-tools/CleanSpec.mkexternal/blktrace/CleanSpec.mkexternal/libpng/CleanSpec.mkdevice/samsung/crespo/CleanSpec.mksystem/core/CleanSpec.mkpackages/wallpapers/MagicSmoke/CleanSpec.mkexternal/bzip2/CleanSpec.mkexternal/iptables/CleanSpec.mk sola 17
    • hardware/ti/wlan/CleanSpec.mkexternal/embunit/CleanSpec.mk Android のビルド手順external/bsdiff/CleanSpec.mkexternal/chromium/CleanSpec.mkpackages/wallpapers/LivePicker/CleanSpec.mkexternal/openssl/CleanSpec.mkpackages/apps/Calculator/CleanSpec.mkdalvik/CleanSpec.mkexternal/xmlwriter/CleanSpec.mkpackages/providers/ContactsProvider/CleanSpec.mkpackages/providers/DownloadProvider/CleanSpec.mkdevice/common/CleanSpec.mkpackages/apps/Contacts/CleanSpec.mkpackages/providers/UserDictionaryProvider/CleanSpec.mkexternal/dbus/CleanSpec.mkexternal/qemu/CleanSpec.mkpackages/inputmethods/PinyinIME/CleanSpec.mkpackages/providers/MediaProvider/CleanSpec.mkexternal/yaffs2/CleanSpec.mkexternal/v8/CleanSpec.mkpackages/apps/Email/CleanSpec.mkexternal/tagsoup/CleanSpec.mkpackages/apps/Settings/CleanSpec.mk sola 18
    • bootable/bootloader/legacy/CleanSpec.mkbuild/CleanSpec.mk Android のビルド手順build/core/definitions.mkbuild/core/distdir.mkbuild/core/user_tags.mkbuild/core/dex_preopt.mkbionic/Android.mkbuild/core/clear_vars.mkbionic/libc/Android.mkbionic/libc/arch-arm/syscalls.mkbuild/core/static_library.mkbuild/core/binary.mkbuild/core/base_rules.mkbuild/core/notice_files.mk sola 19
    • generic での設定generic とは、ビルド時に指定してるもの$ source build/envsetup.sh$ lunch generic-eng$ make -j8generic 指定なので、generic.mk 、generic フォルダ配下の BoardConfig.mk を読み込む。sola 20
    • generic での設定読まれるファイルの一覧   build/target/product/generic.mk   build/target/product/core.mk   build/target/board/generic/BoardConfig.mk   build/core/combo/select.mk   build/core/combo/HOST_linux-x86.mk   build/core/combo/select.mk   build/core/combo/TARGET_linux-arm.mk   build/core/combo/arch/arm/armv5te.mk   build/core/combo/javac.mksola 21
    • generic 以外の設定lunch だけを実行すると、設定可能なリストが出てくる。$ lunchYoure building on LinuxLunch menu... pick a combo: 1. generic-eng 2. simulator 3. full_passion-userdebug 4. full_crespo-userdebug 5. full_crespo4g-userdebugsola 22
    • generic 以外の設定設定は、以下の 3 箇所から探す  vendor/*/vendorsetup.sh  vendor/*/build/vendorsetup.sh  device/*/*/vendorsetup.shandroid-2.3.7_r1 で探すと、以下の 3 つ  device/htc/passion/vendorsetup.sh  device/samsung/crespo/vendorsetup.sh  device/samsung/crespo4g/vendorsetup.shgeneric と simulator はどこか?sola 23
    • generic と simulatorbuild/envsetup.sh に存在する。  add_lunch_combo generic-eng  add_lunch_combo simulatorsimulator は、 uname が Linux の場合に追加される。※master では消えた。master の場合、 generic は存在しない。以下 3 つが設定される。  add_lunch_combo full-eng  add_lunch_combo full_x86-eng  add_lunch_combo vbox_x86-engsola 24
    • lunch がやっていること・ビルドの設定可能なものの一覧を表示する  print_lunch_menu を呼び出す。・選択した設定が正しいか確認する 正しくないものを選ぶと、 エラーメッセージを出して終了する。・環境変数設定 コンパイラのパス等も、ここで設定される。  JAVA_HOME の設定がないと、  export JAVA_HOME=/usr/lib/jvm/java-6-sun を実行する。sola 25
    • 指定可能なターゲット( CPU )$ ls build/core/combo/HOST_darwin-x86.mkHOST_linux-x86.mkHOST_windows-x86.mkTARGET_linux-arm.mkTARGET_linux-sh.mkTARGET_linux-x86.mkarchjavac.mkselect.mksola 26
    • ARM$ ls build/core/combo/arch/arm/armv4t.mkarmv5te-vfp.mkarmv5te.mkarmv7-a-neon.mkarmv7-a.mk設定ファイルは存在するが、 armv4t はビルド出来ない。armv5te-vfp の中身は armv5te と同じ。実質、 3 種類。sola 27
    • armv6.mk を追加してみる自分で用意すれば armv6 等、標準には存在しないものを設定可能になる。build/core/combo/arch/arm/armv6.mk  ARCH_ARM_HAVE_THUMB_SUPPORT := true  ARCH_ARM_HAVE_FAST_INTERWORKING := true  ARCH_ARM_HAVE_64BIT_DATA := true  ARCH_ARM_HAVE_HALFWORD_MULTIPLY := true  ARCH_ARM_HAVE_CLZ := true  ARCH_ARM_HAVE_FFS := true  ARCH_ARM_HAVE_VFP := true   arch_variant_cflags :=   -march=armv6   -mtune=arm1136jf-s   -mfpu=vfp   -mfloat-abi=softfpsola 28
    • build/core/combo/arch/arm/armv6.mkdalvik/vm/compiler/codegen/arm/Codegen.h armv6.mk を追加してみるdalvik/vm/compiler/codegen/arm/CodegenDriver.cdalvik/vm/compiler/codegen/arm/armv6/ArchVariant.cdalvik/vm/compiler/codegen/arm/armv6/ArchVariant.hdalvik/vm/compiler/codegen/arm/armv6/CallingConvention.Sdalvik/vm/compiler/codegen/arm/armv6/Codegen.cdalvik/vm/compiler/template/armv6/TEMPLATE_***dalvik/vm/compiler/template/armv6/TemplateOpList.hdalvik/vm/compiler/template/armv6/fbinop.Sdalvik/vm/compiler/template/armv6/fbinopWide.Sdalvik/vm/compiler/template/armv6/funop.Sdalvik/vm/compiler/template/armv6/funopNarrower.Sdalvik/vm/compiler/template/armv6/funopWider.Sdalvik/vm/compiler/template/armv6/platform.Sdalvik/vm/compiler/template/config-armv6dalvik/vm/compiler/template/out/CompilerTemplateAsm-armv6.Sdalvik/vm/compiler/template/rebuild.shdalvik/vm/mterp/config-armv6dalvik/vm/mterp/out/InterpAsm-armv6.Sdalvik/vm/mterp/out/InterpC-armv6.cdalvik/vm/mterp/rebuild.shsola 29
    • ビルドするターゲットを増やすadd_lunch_combo xxxxx-yyyy を追加する例として、device/key/wahuu/vendorsetup.sh を作成vendorsetup.sh には、add_lunch_combo full_wahuu-eng を書く。sola 30
    • ビルドするターゲットを増やす$ lunchYoure building on LinuxLunch menu... pick a combo: 1. generic-eng 2. simulator 3. full_passion-userdebug 4. full_wahuu-eng 5. full_crespo-userdebug 6. full_crespo4g-userdebug 追加したものが出てきたので、選択してみる。sola 31
    • ビルドするターゲットを増やす実行結果$ lunch full_wahuu-engbuild/core/product_config.mk:203: *** No matches for product "full_wahuu". 中止 .** Dont have a product spec for: full_wahuu** Do you have the right repo manifest?vendorsetup.sh 追加のみでは当然、足りない。sola 32
    • ビルドするターゲットを増やすdevice/key/wahuu/AndroidProducts.mk を作成するPRODUCT_MAKEFILES := $(LOCAL_DIR)/full_wahuu.mkdevice/key/wahuu/full_wahuu.mk を作成するPRODUCT_NAME := full_wahuuPRODUCT_DEVICE := wahuuPRODUCT_MODEL := Full Android on Wahuusola 33
    • ビルドするターゲットを増やす実行結果$ lunch full_wahoo-engbuild/core/product_config.mk:196: *** device/key/wahuu/full_wahuu.mk:PRODUCT_BRAND must be defined.. 中止 .** Dont have a product spec for: full_wahuu** Do you have the right repo manifest?まだ怒られる。PRODUCT_BRAND 書けと。sola 34
    • ビルドするターゲットを増やすdevice/key/wahuu/full_wahuu.mk に追記PRODUCT_NAME := full_wahuuPRODUCT_DEVICE := wahuuPRODUCT_MODEL := Full Android on WahuuPRODUCT_BRAND := keysola 35
    • ビルドするターゲットを増やす実行結果$ lunch full_wahuu-engbuild/core/config.mk:136: *** No config file found for TARGET_DEVICE wahuu. 中止 .** Dont have a product spec for: full_wahuu** Do you have the right repo manifest?まだ怒られる。ターゲット用の config が無いのが原因。sola 36
    • ビルドするターゲットを増やすターゲット用の config を用意するdevice/key/wahuu/BoardConfig.mk  TARGET_NO_BOOTLOADER := true  TARGET_NO_KERNEL := true  TARGET_CPU_ABI := armeabi  BOARD_USES_GENERIC_AUDIO := true  USE_CAMERA_STUB := truesola 37
    • ビルドするターゲットを増やす実行結果$ lunch full_wahuu-eng============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=2.3.7TARGET_PRODUCT=full_wahuuTARGET_BUILD_VARIANT=eng(中略)HOST_BUILD_TYPE=releaseBUILD_ID=GWK74============================================うまくいった。sola 38
    • ビルドするターゲットを増やすビルドするターゲットを増やすためにしたこと。1.device/key/wahuu/vendorsetup.sh を作成する2.device/key/wahuu/AndroidProducts.mk を作成する3.device/key/wahuu/full_wahuu.mk を作成する4.device/key/wahuu/BoardConfig.mk を作成するsola 39
    • ライブラリを追加するターゲット専用のライブラリを用意する事も出来る。libwahuu を用意する場合の例。1.device/key/wahuu/libwahuu を作成する2.device/key/wahuu/libwahuu/Android.mk を作成する3.device/key/wahuu/libwahuu/ にソースコードを追加する4.device/key/wahuu/BoardConfig.mk を変更する5.device/key/wahuu/full_wahuu.mk を変更するsola 40
    • ライブラリを追加するdevice/key/wahuu/libwahuu/Android.mkLOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := wahuu.cLOCAL_PRELINK_MODULE := falseLOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hwLOCAL_MODULE := wahuu.$(TARGET_BOARD_PLATFORM)LOCAL_MODULE_TAGS := optionalinclude $(BUILD_SHARED_LIBRARY)sola 41
    • ライブラリを追加するdevice/key/wahuu/libwahuu/wahuu.cstatic int wahuu( int kudo ){ return 0;}サンプルなので、何もしない関数。sola 42
    • ライブラリを追加するdevice/key/wahuu/BoardConfig.mk に以下を追記TARGET_BOARD_PLATFORM := omap5device/key/wahuu/full_wahuu.mk に以下を追記PRODUCT_PACKAGES += wahuu.omap5sola 43
    • ライブラリを追加する以上の変更後、ビルドを実行する。ビルドログtarget thumb C: wahuu.omap5 <= device/key/wahuu/libwahuu/wahuu.ctarget SharedLib: wahuu.omap5 (out/target/product/wahuu/obj/SHARED_LIBRARIES/wahuu.target Non-prelinked: wahuu.omap5 (out/target/product/wahuu/symbols/system/lib/hw/wtarget Strip: wahuu.omap5 (out/target/product/wahuu/obj/lib/wahuu.omap5.so)Install: out/target/product/wahuu/system/lib/hw/wahuu.omap5.sodevice/key/wahuu 配下に用意したライブラリをビルドすることに成功。sola 44
    • ライブラリを追加するAndroid のソースツリーの中には、LOCAL_MODULE_TAGS := optional なものが存在する。例ADK 関連の USB ライブラリ( frameworks/base/libs/usb )frameworks/base/libs/usb/Android.mk の内容  LOCAL_PATH := $(call my-dir)  include $(CLEAR_VARS)  LOCAL_SRC_FILES := $(call all-java-files-under,src)  LOCAL_MODULE_TAGS := optional  LOCAL_MODULE:= com.android.future.usb.accessory  include $(BUILD_JAVA_LIBRARY)sola 45
    • ライブラリを追加するcom.android.future.usb.accessory を組み込む方法。ターゲット専用のライブラリの組み込みと同様、device/key/wahuu/full_wahuu.mk に追記する。PRODUCT_PACKAGES += com.android.future.usb.accessory補足 . ADK を使うにはもう一つ、ファイルコピーが必要。PRODUCT_COPY_FILES += frameworks/base/data/etc/android.hardware.usb.accessory.xml: system/etc/permissions/android.hardware.usb.accessory.xml※2 行目と 3 行目は 1 行で書く。sola 46
    • アプリを追加するライブラリ同様、 PRODUCT_PACKAGES に追記すれば良い。追記するのは Package 名。例device/key/wahuu/full_wahuu.mk に以下を追記する。PRODUCT_PACKAGES += Rewriteアプリはdevice/key/wahuu/app/Rewrite/***にあるものとする。sola 47
    • 既存のファイルを上書きするDEVICE_PACKAGE_OVERLAYS を使うことで、frameworks 配下等のファイルを差し替えてビルド出来る。例デフォルトの壁紙を差し替える。frameworks/base/core/res/res/drawable/default_wallpaper.jpgを書き換えずに、 device/key/wahuu 配下のものを使うようにする。device/key/wahuu/wahuu_overlay/frameworks/base/core/res/res/drawable/default_wallpaper.jpgを用意し、 device/key/wahuu/full_wahuu.mk に以下を追記する。DEVICE_PACKAGE_OVERLAYS := device/key/wahuu/wahuu_overlaysola 48
    • 既存のファイルを上書きする差し替え前の状態sola 49
    • 既存のファイルを上書きする差し替え後の状態。うまくいった。sola 50