Booting [DRAFT]
Created at 2017-06-17T18:25:33+09:00

TODO

  • uefi
  • grub
  • kernel
  • [x] initramfs /init
  • [x] systemd /sbin/init (other post)
  • console (/dev/console, /dev/tty0, /dev/tty, /dev/ttyS)
  • getty, login

initramfs /init

#!/usr/bin/ash

mount_setup # mount /proc, /sys, /dev (devtmpfs), etc ...

parse_cmdline </proc/cmdline # set shell variable from cmdline (e.g. $root)

resolve_device $root # convert the varialbe $root from "UUID=xxxx" to "/dev/sdaN"

fsck_root # fsck on root filesystem

default_mount_handler /new_root # mount $root onto path /new_root

exec /usr/bin/switch_root /new_root /sbin/init # chroot and exec to systemd

Reference

  • Grub
  • Arch's mkinitcpio (for /init)
  • util-linux (for switch_root, getty)
  • Documentation/filesystems/ramfs-rootfs-initramfs.txt
  • Documentation/early-userspace/README