main/postmarketos-initramfs: wait for boot partition (MR 4775)

Some devices take time to initialize storage, e.g. Qualcomm laptops
using ADSP need to load firmware firstly, and initramfs script does
not always manage to mount boot partition in time.

Unfortunately, there is no reliable way to reproduce the issue, but
this patch should fix cases like this.
This commit is contained in:
Anton Bambura 2024-01-30 20:00:35 +02:00 committed by Clayton Craft
parent 4456938022
commit d2dec46275
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
3 changed files with 13 additions and 7 deletions

View file

@ -87,8 +87,8 @@ sha512sums="
5b364300f31c91fd0591eb0715f67cbf5383f45246a5fb9f34b79f7cb2e3b15768b2130e5f32f816cc169950f988c1beabc879ba31645c58ce131a288dbc071d 00-initramfs-base.dirs
ab41b45b0613f25a61114ed8c8b92bc53c60838f6e2e0ba18c76e5369b2984e6023a0661887692673aca3f647f268c468a468f6b1ac424cfee609017a89481dd 00-initramfs-base.files
8a4adad3785af474b36a09a05f6a3b2c4b4f43aac331a53b903abfa51ea12be1e3d1d807b7a6e66a1346815f3b0044daf8cd62e21e2dc75d2db13ee265a72985 00-initramfs-extra-base.files
4bfcb41b2d5ccd577a6203a9479e5bdf056064d20f02f9120f1a074c7c280c0231cf380ed6be7c80733ed4ae101385c14f123a8a41780bbb7d0851387cd9c613 init.sh
87602909fa9f233385528e41e5395cce076a4d22df858b56b333457815c6978f1b9ca918f0c9ec56f4424ed6c2624d0c6054eaf6e687d60175952cc35c010098 init_functions.sh
b1462989633c65a102e7ae7ced9c41a00673b4c7434cd3fe16c229c39bb870d7e850b0d317487191b7d7ca32c75b2eed1561b1facf405bd4d876d32c71badcf3 init.sh
199c997ecb7f6666cddc2552cecb86613105992f4868394bba367a2e3c0847b40d0fc9556c91eca3eebac8330595ebe80a95fba84a462a81cc183c713c48ca44 init_functions.sh
ba3275a9af788c7c782322a22a0f144d5e50e3498ea6886486a29331f23ae89cd32d500a3635cfa7cab369afba92edc18aeca64ccbf0cd589061cce23d15b46c unudhcpd.conf
675e7d5bee39b2df7d322117f8dcaccc274d61beaf4d50ead19bbf2109446d64b1c0aa0c5b4f9846eb6c1c403418f28f6364eff4537ba41120fbfcbc484b7da7 mdev.conf
"

View file

@ -52,6 +52,7 @@ fi
setup_usb_network
start_unudhcpd
wait_boot_partition
mount_boot_partition /boot
extract_initramfs_extra /boot/initramfs-extra
setup_udev

View file

@ -301,11 +301,6 @@ get_partition_type() {
# switch_root to /sysroot and have the boot partition properly mounted.
mount_boot_partition() {
partition=$(find_boot_partition)
if [ -z "$partition" ]; then
echo "ERROR: boot partition not found!"
show_splash "ERROR: Boot partition not found\\nhttps://postmarketos.org/troubleshooting"
fail_halt_boot
fi
if [ "$2" = "rw" ]; then
mount_opts=""
@ -349,6 +344,16 @@ extract_initramfs_extra() {
gzip -d -c "$initramfs_extra" | cpio -iu
}
wait_boot_partition() {
while [ -z "$(find_boot_partition)" ]; do
show_splash "ERROR: boot partition not found\\nhttps://postmarketos.org/troubleshooting"
echo "Could not find the boot parition."
echo "Maybe you need to insert the sdcard, if your device has"
echo "any? Trying again in one second..."
sleep 1
done
}
wait_root_partition() {
while [ -z "$(find_root_partition)" ]; do
show_splash "ERROR: root partition not found\\nhttps://postmarketos.org/troubleshooting"