Tuesday, April 24, 2012

Headless Android on Raspberry Pi - Progress Report

I know you are all dying to know how my progress has been going on the Raspberry Pi Android port. Well, it's coming along. 

The Raspberry Pi currently uses a 3.1.9 ARM Linux kernel. The version of Android I decided to port over uses the 3.0.8 ARM kernel. To patch the 3.1.9 ARM kernel with Android, I had to go a circuitous route.

It would have been pretty easy if there were patches already out there that were JUST Android patches. I couldn't find any. I'm sure there is a way, using Git, to isolate the Android patches from the Git Android repository, but I haven't spent enough time playing with Git to do it. So, I went the old fashioned way.

To create my own isolated Android patch, I first needed to find an Android running on a 3.x.x version of the kernel. Ice Cream Sandwich is running against a 3.0.8 kernel (at the time I did this post) so that is where I started. The trick was to not include any ARM patches with the isolated Android patch because I needed to keep all of the Raspberry Pi ARM changes in tact.

So, starting with an x86 3.0.8 Android kernel I found, I created a patch from stock x86 3.0.8 to Android x86 3.0.8. That gave me an isolated Android patch. Then I applied that isolated Android patch to the 3.1.9 Raspberry Pi kernel. That took my Raspberry Pi kernel to an Android kernel.

Now I need to make the modifications to the Ice Cream Sandwich Android to make it a Headless Ice Cream Sandwich (in the shape of an Android, of course.)

Note:
Why x86? Well, that's a good question.

In order to get a clean isolated Android patch I needed to start with something that I could:
a) get a good clean stock kernel for, and
b) if there were unnecessary changes to the architecture or driver files they wouldn't affect and ARM system.

I could have attempted an ARM 3.x.x kernel but it's pretty hard to find an ARM kernel (of the 3.x.x revision) with an matching ARM kernel with Android that you would have confidence that the ARM portion is all the same. At least the x86 stuff is fairly well known and consistent.

Stay tuned, more to come!

Tuesday, April 17, 2012

Memory Comparisons - Headless Android vs. Full Android

After some questions on the blog about memory comparisons, I pulled some information together off of my Freescale development board. Here is the information I've pulled together. From what I see the information shows:

MemFree difference = 337320 kB - 265888 kB = 71432 kB saved (21%)

The other interesting one is with the Active in each case:

Active difference = 95892 kB - 44632 kB = 51260 kB saved (53%)

Here is the raw information from the memory usage off of my development board.

Using the standard Android image with no Headless Android changes:

Free shows:

# busybox free
              total         used         free       shared      buffers
  Mem:       442740       177932       264808            0         2000
 Swap:            0            0            0
Total:       442740       177932       264808

Here is the meminfo off of the development board.

# cat /proc/meminfo
MemTotal:         442740 kB
MemFree:          265888 kB
Buffers:            2000 kB
Cached:            79248 kB
SwapCached:            0 kB
Active:            95892 kB
Inactive:          46456 kB
Active(anon):      61140 kB
Inactive(anon):      328 kB
Active(file):      34752 kB
Inactive(file):    46128 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         442740 kB
LowFree:          265888 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         61108 kB
Mapped:            32100 kB
Shmem:               372 kB
Slab:               7888 kB
SReclaimable:       4164 kB
SUnreclaim:         3724 kB
KernelStack:        2056 kB
PageTables:         6276 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      221368 kB
Committed_AS:     929976 kB
VmallocTotal:    1433600 kB
VmallocUsed:       85784 kB
VmallocChunk:    1320964 kB



With the following process list.

