Skip to content

Draft: postmarketos-initramfs: copy all modules if available

Caleb Connolly requested to merge caleb/copy-modules into master

For development it can be helpful to include all kernel modules in the initramfs and copy them to the rootfs during boot. Add support for this directly in the initramfs.

This relies on the fact that development kernels include the git tag and build number (incrementing) so 'uname -r' changes every time.

It's up to the user to manage deleting their old modules.

Opt-in to this behaviour by setting deviceinfo_dev_kernel_copy_all_modules="true" in your deviceinfo file.

This MR will be supplemented by an mkinitfs MR to automatically include all modules in the initramfs if building for a development kernel and the deviceinfo variable is set.

We can detect a development kernel with the regex .+g[a-f0-9]{12}$ on uname -r (or the contents of the kernel.release file).

This basically allows for the workflow:

make
pmbootstrap build --envkernel linux-postmarketos-qcom-sdm845
pmbootstrap chroot -r apk upgrade -a
fastboot boot ~/.local/var/pmbootstrap/chroot_rootfs_oneplus-enchilada/boot/boot.img

I hope to further optimize this in the future (e.g. by NOT running apk and mkinitfs through QEMU, and maybe extending mkinitfs to support running on a rootfs specified on the cmdline)

Edited by Caleb Connolly

Merge request reports