main/postmarketos-mkinitfs: dynamic partitioning support (MR 3088)

This commit is contained in:
Richard Acayan 2022-05-09 20:06:09 -04:00 committed by Oliver Smith
parent 2a120bd2f6
commit 36ff86f895
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 24 additions and 3 deletions

View file

@ -2,7 +2,7 @@
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=postmarketos-mkinitfs
pkgver=1.4.1
pkgrel=2
pkgrel=3
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
depends="
@ -70,6 +70,6 @@ check() {
sha512sums="
f827acb0a10c0e5c1631f1b712e91fde7eb4ade0f1174eb2ef1754018bf4518ea1ad3229fd335c25fb0c6fe46ae20890f5cf43e58c8143ae17b5ab9bb36f0199 postmarketos-mkinitfs-1.4.1.tar.gz
08a3e79c6fa7d3839d43515b8da7817cb36f4ab014552fd0164957c232bb16fde337e57c47c9734d396a5fca3328fbf49ebabe4728c6071c80b04dad14886bba 00-default.modules
0c6d2c749952ff027f1c435a7a3b2861fb632b81c16b6d69a92b47457da4af8cb80e50168b93f92b316377c8c1f5243029fca22ac49fef0940eb5ad6c3dff6ec init.sh
ddf1d545413cbf4bdd910c8bbd457ce46b1d0afe4c32ec204f3fee933386b08bc27af9f2907b0734b53d929b38352c5c8744d5828d60ffbc68f2a724b854d267 init_functions.sh
fae45b5ee2cca9c0a4f75f29b4cb89cf07aed1f19b966964ccfeb5d2933474b60d7aa8f80190a997589e19e6aa3fc6317eaed8a54e1e349311a3564e73ab31e5 init.sh
22617f7ceab27b2c48bdbaa40193a49065b6ba3c49f6f50d5bf987064814c7eedbd97b5000320c4dec419bbf7dd31d83abd1b6792465a9e8f60adbb673defa68 init_functions.sh
"

View file

@ -19,6 +19,7 @@ setup_firmware_path
[ -d /lib/modules ] && modprobe -a ${deviceinfo_modules_initfs} ext4 usb_f_rndis
setup_mdev
setup_dynamic_partitions "${deviceinfo_super_partitions:=}"
mount_subpartitions
setup_framebuffer

View file

@ -76,6 +76,26 @@ get_uptime_seconds() {
awk -F '.' '{print $1}' /proc/uptime
}
setup_dynamic_partitions() {
command -v make-dynpart-mappings > /dev/null || return
attempt_start=$(get_uptime_seconds)
wait_seconds=10
slot_number=0
for super_partition in $1; do
# Wait for mdev
echo "Waiting for super partition $super_partition..."
while [ ! -b "$super_partition" ]; do
if [ "$(get_uptime_seconds)" -ge $(( attempt_start + wait_seconds )) ]; then
echo "ERROR: Super partition $super_partition failed to show up!"
return;
fi
sleep 0.1
done
make-dynpart-mappings "$super_partition" "$slot_number"
slot_number=$(( slot_number + 1 ))
done
}
mount_subpartitions() {
# Do not create subpartition mappings if pmOS_boot
# already exists (e.g. installed on an sdcard)