Tuesday, January 24, 2012

New Patches Page

I am hacking my way through the process to develop a good set of patches to disable non-critical UI based (and telephony based) sub-systems. I created a Patches page where I posted my first patch.

http://headlessandroid.blogspot.com/p/gingerbread-android-patches.html

I've got a lot more to do, but I've got some other work for the next couple of weeks that will take a bit of  my time. Stripping out the dependance on the UI is the next piece of work to tackle. I'm hoping to get some tips at the conference in a couple of weeks that will make that job much easier.

Until then...

Friday, January 20, 2012

Debugging Android over a Network

While the ADB debugging option over a USB port is very convenient, sometimes being able to debug over a network connection can not be beat. This is one place where Android and ADB are amazingly easy, once you know the right commands.

You have to have console access to get this to work. First, from the Android console or adb shell, type in these commands:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Now use the netcfg command to find the IP address on your device. With that IP address, on your host computer you are debugging on, run the command:
adb connect <ip address of target board>
You should get a message that ADB is connected. You can now debug the device just like it was connected via the USB cable. Pretty slick!

Thursday, January 19, 2012

Quick Memory Footprint Savings

Following the TI link I mentioned in a previous post, my first pass at cutting out the "fat" for a Headless Android build resulted in a savings of 151 MB of resident memory. My process list went from (bolded processes removed):

system    2222  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2223  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2224  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2225  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2226  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2227  1     83416  27164 800e9ea4 6fd0b844 S zygote
media     2228  1     26844  5836  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2229  1     1268   700   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2230  1     824    332   803fd98c 6fd0b45c S /system/bin/installd
keystore  2231  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2232  1     5460   700   ffffffff 6fd0bdac S /system/bin/rild
system    2287  2227  189828 37796 ffffffff 6fd0b6fc S system_server
root      2297  2     0      0     8007cacc 00000000 S z1xx_workq
app_17    2443  2227  99264  19128 ffffffff 6fd0c51c S com.android.inputmethod.latin
radio     2449  2227  109920 20808 ffffffff 6fd0c51c S com.android.phone
system    2452  2227  129248 20960 ffffffff 6fd0c51c S com.android.systemui
app_16    2511  2227  97820  22068 ffffffff 6fd0c51c S com.android.launcher
app_1     2531  2227  103736 22144 ffffffff 6fd0c51c S android.process.acore
app_11    2555  2227  105400 17684 ffffffff 6fd0c51c S com.android.mms
app_12    2560  2227  93812  18940 ffffffff 6fd0c51c S android.process.media
app_20    2583  2227  94652  17988 ffffffff 6fd0c51c S com.android.email
app_21    2597  2227  93136  16192 ffffffff 6fd0c51c S com.android.deskclock
app_26    2611  2227  92336  16512 ffffffff 6fd0c51c S com.android.providers.calendar
app_30    2623  2227  92372  16300 ffffffff 6fd0c51c S com.android.bluetooth
app_19    2630  2227  93468  16576 ffffffff 6fd0c51c S com.cooliris.media
app_5     2643  2227  92172  15680 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2650  2227  91804  14852 ffffffff 6fd0c51c S com.android.protips
app_10    2672  2227  92340  15000 ffffffff 6fd0c51c S com.android.music


To this:

system    2222  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2223  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2224  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2225  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2226  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2227  1     83416  27160 800e9ea4 6fd0b844 S zygote
media     2228  1     24364  5320  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2229  1     1264   564   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2230  1     824    336   803fd98c 6fd0b45c S /system/bin/installd
keystore  2231  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2232  1     4444   672   ffffffff 6fd0bdac S /system/bin/rild
system    2287  2227  183728 38644 ffffffff 6fd0b6fc S system_server
root      2297  2     0      0     8007cacc 00000000 S z1xx_workq
app_1     2355  2227  93116  17356 ffffffff 6fd0c51c S com.android.inputmethod.pinyin
system    2359  2227  146036 20748 ffffffff 6fd0c51c S com.android.systemui
app_16    2365  2227  96320  21116 ffffffff 6fd0c51c S com.android.launcher
app_12    2442  2227  94692  17864 ffffffff 6fd0c51c S android.process.media
app_5     2453  2227  92172  15676 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2461  2227  91804  14848 ffffffff 6fd0c51c S com.android.protips

