自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
Android 核心常見問題
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本文件包含 Android 核心 (也稱為通用核心映像檔 (GKI) 核心) 的常見問題。如果您不熟悉 GKI 和 GKI 核心術語,請參閱「核心總覽」。
可以在穩定的核心中變更核心模組介面 (KMI) 符號清單嗎?
不會影響現有 KMI 的變更可新增至已凍結的核心。這些變更包括新的匯出函式和符號清單項目。詳情請參閱「管理符號清單」。
我可以變更供應商模組在穩定版核心中使用的結構嗎?
在凍結的 KMI 中,KVM 介面結構無法變更。在 KMI 凍結前,這些結構體可以變更。
只要不破壞二進位檔或來源相容性,是否可以變更核心?
您可以按照「Android 專屬修補程式」一節的說明,進行不會影響 KMI 的變更。
GKI 如何處理核心設定?
如要瞭解核心設定,請參閱「gki_defconfig 的變更」。
如何處理上游錯誤修正,以便覆寫現有的 GKI 模組?
如果您是根據 Android 通用核心 (ACK) 中的驅動程式建立供應商模組,則您必須確保來自上游和 ACK 的錯誤修正會傳播至您的模組。一般來說,建議您直接使用 GKI 核心和 GKI 模組,不必修改,這樣 Google 就能持續提供這些更新。
是否有 GKI 專屬測試?
供應商測試套件 (VTS) 可驗證已安裝經認證的 GKI 版本,並強制執行各個版本的 GKI 要求。舉例來說,Android 12 有針對開機標頭 v3 的 VTS 測試,可驗證執行 5.10 核心的裝置是否有必要的分區。
如何為裝置版本建立專案 defconfig 片段檔案?
許多符合 GKI 規範的裝置會使用設定片段,說明建構供應商模組所需的設定選項 (除了 gki_defconfig
之外)。ACK 程式碼基底的範例包括 Cuttlefish 和 DB845c。您無法避免手動檢查設定選項,以便對片段進行最佳化,但來自核心來源的 scripts/diffconfig
可用於比較 gki_defconfig
和 gki_defconfig+device.fragment
的結果。
有沒有解決方法,讓 modprobe 將「-」和「_」視為等價?
modprobe 說明文件包含以下說明:「modprobe
可在 Linux 核心中聰明地新增或移除模組:請注意,為方便起見,模組名稱中的 _ 和 - 沒有差異 (會自動執行底線轉換)。」GKI 團隊遵循標準的上游慣例,因此供應商工具或模組命名慣例必須考量這項遵循情形。
如何啟用 debugfs 供內部使用?
如要進一步瞭解如何啟用 debugfs,請參閱「侵入式下游偵錯功能」。
如何解決啟用特定模組設定的 GKI 核心之間的 ABI 不相符問題?
GKI 核心和模組設定之間的 ABI 不相符,代表隱含的模組設定依附元件,如果啟用模組,就會在產生的核心映像檔中建構二進位設定。請與 Android 核心團隊 (kernel-team@android.com) 聯絡,以便決定後續處理方式。確定符號清單後,請在 Issue Tracker 中建立錯誤,並將變更內容上傳至符號清單。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Android kernel frequently asked questions\n\nThis document contains frequently asked questions about the Android kernel,\nknown also as the Generic Kernel Image (GKI) kernel. If you are unfamiliar with\nGKI and GKI kernel terminology, refer to the\n[Kernel overview](/docs/core/architecture/kernel).\n\nCan Kernel Module Interface (KMI) symbol lists be changed in a stable kernel?\n-----------------------------------------------------------------------------\n\nChanges that don't affect the existing KMI can be added to kernels that are\nfrozen. These changes include new exported functions and symbol list entries.\nFor details, see [Manage symbol lists](/docs/core/architecture/kernel/stable-kmi#managing-symbol-lists).\n\nCan I change structures used by vendor modules in a stable kernel?\n------------------------------------------------------------------\n\nStructures that are part of a KMI interface can't be changed in kernels with a\nfrozen KMI. Prior to KMI freeze, these structures can be changed.\n\nCan I change the kernel as long as I don't break binary or source compatibility?\n--------------------------------------------------------------------------------\n\nChanges that don't affect the KMI can be made as described in [Android-specific\npatches](/docs/core/architecture/kernel/kernel-code#android-specific-patches).\n\nHow does GKI handle kernel configuration?\n-----------------------------------------\n\nFor information on kernel configuration, refer to the\n[Changes to gki_defconfig](/docs/core/architecture/kernel/kernel-code#changes-to-gki-defconfig).\n\nHow do I handle upstream bug fixes for overwrites to existing GKI modules?\n--------------------------------------------------------------------------\n\nIf you create a vendor module based on a driver in\n[Android Common Kernel (ACK)](/docs/core/architecture/kernel/android-common),\nit's up to you to ensure that bug fixes from upstream and ACK are propagated\nto your module. Generally, it's in your best interest to use the GKI kernel and\nGKI modules without modification so these updates are provided consistently\nby Google.\n\nAre there GKI specific tests?\n-----------------------------\n\nThere are [Vendor Test Suite (VTS)](/docs/compatibility/vts) tests that verify\nthat a certified GKI build is installed and also to enforce per-release GKI\nrequirements. For example, there are Android 12 VTS tests for boot header v3\nand to verify the existence of required partitions in a device running a 5.10\nkernel.\n\nHow do I create the project defconfig fragment file for device builds?\n----------------------------------------------------------------------\n\nMany GKI-compliant devices use a config fragment to describe the configuration\noptions needed, in addition to `gki_defconfig`, to build the vendor modules.\nExamples that are part of the ACK codebase include Cuttlefish and DB845c.\nThere's no way to avoid some manual examination of configuration options\nto optimize the fragment, but `scripts/diffconfig` from the kernel sources\nis useful for comparing the results of `gki_defconfig` and\n`gki_defconfig+device.fragment`.\n\nIs there a workaround for modprobe treating - and _ as equivalent?\n------------------------------------------------------------------\n\nThe\n[modprobe man page](https://man7.org/linux/man-pages/man8/modprobe.8.html)\ncontains this description: \"`modprobe` intelligently adds\nor removes a module from the Linux kernel: note that for convenience, there is\nno difference between _ and - in module names (automatic underscore conversion\nis performed).\" The GKI team adheres to the standard upstream convention, so\nvendor tools or module naming conventions must take this adherence into account.\n\nHow do I enable debugfs for internal use?\n-----------------------------------------\n\nFor details on enabling debugfs, see [intrusive downstream debug\nfeatures](/docs/core/architecture/kernel/debugging-with-gki#intrusive-downstream-debug-features).\n\nHow can I resolve mismatched ABIs between the GKI kernel with a specific module configuration enabled?\n------------------------------------------------------------------------------------------------------\n\nMismatched ABIs between the GKI kernel and module configuration represents an\nimplicit module config dependency, where enabling a module causes a binary\nconfig to be built into the resulting kernel image. Reach out to the Android\nkernel team\n([kernel-team@android.com](mailto:kernel-team@android.com)) to determine a path\nforward. After the list of symbols is determined, create a bug in the\n[Issue Tracker](https://issuetracker.google.com/components/1124381) and upload\na change to the symbol list."]]