החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
ניהול זמן האתחול
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
תהליך האתחול הוא שרשרת של פעולות שמתחילה ב-ROM של האתחול, ולאחר מכן תוכנת האתחול, הליבה, Init, Zygote ו-system server (הכתב המודגש מציין תהליך אתחול ספציפי ל-Android). בתהליך האתחול הספציפי לכלי רכב, שירותים מוקדמים כמו מצלמת הרכב האחורית (RVC) חייבים להתחיל במהלך האתחול של הליבה.
הזמנה |
רכיב |
Android |
Android Automotive |
1 |
Boot ROM |
טעינת השלב הראשון של מנהל האתחול בזיכרון RAM פנימי. |
2 |
תוכנת אתחול |
הפעלת הזיכרון, אימות האבטחה וטעינה של הליבה. |
3 |
בועה |
הגדרת בקרי הפסקות, הגנה על זיכרון, מטמון ותזמון, הפעלת תהליכים במרחב המשותף של המשתמש. |
התהליך של מצלמת הרכב האחורית (RVC) מתחיל בשלב מוקדם של אתחול הליבה. אחרי שהתהליך מתחיל, GPIO מ-VMCU מפעיל את RVC כדי להציג אותו במסך. |
4 |
תהליך ה-init |
ניתוח סקריפטים של init.rc , טעינה של מערכות קבצים, הפעלת Zygote והפעלת תהליך המערכת. |
Vehicle HAL (VHAL) מתחיל במהלך שלב האינטליגנציה כחלק משירותי הליבה. אפשר להעביר אותו למצבים קודמים בהתאם ל-ServiceManager. לשם כך צריך להסיר את יחסי התלות בספריות משותפות (כמו init). |
5 |
זיגוטה |
הגדרת Java Runtime וזיכרון init לאובייקטים של Android. |
6 |
שרת המערכת |
הרכיב הראשון של Java במערכת, שמפעיל את שירותי הליבה של Android. |
CarService מתחיל לפעול אחרי הפעלת כל שירותי המערכת. |
אופטימיזציה של זמן האתחול
כדי לשפר את זמן האתחול של המערכת, מומלץ לפעול לפי ההנחיות הבאות:
-
Kernel טעינה של המודולים שבשימוש בלבד והפעלה של רכיבי החומרה שבשימוש בלבד.
-
init.rc
- חשוב לבדוק אם יש פעולות חסימה (השוואה בין שירות לבין הפעלת פקודה).
- מפעילים רק את מה שרוצים להשתמש בו.
- הגדרת העדיפות הנכונה לשירותים.
-
זיגוטה אופטימיזציה של טעינה מראש של כיתות (צריך לציין את רשימת הכיתות שרוצים לטעון).
-
מנהל החבילות
-
שרת המערכת מפעילים רק את שירותי המערכת שבהם משתמשים.
כדי לעזור לכם לבצע אופטימיזציה, Google מספקת את הכלים הבאים:
-
משתמשים ב-packages/services/Car/tools/bootanalyze/bootanalyze.py
כדי לנתח את היומנים של logcat ו-dmesg.
-
משתמשים ב-packages/services/Car/tools/bootio/
כדי לתעד את הקלט/פלט של תהליכים במהלך האתחול. צריך לקמפל את הליבה עם דגלים ספציפיים (עיינו בקובץ README.md
).
הפעלת שירותים מראש
בסדרת האתחול, יכול להיות שחלק מהשירותים יתחילו לפעול לפני שמערכת Android תתחיל את תהליך האתחול.
מצלמה אחורית
יש לטפל במצלמת הרוורס (RVC) בליבה. ה-VMCU מודיע לתהליך הליבה המקורי כשהרכב עובר להילוך לאחור, ולאחר מכן תהליך הליבה המקורי מציג את התמונה של ה-RVC במסך. ה-HAL של הרכב יכול לשלוט ב-RVC באמצעות hardware/libhardware/include/hardware/vehicle_camera.h
.
Vehicle HAL (VHAL)
יכול להיות שבחלק מהמערכות יהיה צורך לקרוא ולאגור ב-buffer נתוני CAN (לדוגמה, מהירות הרכב, מצב ההילוכים) בשלבים המוקדמים של רצף האתחול, בזמן ההמתנה לשירות במרחב המשתמש שיתחיל לפעול (הדבר מתרחש בשלב מאוחר יותר ברצף האתחול). בתרחיש הזה, ה-VNS ואת בקרי ה-HAL ו-CAN צריכים להתחיל לפעול מוקדם מאוד, בדרך כלל תוך כמה שניות.
-
במערכות שאפשר לטעון בהן את /system
במהירות, אפשר פשוט להפעיל את מנהל השירות ואז את VNS מוקדם.
-
במערכת שלא ניתן לטעון במהירות את /system
, צריך להעביר את מנהל השירות ואת VNS לקובץ האימג' של אתחול הליבה ולקשר סטטית את כל הספריות התלויות.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# Manage boot time\n\nThe boot process is a chain of actions starting from the boot ROM, followed by the bootloader,\nkernel, **Init** , **Zygote** , and **system server** (bold\nindicates Android-specific boot process). In the automotive-specific boot process, early services\nsuch as rearview camera (RVC) must start during the kernel boot.\n\n| Order | Component | Android | Android Automotive |\n|-------|---------------|----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | Boot ROM | Loads the first stage of the boot loader into internal RAM. ||\n| 2 | Bootloader | Inits memories, verifies for security, and loads kernel. ||\n| 3 | Kernel | Sets up interrupt controllers, memory protection, caches, and scheduling; launches user space processes. | **Rearview camera (RVC)** process starts early in kernel boot. After the process is up, GPIO from VMCU triggers RVC to show on display. |\n| 4 | Init process | Parses `init.rc` scripts, mounts file systems, launches Zygote, launches system process. | **Vehicle HAL (VHAL)** starts during init phase as part of core services. Can be moved to earlier states depending on ServiceManager; requires removing dependencies on shared libraries (such as init). |\n| 5 | Zygote | Sets up Java Runtime and init memory for Android objects. ||\n| 6 | System server | First Java component in the system, starts core Android services. | **CarService** starts after all system services are started. |\n\nOptimize boot time\n------------------\n\nTo improve boot time in your system, use the following guidelines:\n\n- **Kernel.** Load only the modules in use and initialize only the hardware\n components in use.\n\n- `init.rc`\n\n - Watch for blocking operations (service compared to command invocation).\n - Start only what is used.\n - Setting correct priority for services.\n- **Zygote.** Class preloading optimization (specify the list of classes to\n load).\n\n- **Package Manager**\n\n - Optimize product image to include only APKs in use.\n\n - [Enable DEX\n preoptimization](/docs/core/runtime/configure#compilation_options).\n\n- **System server.** Start only the system services that are used.\n\nFor help with optimization, Google provides the following tools:\n\n- Use `packages/services/Car/tools/bootanalyze/bootanalyze.py` to analyze logcat and\n dmesg logs.\n\n- Use `packages/services/Car/tools/bootio/` to record I/O for processes during the\n boot. You must compile the kernel with specific flags (refer to the `README.md`\n file).\n\nStart services early\n--------------------\n\nIn the boot sequence, some services might start before Android starts to boot.\n\n### Rearview camera\n\nThe rearview camera (RVC) should be handled in the kernel. The VMCU notifies the native kernel\nprocess when the vehicle shifts into Reverse, after which the native kernel process displays the\nRVC image onto the display. The vehicle HAL can control the RVC using\n`hardware/libhardware/include/hardware/vehicle_camera.h`.\n\n### Vehicle HAL (VHAL)\n\nSome systems might need to read and buffer CAN data (for example, vehicle speed, gear status)\nduring the early stages of the boot sequence while waiting for the user-space service to start\n(which occurs later in the boot sequence). This scenario requires VNS and the HAL and CAN\ncontrollers to start very early, typically within a few seconds.\n\n- Systems that can quickly mount `/system` can simply launch service manager then\n VNS early.\n\n- System that can't quickly mount `/system` must move both service manager and VNS\n to the kernel boot image and link all dependent libraries statically."]]