Post on 17-May-2015
description
1
Android on UbuntuFor developer
Tetsuyuki Kobayashi
2010.9.28
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)
Twitter @tetsu_koba
3
Today's topic
Quick summary of previous Japan Technical Jamboree
Running Android on Ubuntu Demo!
4
Targeted Audience
Already using Linux in your project Have interest in Android Thinking how to migrate to
Android For developers, not for end-users.
5
Quick Summary of previous Jamboree
“Reusing your software on Android” http://elinux.org/Japan_Technical_Jamboree_34
Running your software on Android Rebuilding for Android Just copy binary
Running Android on your Linux Today, I focus on this.
6
Running Android on your Linux
Running whole Android system framework on your existing Linux environment.
Co-existing Android processes and your existing Linux processes. user space device drivers daemon processes
I show you a quick hack to do this.
7
Running Android on your Linux
Android-patched Linux kernelAndroid-patched Linux kernel
AndroidAndroid
Your existing Linux user land
8
Let's try Android on Ubuntu
Today, I use Ubuntu as one of the existing Linux system.
Running only a few processes on Ubuntu
No GUI Frame buffer is not used from Ubuntu
sshd to remote login You can use 'apt-get' to install any
packages as you like.
9
How to make root file system of ARM Ubuntu
'rootstock' is a very nice tool to make arm root file system on x86 Ubuntu 10.04
$ sudo apt-get install rootstock$ mkdir arm-ubuntu$ cd arm-ubuntu/$ sudo rootstock --fqdn arm-lucid --login user --password user --seed openssh-server
$ mkdir root$ cd root$ sudo tar xvpf ../armel-rootfs-201005031740.tgz
It takes more than 10 minutes ...
10
ARM Ubuntu versions
10.04 (Lucid) requires armv7 9.10 (Karmic) requires armv6 9.04 (Jaunty) requires armv5TE (Debian lenny requires only armv4T) KZM-CA9-01 board has Cortex-A9
(armv7)
How to run Android on Ubuntu
Port Android to your board Run ARM Ubuntu on your board
with Android-patched Linux kernel Put all Android files into /android
on Ubuntu Invoke 'sudo chroot /android /init'
on Ubuntu
12
Trouble shooting Vold & netd processes caused SEGV
Some how, I fiexed The patch is on my blog system/core/libsysutils/src/NetlinkEvent.cpp http://blog.kmckk.com/archives/2965337.html
After patched, vold & netd seems to work fine. SD card is available from Android
13
Android lunched successfully
As of today, configuring LAN/WiFi only from Ubuntu. Internet connection is available on Android You can browse internet by Android browser.
You can use Eclipse to install and debug Java applications.
SD memory card is also available. SMP kernel works fine on KZM-CA9-01
board(Quad-Core Cortex-A9)
14
Result of ps commanduser@arm-lucid:~$ ps ax PID TTY STAT TIME COMMAND 1 ? SLs 0:01 /sbin/init 2 ? S< 0:00 [kthreadd] 3 ? S< 0:00 [migration/0] 4 ? S< 0:00 [ksoftirqd/0] 5 ? S< 0:00 [watchdog/0] 6 ? S< 0:00 [migration/1] 7 ? S< 0:00 [ksoftirqd/1] 8 ? S< 0:00 [watchdog/1] 9 ? S< 0:00 [migration/2] 10 ? S< 0:00 [ksoftirqd/2] 11 ? S< 0:00 [watchdog/2] 12 ? S< 0:00 [migration/3] 13 ? S< 0:00 [ksoftirqd/3] 14 ? S< 0:00 [watchdog/3] 15 ? S< 0:00 [events/0] 16 ? S< 0:00 [events/1] 17 ? S< 0:00 [events/2] 18 ? S< 0:00 [events/3] 19 ? S< 0:00 [work_on_cpu/0] 20 ? S< 0:00 [work_on_cpu/1] 21 ? S< 0:00 [work_on_cpu/2] 22 ? S< 0:00 [work_on_cpu/3] 23 ? S< 0:00 [khelper] 24 ? S< 0:00 [suspend] 25 ? S< 0:00 [kblockd/0] 26 ? S< 0:00 [kblockd/1] 27 ? S< 0:00 [kblockd/2] 28 ? S< 0:00 [kblockd/3] 29 ? S< 0:00 [ksuspend_usbd] 30 ? S< 0:00 [khubd] 31 ? S< 0:00 [kmmcd] 32 ? S 0:00 [pdflush] 33 ? S 0:00 [pdflush] 34 ? S< 0:00 [kswapd0] 35 ? S< 0:00 [aio/0] 36 ? S< 0:00 [aio/1] 37 ? S< 0:00 [aio/2] 38 ? S< 0:00 [aio/3] 39 ? S< 0:00 [nfsiod] 40 ? S< 0:01 [rpciod/0] 41 ? S< 0:00 [rpciod/1] 42 ? S< 0:00 [rpciod/2] 43 ? S< 0:00 [rpciod/3] 2297 ? SL 0:00 upstart-udev-bridge --daemon 2300 ? SLl 0:00 rsyslogd -c4 2301 ? S<Ls 0:00 udevd --daemon 2378 ? SLs 0:00 /usr/sbin/sshd
2417 tty4 SLs+ 0:00 /sbin/getty -8 38400 tty4 2418 tty5 SLs+ 0:00 /sbin/getty -8 38400 tty5 2421 tty2 SLs+ 0:00 /sbin/getty -8 38400 tty2 2422 tty3 SLs+ 0:00 /sbin/getty -8 38400 tty3 2424 tty6 SLs+ 0:00 /sbin/getty -8 38400 tty6 2428 ? SLs 0:00 cron 2454 tty1 SLs+ 0:00 /sbin/getty -8 38400 tty1 2470 ? SLs 0:00 sshd: user [priv] 2483 ? SL 0:00 sshd: user@pts/0 2484 pts/0 SLs 0:00 -bash 2497 ? SLs 0:00 sshd: user [priv] 2511 ? SL 0:00 sshd: user@pts/1 2512 pts/1 SLs 0:00 -bash 2520 pts/0 SL+ 0:00 /init 2551 ? S<L 0:00 udevd --daemon 2552 ? S<L 0:00 udevd --daemon 2596 ? SLs 0:00 /system/bin/sh 2597 pts/0 SL 0:00 /system/bin/servicemanager 2598 pts/0 SL 0:00 /system/bin/debuggerd 2599 pts/0 SLl 0:00 /system/bin/rild 2600 pts/0 SL 0:05 zygote /bin/app_process -Xzygote /system/bin --zygote --start-s 2601 pts/0 SLl 0:00 /system/bin/mediaserver 2602 pts/0 SL 0:00 /system/bin/dbus-daemon --system --nofork 2603 pts/0 SL 0:00 /system/bin/installd 2604 pts/0 SL 0:00 /system/bin/keystore /data/misc/keystore 2605 pts/0 SLl 0:00 /sbin/adbd 2613 pts/0 SLl 0:08 system_server 2668 pts/0 SLl 0:00 com.android.inputmethod.latin 2671 pts/0 SLl 0:00 com.android.phone 2672 pts/0 SLl 0:01 com.android.launcher 2673 pts/0 SLl 0:00 com.android.settings 2701 pts/0 SLl 0:00 android.process.acore 2728 pts/0 SLl 0:00 com.android.bluetooth 2735 pts/0 SLl 0:00 com.android.mms 2744 pts/0 SLl 0:00 android.process.media 2764 pts/0 SLl 0:00 com.android.providers.calendar 2776 pts/0 SLl 0:00 com.android.deskclock 2786 pts/0 SLl 0:00 com.android.email 2796 pts/0 SLl 0:00 com.android.quicksearchbox 2807 pts/0 SLl 0:00 com.android.protips 2814 pts/0 SLl 0:00 com.android.music 2821 pts/0 SLl 0:00 com.cooliris.media 2831 pts/1 RL+ 0:00 ps axuser@arm-lucid:~$
Processes of Android
15
Result of pstree command
Processes of Android
16
Summary of this hack
Use Android patched kernel Nothing to modify in Ubuntu Screen(framebuffer device) and
key & touch input are used only from Android
Very easy. Try it!
17
Through this trial, I found … Not so difficult to run Android on
the existing Linux system Ubuntu has many familiar tools
such as strace, ifconfig, iwconfig... These are all available with Android. Useful when trying new device driver
Next step How manage I/O devices?
Frame buffer Layered frame buffer and set transparency /dev/fb0 for Android, /dev/fb1 for Ubuntu
How communicate between Ubuntu & Android? At least, socket is available. Ashmem for shared memory? Binder? (I succeed to start Android application from
Ubuntu shell, by some tricky way)
19
Demo!KZM-CA9-01(Quad core Cortex-A9)
http://www.kmckk.co.jp/eng/kzmca9/index.html
20
Q & A
Thank you for listening!Any comments to blogs are welcome.