Android 內核、啟動信息 的大致分析
0
Android 內核、啟動信息 的大致分析
以上為Android官方公布的架構圖。在kernel子目錄下存放的就是Android的Linux Kernel了, 通過和標准的Linux 2.6.25 Kernel的對比,我們可以發現,其主要增加了以下的內容:
1. 基於ARM架構增加Gold-Fish平台,相應增加的目錄如下:
kernel/arch/arm/mach-goldfish
kernel/include/asm-arm/arch-goldfish
目前Google的基於Gold-Fish的手機為G1手機,明年G2手機將面世。
該手機采用QualComm公司的高性能處理芯片MSM7201A,該芯片以ARM 11作為Application應用處理器,以ARM926T作為BaseBand主處理器(主要承載GSM/GPRS/EDGE/3G等協議棧處理), 支持JAVA硬加速(ARM本身也自帶JAVA硬件處理),包含GPS Processor, 支持2D/3D圖形加速(每秒可處理4百萬個多邊形),另外還支持最大800萬像素的Sensor, 支持MPEG 4/H.263/H.264/Real Media等多種Codec。
其中ARM926T采用的主頻為274M HZ, ARM11的主頻為528MHZ. (MSM7200的ARM11的主頻為400M HZ)
因為沒有找到MSM7201A的詳細DataSheet, 因此可以簡單地參考MSM7200的規格:
下面為MSM7200架構圖:
2. 增加了yaffs2 FLASH文件系統,相應增加的目錄為:
kernel/fs/yaffs2
實際上,Android包經過編譯後生成的system.img和ramdisk.img文件就是yaffs2格式的包.
3. 增加了Android的相關Driver,相應目錄為:
kernel/drivers/android
主要分為:
Android IPC系統: Binder (binder.c)
Android 日志系統: Logger (logger.c)
Android 電源管理: Power (power.c)
Android 鬧鐘管理: Alarm (alarm.c)
Android 內存控制台: Ram_console (ram_console.c)
Android 時鐘控制的gpio: Timed_gpio (timed_gpio.c)
4. 增加了switch處理, 相應的目錄為:
kernel/drivers/switch/
5. 增加了一種新的共享內存處理方式, 相應增加的文件為:
kernel/mm/ashmem.c
6. 其他為Linux-2.6.25內核所做的補丁等等,例如BlueTooth, 在此不做詳細分析
另外GoldFish平台相關的驅動文件如下:
1. 字符輸出設備:
kernel/drivers/char/goldfish_tty.c
2. 圖象顯示設備: (Frame Buffer)
kernel/drivers/video/goldfishfb.c
3. 鍵盤輸入設備:
kernel/drivers/input/keyboard/goldfish_events.c
4. RTC設備: (Real Time Clock)
kernel/drivers/rtc/rtc-goldfish.c
5. USB Device設備:
kernel/drivers/usb/gadget/android_adb.c
6. SD卡設備:
kernel/drivers/mmc/host/goldfish.c
7. FLASH設備:
kernel/drivers/mtd/devices/goldfish_nand.c
kernel/drivers/mtd/devices/goldfish_nand_reg.h
8. LED設備:
kernel/drivers/leds/ledtrig-sleep.c
9. 電源設備:
kernel/drivers/power/goldfish_battery.c
10. 音頻設備:
kernel/arch/arm/mach-goldfish/audio.c
11. 電源管理:
kernel/arch/arm/mach-goldfish/pm.c
12. 時鐘管理:
kernel/arch/arm/mach-goldfish/timer.c
下面的鏈接為Android Kernel和標准Linux-2.6.25包相比較所產生的PATCH包, 其中比較小的other patch包是除了上面列出的增加文件之外所修改的文件細節,供大家參考。
http://blogimg.chinaunix.net/blog/upfile2/090102095410.gz
以下為Android內核啟動信息:
Uncompressing Linux.................................................................................... done, booting the kernel.
emulator: emulator window was out of view and was recentred
Linux version 2.6.25-00350-g40fff9a (android-build@apa27.mtv.corp.google.com) (gcc version 4.2.1) #1 Wed Jul 23 18:10:44 PDT 2008
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00003137
Machine: Goldfish
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-through cache
CPU0: I cache: 4096 bytes, associativity 4, 32 byte lines, 32 sets
CPU0: D cache: 65536 bytes, associativity 4, 32 byte lines, 512 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 24384
Kernel command line: qemu=1 console=ttyS0 android.checkjni=1 android.qemud=ttyS1 android.ndns=2
Unknown boot option `android.checkjni=1': ignoring
Unknown boot option `android.qemud=ttyS1': ignoring
Unknown boot option `android.ndns=2': 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: 94268KB available (2380K code, 445K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
android_power_init
android_power_init done
NET: Registered protocol family 16
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
checking if image is initramfs... it is
Freeing initrd memory: 136K
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 smc91x at ff012000 irq 12
goldfish_new_pdev goldfish_fb at ff013000 irq 13
goldfish_new_pdev goldfish_audio at ff004000 irq 14
goldfish_new_pdev goldfish_memlog at ff006000 irq -1
goldfish_new_pdev goldfish-battery at ff014000 irq 15
goldfish_new_pdev goldfish_events at ff015000 irq 16
goldfish_new_pdev goldfish_nand at ff016000 irq -1
goldfish_new_pdev goldfish-switch at ff017000 irq 17
goldfish_new_pdev goldfish-switch at ff018000 irq 18
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_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 Jul 23 2008 18:10:35 Installing.
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
No IRQF_TRIGGER set_type function for IRQ 12 (goldfish)
eth0: SMC91C11xFD (rev 1) at c6800000 IRQ 12 [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=0xc6804000 irq=16
events_probe() keymap=qwerty2
input: qwerty2 as /class/input/input0
goldfish_rtc goldfish_rtc: rtc core: registered goldfish_rtc as rtc0
logger: created 64K log 'log_main'
logger: created 64K 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 1
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-01-02 07:43:01 UTC (1230882181)
Freeing init memory: 100K
init: cannot open '/initlogo.rle'
yaffs: dev is 32505856 name is "mtdblock0"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.0, "mtdblock0"
yaffs: dev is 32505857 name is "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.1, "mtdblock1"
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
eth0: link up
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: sys_prop: mis-match msg size recieved: -1 expected: 128
從啟動信息可以看出,其主CPU為ARM926EJ-S,並非ARM11 CPU, 說明下載的Emulator內核並非是針對G1手機的,估計只是實現了對ARM926EJ-S CPU的模擬。
引用 ruixj的專欄
No IRQF_TRIGGER set_type function for IRQ 12 (goldfish)
eth0: SMC91C11xFD (rev 1) at c6800000 IRQ 12 [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=0xc6804000 irq=16
events_probe() keymap=qwerty2
input: qwerty2 as /class/input/input0
goldfish_rtc goldfish_rtc: rtc core: registered goldfish_rtc as rtc0
logger: created 64K log 'log_main'
logger: created 64K 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 1
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-01-02 07:43:01 UTC (1230882181)
Freeing init memory: 100K
init: cannot open '/initlogo.rle'
yaffs: dev is 32505856 name is "mtdblock0"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.0, "mtdblock0"
yaffs: dev is 32505857 name is "mtdblock1"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.1, "mtdblock1"
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
eth0: link up
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: sys_prop: mis-match msg size recieved: -1 expected: 128
從啟動信息可以看出,其主CPU為ARM926EJ-S,並非ARM11 CPU, 說明下載的Emulator內核並非是針對G1手機的,估計只是實現了對ARM926EJ-S CPU的模擬。
引用 ruixj的專欄