每看到嵌入式系統開啟Linux,都會很驚嘆它們是怎麼開機的!從板子通電電到到進入作業系統,是用了什麼神奇魔法?本次將分享幾個 Linux distribution 在 Raspberry Pi 的可能開機過程,以及自己實做一個搭配 OSTree 技術的 Linux distribution 的開機流程。以 Endless OS 在 Raspberry Pi 上開機為例。
It is always amazing, how does an embedded system boot Linux up! What a magic! This time I will share the possible booting sequence of several Linux distributions. And, how do we implement the booting procedures for the Linux distribution working with OSTree, for example Endless OS.
各家處理器架構/晶片都有其專屬的開機流程,通常會搭配特定的儲存空間分割結構,以及開機磁區裡的專屬韌體、bootloader。我們可從 Raspbian 在 Raspberry Pi 上的開機過程看到上述特徵。但是這些高度硬體相關需求導致的高歧異度,大大增加開發人員維護各種嵌入式系統的複雜度。如果有方法可以縮減各嵌入式系統開機過程中的歧異範圍,將可有效幫助開發人員減少系統的複雜度。
透過觀察幾個 Linux distribution 的開機過程,發現 U-Boot 可以做到將開機過程分為「高度硬體相關」與「一般系統皆可通用」的兩大步驟。特別是「一般系統皆可通用」的開機步驟,滿足搭配 OSTree 技術的系統(包含,但不限於)有方便、一致的開機模式需求。更進一步,有機會解決各硬體專屬 Device Tree 的佈署問題。
這次將分享如何實做讓系統在 Raspberry Pi 上開機的過程!
Each processor/chip architecture has its own procedure to boot the kernel. It works with desgined partition layout and vendor specific firmwares/bootloaders in the boot partition. We can learn the related knowledge from the Raspbian image for Raspberry Pi, which is the board we can obtain easily. However, the diversity between the special booting procedures with specific firmwares/bootloaders increases the complexity for distribution maintainers. It will be great if there is a way to make it more generic that can be applied to most of the chip architectures/boards to boot up the system.
After referring to some Linux distributions, we learned U-Boot may play a role in the solution. It splits the booting procedure into hardware specific and generic system parts. This helps distribution maintainers deploy the generic system with OSTree, including device trees.
Let’s deep dive into this magic booting procedure!
About StarNight
目前努力當好維護連結硬體與 Linux 系統之間橋樑的工程師。