Given that the android is based on Linux 2.6 kernel I had tried to figure out how much the android was similar to Linux in terms of process management, user management, file system etc.
In order to do this I had, first, tried to get a shell on my HTC Tattoo. I noticed that I had to pick and install one from the android market place. I installed an app named Terminal Emulator.
With the app installed, I was able to run commands like ls, cd, ps etc. While there is a root user, trying a su root was not allowed (access denied). After googling around a bit I learnt that on the device itself we can’t su as root because applications are restricted from accessing su. In case I wanted my terminal emulator app to get root access I would need to replace the su executable file. While there are loads of webpages which described how to do this, I wasn’t sure if I wanted to replace my su executable file with a one downloaded from the net. I would prefer to build this custom “rooted” su executable file myself.
Eventually, I started to use the adb shell to investigate my phone.
User and process management:
rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
/dev/block/mtdblock3 /system yaffs2 ro 0 0
/dev/block/mtdblock5 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock4 /cache yaffs2 rw,nosuid,nodev 0 0
rootfs and tmpfs are simple RAM based filesystems that are present in the Linux world too. Both are special instances of ramfs (i.e rootfs can not be unmounted). /devpts /proc and sysfs are also very similar to any linux 2.6 installation you’d see. Infact we can cat the files in /proc to learn more about the phone.
$ cat /proc/yaffs
YAFFS built:Sep 29 2009 18:07:44
Device 0 “system”
Device 1 “userdata”
Device 2 “cache”
So, finally we can indeed see that Android is Linux, but not quite so. No wonder the linux kernel team and the android team had a difference of opinion when it came to merging some of android’s code in to liunx :-p…
- May the source be with gnu!