Add phase 1.5 ("build initrd phase") to build process
Right now we have two build phases:
- Phase 1: we install runtime+development packages and build the sources in the current dir in it, which generates output in
$DESTDIR - Phase 2: we install only the runtime packages, and then add the artifacts from
$DESTDIRon top. this then becomes the final image.
I propose we insert another phase 1.5: this would run between phase 1 and 2 and would install runtime packages + initrd generator, and then drop in artifacts from $DESTDIR. In this phase we basically just call dracut to build an initrd for us. The initrd is then written into a new $DESTDIR. phase1 build and phase2 build are then changed to not include dracut anymore. Moreover, phase 2 is then changed to now combine the artifacts from phase 1 plus the initrd from phase 1.5 with the runtime packages.
Net result: dracut and its deps no longer present in final image, but still a freshly generated, fully updated initrd in use.
I thought a bit about this but it seemed rather complex, especially in the context of mkosi-initrd if we'd want to use that to build initrds and allow users to configure the initrd that they'd have mkosi build.
What I figured could work is to introduce looser coupling by adding a new --initrd option that allows users to configure a prebuilt initrd. This initrd can then be built however the user likes (e.g. using mkosi-initrd) and it will be used by mkosi as the initrd instead of building its own initrd.
So this can be closed now that we have presets and generate an initrd on the fly in the basic case