2011年7月7日 星期四

Android Open Source (6) Porting Kernel

Android 版本實在前進的很快,Linux Kernel 也是,不想也沒辦法一直跟著改,
我是用32-bit 的發展環境,所以先固定 Android 2.2 -- FroYo ,由Android 網站下載的 Kernel 是 2.6.32 (2011-4-7);Linux Kernel 是 2.6.32.9,而我原先用的 Linux Kernel 則是 2.6.31.6,
得要分階段一步步來完成 porting。

第一步,列出當Linux 2.6.31.6 porting 到目標SoC平台時,所有需要修改及加入的檔案。
第二步,依據前一步驟列出的資料,Poring Linux Kernel 2.6.32.9 到目標SoC平台,並測試功能。
第三步,將 Andoid Kernel 2.6.32與第二步驟產生的 Linux Kernel 2.6.32.9 不同的部分(drivers for Android....) 併入。


一直要 porting Android 到自己用的平台,不過原先的Linux系統還是要持續改進,拖到現在才把第三步完成,現在Kernel Booting,執行原來的Root Filesystem .....都沒問題了。
再來就是要根據Andriod 的需求來 compile kernel 了。
參考 Kernel Source Code Tree 的 Documentation 目錄下的 android.txt 來configure kernel。

原文是照字母順序排的,但我是由 menuconfig 來選。

CONFIG_ANDROID_PARANOID_NETWORK
    Networking Support --> Networking options --> Only allow certain groups to create sockets

CONFIG_ASHMEM
    General setup --> Enable the Anonymous Shared Memory Subsystem

CONFIG_FONT_8x8
CONFIG_FONT_8x16
    Device Drivers --> Graphics support -->Console display driver support-->Select compiled-in fonts
         --> VGA 8x8 font
         --> VGA 8x16 font

CONFIG_DAB
    Device Drivers --> Multimedia support -->  DAB adapters

CONFIG_FB
CONFIG_FB_CFB_COPYAREA
CONFIG_FB_CFB_FILLRECT
CONFIG_FB_CFB_IMAGEBLIT
   Device Drivers --> Graphics support --> Support for frame buffer devices
CONFIG_FB_DEFERRED_IO
      Need to modify drivers/video/Kconfig

CONFIG_FB_MODE_HELPERS
    Device Drivers --> Graphics support --> Support for frame buffer devices 
         -->Enable Video Mode Handling Helpers

CONFIG_FB_TILEBLITTING
    Device Drivers --> Graphics support --> Support for frame buffer devices
      --> Enable Tile Blitting Support

NO_HZ
HIGH_RES_TIMERS
     Kernel Features -->  Tickless System (Dynamic Ticks)
     Kernel Features -->   High Resolution Timer Support
SoC 的 config 必須有 select GENERIC TIME 及 GENERIC_CLOCKEVENTS,
這兩個選項才會出來。但是不適用於這個SoC

CONFIG_DNOTIFY <-- Disabled
CONFIG_INOTIFY
     File systems --> Inotify file change notification support 
CONFIG_INOTIFY_USER
     File systems --> Inotify support for userspace



CONFIG_INPUT_EVDEV
     Device Drivers  -->Input device support -->Event interface

CONFIG_INPUT_MISC
CONFIG_INPUT_GPIO
     Device Drivers  -->Input device support  --> Miscellaneous devices --> Miscellaneous devices

CONFIG_NEW_LEDS
CONFIG_LEDS_CLASS
CONFIG_LEDS_GPIO
     Device Drivers  --> LED Support --> LED Class Support --> LED Support for GPIO connected LEDs

LOCK_KERNEL
     ==> depends on SMP, but my SoC is not SMP

CONFIG_ANDROID
CONFIG_ANDROID_BINDER_IPC
CONFIG_ANDROID_LOGGER
CONFIG_ANDROID_RAM_CONSOLE
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
CONFIG_ANDROID_LOW_MEMORY_KILLER
     Device Drivers  -->  !Exclude Staging drivers from being built -> Andriod
            -->  Android Drivers -->  Android Binder IPC Driver
                                             --> Android log driver
                                             --> Android RAM buffer console
                                             --> Android RAM Console Enable error correction
                                             --> Android Low Memory Killer
CONFIG_MISC_DEVICES
CONFIG_ANDROID_PMEM
     Device Drivers  -->  Misc devices --> Android pmem allocator

CONFIG_POWER_SUPPLY
     Device Drivers  -->  Power supply class support --> Generic PDA/phone power driver
         generic power driver for PDAs and phones with one or two external power supplies (AC/USB)
         connected to main and backup batteries, and optional built-in charger.


CONFIG_PREEMPT
     Kernel Features --> Preemption Model --> Preemptible Kernel (Low-Latency Desktop)

CONFIG_RTC_CLASS
CONFIG_RTC_LIB
     Device Drivers  --> Real Time Clock

CONFIG_SWITCH
CONFIG_SWITCH_GPIO

     Device Drivers  -->  Switch class support --> GPIO Swith support 


CONFIG_TMPFS
     File systems -->  Pseudo filesystems --> Virtual memory file system support (former shm fs)

CONFIG_UID_STAT
CONFIG_UID16
     Device Drivers  -->  Misc devices --> UID based statistics tracking exported to /proc/uid_stat

USB_FUNCTION
USB_FUNCTION_ADB

CONFIG_WAKELOCK
CONFIG_WAKELOCK_STAT
CONFIG_USER_WAKELOCK
CONFIG_EARLYSUSPEND
    Power management options --> Wake lock
                                                             Wake lock stats
                                                             Userspace wake locks
                                                             Early suspend



CONFIG_VIDEO_OUTPUT_CONTROL
    Device Drivers  --> Graphics support  --> Lowlevel video output switch controls

CONFIG_YAFFS_FS
CONFIG_YAFFS_YAFFS1
CONFIG_YAFFS_YAFFS2
CONFIG_YAFFS_AUTO_YAFFS2
   Those options depend on MTD_BLOCK
    File systems --> Miscellaneous filesystems -->  YAFFS2 file system support
                                                                            512 byte / page devices 
                                                                            2048 byte (or larger) / page devices
                                                                               Autoselect yaffs2 format
CONFIG_YAFFS_SHORT_NAMES_IN_RAM
    defined in  fs/yaffs2/moduleconfig.h

CONFIG_CRC_CCITT
     Library routines --> CRC-CCITT functions

先build好一版 kernel,開機測試一下,跑得算正常。
不過,要真正開始執行Android 系統才算完成。



沒有留言: