android平台初步分析
来自:http://dyverin.blogspot.com/2009/05/android.html,里面的目录结构和unyaffs比较有用。
from : http://blog.csdn.net/chief1985/article/details/4420293
内核打印:
Uncompressing Linux.......................................................................................... done, booting the kernel.
Linux version 2.6.29-00135-ga4ae495 (dybbuk@localhost.localdomain) (gcc version 4.3.1 (GCC) ) #1 Mon May 18 22:01:19 CST 2009
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: Goldfish
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24384
Kernel command line: qemu=1 console=ttyS0 androidboot.console=ttyS1 android.checkjni=1android.qemud=ttyS2 android.ndns=1
Unknown boot option `androidboot.console=ttyS1': ignoring
Unknown boot option `android.checkjni=1': ignoring
Unknown boot option `android.qemud=ttyS2': ignoring
Unknown boot option `android.ndns=1': ignoring
PID hash table entries: 512 (order: 9, 2048 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 96MB = 96MB total
Memory: 93880KB available (2528K code, 671K data, 108K init)
Calibrating delay loop... 183.91 BogoMIPS (lpj=919552)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 520 bytes
NET: Registered protocol family 16
bio: create slab at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
checking if image is initramfs... it is
Freeing initrd memory: 140K
goldfish_new_pdev goldfish_interrupt_controller at ff000000 irq -1
goldfish_new_pdev goldfish_device_bus at ff001000 irq 1
goldfish_new_pdev goldfish_timer at ff003000 irq 3
goldfish_new_pdev goldfish_rtc at ff010000 irq 10
goldfish_new_pdev goldfish_tty at ff002000 irq 4
goldfish_new_pdev goldfish_tty at ff011000 irq 11
goldfish_new_pdev goldfish_tty at ff012000 irq 12
goldfish_new_pdev smc91x at ff013000 irq 13
goldfish_new_pdev goldfish_fb at ff014000 irq 14
goldfish_new_pdev goldfish_audio at ff004000 irq 15
goldfish_new_pdev goldfish_memlog at ff006000 irq -1
goldfish_new_pdev goldfish-battery at ff015000 irq 16
goldfish_new_pdev goldfish_events at ff016000 irq 17
goldfish_new_pdev goldfish_nand at ff017000 irq -1
goldfish_new_pdev goldfish-switch at ff018000 irq 18
goldfish_new_pdev goldfish-switch at ff019000 irq 19
goldfish_pdev_worker registered goldfish-switch
goldfish_pdev_worker registered goldfish-switch
goldfish_pdev_worker registered goldfish_nand
goldfish_pdev_worker registered goldfish_events
goldfish_pdev_worker registered goldfish-battery
goldfish_pdev_worker registered goldfish_memlog
goldfish_audio_probe
goldfish_pdev_worker registered goldfish_audio
goldfish_pdev_worker registered goldfish_fb
goldfish_pdev_worker registered smc91x
goldfish_pdev_worker registered goldfish_tty
goldfish_pdev_worker registered goldfish_tty
goldfish_pdev_worker registered goldfish_tty
goldfish_pdev_worker registered goldfish_rtc
goldfish_pdev_worker registered goldfish_timer
goldfish_pdev_worker registered goldfish_device_bus
goldfish_pdev_worker registered goldfish_interrupt_controller
ashmem: initialized
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
yaffs May 18 2009 21:56:58 Installing.
msgmni has been set to 183
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
allocating frame buffer 320 * 480, got ffc10000
Console: switching to colour frame buffer device 40x30
console [ttyS0] enabled
brd: module loaded
loop: module loaded
nbd: registered device at major 43
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre
eth0 (smc91x): not using net_device_ops yet
eth0: SMC91C11xFD (rev 1) at c684c000 IRQ 13 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
goldfish nand dev0: size 4000000, page 2048, extra 64, erase 131072
goldfish nand dev1: size 4000000, page 2048, extra 64, erase 131072
goldfish nand dev2: size 4000000, page 2048, extra 64, erase 131072
mice: PS/2 mouse device common for all mice
*** events probe ***
events_probe() addr=0xc6854000 irq=17
events_probe() keymap=qwerty
input: qwerty as /devices/virtual/input/input0
goldfish_rtc goldfish_rtc: rtc core: registered goldfish_rtc as rtc0
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear
All bugs added by David S. Miller
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
goldfish_rtc goldfish_rtc: setting system clock to 2009-05-19 05:21:03 UTC (1242710463)
Freeing init memory: 108K
init: cannot open '/initlogo.rle'
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.0, "mtdblock0"
yaffs_read_super: isCheckpointed 0
save exit: isCheckpointed 1
yaffs: dev is 32505857 name is "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.1, "mtdblock1"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
init: cannot find '/system/bin/playmp3', disabling 'bootsound'
# eth0: link up
warning: `rild' uses 32-bit capabilities (legacy support in use)
从这行打印开始,内核调用用户层的init,开始执行ramdisk中的程序.
init: cannot open '/initlogo.rle'
android的init 与标准linux 的init 逻辑有些差异.他包含开机显示, 像上面的打印则是开机logo的打印. 还包含监控服务的内容,以及udev的内容,以及.
init会读/init.rc这个配置文件,然后会读取/proc/cpuinfo中Hardware这一行的值,来选择读取/init.Hardware.rc这个文件.
ramdisk 目录层次:
.
|-- data
|-- default.prop
|-- dev
|-- init
|-- init.goldfish.rc
|-- init.rc
|-- proc
|-- sbin
| `-- adbd
|-- sys
`-- system
目录中没有库文件,所以init与adbd都是静态链接程序.
init.rc 里会把主要的根文件系统(nand flash中一个分区)mount到/system 目录下,然后执行里面的一些后台程序.
yaffs2 image可以使用unyaffs解开(http://code.google.com/p/unyaffs):
.
|-- abc
|-- app
| |-- AlarmClock.apk
| |-- Browser.apk
| |-- Calendar.apk
| |-- CalendarProvider.apk
| |-- Camera.apk
| |-- Contacts.apk
| |-- ContactsProvider.apk
| |-- Development.apk
| |-- DownloadProvider.apk
| |-- DrmProvider.apk
| |-- GoogleSearch.apk
| |-- HTMLViewer.apk
| |-- LatinIME.apk
| |-- Launcher.apk
| |-- MediaProvider.apk
| |-- Mms.apk
| |-- Music.apk
| |-- PackageInstaller.apk
| |-- Phone.apk
| |-- Settings.apk
| |-- SettingsProvider.apk
| |-- SoundRecorder.apk
| |-- SpareParts.apk
| |-- SubscribedFeedsProvider.apk
| |-- TelephonyProvider.apk
| |-- Term.apk
| `-- UserDictionaryProvider.apk
|-- bin
| |-- am
| |-- app_process
| |-- applypatch
| |-- bugreport -> dumpstate
| |-- cat -> toolbox
| |-- check_prereq
| |-- chmod -> toolbox
| |-- chown -> toolbox
| |-- cmp -> toolbox
| |-- dalvikvm
| |-- date -> toolbox
| |-- dbus-daemon
| |-- dd -> toolbox
| |-- debuggerd
| |-- dexopt
| |-- df -> toolbox
| |-- dhcpcd
| |-- dmesg -> toolbox
| |-- dosfsck
| |-- dumpcrash -> dumpstate
| |-- dumpstate
| |-- dumpsys
| |-- dvz
| |-- flash_image
| |-- gdbserver
| |-- getevent -> toolbox
| |-- getprop -> toolbox
| |-- gzip
| |-- hd -> toolbox
| |-- id -> toolbox
| |-- ifconfig -> toolbox
| |-- iftop -> toolbox
| |-- ime
| |-- input
| |-- insmod -> toolbox
| |-- installd
| |-- ioctl -> toolbox
| |-- iptables
| |-- kill -> toolbox
| |-- linker
| |-- ln -> toolbox
| |-- log -> toolbox
| |-- logcat
| |-- logwrapper
| |-- ls -> toolbox
| |-- lsmod -> toolbox
| |-- mediaserver
| |-- mkdir -> toolbox
| |-- mkdosfs -> toolbox
| |-- monkey
| |-- mount -> toolbox
| |-- mv -> toolbox
| |-- netcfg
| |-- netstat -> toolbox
| |-- notify -> toolbox
| |-- ping
| |-- pm
| |-- printenv -> toolbox
| |-- ps -> toolbox
| |-- pv2way_omx_engine_test
| |-- pvplayer_engine_test
| |-- qemud
| |-- radiooptions
| |-- reboot -> toolbox
| |-- recovery
| |-- renice -> toolbox
| |-- rild
| |-- rm -> toolbox
| |-- rmdir -> toolbox
| |-- rmmod -> toolbox
| |-- route -> toolbox
| |-- schedtest
| |-- schedtop -> toolbox
| |-- sdutil
| |-- sendevent -> toolbox
| |-- service
| |-- servicemanager
| |-- setconsole -> toolbox
| |-- setprop -> toolbox
| |-- sh
| |-- showlease
| |-- sleep -> toolbox
| |-- smd -> toolbox
| |-- start -> toolbox
| |-- stop -> toolbox
| |-- surfaceflinger
| |-- svc
| |-- sync -> toolbox
| |-- system_server
| |-- test_pvauthorengine
| |-- toolbox
| |-- top -> toolbox
| |-- umount -> toolbox
| |-- vmstat -> toolbox
| |-- vold
| |-- watchprops -> toolbox
| `-- wipe -> toolbox
|-- build.prop
|-- etc
| |-- NOTICE.html.gz
| |-- apns-conf.xml
| |-- bookmarks.xml
| |-- dbus.conf
| |-- dhcpcd
| | |-- dhcpcd-hooks
| | | |-- 01-test
| | | |-- 20-dns.conf
| | | `-- 95-configured
| | |-- dhcpcd-run-hooks
| | `-- dhcpcd.conf
| |-- event-log-tags
| |-- hosts
| |-- init.goldfish.sh
| |-- permissions
| | `-- platform.xml
| |-- pvplayer.cfg
| |-- security
| | |-- cacerts.bks
| | `-- otacerts.zip
| `-- vold.conf
|-- fonts
| |-- DroidSans-Bold.ttf
| |-- DroidSans.ttf
| |-- DroidSansFallback.ttf
| |-- DroidSansMono.ttf
| |-- DroidSerif-Bold.ttf
| |-- DroidSerif-BoldItalic.ttf
| |-- DroidSerif-Italic.ttf
| `-- DroidSerif-Regular.ttf
|-- framework
| |-- am.jar
| |-- android.awt.jar
| |-- android.policy.jar
| |-- android.test.runner.jar
| |-- com.android.im.plugin.jar
| |-- core.jar
| |-- ext.jar
| |-- framework-res.apk
| |-- framework-tests.jar
| |-- framework.jar
| |-- ime.jar
| |-- input.jar
| |-- monkey.jar
| |-- pm.jar
| |-- services.jar
| `-- svc.jar
|-- lib
| |-- browsertestplugin.so
| |-- hw
| | `-- sensors.goldfish.so
| |-- libEGL.so
| |-- libFFTEm.so
| |-- libGLESv1_CM.so
| |-- libaes.so
| |-- libagl.so
| |-- libandroid_runtime.so
| |-- libandroid_servers.so
| |-- libaudioflinger.so
| |-- libc.so
| |-- libc_debug.so
| |-- libcameraservice.so
| |-- libcorecg.so
| |-- libcrypto.so
| |-- libctest.so
| |-- libcutils.so
| |-- libdbus.so
| |-- libdl.so
| |-- libdrm1.so
| |-- libdrm1_jni.so
| |-- libdvm.so
| |-- libemoji.so
| |-- libexif.so
| |-- libexpat.so
| |-- libhardware.so
| |-- libhardware_legacy.so
| |-- libicudata.so
| |-- libicui18n.so
| |-- libicuuc.so
| |-- libjni_latinime.so
| |-- liblog.so
| |-- libm.so
| |-- libmedia.so
| |-- libmedia_jni.so
| |-- libmediaplayerservice.so
| |-- libnativehelper.so
| |-- libnetutils.so
| |-- libomx_aacdec_sharedlibrary.so
| |-- libomx_amrdec_sharedlibrary.so
| |-- libomx_amrenc_sharedlibrary.so
| |-- libomx_avcdec_sharedlibrary.so
| |-- libomx_avcenc_sharedlibrary.so
| |-- libomx_m4vdec_sharedlibrary.so
| |-- libomx_m4venc_sharedlibrary.so
| |-- libomx_mp3dec_sharedlibrary.so
| |-- libomx_sharedlibrary.so
| |-- libopencore_2way.so
| |-- libopencore_author.so
| |-- libopencore_common.so
| |-- libopencore_download.so
| |-- libopencore_downloadreg.so
| |-- libopencore_mp4local.so
| |-- libopencore_mp4localreg.so
| |-- libopencore_net_support.so
| |-- libopencore_player.so
| |-- libopencore_rtsp.so
| |-- libopencore_rtspreg.so
| |-- libpagemap.so
| |-- libpixelflinger.so
| |-- libreference-ril.so
| |-- libril.so
| |-- libsgl.so
| |-- libskiagl.so
| |-- libsonivox.so
| |-- libsoundpool.so
| |-- libsqlite.so
| |-- libsrec_jni.so
| |-- libssl.so
| |-- libstdc++.so
| |-- libsurfaceflinger.so
| |-- libsystem_server.so
| |-- libthread_db.so
| |-- libui.so
| |-- libutils.so
| |-- libvorbisidec.so
| |-- libwbxml.so
| |-- libwbxml_jni.so
| |-- libwebcore.so
| |-- libwpa_client.so
| |-- libxml2wbxml.so
| `-- libz.so
|-- usr
| |-- keychars
| | |-- qwerty.kcm.bin
| | |-- qwerty2.kcm.bin
| | `-- tuttle2.kcm.bin
| |-- keylayout
| | |-- AVRCP.kl
| | |-- qwerty.kl
| | `-- tuttle2.kl
| |-- share
| | |-- bmd
| | | |-- RFFspeed_501.bmd
| | | `-- RFFstd_501.bmd
| | `-- zoneinfo
| | |-- zoneinfo.dat
| | |-- zoneinfo.idx
| | `-- zoneinfo.version
| `-- srec
| `-- config
| `-- en.us
| |-- baseline.par
| |-- baseline11k.par
| |-- baseline8k.par
| |-- dictionary
| | |-- basic.ok
| | |-- cmu6plus.ok.zip
| | `-- enroll.ok
| |-- g2p
| | `-- en-US-ttp.data
| |-- grammars
| | `-- VoiceDialer.g2g
| `-- models
| |-- generic.swiarb
| |-- generic11.lda
| |-- generic11_f.swimdl
| |-- generic11_m.swimdl
| |-- generic8.lda
| |-- generic8_f.swimdl
| `-- generic8_m.swimdl
`-- xbin
|-- add-property-tag
|-- backup
|-- check-lost+found
|-- cpueater
|-- crasher
|-- daemonize
|-- dbus-monitor
|-- dbus-send
|-- dexdump
|-- latencytop
|-- librank
|-- nc
|-- netperf
|-- netserver
|-- opcontrol
|-- oprofiled
|-- pppd
|-- procmem
|-- procrank
|-- scp
|-- showmap
|-- showslab
|-- sqlite3
|-- ssh
|-- strace
|-- su
`-- timeinfo
25 directories, 302 files