Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
您现在的位置: Android教程網 >> Android系統教程 >  >> Android 技術 >> Android 開發實例

Android 核心移植需要哪些模組?一份對照清單

編輯:Android 開發實例

核心移植的做法,本質上是把兩份原始碼擺在一起比對,把 Android 專屬的改動挑出來補進目標核心。取得來源有兩個:

  • https://android.git.kernel.org/:抓取 Android 版本的核心 linux-2.6.x
  • https://www.kernel.org/:抓取對應版本的官方核心 linux-2.6.x

以下以 2.6.29 為例,列出需要移植的模組與檔案。

模組一:drivers/staging/android 目錄

  • binder.c(含 binder.h)
  • logger.c(含 logger.h)
  • lowmemorykiller.c
  • ram_console.c
  • timed_gpio.c(含 timed_gpio.h)
  • timed_output.c(含 timed_output.h)

模組二:drivers/alarm.c

單一檔案,注意相關 include 一併帶入。

模組三:drivers/misc 目錄

  • Kernel_debugger.c(include\linux\Kernel_debugger.h)
  • Uid_stat.c(include\linux\Uid_stat.h)
  • Pmem.c(linux/android_pmem.h)

模組四:kernel/power 目錄

  • wakelock.c(include\linux\Wakelock.h)
  • userwakelock.c(include\linux\Wakelock.h)
  • earlysuspend.c
  • consoleearlysuspend.c
  • fbearlysuspend.c

模組五:mm/ashmem.c

含 linux/ashmem.h,是 Android 共享記憶體機制的基礎。

模組六:drivers/input/misc 目錄

  • Gpio_axis.c
  • Gpio_event.c(Gpio_event.h)
  • Gpio_input.c
  • Gpio_matrix.c
  • Gpio_output.c
  • Keychord.c(Keychord.h)

模組七:drivers/input/keyreset.c

含 keyreset.h。

模組八:drivers/switch 目錄

  • switch_class.c
  • switch_gpio.c(switch.h)

模組九:drivers/usb/gadget 目錄

  • Android.c(include/linux/usb/android.h)
  • Android_aid.h
  • F_adb.c、F_adb.h
  • F_mass_storage.c、F_mass_storage.h

模組十:drivers/net 目錄

  • Pppolac.c
  • Pppopns.c
  • Ppp_mppe.c

模組十一:net/ipv4 目錄

  • Sysfs_net_ipv4.c

移植時的幾點建議

比對時最好逐檔 diff,不要整包覆蓋——Android 分支上有些檔案與主線同名但差異很大。另外,binder、ashmem、wakelock 這三塊是 Android 使用者空間能否正常動作的關鍵,缺任何一項都會在啟動階段就失敗。移植完成後記得同步更新對應的 Kconfig 與 Makefile,否則新檔案根本不會被編進去。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © Android教程網 All Rights Reserved