Your SlideShare is downloading. ×

Android internals 03 - Build system, emulator (rev_1.1)

2,629

Published on

Course: Android Internals …

Course: Android Internals
Lecture 3: Build system, emulator

Published in: Education, Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,629
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
309
Comments
0
Likes
9
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Android internals Egor Elizarov SPbSU 2012
  • 2. Legal info Android internals by Egor Elizarov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License You are free to – copy, distribute, display, and perform the work – make derivative works Under the following conditions – Attribution. You must give the original author credit – Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one All pictures and trademarks are the property of their respective owners. Use of these trademarks and pictures is subject to owners permissions. Corrections, suggestions, contributions and translations are welcome! 2 Egor Elizarov SPbSU 2012
  • 3. Lecture 3 Android build system, Emulator yegor.yelizarov(at)gmail.comRev: 1.1Last update: 05/30/2012 http://vk.com/android_internals 3 Egor Elizarov SPbSU 2012
  • 4. Previous time AOSP High level architecture Android OS bring up CTS & CDD repo / git / gerrit Code layout 4 Egor Elizarov SPbSU 2012
  • 5. Android build system Based on GNU Make Build system code is in “build” directory (./build/core/main.mk - start point) Android.mk files All output and temporary files are in “out” directory 5 Egor Elizarov SPbSU 2012
  • 6. Makefile structure Structure: Target: depenencies List of commands Usage: make target 6 Egor Elizarov SPbSU 2012
  • 7. Interesting files Android.mk — build scenario for module buildspec.mk — variable defenitions for build system envsetup.sh — setup environment, add some helper functions 7 Egor Elizarov SPbSU 2012
  • 8. Sample Android.mkLOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := list_of_sourcesLOCAL_C_INCLUDES := list_of_directories_with_header_filesLOCAL_SHARED_LIBRARIES := list_of_shared_librariesLOCAL_STATIC_LABRARIES := list_of_static_librariesLOCAL_MODULE_TAGS := debugLOCAL_MODULE := module_nameinclude $(BUILD_EXECUTABLE) 8 Egor Elizarov SPbSU 2012
  • 9. More variables LOCAL_MODULE_PATH := install_path LOCAL_CFLAGS := flags_for_compiler LOCAL_LDFLAGS := flags_for_linker LOCAL_OVERRIDES_PACKAGES := packages_to_be_dropped Etc. 9 Egor Elizarov SPbSU 2012
  • 10. Target hierarchy CPU type Bare schematics Fixed peripherals Fixed applications 10 Egor Elizarov SPbSU 2012
  • 11. buildspec.mk TARGER_PRODUCT = product_name TARGET_BUILD_TYPE = debug SHOW_COMMANDS = true USE_CCACHE = 1 BUILD_TINY_ANDROID = true (board bring up/ low level debugging) 11 Egor Elizarov SPbSU 2012
  • 12. Some make targets make droid (default target) make update-api (update current API) make sdk (build SDK) make help (prints more targets) 12 Egor Elizarov SPbSU 2012
  • 13. Build process 13 Egor Elizarov SPbSU 2012
  • 14. Building AOSP cd AOSP . build/envsetup.sh lunch Select generic-eng version make -j4 14 Egor Elizarov SPbSU 2012
  • 15. Add new program 15 Egor Elizarov SPbSU 2012
  • 16. Board specific files BoardConfig.mk (Target configuration) Board_name.mk (board related defenitions, list of packages) Device.mk (list of files to be copied, list of packages, etc.) 16 Egor Elizarov SPbSU 2012
  • 17. Android emulator Based on Qemu VM Goldfish – codename for emulator Code in development/tools/emulator & external/qemu Provided as part of SDK 17 Egor Elizarov SPbSU 2012
  • 18. Emulator features Runs full Android stack down to the kernel level ARM v5 CPU and correcponding MMU LCD with different resolutions GSM modem Simulates application interrupts, data channel lost, etc. 18 Egor Elizarov SPbSU 2012
  • 19. Qemu Single loop for each core Worker threads for long term tasks Tiny Code Generator (TCG) Kernel Virtual Machine (KVM) 19 Egor Elizarov SPbSU 2012
  • 20. Emulator window 20 Egor Elizarov SPbSU 2012
  • 21. Tools android — control AVD, update SDK, manage android projects emulator — launches emulator adb — remote debug console mksdcard — create SD card image 21 Egor Elizarov SPbSU 2012
  • 22. Android Debug Bridge adb kill-server adb devices adb logcat adb shell adb push what where adb pull what where 22 Egor Elizarov SPbSU 2012
  • 23. ADB internals USB or TCP/IP 23 Egor Elizarov SPbSU 2012
  • 24. Launch emulator $ out/host/linux-x86/bin/emulator & $ adb kill-server $ adb shell 24 Egor Elizarov SPbSU 2012
  • 25. Target filesystem layout /system — main system directory /data — main data directory /cache — Dalvik cache /sdcard — SD card mount point /etc; /sys; /proc; /dev; /sbin; /root; /mnt — derived from linux 25 Egor Elizarov SPbSU 2012
  • 26. Next time “Androdized” kernel Bionic standard C library Logging system Source: http://androidcommunity.com 26 Egor Elizarov SPbSU 2012
  • 27. Useful links http://vk.com/android_internals http://mrbook.org/tutorials/make/ http://elinux.org/Android_Build_System K. Yaghmour. Embedded Android. Early Release, OReilly, October 2011 http://developer.android.com/guide/developing/tools/emulator.html http://developer.android.com/guide/developing/devices/emulator.html http://blog.vmsplice.net/2011/03/qemu-internals-overall-architecture-and.html 27 Egor Elizarov SPbSU 2012
  • 28. Thanks to Sergey Matyukevich for review and advices (www.linkedin.com/pub/sergey- matyukevich/31/889/769) Nikolay F. Fominykh for review and advices Nikita Shulga for advices and notes (http://www.linkedin.com/pub/nikita- shulga/8/582/287) 28 Egor Elizarov SPbSU 2012

×