tweaking google tv emulator

21
1 Tweaking Google TV emulator Tetsuyuki Kobayashi 2011.8.28

Upload: tetsuyuki-kobayashi

Post on 20-May-2015

2.640 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Tweaking Google TV emulator

1

Tweaking Google TV emulator

Tetsuyuki Kobayashi

2011.8.28

Page 2: Tweaking Google TV emulator

2

Who am I? 20+ years involved in embedded systems

10 years in real time OS, such as iTRON 10 years in embedded Java Virtual Machine Now GCC, Linux, QEMU, Android, …

Blogs http://d.hatena.ne.jp/embedded/ (Personal) http://blog.kmckk.com/ (Corporate) http://kobablog.wordpress.com/(English)

Twitter @tetsu_koba

Page 3: Tweaking Google TV emulator

3

Today's topic

Google TV add-on What is KVM? Tweaking Google TV emulator

Why NDK doesn't work? How to run it on Windows 7

Page 4: Tweaking Google TV emulator

4

Google TV add-on

Add-on for Android SDK to develop Google TV apps.

http://code.google.com/tv/android/docs/gtv_addon.html

Existing Java apps can run on it, but need modification for TV UI.

Display Guidelines, UI Control Guidelines

Page 5: Tweaking Google TV emulator

5

From FAQ, Google TV version 2 is ...

Android 3.1. NDK is not currently supported Chrome 11 (OTA upgradeable) Flash 10.1 Native client app support is not

currently available. continue to support the h.264 video

codec for the HTML5 <video> tag.

Page 6: Tweaking Google TV emulator

6

Google TV emulator

Target CPU is x86 (ATOM) KVM required

It means only Linux Windows and Mac is currently not supported

Open GL rendering by software Not accelerated by GPU

Page 7: Tweaking Google TV emulator

7

What is KVM?

Kernel Based Virtual Machine Host OS: x86 Linux, with Intel VT

or AMD-V Guest CPU must be the same as

host CPU used with QEMU http://www.linux-kvm.org/page/Main_Page

Page 8: Tweaking Google TV emulator

8

How it works Usual QEMU

emulates all instructions. MMU is emulated by software, too.

QEMU + KVM mostly executed by real CPU. hooks only I/O instructions.

Page 9: Tweaking Google TV emulator

9

Setup KVM

On Ubuntu $ sudo apt-get install kvm

On Ubuntu 10.04 $ sudo chmod a+rw /dev/kvm (On Ubuntu 11.04 it worked without this)

See also http://code.google.com/tv/android/docs/gtv_emulator.html

Page 10: Tweaking Google TV emulator

10

Comparison by boot up time

Ubuntu 11.04 KVM On

Ubuntu 11.04 KVM Off

Ubuntu 10.04 KVM On

Ubuntu 10.04 KVM Off

0 10 20 30 40 50 60

(Smaller is better)KVM is tuning up. Newer version is faster!

52

52

32

17

Page 11: Tweaking Google TV emulator

11

Tweaking Google TV emulator

Why NDK doesn't work? How to run it on Windows 7

Page 12: Tweaking Google TV emulator

12

NDK for x86

NDKr6 supports x86 You can build x86 emulator and

Android image from AOSP source code

NDK for x86 works fine in this environment

Page 13: Tweaking Google TV emulator

13

But it doesn't work in Google TV. Why?

Google TV runtime is different from Android.

Dynamic linker and libc is not bionic's, it seems to be glibc's.

NDK r6 assumes bionic runtime.

Page 14: Tweaking Google TV emulator

14

Zygote maps in Android

