mkosi icon indicating copy to clipboard operation
mkosi copied to clipboard

Add phase 1.5 ("build initrd phase") to build process

Open poettering opened this issue 4 years ago • 1 comments

Right now we have two build phases:

  1. Phase 1: we install runtime+development packages and build the sources in the current dir in it, which generates output in $DESTDIR
  2. Phase 2: we install only the runtime packages, and then add the artifacts from $DESTDIR on 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.

poettering avatar Jul 02 '21 14:07 poettering

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.

DaanDeMeyer avatar Jun 16 '22 18:06 DaanDeMeyer

So this can be closed now that we have presets and generate an initrd on the fly in the basic case

DaanDeMeyer avatar May 05 '23 17:05 DaanDeMeyer