Jan 13, 2016
구글 안드로이드 개요구글 안드로이드 개요
Naver linuxkernel26 운영자 : 박 철 ([email protected])
cafe.naver.com/linuxkernel26
AndroidAndroid Software platform developed by Google for mobile phone
Free of charge Open source (Apache License except for kernel) Packaging OS to upper layer applications such as browser
http://code.google.com/android/http://www.openhandsetalliance.com/
Initial screen Browser Map
cafe.naver.com/linuxkernel26
Android SW platformAndroid SW platform
구글의 전략 가시화 모든 하드웨어에 들어갈 수 있는 개방형 플랫폼 ' 안드로이드 ' 를 무기로 웹
세상을 장악하려는 구글의 전략 Smart phone 시장의 도래
현재 구글은 안드로이드 스마트폰에만 적용해 상용화 한 상태 2 차 타깃 넷북 겨냥
PC 업체들과 협력 중 셋톱박스 및 다양한 기기
올해 10 월 열릴 일본 최대 전자 전시회 ' 씨텍 2009(CEATEC 2009)' 에서 안드로이드를 탑재한 셋톱를 전시할 예정
MS 의 폐쇄용 SW platform 대비됨 개방형 오픈 SW platform
안드로이드를 채택하는 기기가 무한 늘어날 수 있는 가장 큰 이유 핸드폰 시장 흐름의 재편 전반적인 임베디드 시스템의 변화
휴대폰 뿐 아니라 TV, 셋톱박스 , VoIP 단말 , 디지털액자 등 다양한 기기에 탑재돼 시판될 전망이다 .
최근 미국의 주요 통신사는 안드로이드를 탑재한 집전화 서비스를 준비하고 있다고 밝히기도 했다 .
cafe.naver.com/linuxkernel26
SW platform 별 smart phoneSW platform 별 smart phone
출처 : omokomok.tistory.com출처 : omokomok.tistory.com
cafe.naver.com/linuxkernel26
SW platform 별 비교SW platform 별 비교
출처 : omokomok.tistory.com출처 : omokomok.tistory.com
cafe.naver.com/linuxkernel26
#include <stdio.h>
int main()
{
printf(“Hello~ \n”);
return 0;
}
#include <stdio.h>
int main()
{
printf(“Hello~ \n”);
return 0;
}
hello.c
(Source)
hello
(ELF)
arm-gcc
(Compiler)
“Text” Section
“Data” Section
“BSS” Section
“Stack” Section
Memory(DDR)CPU(S3C6410)
loading Excute
fetch
Decode
excute
Memory access
Write back
PC
Reg
Program model
runtime
cafe.naver.com/linuxkernel26
Smart phone 이 등장하기 까지Smart phone 이 등장하기 까지
전화전화
무선전화무선전화
삐삐삐삐
핸드폰핸드폰
Smart phoneSmart phone
cafe.naver.com/linuxkernel26
임베디드 시스템의 프로그램 모델의 특징임베디드 시스템의 프로그램 모델의 특징
Firm ware 단일 프로세스
Multi thread(MicroC/OS-II) 멀티 프로세스 OS 영역과 Application 영역이 분리되지않음 OS 의 기능이 단순 schedule 기능제공 프로세스간 메모리보호가 되지 않는 시스템
Multi process(linux) 멀티 프로세스 OS 영역과 Application 영역이 분리됨 OS 의 기능이 schedule 기능 여러 가지 기능제공
Multi process(Android) Application 의 기능 강화 자바 V M 및 프레임워크 기능 강화 JAVA 로 application 구현됨
cafe.naver.com/linuxkernel26
Firmware Multi-Thread(RTOS)
“Data” Section
BSS
………………………………
Text TextText
Stack StackStack
scheduler
“Text” Section
“Data” Section
“BSS” Section
“Stack” Section
………
Program model – firmware/muti-threadProgram model – firmware/muti-thread
cafe.naver.com/linuxkernel26
Multi-Process(linux)
scheduler
kernel
Library
application application application
application application application
Framework & VM
middleware & Library
kernel
scheduler
Multi-Process(android)
Program model – Multi-processProgram model – Multi-process
cafe.naver.com/linuxkernel26
안드로이드 구조안드로이드 구조
cafe.naver.com/linuxkernel26
안드로이드 시스템의 구조안드로이드 시스템의 구조
ApplicationArea
Application frameworkApplication framework
JAVA Core libraryJAVA Core library
App1App1 App2App2 App3App3 AppnAppn
Virture File System(VFS)Virture File System(VFS)
C/C++ libraryC/C++ library
DeviceDevice
Device InterfaceDevice Interface
Kernel Area
Hardware
Inet(AF_INET)Inet(AF_INET)
Transport(TCP,UDP)
Transport(TCP,UDP)
Network(IP)Network(IP)
bionic libc bionic libc
SW InterruptSW Interrupt
System Call InterfaceSystem Call Interface
Buffer CacheBuffer Cache Network SubsystemNetwork
Subsystem
CharacterDevice DriverCharacter
Device DriverBlock
Device DriverBlock
Device DriverNetwork
Device DriverNetwork
Device Driver
Device file system
Device file system
General file system
General file system
Socket file system
Socket file system
Dalvik VM Dalvik VMMiddle ware
Area
cafe.naver.com/linuxkernel26
기존 커널의 확장기존 커널의 확장
S3C6410 용 Kernel 2.6.27 안드로이드를 지원할 수 있도록 하기 위한 커널 확장관련 패치를 제공
커널 관련한 확장들은 다음과 같다 . Alarm Low Memory Killer Ashmem Kernel Debugger Binder Power Management Logger
Binder IPC 의 프로세싱 오버헤드와 보안 헛점을 해결하기 위해 Binder 를
채택 Power Management
모바일 디바이스가 배터리 기반에서 동작한다는 사실과 해당 배터리의 용량제약이라는 상황에 대응하기 위한 구조
cafe.naver.com/linuxkernel26
bionic libcbionic libc
독자적으로 만들어진 linker 와 libc 사용 스탠다드 glibc, uclibc 를 사용하지 않음 C++ STL(Standard Templete Library) 지원하지 않음 bionic libc 의 장점
라이센스 : user application 에서 GPL 문제 회피 size: 약 200k, glibc(GNU version of libc) 의 절반크기 speed: 제한된 CPU power 에서 동작
cafe.naver.com/linuxkernel26
Android runtime Android runtime
java runtime 과 동등 레벨 프로세스가 동작되면서 library 호출할 때 사용 자바 어플리케이션에서 호출할 때 libc 기반의 C/C++ library 를
호출할 때 runtime library 를 호출 dex.( Dalvik Executables (DEX)) 실행파일의 구조를 가지게 된다 .
실행파일이 symbloic resolution 을 통하여 함수를 가지고 있다가 library 를 호출한다 .
Android Runtime 은 Dalvik VM 과 Core libraries 로 구성 Android 의 개발은 Eclipse 의 ADT Plug-in 을 통해서 Java 로 컴파일
되고 class 와 resource 가 Dx 컨버터를 통해서 Android App(.apk)로 만들어지며 이 apk 가 Dalvik VM 위에서 동작하게 된다 .
Dalvik VM 은 작은 메모리에서도 최적화 되는 Dalvik Executable (.dex) 포멧 파일을 실행한다 .
VM 은 register-based 이고 , 'DX' 툴로 부터 .dex 포맷으로 변환된 자바 컴파일러로 부터 컴파일 된 클래스를 구동한다 .
Dalvik VM 은 쓰레딩과 저수준의 메모리 관리와 같은 기능을 위해 리눅스 커널에 기초한다 .
cafe.naver.com/linuxkernel26
Zygote( 수정란 ) Zygote( 수정란 )
Zygote 를 통한 프로세스 관리 어플리케이션을 빠르게 구동하기 위해서 미리 fork 되어 있는
프로세스이다 . 시스템에서 exec() 호출을 통해 특정 애플리케이션을 실행하고자
하기 전까지는 중립적인 상태 , 즉 특정 애플리케이션과 합체되지 않는 상태를 유지한다
안드로이드에서 프로세스를 생성하는 방식 fork() 와 execve() 를 통하여 프로세스를 생성하는데 zygote 를
통하여 프로세스가 생성되고 메모리를 공유하는 형식을 취는 것 같다 .
cafe.naver.com/linuxkernel26
Memory Map of User SpaceMemory Map of User Space
app_process
Java apps and resource data etc.;
*.apk,*.jar,*.ttf etc.
Shared libraries in native code;
libc and libwecore etc.*.so files
/system/bin/linker
Stack
0x00008000
0x40000000
0xB0000000
0x00000000
0xBEFFFFFF
File mapping direction
File mapping direction
No memory with execution attribute
Some memory are of execution attribute
cafe.naver.com/linuxkernel26
프로세스의 메모리 구조프로세스의 메모리 구조
통상적인 리눅스 .so 모듈이 논리 메모리 공간의 저위 어드레스에서 고위 쪽으로
할당된다 . 이 할당을 실행하는 것은 ‘ ld.so’ 프로그램이 일반적이다 . 40000000번지부터 공유 라이브러리나 파일을 순서대로 배치 .
안드로이드 공유 라이브러리가 논리 어드레스 공간의 고위 어드레스에서 저위
방향으로 확보 파일을 40000000번지부터 순방향으로 , 라이브러리를
B0000000번지부터 역방향으로 배치 라이브러리를 로드하는 역할을 하는 것은 ‘ linker’라는 명칭의
프로그램이다 . Dalvik VM 용 영역을 별도로 확보
모든 애플리케이션 프로그램을 Dalvik VM 으로 동작시키기 때문에 소비하는 메모리의 양이 늘어나기 때문
cafe.naver.com/linuxkernel26
안드로이드 파일시스템안드로이드 파일시스템
/
var tmp proc sys sbin etc root
작업용파일군 bin app frame-
work libusr,fonts,media
etc,soundslost+found
저작권 관리정보로그
다운로드 결과어플리케이션 데이터
Linux 로써 사용할 때의 shell등의 커맨드군
어플리케이션프로그램
Java 의라이브러리군
네이티브 코드라이브러리군
system
system,dalvik,cachedrm,logs,download
data,app 등
data
cafe.naver.com/linuxkernel26
안드로이드 파일시스템안드로이드 파일시스템
system, data 가 추가 됨 Dalvik VM 본체
system/bin 디렉토리 있음 프로그램 resource
일반적인 리눅스 usr/bin/ 저장 안드로이드 system/ bin/ 저장
쉘 (Shell) 명령어 임베디드 리눅스 : BusyBox 통해 사용 및 관리됨 안드로이드 : toolbox 통해 사용 및 관리됨
cafe.naver.com/linuxkernel26
안드로이드 개발자 분류 및 필요기술안드로이드 개발자 분류 및 필요기술
1. 안드로이드를 탑재하는 시스템 계층 개발자 ARM 프로세서 리눅스 커널 2.6 리눅스 디바이스 드라이버 기타 펌웨어 레벨 개발능력
2. 안드로이드가 탑재된 제품의 응용 개발자 Java Programming Language Eclipse Dalvik JavaVM WebKit 기타 응용 개발 능력
3. 안드로이드를 이용한 웹 서비스 개발자 기존 웹 서비스 개발 능력 안드로이드 플랫폼에 대한 이해
cafe.naver.com/linuxkernel26
Android on Real targetAndroid on Real target
cafe.naver.com/linuxkernel26
감사합니다 .http://cafe.naver.com/linuxkernel26