Skip to content

Support (postmarketos-)mkinitfs 2.0

clayton craft requested to merge the-great-mkinitfs-refactor into master

Testing Instructions

Important: Do not attempt to test this on an existing installation that you care about. This modifies boot files, and may result in a non-booting device. Make sure you have a way to recover (e.g. jumpdrive), or test this on a throwaway install.

The easiest way to test this on an existing installation of pmOS is to use mrtest:

$ sudo apk add mrtest
$ mrtest add 3895
# 1) hit 'u' to select packages for upgrade
# 2) make sure to also manually select the postmarketos-initramfs package
# 3) this is also a good time to select an initramfs hook if you want to test that
# 4) verify that any *required* packages for your device will be installed/upgraded before proceeding!

Important: make sure you select the "postmarketos-initramfs" package, it's new so it won't be selected by hitting 'u' above, and it's required

To build a new image with this branch, check out the branch in your local pmaports and pmbootstrap install like normal. No special steps are needed to use these changes.

What to test:

  • pmOS should boot to UI like normal
  • pbsplash should show up / work as expected
  • initramfs hooks should work (debug shell)
  • FDE should work, if you use osk-sdl or unl0kr, either should load on boot and let you unlock your rootfs
  • any device-specific modules configured to load in the initramfs should be loaded as expected. Often times when these are missing, boot is broken and/or the FDE unlocker isn't working properly, so it should be fairly obvious if this isn't working.

Important: Please report any new issues in a new comment thread below!

Background

This is the big mkintifs / initramfs re-write that no one asked for, but (imho) we all needed.

Most of the patches in this series are just updating device packages to use the new paths (see below for more info), the real interesting bits are in the postmarketos-mkinitfs and postmarketos-initramfs packages.

Notable changes:

  • postmarketos-mkinitfs binary was renamed to mkinitfs, shouldn't cause any issue since the package was already installing a symlink to mkinitfs.
  • postmarketos-mkinitfs package only builds/installs the mkinitfs tool, and no initramfs files/config.
  • a new postmarketos-initramfs installs files for creating the base initramfs
  • initramfs hook packages still work as before, and "enhance" the initramfs by installing new lists of things to slurp up into the appropriate directory in /usr/share
  • packages install initramfs config in /usr/share/mkinitfs (not in /etc/), users can add to the initramfs by adding file lists in /etc/mkinitfs (see manpage in mkinitfs 2.0)

Related: postmarketos-mkinitfs!30 (merged)

Why?!

I want mkinitfs to be distro-agnostic, and V2.0 will be pretty much there. It won't have any files hardcoded in it, all config it gets for generating the initramfs will come from distro packaging / user changes. (there's an exception to this: osk-sdl... but once we merge unl0kr, I plan to drop that code from mkinitfs...) This makes mkinitfs 2.0 entirely configurable by using hook packages, and by writing lists of files and/or scripts (to run as hooks) as a user under /etc. I think that's neat!

Main motivation for making this MR right now is 1) create some awareness that this is here, and 2) gitlab tells me when the branch has merge conflicts, so I don't have to wait around too long to notice that I have to go manually rebase...

TODO:

  • Finish mkinitfs 2.0
  • squash commits for mkinitfs and initramfs packages... they're separated now to help with review.
  • Test!
Edited by Oliver Smith

Merge request reports