main/postmarketos-mkinitfs: fix space issues (MR 2051)

In order to have hardware acceleration in osk-sdl, we have included mesa
for some devices (like the PinePhone) in initfs-extra. Mesa drags in
libLLVM, which got a size increase of 27 MB in the last version. This
leads to running out of space on the boot partition:

  ==> initramfs: creating /boot/initramfs-postmarketos-allwinner-extra
  gzip: write error: No space left on device
  cpio: write error: Broken pipe

Improve the situation by not directly writing initfs-extra to /boot
(next to the old version), but to a temporary directory first. Replace
the old version with the new version afterwards (like before).

This is a rather minimal fix for this specific issue. The mkinitfs
script needs more fixing (it's one of the oldest pieces of code in
postmarketOS and could use a rewrite...), but that's out of scope for
this patch.
This commit is contained in:
Oliver Smith 2021-03-21 17:22:44 +01:00
parent c6539b51e5
commit 31ed6f21ef
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 7 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=postmarketos-mkinitfs
pkgver=0.22
pkgrel=0
pkgrel=1
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
depends="
@ -57,5 +57,5 @@ sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f313
bafd06286594102b8b3b126c3ae0a77a97f004ab804f03426154310c5107a1acaf3636bdba92626333adfe4fb0df32ff42c6d8d9e7adf35f6da620c6e14407a1 init.sh.in
9a18ccd14ab5a9e2decc3df35c9b489cbb94b57dc180f0919d0cdf003de5f0f4730beb96d5c3d19b13aebc6d6fe046aa9e81846b86a66f794ca1cb59b91eabfe init_functions.sh
dfc01ee0547ea88b7aa45a005e842b636e9e19bbf1705f3dad53a66d57af7c5c513c092b5469a06d9b00322e56a4d25f1b47e4c5324aafa99f5291679968d1f1 mkinitfs.sh
d5df1872b40d7d5aaf2f0cd2169b8485df81899eb930c0772b821445bc1bcd244eac628b9cecb0d655c603e5dda06e0e7f2743773ed0ba9930b8e85e4f83afc9 mkinitfs_functions.sh
fa5a6d99f05988324b8dbf35f02eee276448c04775dad85ecdd21ed0f8009472143038334967a629a021633031f6e376cc2307423d94b00e99e9a5789337aaa8 mkinitfs_functions.sh
c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh"

View file

@ -484,13 +484,16 @@ generate_initramfs_extra()
# Set up initramfs-extra in temp folder
tmpdir_extra=$(mktemp -d /tmp/mkinitfs.XXXXXX)
tmpdir_extra_cpio=$(mktemp -d /tmp/mkinitfs-cpio.XXXXXX)
tmpdir_extra_cpio_img="$tmpdir_extra_cpio/extra.img"
mkdir -p "$tmpdir_extra"
copy_files "$(get_binaries_extra)" "$tmpdir_extra"
copy_files "$osk_conf" "$tmpdir_extra"
create_cpio_image "$tmpdir_extra" "$1.new"
create_cpio_image "$tmpdir_extra" "$tmpdir_extra_cpio_img"
rm -rf "$tmpdir_extra"
# Replace old initramfs-extra *after* we are done to make sure
# it does not become corrupted if something goes wrong.
mv "$1.new" "$1"
cp "$tmpdir_extra_cpio_img" "$1"
rm -rf "$tmpdir_extra_cpio"
}