2016年9月23日 星期五

[Ubuntu Snappy 2] - trace the booting process

最近新的 Ubuntu Core 16 Image release 了,這是就我知道的第一版 base on Snappy 2.x 的 Ubuntu core image (Snappy 2.x 是利用 snapd 管理套件, Snappy 1.x 沒研究), 詳情可見這封 mail :
https://lists.snapcraft.io/archives/snapcraft/2016-September/001166.html

小弟花了一點時間看一下他的 boot process 在此作一下記錄以免大腦記憶体不足被 garbage collection 清掉。

Ubuntu core image divides the storage to 2 partition: "writable" and "system-boot" 給 KVM 和給 raspberry pi 3 的 image 其 boot partition label 看起來不同,反正就是一個 boot ,一個 system.

boot partition:
  • /boot/grub/grubenv decides the kernel and core snap which will be loop mounted by grub.
  • /boot/grub/grub.cfg loop mount kernel snap to specify the position of kernel and initramfs image.

在writable partition 中的 kernel snap 中取得 kernel 及 initramfs ,在 initramfs 中 再 mount OS snap:

mount "${writable_mnt}/system-data/var/lib/snapd/snaps/${snap_core}" "$rootmnt"

這裡我覺得可以在開發時將 OS snap 轉成 ext4 image,然後 mount 成 rw ,這樣比較方便,只是 size 會從 75mb 擴增到 242mb。

然後其 initramfs 應該是來自於這裡:
最後就是進到 systemd 再把 snapd 叫起來。

沒有留言:

張貼留言