החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
שמירה על ממשק יציב של מודול הליבה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
חשוב מאוד לשמור על ממשק יציב של מודול הליבה (KMI) למודול של הספק. הליבה של GKI נוצרת ונשלחת בפורמט בינארי, והמודולים שספקים יכולים לטעון נוצרים בעץ נפרד. הליבה והמודולים של הספקים של GKI שנוצרים צריכים לפעול כאילו הם נוצרו יחד.
באופן כללי, קהילת Linux לא מחבבת את הרעיון של יציבות ABI בליבה בליבה הראשית. לאור מגוון כלי הפיתוח, ההגדרות והלינץ' הראשי של Linux שמתפתח כל הזמן, לא ניתן לשמור על KMI יציב בלינץ' הראשי. עם זאת, אפשר לשמור על KMI יציב בסביבת GKI עם האילוצים הבאים:
אפשר להשתמש רק בהגדרה אחת, gki_defconfig
, כדי ליצור את הליבה.
ה-KMI יציב רק באותה גרסת LTS ו-Android של ליבה, כמו android14-6.1
, android15-6.6
או android16-6.12
.
- אין יציבות של KMI ב-
android-mainline
.
רק כלי הפיתוח הספציפיים של Clang שסופקו ב-AOSP והוגדרו להסתעפות המתאימה משמשים ליצירת הליבה והמודולים.
רק סמלים שידועים כסמלים שמשמשים מודולים, כפי שצוין ברשימת הסמלים, נמצאים במעקב אחר יציבות ונחשבים לסמלי KMI.
- המשמעות היא שמודולים של ספקים חייבים להשתמש רק בסמלי KMI. האילוץ הזה נאכף על ידי כשל טעינה של מודולים אם נדרשים סמלים שאינם של KMI.
אחרי שההסתעפות של KMI קופאת, אפשר לבצע שינויים, אבל הם לא יכולים לשבור את KMI.
השינויים האלה כוללים:
- שינויים בתצורה
- שינויים בקוד הליבה
- שינויים בכלי הפיתוח (כולל עדכונים)
שימוש בתהליך build אטום וב-toolchain של LLVM
תהליך ה-build האטום מבטיח יציבות של KMI באמצעות מניפסטים של repo
ב-kernel/manifest
שמתארים באופן מלא את סביבת ה-build. לדוגמה, המניפסט של android16-6.12
כולל את כלי הפיתוח, מערכת ה-build וכל מה שדרוש כדי ליצור את הליבה של Generic Kernel Image (GKI). הגדרת ה-build, בעיקר BUILD.bazel
, מבטיחה שהכלים הכלולים ישמשו בצורה נכונה כדי ליצור תוצאות build עקביות.
שימוש בתהליך build אטום מבטיח גם שתיאורי ה-ABI של העץ יהיו עקביים, בין אם הם נוצרו על ידי Google (לדוגמה, gki/aarch64/abi.stg
עבור android16-6.12
) ובין אם הם נוצרו בעץ מקומי שכולל את המודולים של הספק. הכלים ליצירה ולהשוואה של תיאור ה-ABI לממשק מודול הליבה (KMI) זמינים גם כחלק מהמאגר שמתואר במניפסט.
כלי הפיתוח ששימשו ליצירת הליבה של GKI חייבים להיות תואמים לחלוטין לכלי הפיתוח ששימשו ליצירת המודולים של הספק. החל מגרסה Android 10, כל הליבות של Android צריכות להיות מפותחות באמצעות ערכת כלים של LLVM. ב-GKI, כלי הפיתוח של LLVM המשמש ליצירת ליבות של מוצרים ומודולים של ספקים חייב ליצור את אותו ABI כמו כלי הפיתוח של LLVM מ-AOSP, והשותפים צריכים לוודא שה-KMI תואם לליבה של GKI.
מומלץ מאוד להשתמש בכלי ה-build שסופקו, כי הם מספקים את התאימות הטובה ביותר.
מה השלב הבא?
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],null,["# Maintain a stable kernel module interface\n\nIt's critical to maintain a stable kernel module interface (KMI) for vendor\nmodules. The GKI kernel is\nbuilt and shipped in binary form and vendor-loadable modules are built in a\nseparate tree. The resulting GKI kernel and vendor modules must work as\nthough they were built together.\n\nGenerally, the Linux community has\n[frowned on the notion of in-kernel ABI\nstability](https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst)\nfor the mainline kernel. In the face of different toolchains, configurations,\nand an ever-evolving Linux mainline kernel, it isn't feasible to maintain a\nstable KMI in mainline. However, it's possible to maintain a stable KMI in\nthe highly-constrained GKI environment with these constraints:\n\n- Only a single configuration, `gki_defconfig`, can be used to build the\n kernel.\n\n- The KMI is only stable within the same LTS and Android version of a kernel,\n such as `android14-6.1`, `android15-6.6` or `android16-6.12`.\n\n - No KMI stability is maintained for `android-mainline`.\n- Only the specific *Clang* toolchain supplied in AOSP and defined for the\n corresponding branch is used for building kernel and modules.\n\n- Only symbols known to be used by modules as specified in a symbol list are\n monitored for stability and considered KMI symbols.\n\n - The corollary is that vendor modules must use only KMI symbols. This constraint is enforced by failing module loads if non-KMI-symbols are required.\n- After the KMI branch is frozen, changes are allowed but can't break the KMI.\n These changes include the following:\n\n - Config changes\n - Kernel code changes\n - Toolchain changes (including updates)\n\nUse the hermetic build process and LLVM toolchain\n-------------------------------------------------\n\nThe hermetic build process ensures a stable KMI by having `repo` manifests in\n`kernel/manifest` completely describe the build environment. For example, the\n[manifest for `android16-6.12`](https://android.googlesource.com/kernel/manifest/+/refs/heads/common-android16-6.12/default.xml)\nincludes the toolchain, build system, and everything else required to build the\nGeneric Kernel Image (GKI) kernel. The build configuration, primarily\n[`BUILD.bazel`](https://android.googlesource.com/kernel/common/+/refs/heads/android16-6.12/BUILD.bazel),\nensures that the included tools are used correctly to generate consistent build\nresults.\n\nUsing a hermetic build process also ensures that the ABI description for the\ntree is consistent whether generated by Google (for example,\n[`gki/aarch64/abi.stg`](https://android.googlesource.com/kernel/common/+/refs/heads/android16-6.12/gki/aarch64/abi.stg)\nfor `android16-6.12`) or generated in a local tree that includes the vendor\nmodules. The\n[tools to create and compare the ABI description](https://android.googlesource.com/kernel/build/+/refs/heads/main-kernel/abi/)\nfor the Kernel Module Interface (KMI) are also provided as part of the repo\ndescribed by the manifest.\n\nThe toolchain used to build the GKI kernel must be completely compatible with\nthe toolchain used to build vendor modules. As of Android\n10, all Android kernels must be built\nwith an LLVM toolchain. With GKI, the LLVM toolchain used to build product\nkernels and vendor modules must generate the same ABI as the LLVM toolchain from\nAOSP and partners must ensure that the KMI is compatible with the GKI kernel.\nUsing the provided build tools is strongly encouraged as they provide the\nbest compatibility.\n\nWhat's next?\n------------\n\n- For instructions on building the kernel using the hermetic build process and\n LLVM toolchain, refer to refer to\n [Build kernels](/docs/setup/build/building-kernels).\n\n- For instructions on how to monitor the ABI and fix issues, refer to\n [Android Kernel ABI Monitoring](/docs/core/architecture/kernel/abi-monitor)"]]