קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדף הזה נסביר איך להגדיר תכונה חדשה של הליבה כמודול GKI, או איך להגדיר תכונה מובנית קיימת של הליבה כמודול GKI.
הגדרת תכונה חדשה כמודול GKI
כדי להשתמש בתכונה החדשה, עורכים את הקובץ gki_defconfig ומגדירים את פריט התצורה של תכונת הליבה הנדרשת מ-n ל-m (=m). מגדירים את ההגדרה הזו גם ב-arch/arm64/configs/gki_defconfig וגם ב-arch/x86/configs/gki_defconfig.
מוסיפים את קובצי ה-KO (.ko) שנוצרו עבור התכונה לקטע COMMON_GKI_MODULES_LIST ב-common/modules.bzl. מוסיפים את הקבצים בסדר ממוין. אם אתם לא בטוחים לגבי כל הקבצים שנוצרו, תהליך ה-build נכשל ותופיע רשימה של כל קובצי ה-KO הנדרשים להוספה לרשימה.
ב-Android 14, מוסיפים את אותה קבוצה של קובצי KO משלב 2, שממוינים בסדר עולה לחיפוש בינארי בזמן ריצה, אל common/android/gki_{ARCH}_protected_modules כדי לסמן את המודול כמודול GKI מוגן.
לגרסאות Android 14 ו-15, מעדכנים את רשימת הייצוא כך שתכלול את הייצוא החדש שנוסף בקובץ common/android/abi_gki_protected_exports_ARCHITECTURE. לדוגמה, כדי לעדכן את הרשימה, מריצים את tools/bazel run //common:kernel_aarch64_abi_update_protected_exports עבור aarch64.
מוודאים שקובצי ה-KO החדשים שנוספו בשלב 2 מועתקים ל-out/<androidX-Y.Z>/dist/system_dlkm.img ול-out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz של הליבה.
אפשר להשתמש במודולים בארכיון system_dlkm_staging_archive.tar.gz כקלט ליצירת system_dlkm.img ב-build של הפלטפורמה.
שולחים את השינויים לבדיקה. מודולי GKI הם תכונה של ליבה ל-Android בלבד, ולכן אין צורך לשלוח תיקוני המרה של מודולים למקור. עם זאת, כדי לשלוח תיקוני ליבה משותפים ל-Android (ACK), צריך לפעול לפי הנחיות אחרות.
הגדרת תכונה מובנית בליבה כמודול GKI
לתכונה מובנית קיימת בליבה, עורכים את הקובץ gki_defconfig ומגדירים את פריט התצורה של התכונה הנדרשת בליבה מ-y ל-m (=m). מגדירים את ההגדרה הזו גם בקובץ arch/arm64/configs/gki_defconfig וגם בקובץ arch/x86/configs/gki_defconfig.
מוסיפים את קובצי ה-KO (.ko) שנוצרו עבור התכונה לקטע COMMON_GKI_MODULES_LIST בקובץ common/modules.bzl. מוסיפים את הקבצים בסדר ממוין. אם אתם לא בטוחים לגבי כל הקבצים שנוצרו, תהליך ה-build נכשל ותופיע רשימה של כל קובצי ה-KO הנדרשים להוספה לרשימה.
ב-Android 14, מוסיפים את אותה קבוצה של קובצי KO משלב 2, שממוינים בסדר עולה לחיפוש בינארי בזמן ריצה, אל common/android/gki_{ARCH}_protected_modules כדי לסמן את המודול כמודול GKI מוגן.
ב-Android 14 וב-Android 15, מעדכנים את רשימת הייצוא המוגנים כך שתכלול את הייצוא מהמודול החדש שנוסף ב-common/android/abi_gki_protected_exports_{ARCH} באמצעות tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports עבור aarch64.
מוודאים שקובצי ה-KO של המודולים שהועברו בשלב 2 מועתקים ל-out/<androidX-Y.Z>/dist/system_dlkm.img ול-out/androidX-Y.Z/dist/system_dlkm_staging_archive.tar.gz של הליבה.
אפשר להשתמש במודולים בארכיון system_dlkm_staging_archive.tar.gz כקלט ליצירת system_dlkm.img ב-build של הפלטפורמה.
שולחים את השינויים לבדיקה. מודולי GKI הם תכונה של ליבה ל-Android בלבד, ולכן אין צורך לשלוח תיקוני המרה של מודולים למקור. עם זאת, עליכם לפעול לפי ההנחיות האחרות כדי לשלוח תיקוני ליבה משותפים ל-Android (ACK).
המרת מודול GKI מוגן למודול לא מוגן
במכשירים עם Android מגרסה 15 ואילך, מוסיפים את המודול שמומר ממוגן ללא מוגן לרשימת COMMON_UNPROTECTED_MODULES_LIST בקובץ common/modules.bzl.
ב-Android 14, מסירים את המודול שמומר ממודול מוגן למודול לא מוגן מרשימת המודולים המוגנים בקטע common/android/gki_protected_modules.
ב-Android 14 וב-15, מעדכנים את רשימת הייצוא המוגנים כך שלא תכלול את הייצוא מהמודול החדש שהומר ללא הגנה בקובץ common/android/abi_gki_protected_exports_{ARCH} באמצעות tools/bazel run
//common:kernel_aarch64_abi_update_protected_exports עבור aarch64.
שולחים את השינויים לבדיקה. מודולי GKI הם תכונה של ליבה ל-Android בלבד, ולכן אין צורך לשלוח תיקוני המרה של מודולים למקור. עם זאת, עליכם לפעול לפי ההנחיות האחרות כדי לשלוח תיקוני ליבה משותפים ל-Android (ACK).
מדריך מהיר לפתרון הפרות של סמלים במודולים של GKI
כשמודולים לא חתומים מפירים את ההגנה על הסמלים שמוגדרת למודול GKI, יכולים להתרחש שני סוגים של שגיאות במהלך טעינת המודול, וכתוצאה מכך הוא לא ייטען.
קובץ module.ko הוא מודול של ספק ללא חתימה, שמנסה לפתור את הסמל some_kernel_function שיוצאו מהמודול GKI במהלך הטעינה, בלי להופיע ברשימת הסמלים של הספק.
פתרון:
אם module.ko הוא לא מודול GKI מוגן, הפתרון לשגיאה הוא לעדכן את רשימת הסמלים כך ש-some_kernel_function יהיה כלול ברשימת הסמלים של הספק.
לחלופין, אפשר להשתמש בגרסה של module.ko ב-GKI.
2. מודול לא חתום שמייצא את הסמל המוגן
שגיאה:
module: exports protected symbol some_kernel_function
הסיבה:
המודול שמייצא את some_kernel_function הוא מודול GKI מוגן, ו-module.ko הוא כנראה גרסה מותאמת אישית לא חתומה של המודול הזה. כש-module.ko מנסה לייצא את some_kernel_function, שאפשר לייצא רק באמצעות מודול GKI חתום, הטעינה נכשלת עם ההודעה הזו.
פתרון:
אפשר לתקן את הבעיה באמצעות גרסה של GKI של המודול שמייצא את some_kernel_function, אם המודול ללא החתימה הוא גרסה מותאמת אישית.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Configure kernel features as GKI modules\n\nThis page covers how to configure a new kernel feature as a GKI module or\nconfigure an existing built-in kernel feature as a GKI module.\n| **Note:** Changes that result in a new GKI module or that change the protection status of a GKI module must be approved by Google.\n\nConfigure a new feature as a GKI module\n---------------------------------------\n\n1. For the new feature, edit `gki_defconfig` and set the required kernel\n feature's config item from `n` to `m` (`=m`). Set this setting in both\n `arch/arm64/configs/gki_defconfig` and `arch/x86/configs/gki_defconfig`.\n\n2. Add the KO (`.ko`) files generated for the feature\n to the `COMMON_GKI_MODULES_LIST` section of `common/modules.bzl`. Add the\n files in a sorted order. If you're unsure of all the files generated,\n the build fails and lists all the necessary KO files to be added to the list.\n\n3. For Android 14, add the same set of KO files from step 2, sorted in ascending\n order for binary search at runtime, to\n `common/android/gki_{ARCH}_protected_modules` to designate the module as a\n protected GKI module.\n\n4. For Android 14 and 15, update the list of exports so that it includes the\n newly-added exports in `common/android/abi_gki_protected_exports_`\u003cvar translate=\"no\"\u003eARCHITECTURE\u003c/var\u003e. For example, to update the list, run\n `tools/bazel run //common:kernel_aarch64_abi_update_protected_exports` for\n `aarch64`.\n\n5. Make sure newly added KO files from step 2 are copied to the kernel's\n `out/\u003candroidX-Y.Z\u003e/dist/system_dlkm.img` and\n `out/`\u003cvar translate=\"no\"\u003eandroidX-Y.Z\u003c/var\u003e`/dist/system_dlkm_staging_archive.tar.gz`.\n Modules in the `system_dlkm_staging_archive.tar.gz` archive can be used as\n input to generate the `system_dlkm.img` in the platform build.\n\n6. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow other guidelines to submit\n [Android Common Kernel (ACK) patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nConfigure a kernel built-in feature as a GKI module\n---------------------------------------------------\n\n1. For an existing built-in kernel feature, edit `gki_defconfig` and set the\n required kernel feature's config item from `y` to `m` (`=m`). Set this\n setting in both `arch/arm64/configs/gki_defconfig` and\n `arch/x86/configs/gki_defconfig`.\n\n2. Add the KO (`.ko`) files generated for the feature to the\n `COMMON_GKI_MODULES_LIST` section of `common/modules.bzl`. Add the files\n in a sorted order. If you're unsure of all the files generated,\n the build fails and lists all the necessary KO files to be added to the list.\n\n3. For Android 14, add the same set of KO files from step 2, sorted in ascending\n order for binary search at runtime, to\n `common/android/gki_{ARCH}_protected_modules` to designate the module as a\n protected GKI module.\n\n4. For Android 14 and 15, update the list of exports that are protected to\n include ones from the newly added module in\n `common/android/abi_gki_protected_exports_{ARCH}` using `tools/bazel run\n //common:kernel_aarch64_abi_update_protected_exports` for `aarch64`.\n\n5. Make sure newly converted module KO files from step 2 are copied to the\n kernel's `out/\u003candroidX-Y.Z\u003e/dist/system_dlkm.img` and\n `out/`\u003cvar translate=\"no\"\u003eandroidX-Y.Z\u003c/var\u003e`/dist/system_dlkm_staging_archive.tar.gz`.\n Modules in the `system_dlkm_staging_archive.tar.gz` archive can be used as\n input to generate the `system_dlkm.img` in the platform build.\n\n6. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow the other guidelines to submit\n [Android Common Kernel (ACK)\n patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nConvert a protected GKI module to unprotected\n---------------------------------------------\n\n1. For Android 15 and higher, add the module being converted from protected to\n unprotected to the `COMMON_UNPROTECTED_MODULES_LIST` list in\n `common/modules.bzl` file.\n\n2. For Android 14, remove the module being converted from protected to\n unprotected from the list of protected modules at\n `common/android/gki_protected_modules`.\n\n3. For Android 14 and 15, update the list of exports that are protected to\n exclude ones from the newly converted unprotected module in the\n `common/android/abi_gki_protected_exports_{ARCH}` using `tools/bazel run\n //common:kernel_aarch64_abi_update_protected_exports` for `aarch64`.\n\n4. Submit your changes for review. GKI modules are an Android-only kernel\n feature, so module conversion patches aren't required to be submitted\n upstream. However, you must follow the other guidelines to submit\n [Android Common Kernel (ACK)\n patches](/docs/core/architecture/kernel/kernel-code#ack-patches).\n\nGKI modules symbol violation resolution quick guide\n---------------------------------------------------\n\nWhen unsigned modules violate the symbol protection in place for GKI modules,\ntwo types of errors may be encountered during module loading, resulting in\nfailure.\n\n### 1. Unsigned module using the protected symbol\n\n**Error:**\n\n`module: Protected symbol: some_kernel_function (err -13)`\n\n**Cause:**\n\nThe `module.ko` file is an unsigned vendor module and attempts to resolve the\nGKI module exported symbol `some_kernel_function` during loading, without\nbeing listed in the vendor symbol list.\n\n**Resolution:**\n\nIf `module.ko` is not a protected GKI module, updating the symbol list will\nresolve the error by including `some_kernel_function` in the vendor symbol list.\nAlternatively, use the GKI version of `module.ko`.\n\n### 2. Unsigned module exporting the protected symbol\n\n**Error:**\n\n`module: exports protected symbol some_kernel_function`\n\n**Cause:**\n\nThe module exporting the `some_kernel_function` is a protected GKI module, and\n`module.ko` is likely an unsigned custom version of that module. When\n`module.ko` tries to export `some_kernel_function`, which can only be exported\nby a signed GKI module, loading fails with this message.\n\n**Resolution:**\n\nThis can be corrected by using the GKI version of the module that exports\n`some_kernel_function`, if the unsigned module is a custom version."]]