This is a note of COSCUP.
In this talk, I learn many knowledge from system scope and find something I should study in advance.
In fact, I am an embedded software engineer and I am not a system engineer yet.
But I believe I will be.
This topic will make up my shortage.
Source: author: Carl Su
Elements of Linux
- tool chain
- compile and execute
- grub or u-boot for bring up
- linux kernel
covering the above
Overview of rootfs
- kernel will mount rootfs to (/) with read-only (in order to use init)
- execute/sbin/init or /bin/sh for initialize system
- init will remount rootfs and other file systems according to /etc/fstab
- /sbin/init will be managed by systemd (symbolic link)
Boot flow of ARM
- ROM code
- It provider by vendor, and OEM can’t customize.
- SPL (Secondary Program Loader)
- Put in SRAM (OEM can customize)
- TPL (Tertitary Program Loader)
- e.g. UBOOT
- Linux kernel: kernel extracts by itself, then pid= 0, 1, 2
/bin/ :Utilities: sh, ls, cp, mv, etc.
/etc/ :fstab, group, passwd, profile
/lib/ :Runtime libs: glibc, musl, etc.
Methods to build rootfs
- Use package made by someone
- rootfs tools
- debootstrap, cdebootstrap
- buildroot ( for most embedded system and easier)
- project Yocto (for most embedded system and harder)
FHS Spec: https://refspecs.linuxfoundation.org/fhs.shtml
Linux From Scratch (LFS): http://www.linuxfromscratch.org/lfs/
建立基於 BusyBox 的 rootfs: https://hackmd.io/@c_0KKCwzQE2rsd39mpvNQQ/rknxhDzvB
A Journey to Boot Linux on Raspberry Pi: