Android 与Linux Kernel
在kernel子目录下存放的就是Android的Linux Kernel了, 通过和标准的Linux 2.6.25 Kernel的对比,我们可以发现,其主要增加了以下的内容:
1. 基于ARM架构增加Gold-Fish平台,相应增加的目录如下:
kernel/arch/arm/mach-goldfish
kernel/include/asm-arm/arch-goldfish
Gold-Fish平台采用的是ARM926T CPU作为BaseBand处理器, 该CPU主频至少为200M HZ. 采用MSM7201A CPU(ARM 11)作为主CPU, 其主频为528M HZ.
2. 增加了yaffs2 FLASH文件系统,相应增加的目录为:
kernel/fs/yaffs2
实际上,Android包经过编译后生成的system.img和ramdisk.img文件就是yaffs2格式的包.
3. 增加了Android的相关Driver,相应目录为:
kernel/drivers/android
主要分为:
Android IPC系统: Binder
Android 日志系统: Logger
Android 电源管理: Power
Android 闹钟管理: Alarm
Android 内存控制台: Ram_console
Android 时钟控制的gpio: Timed_gpio
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
. 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内核的大致分析,希望能给有兴趣的人员以简单帮助
---------------摘自程广辉博客:http://hi.baidu.com/l4os/home
Goldfish Audio <-> arch/arm/mach-goldfish/audio.c Goldfish pdev-bus <-> arch/arm/mach-goldfish/board-goldfish.c arch/arm/mach-goldfish/pdev_bus.c Goldfish power management <-> arch/arm/mach-goldfish/pm.c Goldfish switch device(我觉得这是一个test device) <-> arch/arm/mach-goldfish/switch.c Goldfish timer <-> arch/arm/mach-goldfish/timer.c Goldfish tty <-> drivers/char/goldfish_tty.c Goldfish mmc(multi-media card) <-> drivers/mmc/host/goldfish.c Goldfish keyboard <->drivers/input/keyboard/goldfish_events.c Goldfish Nand <-> drivers/mtd/devices/goldfish_nand.c goldfish battery <-> drivers/power/goldfish_battery.c Goldfish rtc <-> drivers/rtc/rtc-goldfish.c Goldfish framebuffer <-> drivers/video/goldfishfb.c And others: drivers/leds/ledtrig-sleep.c drivers/misc/lowmemorykiller.c drivers/misc/qemutrace/* drivers/switch/* Normally we can find all the device hardware info in the android-emulator/qemu/hw directory including goldfish_audio, goldfish_mmc, goldfish_nand, goldfish_tty, goldfish_events_device, goldfish_battery, goldfish_fb, goldfish_timer,goldfish_switch. Android / Anonymous Shared Memory Subsystem, ashmem <-> mm/ashmem.c drivers/android/(alarm.c binder.c logger.c power.c ram_console.c timed_gpio.c) From android-emulator boot log goldfish_add_device: goldfish_interrupt_controller, base ff000000 1000, irq 0 0 goldfish_add_device: goldfish_device_bus, base ff001000 1000, irq 1 1 goldfish_add_device: goldfish_timer, base ff003000 1000, irq 3 1 goldfish_add_device: goldfish_rtc, base ff010000 1000, irq 10 1 goldfish_add_device: goldfish_tty, base ff002000 1000, irq 4 1 goldfish_add_device: goldfish_tty, base ff011000 1000, irq 11 1 goldfish_add_device: smc91x, base ff012000 1000, irq 12 1 goldfish_add_device: goldfish_fb, base ff013000 1000, irq 13 1 goldfish_add_device: goldfish_memlog, base ff006000 1000, irq 0 0 goldfish_add_device: goldfish-battery, base ff014000 1000, irq 14 1 goldfish_add_device: goldfish_events, base ff015000 1000, irq 15 1 goldfish_add_device: goldfish_nand, base ff016000 1000, irq 0 0 goldfish_add_device: goldfish-switch, base ff017000 1000, irq 16 1 goldfish_add_device: goldfish-switch, base ff018000 1000, irq 17 1 In the end the Google Android use YAFFS2 file system which is a NAND file system, more info is here (http://discuz-android.blogspot.com/2008/01/yaffsyaffs2-and-jffs2-comparison.html) drivers/char/goldfish_tty.c drivers/char/Kconfig config GOLDFISH_TTY tristate "Goldfish TTY Driver" default n help TTY driver for Goldfish Virtual Platform. drivers/mmc/host/goldfish.c drivers/mmc/host/Kconfig config MMC_GOLDFISH tristate "goldfish qemu Multimedia Card Interface support" depends on ARCH_ANDROIDSIM help This selects the Goldfish Multimedia card Interface emulation. If unsure, say N. drivers/input/keyboard/goldfish_events.c drivers/input/keyboard/Kconfig config KEYBOARD_GOLDFISH_EVENTS tristate "Generic Input Event device for Goldfish" help no help drivers/mtd/devices/goldfish_nand.c drivers/mtd/devices/goldfish_nand_reg.h drivers/mtd/devices/Kconfig config MTD_GOLDFISH_NAND tristate "Goldfish NAND device" help none drivers/power/goldfish_battery.c drivers/power/Kconfig config BATTERY_GOLDFISH tristate "Goldfish battery driver" help Say Y to enable support for the battery and AC power in the Goldfish emulator. drivers/rtc/rtc-goldfish.c drivers/rtc/Kconfig config RTC_DRV_GOLDFISH tristate "GOLDFISH" depends on RTC_CLASS help RTC driver for Goldfish Virtual Platform drivers/video/goldfishfb.c drivers/video/Kconfig config FB_GOLDFISH tristate "Goldfish Framebuffer depends on FB select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT ---help--- Framebuffer driver for Goldfish Virtual Platform mm/ashmem.c mm/Makefile obj-$(CONFIG_ASHMEM) += ashmem.o drivers/android/(alarm.c binder.c logger.c power.c ram_console.c timed_gpio.c) drivers/Kconfig source "drivers/android/Kconfig" drivers/Makefile obj-y += android/ |
评论
发表评论