postmarketos-mkinitfs needs rewrite / improvements to make it more reliable
The postmarketos-mkinitfs code is pretty old, it has several issues:
- doesn't run with
set -e
, if a corrupted initfs archive gets produced, or anything else goes wrong, it does not stop and replaces the previous, working initfs with a broken one - space of /boot is not checked before attempting to update the initfs related files
- initfs files are not atomically replaced (could be done if there was enough space, pmbootstrap!2037 (merged), and otherwise we could print a warning that the boot partition should be increased and not do an atomic replacement.)
- parameters for the script should be optional, it should figure out the correct mkinitfs name automatically (#660 (closed))
- maybe even store initfs-extra uncompressed, if the space is there, to save time during compression and decompression (but benchmark first if that really saves time)
- EDIT: as of writing, the uncompressed cpio file for initfs-extra is 120 MiB for the pinephone... so we'd need to increase the boot partition size again to store that twice uncompressed. we should probably omit that for now.
- EDIT: verify that busybox cpio is actually able to extract the generated initramfs before rolling it out to the boot partition
The script itself is rather short, it should not be too hard to rewrite it to address the above issues.
Edited by Administrator