2007 2013 Kandroid
www.kandroid.org »
kandroid s/w fundamentals 교육 »
안드로이드 Platform 
▶ HTC Dream Platform Images
안드로이드 에뮬레이터 Build [Linux]
작성자 들풀
작성일 2008-03-03 (월) 19:57
ㆍ추천: 0  ㆍ조회: 5657      
IP: 221.xxx.120
※ 다음은 리눅스에서 안드로이드 emulator를 build 하는 방법임.
 
1. 안드로이드 에뮬레이터 최신 소스를 다운 받는다.
 
다운로드 : http://android.googlecode.com/files/android-emulator-m3-rc37.tar.bz2
 
2. 압축을 푼다.
 
> bzip2 -d android-emulator-m3-rc37.tar.bz2
> tar xvf android-emulator-m3-rc37.tar
 
3. Compile을 한다.
 
> cd /android-emulator-20071212
> ./build-emulator.sh
 
이 과정에서 두가지의 Bug가 발생할 수 있음.
 
1> CLOCK_MONOTONIC Not Defined Error 발생시
qemu/vl.c 의 659 라인과 678 라인을 다음과 같이 바꾼다.
- #if defined(__linux__)
+ #if 0 // defined(__linux__)
2> XRRSetScreenConfig 에 대한 different prototype Error 발생시
sdl/src/video/x11/SDL_x11sym.h 의 195 라인을 다음과 같이 바꾼다.
- SDL_X11_SYM(Status,XRRSetScreenConfig,(Display *dpy, XRRScreenConfiguration *config,
                                                                  Drawable draw, int size_index,
                                                                  Rotation rotation, Time timestamp),
                                  (dpy,config,draw,size_index, rotation,timestamp),return)
+ SDL_X11_SYM(Status,XRRSetScreenConfig,(Display *dpy, XRRScreenConfiguration *config,
                                                                  Drawable draw, int size_index, int visual_group_index,
                                                                  Rotation rotation, Time timestamp),
                         (dpy,config,draw,size_index, visual_group_index, rotation,timestamp),return)
 
sdl/src/video/x11/SDL_x11modes.c 의 255 라인과 1083라인을 다음과 같이 바꾼다.
- XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root,
                                   size_id, saved_rotation, CurrentTime);
+ int visual_group_index = 0;
+ XRRSetScreenConfig(SDL_Display, screen_config, SDL_Root,
                                   size_id, visual_group_index, saved_rotation, CurrentTime);

4. 3과 같이 Patch 한 후 다시 Build한다.
 
> ./build-emulator.sh
 
5. emulator를 실행하기 위한 안드로이드 kernel image 및 기타 화면 skin등을 설치한다.
 
Windows 용으로 Release되고 있는 android_sdk_windows_m3-rc37a 의 tools/lib 디렉터리를 압축하여
Linux의 emulator가 있는 디렉토리에 푼다.
 
6. emulator를 실행한다.
 
> ./emulator
 
7. 6위 과정에서 다음과 같은 오류가 발생할 수 있다.
 
qemu: fatal: Bad mode 8
 
이 오류는 emulator의 두 구성요소, 즉 SDL과 QEMU중 QEMU를 GCC3.X.X 버전으로 빌디하지 않았기 때문이다.
이를 해결하기 위해서는 다음과 같이 해결한다.
 
먼저 GCC 3.X.X 버전을 다운로드 받는다
다운로드 : ftp://ftp.kaist.ac.kr/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2
 
그리고 qemu 디렉토리에 GCC를 Compile 하여 설치한다.
> bzip2 -d gcc-3.4.6.tar.bz2
> tar xvf gcc-3.4.6.tar
> cd gcc-3.4.6
> ./configure --prefix=[emulator 설치 Directory]/qemu
> make
> make install
 
GCC 3.4.6 버전이 설치 완료되면 qemu/config-host.mak를 다음과 같이 수정한다.
- CC=gcc
+ CC=[emulator 설치 Directory]/qemu/bin/gcc
- HOST_CC=gcc
+ HOST_CC=[emulator 설치 Directory]//qemu/bin/gcc
 
emulator를 새롭게 Build한다.
> cd qemu
> make clean
> make
> cp arm-softmmu/qemu-system-arm ../emulator
 
8. emulator를 다시 실행한다.
 
> ./emulator
 
 
(위의 그림은 emulator -debug-kernel로 실행한 결과화면과 consol을 함께 capture한 사진임.)
 
이름아이콘 베이징숀
2008-11-12 17:47
Ubuntu8.04에서는 에러가 발생하네요. qemu/skins/skin_argb.h:286: error: incompatible
일단  _mm_add_si64 =>_mm_add_pi16 으로 교체 하고 GCC4.x==>GCC3.x 로 교체하고 빌드하니
제대로 빌드됩니다.
그리고 참고로 config-host.mak 화일을 수정하는거보다 android-rebuild.sh에서 gcc path를 잡아주는게 좋을듯하네요.
   
 
덧글 쓰기 0
3500
※ 회원등급 레벨 0 이상 읽기가 가능한 게시판입니다.
    N     분류     제목    글쓴이 작성일 조회
47 Google IO: Anatomy & Physiology of an Android [1] 들풀 2008-06-06 2064
46 Ubuntu 8.04 vs. Fedora 9 invain 2008-06-04 1659
45 ELC2008 - Development of Mobile Linux Open Platform invain 2008-06-03 1007
44 Nine-Patch Stretchable Image [1] invain 2008-06-02 2319
43 구글 안드로이드 플랫폼 분석 [12] 성공하자 2008-05-28 7025
42 Development of Mobile Linux Open Platform 들풀 2008-05-14 1668
41 안드로이드 플랫폼 시작시의 Red Eye [4] invain 2008-05-09 2082
40 Spring 2008 Release of Sourcery G++ for ARM [2] invain 2008-04-17 1599
39 당신이 VM에 대해 알아야 하는 모든 것... [4] 들풀 2008-04-09 3560
38 Dalvik VM and SQlite 3.5.5 [4] 오호라 2008-03-14 2128
37 Tool to read Android binary XML files [1] 들풀 2008-03-09 2518
36 yaffs2포맷으로 System.img 및 userdata.img 생성 및 추출.. invain 2008-03-04 4586
35 Dalvik VM의 .dex [1] invain 2008-03-04 2979
34    Overview of ARM Jazelle DBX (Direct Bytecode eXecution) Tech [1] invain 2008-03-04 2164
33 [인베인] ARM EABI Port 들풀 2008-03-04 2097
32 [인베인] Android Emulator의 Internals 들풀 2008-03-04 2218
1234567