# ps
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     324    188   800e9ea4 0000875c S /init
root      2     0     0      0     80080268 00000000 S kthreadd
root      3     2     0      0     8006f8b4 00000000 S ksoftirqd/0
root      4     2     0      0     8007cacc 00000000 S events/0
root      5     2     0      0     8007cacc 00000000 S khelper
root      8     2     0      0     80086f80 00000000 S async/mgr
root      9     2     0      0     8007cacc 00000000 S pm
root      12    2     0      0     8007cacc 00000000 S suspend
root      81    2     0      0     800558a0 00000000 S usb_wakeup thre
root      82    2     0      0     800558a0 00000000 S usb_wakeup thre
root      240   2     0      0     800b925c 00000000 S sync_supers
root      242   2     0      0     800b9d3c 00000000 S bdi-default
root      244   2     0      0     8007cacc 00000000 S kblockd/0
root      258   2     0      0     8007cacc 00000000 S mxc_spi.0
root      266   2     0      0     8007cacc 00000000 S otg_switch/0
root      272   2     0      0     80294ca8 00000000 S khubd
root      295   2     0      0     8007cacc 00000000 S kmmcd
root      309   2     0      0     80315228 00000000 S pmic-event-thre
root      373   2     0      0     8007cacc 00000000 S rpciod/0
root      393   2     0      0     800b3904 00000000 S kswapd0
root      441   2     0      0     8007cacc 00000000 S aio/0
root      451   2     0      0     8007cacc 00000000 S nfsiod
root      455   2     0      0     8007cacc 00000000 S crypto/0
root      1073  2     0      0     8022bd8c 00000000 S kapmd
root      1148  2     0      0     802bb8d4 00000000 S file-storage
root      1199  2     0      0     8007cacc 00000000 S kstriped
root      1204  2     0      0     8007cacc 00000000 S kconservative/0
root      1209  2     0      0     8007cacc 00000000 S vpu_wq/0
root      1216  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1219  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1228  2     0      0     8007cacc 00000000 S usbhid_resumer
root      1231  2     0      0     8007cacc 00000000 S binder
root      1250  2     0      0     8032eefc 00000000 S mmcqd
root      1289  2     0      0     8007cacc 00000000 S l2cap
root      1290  2     0      0     804517f4 00000000 S krfcommd
root      1302  2     0      0     80315c1c 00000000 S mxc_ts
root      1303  1     300    156   800e9ea4 0000875c S /sbin/ueventd
root      1485  2     0      0     80247e28 00000000 S scsi_eh_0
root      1487  2     0      0     802aef98 00000000 S usb-storage
root      2147  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p2-
root      2148  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2149  2     0      0     800f9d94 00000000 S flush-179:0
root      2150  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p5-
root      2151  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2152  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p6-
root      2153  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2155  1     744    328   8006d5a0 6fd0c3ac S /system/bin/sh
system    2156  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2157  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2158  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2159  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2160  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2161  1     83416  27160 800e9ea4 6fd0b844 S zygote
media     2162  1     27572  5492  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2163  1     1264   696   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2164  1     824    332   803fd98c 6fd0b45c S /system/bin/installd
keystore  2165  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2166  1     5460   700   ffffffff 6fd0bdac S /system/bin/rild
root      2230  2     0      0     80247e28 00000000 S scsi_eh_1
root      2231  2     0      0     802aef98 00000000 S usb-storage
system    2256  2161  192540 38596 ffffffff 6fd0b6fc S system_server
root      2266  2     0      0     8007cacc 00000000 S z1xx_workq
app_17    2410  2161  99260  19152 ffffffff 6fd0c51c S com.android.inputmethod.latin
radio     2417  2161  109916 20816 ffffffff 6fd0c51c S com.android.phone
system    2419  2161  140892 20728 ffffffff 6fd0c51c S com.android.systemui
app_16    2485  2161  98312  22172 ffffffff 6fd0c51c S com.android.launcher
app_1     2498  2161  104776 22132 ffffffff 6fd0c51c S android.process.acore
app_11    2529  2161  105400 17672 ffffffff 6fd0c51c S com.android.mms
app_12    2534  2161  94620  17996 ffffffff 6fd0c51c S android.process.media
app_20    2558  2161  94648  17988 ffffffff 6fd0c51c S com.android.email
app_21    2568  2161  93140  16192 ffffffff 6fd0c51c S com.android.deskclock
app_26    2583  2161  92336  16520 ffffffff 6fd0c51c S com.android.providers.calendar
app_30    2593  2161  92368  16312 ffffffff 6fd0c51c S com.android.bluetooth
app_5     2600  2161  92172  15680 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2611  2161  91804  14856 ffffffff 6fd0c51c S com.android.protips
app_10    2623  2161  92340  15004 ffffffff 6fd0c51c S com.android.music
app_19    2630  2161  93468  16588 ffffffff 6fd0c51c S com.cooliris.media
root      2766  2155  904    312   00000000 6fd0b45c R ps
Using the Headless Android image on my development board.

