קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מכשירים שיושקו עם Android 12 באמצעות גרסאות ליבה גבוהות מ-v5.4 חייבים להימכר עם ליבה של GKI. כדי שהשותפים יוכלו לגשת ל-DebugFS ב-builds של userdebug במהלך הפיתוח בליבה של GKI, הגדרת הליבה CONFIG_DEBUG_FS מופעלת ב-defconfig של GKI.
לעולם אל תרכיבו את DebugFS ב-builds של משתמשים במכשירים שיושקו עם Android 12.
לגרסאות build של Userdebug יש כיסוי בדיקות טוב יותר מאשר לגרסאות build של User, והן עוברות בדיקות מקיפות במהלך מחזור הפיתוח. התוכנית הבאה מצמצמת את ההבדל בין שני סוגי ה-build לגבי הגישה ל-DebugFS, ומספקת את היתרונות הבאים:
מונעת מ-builds של userdebug להסתמך בטעות על DebugFS
לצורך פונקציונליות חדשה
מוודאים שכל פונקציונליות קיימת שנפגעת בגלל חוסר DebugFS תהיה ידועה בשלב מוקדם של מחזור הפיתוח
הגישה ל-Debugfs ב-builds של userdebug מסווגת באופן הבא:
DebugFS הפעלות של קבצים במהלך האתחול של המכשיר, כמו גישה לכתיבה לקובץ ב-DebugFS כדי להפעיל את איסוף הנתונים לניפוי באגים.
יצירת דוח על באג: ה-HAL של dumpstate קורא קבצים מסוג DebugFS כש-dumpstate מפעיל את DumpstateBoard(). המידע הזה יהפוך לחלק מדוח הבאג.
בדיקה ואימות ספציפיים למכשיר.
בטבלה הבאה מוסבר איך כל אחת משלוש הקטגוריות האלה נתמכת ב-Android 12. חשוב לזכור שההוראות הבאות רלוונטיות רק לגרסאות build של userdebug, כי אי אפשר לטעון את DebugFS בגרסאות build של user.
תרחיש לדוגמה
Android 12 userdebug build
אתחול חד-פעמי של קבצים מסוג DebugFS, במהלך ההפעלה.
הגישה הזו מתרחשת רק פעם אחת במהלך האתחול.
ה-HAL של Dumpstate מבצע זאת במהלך האתחול של ה-HAL. כדי להפעיל את התכונה הזו, המערכת מטעינה את DebugFS ב-init ב-builds של userdebug לפני שה-HAL מופעל.
Init קורא ל-umount() ב-DebugFS כשהמכשיר מסיים את תהליך האתחול.
יצירת דוח על באג: ה-HAL של dumpstate קורא את הקבצים DebugFS, שהופכים לחלק מדוח הבאג.
הפעולה מתבצעת על ידי HAL של dumpstate ב-DumpstateBoard() כשהיא מופעלת על ידי dumpstate
(DumpstateDevice.cpp).
הכלי dumpstate (חלק מה-framework של Android) מוודא ש-DebugFS מצורף במהלך ההפעלה.
בדיקה ואימות ספציפיים למכשיר
Adb root ו-shell. מחברים את DebugFS מ-adb shell עם גישה לרמה הבסיסית (root)1.
1כדי לטעון את DebugFS מ-adb shell עם גישת root, משתמשים בפקודה הבאה:
adb shell mount -t debugfs debugfs /sys/kernel/debug.
הפעולות הנדרשות מהשותפים
השותפים חייבים לבצע את הפעולות הבאות בהתאם לשינויים האלה במכשירי Android 12:
לא לאפשר גישה ל-DebugFS במהלך זמן הריצה. יש יוצאים מן הכלל:
יצירת דוח על באג (מגיע מ-HAL של dumpstate)
בדיקה ואימות (אפשר לגשת אליהם באמצעות adb root ו-shell – חשוב לוודא ש-DebugFS מוצמד קודם)
מפתחים יכולים להגדיר את המאפיין הקבוע של ניפוי הבאגים persist.dbg.keep_debugfs_mounted כדי שהאחסון DebugFs יישאר מותקן אחרי הפעלות מחדש ב-userdebug וב-eng build.
בדיקות התאימות ל-GTS מבטיחות שמערכת הקבצים DebugFS לא תוצמד בגרסאות build של משתמשים. הצהרות neverallow של Sepolicy מבטיחות שבמכשירים שמריצים Android מגרסה 12 ואילך, תהליכים לא מורשים לא יקבלו גישה ל-DebugFs.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Use DebugFS in Android 12\n\nDevices that launch with Android 12 using kernel\nversions higher than v5.4 are required to ship with the GKI kernel. So that\npartners can access `DebugFS` in userdebug builds while they develop on the GKI\nkernel, the kernel config `CONFIG_DEBUG_FS` is enabled in the GKI defconfig.\n**Never mount `DebugFS` in user builds** for devices\nlaunching on Android 12.\n\n\nUserdebug builds have better test coverage than user builds and get heavily\ntested throughout the development cycle. The following plan minimizes the\ndifference between the two build types with respect to `DebugFS` access, and\nprovides these benefits:\n\n- Prevents userdebug builds from accidentally depending on `DebugFS` for new functionality\n- Ensures that any existing functionality that's broken by the lack of DebugFS is known early in the development cycle\n\n\nDebugfs accesses **in userdebug builds** are categorized as\nfollows:\n\n1. `DebugFS` file initializations during device boot, such as a write access to a file in `DebugFS` to turn on debug data collection.\n2. Bugreport generation: The dumpstate HAL reads `DebugFS` files when `DumpstateBoard()` is invoked by `dumpstate`. This information becomes part of the bug report.\n3. Device-specific testing and validation.\n\nThe following table describes how each of these three categories is\nsupported in Android 12. Note that the\nfollowing only applies to userdebug builds since `DebugFS` can't be\nmounted in user builds.\n\n| Use case | Android 12 userdebug build |\n|-------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **One-time `DebugFS` files initialization, during startup** . This access **happens only once** during boot time. | Dumpstate HAL performs this during HAL initialization. To enable the same, init mounts `DebugFS` in userdebug builds before the HAL initializes. `Init` calls `umount()` on `DebugFS` when the device has completed booting. |\n| **Bugreport generation** : The dumpstate HAL reads `DebugFS` files, which become part of the bug report. | Done by dumpstate HAL within `DumpstateBoard()` when invoked by dumpstate ([DumpstateDevice.cpp](https://cs.android.com/android/platform/superproject/+/android-latest-release:device/google/trout/hal/dumpstate/1.1/DumpstateDevice.cpp)). The dumpstate tool (part of the Android framework) ensures that `DebugFS` mounts during the invocation. |\n| **Device-specific testing and validation** | Adb root and shell. Mount `DebugFS` from the adb shell with root access^1^. |\n\n\n^1^To mount `DebugFS` from `adb shell` with\nroot access, use this command:\n\n`adb shell mount -t debugfs debugfs /sys/kernel/debug`.\n| **Note:**\n|\n| - **Android 12: There aren't any new APIs for accessing the\n| dumpstate HAL**.\n| - **Android 12: New clients don't have access** to the dumpstate HAL.\n| - Only the dumpstate HAL process and vendor-modprobe tool can access `DebugFS` for Android 12 launching devices, since the kernel modules it loads might create `DebugFS` files.\n\nRequired partner actions\n------------------------\n\n\nPartners must enact the following based on these changes in\nAndroid 12 devices:\n\n- Make all boot time initializations of `DebugFS` nodes happen during the dumpstate HAL initialization. For an example of how to do this, see [DNM:\n Example for boot time initialization of `DebugFS` files](https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1426054).\n- **Don't allow `DebugFS` access during runtime. The following exceptions\n apply:**\n - Bugreport generation (comes from the dumpstate HAL)\n - Testing and validation (accessible by `adb root` and `shell` - ensure that DebugFS is mounted first)\n\nDevelopers can set the debug persistent property\n`persist.dbg.keep_debugfs_mounted` to keep `DebugFs` mounted across\nreboots on userdebug and eng builds.\n\nGTS compliance tests ensure that the `DebugFS` filesystem isn't\nmounted in user builds. Sepolicy `neverallow` statements ensure that in devices\nlaunching on Android 12 or higher, unauthorized processes aren't provided\naccess to `DebugFs`."]]