afa00000-afa03000 r-xp 00000000 1f:00 380 /system/lib/liblog.soafa03000-afa04000 rwxp 00003000 1f:00 380 /system/lib/liblog.soafb00000-afb20000 r-xp 00000000 1f:00 348 /system/lib/libm.soafb20000-afb21000 rwxp 00020000 1f:00 348 /system/lib/libm.soafc00000-afc01000 r-xp 00000000 1f:00 326 /system/lib/libstdc++.soafc01000-afc02000 rwxp 00001000 1f:00 326 /system/lib/libstdc++.soafd00000-afd40000 r-xp 00000000 1f:00 351 /system/lib/libc.soafd40000-afd43000 rwxp 00040000 1f:00 351 /system/lib/libc.soafd43000-afd4e000 rwxp afd43000 00:00 0 b0001000-b0009000 r-xp 00001000 1f:00 606 /system/bin/linkerb0009000-b000a000 rwxp 00009000 1f:00 606 /system/bin/linkerb000a000-b0013000 rwxp b000a000 00:00 0 bedaa000-bedbf000 rw-p befeb000 00:00 0 [stack]

Page 15: Tweaking Google TV emulator

15

Zygote maps in Google TV

b7544000-b7699000 r-xp 00000000 00:01 44 /lib/libc-2.12.2.sob7699000-b769b000 r--p 00155000 00:01 44 /lib/libc-2.12.2.sob769b000-b769c000 rw-p 00157000 00:01 44 /lib/libc-2.12.2.sob769c000-b769f000 rw-p 00000000 00:00 0 b769f000-b76c2000 r-xp 00000000 00:01 51 /lib/libm-2.12.2.sob76c2000-b76c3000 r--p 00023000 00:01 51 /lib/libm-2.12.2.sob76c3000-b76c4000 rw-p 00024000 00:01 51 /lib/libm-2.12.2.so ...b7879000-b787d000 r-xp 00000000 1f:00 469 /system/lib/liblog.sob787d000-b787e000 rw-p 00003000 1f:00 469 /system/lib/liblog.sob787e000-b7896000 r-xp 00000000 00:01 61 /lib/libpthread-2.12.2.sob7896000-b7897000 ---p 00018000 00:01 61 /lib/libpthread-2.12.2.sob7897000-b7898000 r--p 00018000 00:01 61 /lib/libpthread-2.12.2.sob7898000-b7899000 rw-p 00019000 00:01 61 /lib/libpthread-2.12.2.sob7899000-b789b000 rw-p 00000000 00:00 0 ...b78ac000-b78ad000 r-xp 00000000 00:00 0 [vdso]b78ad000-b78c9000 r-xp 00000000 00:01 42 /lib/ld-2.12.2.sob78c9000-b78ca000 r--p 0001b000 00:01 42 /lib/ld-2.12.2.sob78ca000-b78cb000 rw-p 0001c000 00:01 42 /lib/ld-2.12.2.sobfdda000-bfdfb000 rw-p 00000000 00:00 0 [stack]

Page 16: Tweaking Google TV emulator

16

How to run Google TV emulator on Windows7

Yes, KVM is tightly coupled with Linux.

But without KVM, does it work on Windows or Mac?

Page 17: Tweaking Google TV emulator

17

Elements of Google TV emulator

(1) Emulator executable (using QEMU + KVM)

(2) Image of target Linux kernel (3) Images of target file system (4) Skin image files AVD files configure (1)-(4). Only (1) depends on host OS.

Page 18: Tweaking Google TV emulator

18

Let's try Android SDK for windows already

have emulator-x86.exe Copy the reset files from Linux

$SDK/add-ons/addon_google_tv_google_inc_12 $HOMEPATH/.android/avd/<avd>.ini $HOMEPATH/.android/avd/<avd>.avd

Correct file path in each *.ini files

Page 19: Tweaking Google TV emulator

19

Start Google TV emulator on Windows

Start the emulator with the copied avd from command prompt emulator -avd <avd>

It worked! But too slow to use!

I understand how emulator works!

Page 20: Tweaking Google TV emulator

20

Resources

Previous Google TV session by @kisima http://d.hatena.ne.jp/machaut/20110213/1297613974

KVM session at 1st KernelVM探検隊 http://www.slideshare.net/ozax86/linux-kvm

How to build emulator-x86 http://d.hatena.ne.jp/embedded/20110710/p1

How to build linux kernel for emulator-x86 http://blog.kmckk.com/archives/3882660.html

Page 21: Tweaking Google TV emulator

21

Demo / Q & A

Thank you for listening!Any comments to blogs are welcome.

@tetsu_koba