nanmi-initramfs

nanmi's initramfs
git clone git://xn--q9jzb1c.xn--q9jyb4c/nanmi-initramfs
Log | Files | Refs | README | LICENSE

README.md (2257B)


      1 # nanmi's initramfs
      2 Initramfs used on the late boot sequence (after the firmware loaded the bootloader; after the bootloader loaded the kernel; after the kernel is loaded), with the intent of using encrypted/verified drives with dm-crypt/dm-integrity and displaying a cute custom ASCII art to greet the user.
      3 
      4 ## Directory structure explanation
      5 - bin/ - Needed to store binaries 
      6 - dev/ - Needed for devtmps
      7 - etc/ - Needed for Busybox's `mtab`
      8 - init - Initramfs' shell script
      9 - mnt/ - Needed to mount devices 
     10 - proc/ - Needed to mount proc
     11 - run/ - Needed for `cryptsetup`
     12 - sbin/ - Needed to store elevated binaries
     13 - sys/ - Needed to mount sysfs
     14 
     15 ## Needed packages
     16 - sys-apps/busybox (statically linked)
     17 - sys-fs/cryptsetup (statically linked)
     18 
     19 ## Function structure explanation
     20 ### text()
     21 Colorized informational text, OpenRC style.
     22 
     23 ### installGentoo()
     24 ASCII art of Yotsuba, colored with ANSI escape code sequences (\033[32;01m) and centered on a 1920x1080 resolution display with 101 whitespaces (%101s).
     25 
     26 ### cmdline()
     27 Used to replace hardcoded UUIDs on the init script with aliases set with [kernel parameters](https://wiki.archlinux.org/title/Kernel_parameters).
     28 
     29 ### setUp()
     30 Prepare the initramfs enviroment. In order to safely display the ASCII art, [printk()](https://www.kernel.org/doc/html/latest/core-api/printk-basics.html) is set to 0 so the kernel stops spamming text.
     31 
     32 **IMPORTANT!: The 1 second sleep is needed so the kernel can identify all devices before dinamically populating dev/. Not doing this while using devtmps might lead to kernel panics.**
     33 
     34 ### preparestick()
     35 Unlock and mount the USB drive containing the header and key-file used do decrypt the main disk.
     36 
     37 ### prepareDisk()
     38 Decrypt, verify the integrity and mount the main disk.
     39 
     40 ### closeStick()
     41 Unmount and close the USB stick dm-crypt volume so it doesn't appear unlocked/mounted on startup.
     42 
     43 ### cleanUp()
     44 Tidy everything up before booting the real thing.
     45 
     46 ### bootUp()
     47 Utilize the /sbin/init contained in the main disk. The init script of the initramfs is no longer used.
     48 
     49 ## Further reading
     50 All binaries are empty files only for illustration purposes.
     51 Further reading: [https://wiki.gentoo.org/wiki/Custom_Initramfs](https://wiki.gentoo.org/wiki/Custom_Initramfs)