החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
סקירה כללית על תוכנת אתחול
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
תוכנת אתחול היא קובץ אימג' בבעלות הספק, שמפעיל את הליבה במכשיר. מנהל האתחול שומר על מצב המכשיר והוא אחראי להפעלה הראשונית של סביבת המחשוב המאובטחת (TEE) ולקישור של Root of Trust שלו. מנהל האתחול גם מאמת את תקינות המחיצות boot
ו-recovery
לפני שהוא מעביר את הביצוע לליבת המעבד.
דוגמה לתהליך של תוכנת אתחול
דוגמה לתהליך של מנהל האתחול:
טעינת זיכרון והפעלה שלו.
מאמתים את המכשיר לפי תהליך האימות של הפעלה מאומתת.
מאמתים את מחיצות האתחול, כולל boot
, dtbo
, init_boot
ו-recovery
, בהתאם לתהליך של הפעלה מאומתת. כחלק מהשלב הזה, בודקים את הגרסה של כותרת קובץ האימג' לאתחול ומנתחים את הכותרת בהתאם.
אם נעשה שימוש בעדכוני A/B, צריך לקבוע את החריץ הנוכחי להפעלה.
קובעים אם צריך להפעיל את המכשיר במצב שחזור. למידע נוסף, ראו תמיכה בעדכוני OTA.
טעינה של קובצי אימג' לאתחול, כמו boot.img
, vendor_boot.img
, init_boot.img
וקובצי אימג' קנייניים אחרים של ספקים. קובצי האימג' להפעלה מכילים את קובצי האימג' של הליבה ושל ה-ramdisk.
טוענים את הליבה לזיכרון כקובץ בינארי דחוס שניתן להרצה עצמית. הליבה מפרקת את עצמה ומתחילה לפעול בזיכרון.
טוענים את הדיסקים הווירטואליים מסוג RAMdisk ואת הקטע bootconfig לזיכרון כדי ליצור את initramfs
.
תכונות נוספות שקשורות למחולל האתחול
בהמשך מופיעה רשימה של תכונות נוספות שקשורות למחולל האתחול שאפשר להטמיע:
שכבת-על של פירוט מבנה המכשיר (DTO).
שכבת-על של עץ המכשיר מאפשרת למחולל האתחול לתמוך בתצורות חומרה שונות. קובץ ה-DTO עובר הידור ל-device tree blob (DTB) שמשמש את מנהל האתחול.
רנדומיזציה של כתובות וירטואליות של קובץ אימג' של ליבה מנהל האתחול תומך ביצירת כתובת וירטואלית אקראית שבה נטען קובץ האימג' של הליבה. כדי לגרום לכתובת להיות אקראית, מגדירים את RANDOMIZE_BASE
כ-true
בתצורת הליבה.
כדי לספק את האנטרופיה, מנהל האתחול צריך להעביר ערך u64 אקראי בצומת /chosen/kaslr-seed
של עץ המכשיר.
הפעלה מאומתת Verified Boot מאפשר למחולל האתחול לוודא שכל הקוד שמופעל מגיע ממקור מהימן.
הגדרות אתחול
Boot config זמין ב-Android מגרסה 12 ואילך, והוא מנגנון להעברת פרטי התצורה מה-build ומ-bootloader למערכת ההפעלה.
לפני Android 12, נעשה שימוש בפרמטרים של שורת הפקודה של הליבה עם הקידומת androidboot
.
עדכונים אוויריים (OTA). מכשירי Android בשטח יכולים לקבל ולהתקין עדכוני OTA למערכת, לתוכנות האפליקציות ולכללים של אזורי הזמן. לתכונה הזו יש השלכות על הטמעת מנהל האתחול. למידע כללי על OTA, ראו עדכוני OTA. פרטים על הטמעת OTA ספציפית לאתחול מפורטים במאמר תמיכה בעדכוני OTA.
קישור לגרסה.
קישור גרסאות מקשר בין מפתחות האבטחה לבין מערכת ההפעלה ורמת התיקון. קישור הגרסאות מבטיח שמתקפה שמגלה נקודת חולשה בגרסה ישנה של המערכת או של תוכנת ה-TEE לא תוכל להחזיר מכשיר לגרסה הפגיעה ולהשתמש במפתחות שנוצרו בגרסה החדשה יותר. כדי לתמוך בקישור לגרסה, מנהל האתחול צריך לספק מידע מסוים. מידע נוסף זמין במאמר פרטי גרסה במאפייני AVB.
שורת הפקודה של הליבה
שרשור שורת הפקודה של הליבה מהמיקומים הבאים:
שורת הפקודה של תוכנת האתחול: קבוצה של פרמטרים סטטיים ודינמיים שמוגדרים על ידי תוכנת האתחול
פירוט מבנה המכשיר: מהצומת chosen/bootargs
defconfig
: מ-CONFIG_CMDLINE
boot.img
: משורת הפקודה (למידע על ערכי הזחה וגודלים, אפשר לעיין במאמר system/core/mkbootimg/bootimg.h
החל מ-Android 12, לפרמטרים של androidboot.*
שצריך להעביר למרחב המשתמש של Android, אפשר להשתמש ב-bootconfig במקום בשורת הפקודה של הליבה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Bootloader overview\n\nA *bootloader* is a vendor-proprietary image responsible for bringing up the\nkernel on a device. The bootloader guards the device state and is responsible\nfor initializing the [Trusted Execution Environment (TEE)](/docs/security/features/trusty)\nand binding its root of trust. The bootloader also verifies the integrity of the\n`boot` and `recovery` partitions before moving execution to the kernel.\n\nExample bootloader flow\n-----------------------\n\nHere's an example bootloader flow:\n\n1. Load and initialize memory.\n\n2. Verify the device according to [Verified Boot flow](/docs/security/features/verifiedboot).\n\n3. Verify the boot partitions, including `boot`, `dtbo`, `init_boot`, and\n `recovery`, according to the Verified Boot flow. As part of this step, check the\n [boot image header](/docs/core/architecture/bootloader/boot-image-header)\n version and parse the header accordingly.\n\n4. If [A/B updates](/docs/core/ota/ab) are used, determine the current slot to\n boot.\n\n5. Determine if recovery mode should be booted. For more\n information, see\n [Supporting OTA Updates](/docs/core/architecture/bootloader/updating).\n\n6. Load the boot images, such as `boot.img`, `vendor_boot.img`,\n `init_boot.img`, and other proprietary vendor boot images. These boot images\n contain the kernel and ramdisk images.\n\n 1. Load the kernel into memory as a self-executable compressed\n binary. The kernel decompresses itself and starts executing into memory.\n\n 2. Load ramdisks and the bootconfig section into memory\n to create `initramfs`.\n\nAdditional bootloader-related features\n--------------------------------------\n\nFollowing is a list of additional bootloader-related features that you can\nimplement:\n\n- *Device tree overlay (DTO).*\n A [device tree overlay](/docs/core/architecture/dto) lets the bootloader to\n support different hardware configurations. A DTO is compiled into a *device\n tree blob (DTB)* which is used by the bootloader.\n\n- *Kernel image virtual address randomization.* The bootloader supports\n randomizing the virtual address at which the kernel image is loaded. To\n randomize the address, set `RANDOMIZE_BASE` to `true` in the kernel config.\n The bootloader must provide entropy by passing a random u64 value in the\n `/chosen/kaslr-seed` device tree node.\n\n- *Verified Boot.* [Verified Boot](/docs/security/features/verifiedboot) lets\n the bootloader to ensure all executed code comes from a trusted source.\n\n- *Boot config.*\n [Boot config](/docs/core/architecture/bootloader/implementing-bootconfig)\n is available in Android 12 and higher and is a mechanism for passing\n configuration details from the build and bootloader to the operating system.\n Prior to Android 12, kernel command-line parameters with the prefix of\n `androidboot` are used.\n\n- *Over-the-air (OTA) updates.* Android devices in the field can receive and\n install OTA updates to the system, app software, and\n time zone rules. This feature has implications on your bootloader\n implementation. For general information on OTA, see\n [OTA updates](/docs/core/ota). For bootloader-specific OTA implementation\n details, see\n [Supporting OTA updates](/docs/core/architecture/bootloader/updating).\n\n- *Version binding* .\n [Version binding](/docs/security/features/keystore/version-binding) binds\n security keys to the operating system and patch level version. Version binding\n ensures that an attacker who discovers a weakness in an old version of the\n system or the TEE software can't roll a device back to the vulnerable version\n and use keys created with the newer version. The bootloader must provide certain\n information to support version binding. For further information, see\n [Version information in AVB properties](/docs/core/architecture/bootloader/version-info-avb).\n\nKernel command line\n-------------------\n\nConcatenate the kernel command line from the following locations:\n\n- Bootloader command line: set of static and dynamic parameters determined by\n the bootloader\n\n- Device tree: from the `chosen/bootargs` node\n\n- `defconfig`: from `CONFIG_CMDLINE`\n\n- `boot.img`: from the command line (for offsets and sized, refer to\n [`system/core/mkbootimg/bootimg.h`](https://android.googlesource.com/platform/system/tools/mkbootimg/+/refs/heads/android16-release/include/bootimg/bootimg.h)\n\nAs of Android 12, for `androidboot.*` parameters that\nwe need to pass to Android userspace, we can use\n[bootconfig](/docs/core/architecture/bootloader/implementing-bootconfig) instead\nof the kernel command line."]]