跳到主要內容

發表文章

目前顯示的是有「系統啟動」標籤的文章

Android 開機啟動鏈拆解:從 init、Zygote 到 SystemServer 的行程孵化與服務註冊時序 / Android Boot Chain Deconstructed: Process Forking, Preloading, and Service Startup from init and Zygote to SystemServer

daily-tech:2026-12-04 現象: 上一篇我們拆解了系統跑起來之後,如何用 ftrace 與 perf 揪出核心延遲尖峰與鎖競爭熱點;今天我們把時間軸往回拉,對準按下電源鍵到桌面出現的那幾十秒。你可能遇過這樣的畫面:Android 手機做完系統更新重新開機,或是開發板剛燒錄好新映像檔,螢幕一直停在開機動畫打轉,既沒有直接當機重啟,也看不到哪個環節卡住了。究竟是 Linux 核心還沒交棒、磁碟分區掛載慢了、Zygote 預載類別太重,還是 SystemServer 裡某個系統服務在主執行緒卡死? Symptom: In our previous post, we used ftrace and perf to hunt down kernel latency spikes and lock contention on a running system. Today we rewind the clock to the tens of seconds between pressing the power button and seeing the home screen. You have likely seen an Android phone after an OS update—or a freshly flashed dev board—spin endlessly on the boot animation without crashing or revealing where time is going. Is the Linux kernel still handing off control, is partition mounting stalled, is Zygote preloading too much, or is a service inside SystemServer blocking the main thread? 想看懂開機時間花去哪裡,不能只把開機動畫當成一個黑盒子。整個 Android 使用者空間(Userspace)的誕生其實是一條高度有序的接力鏈:從 Linux 核心交出第一個使用者行程 init (PID 1) ,再由 init 喚起行程母體 Zygote 預先暖機 AR...