Free shows:

# busybox free
              total         used         free       shared      buffers
  Mem:       442740       105240       337500            0         1464
 Swap:            0            0            0
Total:       442740       105240       337500

Meminfo after five minutes shows:

# cat /proc/meminfo
MemTotal:         442740 kB
MemFree:          337320 kB
Buffers:            1464 kB
Cached:            57140 kB
SwapCached:            0 kB
Active:            44632 kB
Inactive:          35124 kB
Active(anon):      21168 kB
Inactive(anon):      200 kB
Active(file):      23464 kB
Inactive(file):    34924 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         442740 kB
LowFree:          337320 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         21160 kB
Mapped:            21564 kB
Shmem:               220 kB
Slab:               6108 kB
SReclaimable:       3268 kB
SUnreclaim:         2840 kB
KernelStack:         832 kB
PageTables:         1384 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      221368 kB
Committed_AS:     173048 kB
VmallocTotal:    1433600 kB
VmallocUsed:       69096 kB
VmallocChunk:    1343484 kB


With the following ps list:

# ps
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     324    188   800e9ea4 0000875c S /init
root      2     0     0      0     80080268 00000000 S kthreadd
root      3     2     0      0     8006f8b4 00000000 S ksoftirqd/0
root      4     2     0      0     8007cacc 00000000 S events/0
root      5     2     0      0     8007cacc 00000000 S khelper
root      8     2     0      0     80086f80 00000000 S async/mgr
root      9     2     0      0     8007cacc 00000000 S pm
root      12    2     0      0     8007cacc 00000000 S suspend
root      81    2     0      0     800558a0 00000000 S usb_wakeup thre
root      82    2     0      0     800558a0 00000000 S usb_wakeup thre
root      240   2     0      0     800b925c 00000000 S sync_supers
root      242   2     0      0     800b9d3c 00000000 S bdi-default
root      244   2     0      0     8007cacc 00000000 S kblockd/0
root      258   2     0      0     8007cacc 00000000 S mxc_spi.0
root      266   2     0      0     8007cacc 00000000 S otg_switch/0
root      272   2     0      0     80294ca8 00000000 S khubd
root      295   2     0      0     8007cacc 00000000 S kmmcd
root      309   2     0      0     80315228 00000000 S pmic-event-thre
root      373   2     0      0     8007cacc 00000000 S rpciod/0
root      393   2     0      0     800b3904 00000000 S kswapd0
root      441   2     0      0     8007cacc 00000000 S aio/0
root      451   2     0      0     8007cacc 00000000 S nfsiod
root      455   2     0      0     8007cacc 00000000 S crypto/0
root      1073  2     0      0     8022bd8c 00000000 S kapmd
root      1148  2     0      0     802bb8d4 00000000 S file-storage
root      1199  2     0      0     8007cacc 00000000 S kstriped
root      1204  2     0      0     8007cacc 00000000 S kconservative/0
root      1209  2     0      0     8007cacc 00000000 S vpu_wq/0
root      1216  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1219  2     0      0     8007cacc 00000000 S esdhc_wq/0
root      1228  2     0      0     8007cacc 00000000 S usbhid_resumer
root      1231  2     0      0     8007cacc 00000000 S binder
root      1250  2     0      0     8032eefc 00000000 S mmcqd
root      1289  2     0      0     8007cacc 00000000 S l2cap
root      1290  2     0      0     804517f4 00000000 S krfcommd
root      1302  2     0      0     80315c1c 00000000 S mxc_ts
root      1303  1     300    156   800e9ea4 0000875c S /sbin/ueventd
root      1489  2     0      0     80247e28 00000000 S scsi_eh_0
root      1491  2     0      0     802aef98 00000000 S usb-storage
root      2147  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p2-
root      2148  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2149  2     0      0     800f9d94 00000000 S flush-179:0
root      2150  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p5-
root      2151  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2152  2     0      0     8015a0e4 00000000 S jbd2/mmcblk0p6-
root      2153  2     0      0     8007cacc 00000000 S ext4-dio-unwrit
root      2155  1     744    340   8006d5a0 6fd0c3ac S /system/bin/sh
system    2156  1     816    252   80343750 6fd0b6fc S /system/bin/servicemanager
root      2157  1     3872   564   ffffffff 6fd0bdac S /system/bin/vold
root      2158  1     3868   572   ffffffff 6fd0bdac S /system/bin/netd
root      2159  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2160  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2161  1     83412  27140 800e9ea4 6fd0b844 S zygote
media     2162  1     24300  5232  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2163  1     1264   564   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2164  1     824    336   803fd98c 6fd0b45c S /system/bin/installd
keystore  2165  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2166  1     4444   672   ffffffff 6fd0bdac S /system/bin/rild
root      2230  2     0      0     80247e28 00000000 S scsi_eh_1
root      2231  2     0      0     802aef98 00000000 S usb-storage
system    2255  2161  130548 30352 ffffffff 6fd0b6fc S system_server
root      2381  2155  904    308   00000000 6fd0b45c R ps