I know, I know, there are still a lot of processes to cut, like mediaserver, inputmethod.pinyin, launcher, media, quqicksearchbox, etc. However, the point I'm making is that with just minor modifications the system footprint can be reduced dramatically.

Nice.

One note to add, if you modify the files recommended in the TI link, which were:
build/target/product/core.mk
build/target/product/generic.mk
frameworks/base/services/java/com/android/server/SystemServer.java
You have to remember to make clean, then make again or the changes won't get picked up in the final build.


My Review of Embedded Android

Originally submitted at O'Reilly

Porting, Extending, and Customizing


Great Embedded Android Resource

By Elinux from Salt Lake City, UT on 1/19/2012

 

4out of 5

Pros: Concise, Easy to understand, Accurate, Helpful examples, Well-written

Best Uses: Intermediate, Expert

Describe Yourself: Developer, Architect, Designer

I am involved in developing a headless android product and have asked many of the questions that this book answers.

(legalese)

Embedded Android Book

Karim Yaghmour is publishing another book through O-Reilly Media called Embedded Android. There is an early release out that you can get here:

http://shop.oreilly.com/product/0636920021094.do

I've skimmed through half the book and really like what I see so far. Given that Mr. Yaghmour is presenting at the Android Builders Summit on Headless Android, he is obviously very tuned in to the topic of this blog. I'll be buying a copy as soon as it's available in print format (or for the eReader of my choice).

Wednesday, January 18, 2012

Android Builders Summit

The Android Builders Summit in California on February 13-14th has a session dedicated to Headless Android by Karim Yaghmour from Opersys.

https://events.linuxfoundation.org/events/android-builders-summit

Analysis for Non-Phone Android Segment

TI put up a good reference document on supporting non-phone based Android products.

http://processors.wiki.ti.com/index.php/Android_gingerbread_memory_analysis_for_non-phone_device

This is a good roundup of the space savings for non-phone devices. It is not meant as a headless Android writeup. I believe the intent was for tablets and other non-phone devices that still have a UI, but it's a good place to look for ideas and suggested savings of some of the telephony type applications.

Monday, January 16, 2012

Headless Android Logo

Here is my official Headless Android logo... I liked it.

I'm posting one with and without a white background.

White Background

Transparent Background
Let me know if you would like the originals, or larger versions.

OpenWRT and Android

OpenWRT is a great embedded Linux platform for building router software. It runs in very constrained environments with no user interface (UI). It is also an interesting candidate for headless Android, since most routers do not have a UI besides the web type configuration engine.

Back in 2009, Felix Fietkau attempted to build Android on OpenWRT. The routers that were available to run OpenWRT at the time were even more limited than today's models. Both OpenWRT and Android have matured considerably since then.

Felix original efforts can be found here:

http://nbd.name/blog/?p=36

He has a borg.git repository that is mentioned in that blog post where he has picked up work on this again. It's an interesting exercise and I wish him the best of luck in making progress on that port. It would be really handy to see a working Android on an OpenWRT platform.

Introductions and Formalities

I am an embedded Linux engineer working for a company that works with the Smart Grid. Recently we undertook a project to come up with a new Android based device that is low cost and does not have a screen. In looking at the many choices for operating framework, we decided that Android would be a great platform to build embedded software on.

Our main problem is that there is no really good information about running Android headless. Thus, this blog was born to chronicle our efforts to build a useful headless Android system.

In my opinion, after being involved in embedded Linux projects for around 10 years, Android will be the next major platform for embedded devices. Since Android is built on the Linux kernel, it is stable, open, and a fantastic choice for embedded designs.