اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
الحفاظ على واجهة وحدة نواة مستقرة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
من المهم الحفاظ على واجهة وحدة نواة ثابتة (KMI) لوحدات
المورّدين. يتم
إنشاء نواة GKI وشحنها بتنسيق ثنائي ويتم إنشاء الوحدات القابلة للتحميل من قِبل المورّد في شجيرة
منفصلة. يجب أن تعمل نواة GKI ووحدات المورّدين الناتجة كما ينطبق
على أنّه تم إنشاؤها معًا.
بشكل عام، كان منتدى Linux يرفض
فكرة ثبات ABI داخل kernel
لنظام التشغيل الرئيسي. في ظلّ سلاسل الأدوات والإعدادات المختلفة،
ونظام التشغيل Linux الأساسي المتغيّر باستمرار، ليس من الممكن الحفاظ على
مجموعة KMI ثابتة في الإصدار الأساسي. ومع ذلك، من الممكن الحفاظ على مؤشر KMI ثابت في
بيئة GKI ذات القيود العالية باستخدام القيود التالية:
يمكن استخدام إعداد واحد فقط، وهو gki_defconfig
، لإنشاء
النواة.
لا يكون معهد KMI ثابتًا إلا ضمن إصدارات LTS وAndroid نفسها من kernel،
مثل android14-6.1
أو android15-6.6
أو android16-6.12
.
- لم يتم الحفاظ على ثبات مؤشر KMI لـ
android-mainline
.
لا يتم استخدام سوى مجموعة أدوات Clang المحدّدة والمضمّنة في AOSP والمُحدّدة
للفرع المقابل من أجل إنشاء النواة والوحدات.
يتم فقط مراقبة الرموز المعروف أنّها تستخدمها الوحدات كما هو محدّد في قائمة الرموز من أجل رصد مدى ثباتها، ويتم اعتبارها رموز KMI.
- ويعني ذلك أنّه يجب أن تستخدم وحدات المورّدين رموز KMI فقط. يتم فرض هذاقيد
من خلال إيقاف تحميل الوحدات إذا كانت هناك رموز غير رموز KMI مطلوبة.
بعد تجميد فرع KMI، يُسمح بإجراء التغييرات، ولكن لا يمكن أن تؤدي إلى إيقاف KMI.
تشمل هذه التغييرات ما يلي:
- تغييرات الإعدادات
- تغييرات في رمز النواة
- تغييرات مجموعة الأدوات (بما في ذلك التحديثات)
استخدام عملية التصميم المحكم وسلسلة أدوات LLVM
تضمن عملية الإنشاء المحكم ثباتًا في نموذج KMI من خلال توفير repo
ملفات بيان في
kernel/manifest
تصف بيئة الإنشاء بالكامل. على سبيل المثال، يحتوي
بيان android16-6.12
على مجموعة الأدوات ونظام الإنشاء وكل ما هو مطلوب لإنشاء ملف تعريف
Generic Kernel Image (GKI). يضمن إعداد عملية الإنشاء، وBUILD.bazel
بشكل أساسي، استخدام الأدوات المضمّنة بشكل صحيح لإنشاء نتائج عملية إنشاء متّسقة.
يضمن استخدام عملية الإنشاء المحكم أيضًا أن يكون وصف ABI للملف
المدرَج متسقًا سواء أنشأته Google (على سبيل المثال،
gki/aarch64/abi.stg
لنظام التشغيل android16-6.12
) أو تم إنشاؤه في ملف مدرَج محلي يتضمّن وحدات العميل. يتم أيضًا توفير
أدوات إنشاء وصف ABI ومقارنته
لواجهة Kernel Module Interface (KMI) كجزء من المستودع
الذي يصفه البيان.
يجب أن تكون سلسلة الأدوات المستخدَمة لإنشاء نواة GKI متوافقة تمامًا مع
سلسلة الأدوات المستخدَمة لإنشاء وحدات المورّدين. اعتبارًا من الإصدار
10 من Android، يجب إنشاء جميع نواة Android
باستخدام سلسلة أدوات LLVM. باستخدام GKI، يجب أن تُنشئ سلسلة أدوات LLVM المستخدَمة لإنشاء ملف تعريف ABI نفسه المستخدَم في سلسلة أدوات LLVM من AOSP، ويجب أن يضمن الشركاء توافق KMI مع نواة GKI.
ننصح بشدة باستخدام أدوات الإنشاء المقدَّمة لأنّها توفّر
أفضل توافق.
ما هي الخطوات التالية؟
للحصول على تعليمات حول إنشاء النواة باستخدام عملية الإنشاء التام
ومجموعة أدوات LLVM، يُرجى الرجوع إلى مقالة
إنشاء النوى.
للحصول على تعليمات حول كيفية مراقبة ABI وحلّ المشاكل، يُرجى الرجوع إلى مقالة
مراقبة ABI لنظام تشغيل Android.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ 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,["# 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)"]]