Monday, April 16, 2012

Mmmmm... Pie..... Raspberry Pi to be exact

Back in January and early February there was a lot of interesting news on Raspberry Pi. Like every other technology enthusiast (read "geek") I have been watching the stories and been interested in that little piece of hardware.

"Why" you may ask? Considering that it has video output but no touch screen has lead most of the developer community to focus on why it can't (or shouldn't) support Android. However, it's perfect for creating a droid army to rival that of the Trade Federation <insert evil laugh here>.

Seriously though, I can't think of anything better than a low cost, easily accessible hardware platform to put a Headless Android on.

One problem... it's all sold out. Bother.

Stay tuned for some activity in the near future on porting the Android patches to the Raspberry Pi kernel, minus of course the video subsystem. Let's see what we get, shall we? Headless Raspberry Pi anyone, with Gingerbread crust? Mmmmmm, sounds good to me!

Wednesday, April 4, 2012

From the Archives - 2008 Article on non-phone Android

I'm sure most of you have seen this article from Stephen Shankland of CENT in 2008 on using Android on non-phone devices. He was spot on about Android showing up in a lot more things than phones.

http://news.cnet.com/8301-17938_105-10047551-1.html

 Now, four years later (ish) I find it interesting that many of the concerns that Stephen had about Android have come to the forefront. Issues around fragmentation and compatibility that he calls out in his article are a big deal for Android developers.

While some may think these issues are mostly UI related, even in non-UI based Android systems there will be some compatibility issues from version to version. It was true in 2008 and it's still true today.

Monday, April 2, 2012

As Headless as an Android gets

Minor changes and now it's Headless. See the updated patch page.

Here is my ps of my currently running system:

# ps
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      1     0     324    188   800d4fa4 0000875c S /init
root      2     0     0      0     8006d344 00000000 S kthreadd
root      3     2     0      0     8005cf24 00000000 S ksoftirqd/0
root      4     2     0      0     8008d2cc 00000000 S watchdog/0
root      5     2     0      0     80069bdc 00000000 S events/0
root      6     2     0      0     80069bdc 00000000 S khelper
root      9     2     0      0     80073e50 00000000 S async/mgr
root      10    2     0      0     80069bdc 00000000 S pm
root      13    2     0      0     80069bdc 00000000 S suspend
root      87    2     0      0     80041cf4 00000000 S usb_wakeup thre
root      227   2     0      0     800a5588 00000000 S sync_supers
root      229   2     0      0     800a5ff0 00000000 S bdi-default
root      231   2     0      0     80069bdc 00000000 S kblockd/0
root      241   2     0      0     80069bdc 00000000 S mxc_spi.0
root      249   2     0      0     80069bdc 00000000 S otg_switch/0
root      255   2     0      0     80268948 00000000 S khubd
root      277   2     0      0     80069bdc 00000000 S kmmcd
root      299   2     0      0     80069bdc 00000000 S rpciod/0
root      317   2     0      0     8008d514 00000000 S khungtaskd
root      318   2     0      0     8009fe28 00000000 S kswapd0
root      366   2     0      0     80069bdc 00000000 S aio/0
root      376   2     0      0     80069bdc 00000000 S nfsiod
root      380   2     0      0     80069bdc 00000000 S crypto/0
root      997   2     0      0     80210978 00000000 S kapmd
root      1068  2     0      0     802913c4 00000000 S file-storage
root      1116  2     0      0     80069bdc 00000000 S kstriped
root      1119  2     0      0     80069bdc 00000000 S kconservative/0
root      1126  2     0      0     80069bdc 00000000 S vpu_wq/0
root      1128  2     0      0     802e9fec 00000000 S hwevent
root      1133  2     0      0     80069bdc 00000000 S esdhc_wq/0
root      1136  2     0      0     80069bdc 00000000 S esdhc_wq/0
root      1143  2     0      0     80069bdc 00000000 S usbhid_resumer
root      1146  2     0      0     80069bdc 00000000 S binder
root      1156  2     0      0     802fe5c4 00000000 S mmcqd
root      1197  1     300    156   800d4fa4 0000875c S /sbin/ueventd
root      1958  2     0      0     80143604 00000000 S jbd2/mmcblk0p2-
root      1959  2     0      0     80069bdc 00000000 S ext4-dio-unwrit
root      1961  2     0      0     80143604 00000000 S jbd2/mmcblk0p5-
root      1962  2     0      0     80069bdc 00000000 S ext4-dio-unwrit
root      1963  2     0      0     80143604 00000000 S jbd2/mmcblk0p6-
root      1964  2     0      0     80069bdc 00000000 S ext4-dio-unwrit
root      1966  1     744    268   8005ac1c 6fd0c3ac S /system/bin/sh
system    1967  1     816    176   80313b44 6fd0b6fc S /system/bin/servicemanager
root      1968  1     3872   380   ffffffff 6fd0bdac S /system/bin/vold
root      1969  1     3868   452   ffffffff 6fd0bdac S /system/bin/netd
root      1970  1     820    204   800d4fa4 6fd0b844 S /system/bin/dispd
root      1971  1     676    148   8034ab44 6fd0c0cc S /system/bin/debuggerd
root      1972  1     83412  26312 800d4fa4 6fd0b844 S zygote
media     1973  1     24288  4492  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 1974  1     1264   184   800d4fa4 6fd0c59c S /system/bin/dbus-daemon
root      1975  1     824    208   803c9edc 6fd0b45c S /system/bin/installd
keystore  1976  1     1752   284   8034ab44 6fd0c0cc S /system/bin/keystore
radio     1977  1     4444   396   ffffffff 6fd0bdac S /system/bin/rild
system    2032  1972  127452 29024 ffffffff 6fd0b6fc S system_server
root      2170  1966  904    308   00000000 6fd0b45c R ps