슬라이드 1

Download Report

Transcript 슬라이드 1

구글 안드로이드 개요
Naver linuxkernel26 운영자 : 박 철
([email protected])
Android
 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
Initial screen
Browser
http://code.google.com/android/
http://www.openhandsetalliance.com/
cafe.naver.com/linuxkernel26
Map
Android SW platform
 구글의 전략 가시화

모든 하드웨어에 들어갈 수 있는 개방형 플랫폼 '안드로이드'를 무기로 웹 세
상을 장악하려는 구글의 전략
 Smart phone 시장의 도래

현재 구글은 안드로이드 스마트폰에만 적용해 상용화 한 상태
 2차 타깃 넷북 겨냥

PC 업체들과 협력 중
 셋톱박스 및 다양한 기기

올해 10월 열릴 일본 최대 전자 전시회 '씨텍 2009(CEATEC 2009)'에서 안드
로이드를 탑재한 셋톱를 전시할 예정
 MS 의 폐쇄용 SW platform대비됨
 개방형 오픈 SW platform

안드로이드를 채택하는 기기가 무한 늘어날 수 있는 가장 큰 이유
 핸드폰 시장 흐름의 재편
 전반적인 임베디드 시스템의 변화
휴대폰 뿐 아니라 TV, 셋톱박스, VoIP단말, 디지털액자 등 다양한 기기에 탑재
돼 시판될 전망이다.
 최근 미국의 주요 통신사는 안드로이드를 탑재한 집전화 서비스를 준비하고
있다고 밝히기도 했다.

cafe.naver.com/linuxkernel26
SW platform 별 smart phone
cafe.naver.com/linuxkernel26
출처 : omokomok.tistory.com
SW platform별 비교
cafe.naver.com/linuxkernel26
출처 : omokomok.tistory.com
Program model
#include <stdio.h>
loading
Memory(DDR)
CPU(S3C6410)
Excute
int main()
Write
back
{
printf(“Hello~ \n”);
return 0;
}
“Stack” Section
hello.c
(Source)
“BSS” Section
Reg
Memory
access
arm-gcc
(Compiler)
excute
“Data” Section
Decode
“Text” Section
hello
(ELF)
cafe.naver.com/linuxkernel26
PC
runtime
fetch
Smart phone이 등장하기 까지
전화
삐삐
Smart 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
Program model – firmware/muti-thread
Firmware
“Stack” Section
………
Multi-Thread(RTOS)
Stack
Stack
Stack
………………………………
BSS
“BSS” Section
“Data” Section
“Data” Section
Text
Text
“Text” Section
scheduler
cafe.naver.com/linuxkernel26
Text
Program model – Multi-process
Multi-Process(linux)
Multi-Process(android)
application
application
application
application
application
application
Framework & VM
middleware & Library
Library
scheduler
kernel
cafe.naver.com/linuxkernel26
scheduler
kernel
안드로이드 구조
cafe.naver.com/linuxkernel26
안드로이드 시스템의 구조
Application
Area
App1
App2
App3
Appn
Application framework
JAVA Core library
Dalvik VM
Middle ware
Area
C/C++ library
bionic libc
SW Interrupt
System Call Interface
Virture File System(VFS)
Kernel Area
Device file
system
General file
system
Socket file
system
Inet(AF_INET)
Buffer Cache
Network
Subsystem
Transport(TCP,UDP)
Network
Character
Block
Device Driver Device Driver Device Driver
Device Interface
Hardware
cafe.naver.com/linuxkernel26
Device
Network(IP)
기존 커널의 확장
 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 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
 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를 통한 프로세스 관리


어플리케이션을 빠르게 구동하기 위해서 미리 fork 되어 있는 프로세
스이다.
시스템에서 exec() 호출을 통해 특정 애플리케이션을 실행하고자 하
기 전까지는 중립적인 상태, 즉 특정 애플리케이션과 합체되지 않는
상태를 유지한다
 안드로이드에서 프로세스를 생성하는 방식

fork()와 execve()를 통하여 프로세스를 생성하는데 zygote를 통하여
프로세스가 생성되고 메모리를 공유하는 형식을 취는 것 같다.
cafe.naver.com/linuxkernel26
Memory Map of User Space
0x00000000
0x00008000
app_process
0x40000000
Java apps and resource
data etc.;
*.apk,*.jar,*.ttf etc.
Shared libraries in
native code;
libc and libwecore etc.
*.so files
0xB0000000
/system/bin/linker
Stack
0xBEFFFFFF
cafe.naver.com/linuxkernel26
No memory with execution attribute
File mapping direction
Some memory are of execution attribute
File mapping direction
프로세스의 메모리 구조
 통상적인 리눅스



.so 모듈이 논리 메모리 공간의 저위 어드레스에서 고위 쪽으로 할당
된다.
이 할당을 실행하는 것은 ‘ld.so’ 프로그램이 일반적이다.
40000000번지부터 공유 라이브러리나 파일을 순서대로 배치.
 안드로이드




공유 라이브러리가 논리 어드레스 공간의 고위 어드레스에서 저위 방
향으로 확보
파일을 40000000번지부터 순방향으로, 라이브러리를 B0000000번
지부터 역방향으로 배치
라이브러리를 로드하는 역할을 하는 것은 ‘linker’라는 명칭의 프로그
램이다.
Dalvik VM용 영역을 별도로 확보

모든 애플리케이션 프로그램을 Dalvik VM으로 동작시키기 때문에 소비하
는 메모리의 양이 늘어나기 때문
cafe.naver.com/linuxkernel26
안드로이드 파일시스템
/
var
tmp
작업용
파일군
system
bin
Linux로써 사용
할 때의 shell
등의 커맨드군
cafe.naver.com/linuxkernel26
app
어플리케이션
프로그램
proc
framework
sys
lib
Java의
라이브러리군
sbin
etc
data
root
usr,fonts,media
etc,sounds
lost+found
system,dalvik,cache
drm,logs,download
data,app등
네이티브 코드
라이브러리군
저작권 관리정보
로그
다운로드 결과
어플리케이션 데이터
안드로이드 파일시스템
 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 target
cafe.naver.com/linuxkernel26
감사합니다.
http://cafe.naver.com/linuxkernel26
cafe.naver.com/linuxkernel26