main/pmos-mkinitfs: wait for rootfs, framebuffer
Fix Nexus 5 (hammerhead) boot and framebuffer issues at startup by waiting up to 10 seconds until the rootfs and /dev/fb0 have been found. Waiting for the framebuffer device can be disabled by setting deviceinfo_no_framebuffer=true in the deviceinfo.
This commit is contained in:
parent
ea0040efc1
commit
5db8fd724c
3 changed files with 58 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
pkgname=postmarketos-mkinitfs
|
||||
pkgver=0.7.1
|
||||
pkgver=0.7.2
|
||||
pkgrel=0
|
||||
pkgdesc="Tool to generate initramfs images for postmarketOS"
|
||||
url="https://postmarketos.org"
|
||||
|
@ -23,6 +23,7 @@ package() {
|
|||
"$pkgdir/sbin/mkinitfs"
|
||||
mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/"
|
||||
}
|
||||
sha512sums="d5abfe9a1298069e6722555c6e16223b09b36af65d879feb64d540aa6cbc009a3aa7f00528bcf656370ec37cc64f925c72ebb77813961cd6ebf22107b57ea029 init.sh.in
|
||||
4515bc6891110e9c8b1ed8d31a89818c7c222a364bdbdf90097d5d6bbdb97eb889d4dbaec78dc928aa5ff698a8e89a76338e7c63017bf8dfb93f44a293848ca0 init_functions.sh
|
||||
|
||||
sha512sums="c8ed2697ba0368b907eaefe7544bff8539adc7e8247af6bd425c722e3cedeb34e303f6bd9e00f283921352bc43dff3db83f3b3c1f427ef597ac15323f1e9c3eb init.sh.in
|
||||
8ca82bfa1e092885882df36a3628d653457522b39f60457f29d7cddfc81df470e479d8e7bb51011de2d312ffdf35b785c511f1a32e5952403be819548b2ace23 init_functions.sh
|
||||
4c8a999009bc7e909bc1848c8c2421cb5f79f2603ee210b8f8c145f47c31a9e56e1861cffe742fcfd3c7bbb315e37dbe347bb5ac602f45eeccc0e40516889618 mkinitfs.sh"
|
||||
|
|
|
@ -12,11 +12,10 @@ mount_proc_sys_dev
|
|||
setup_log
|
||||
# shellcheck disable=SC2154,SC2086
|
||||
[ -d /lib/modules ] && modprobe -a ${deviceinfo_modules_initfs} ext4
|
||||
|
||||
setup_mdev
|
||||
mount_subpartitions
|
||||
|
||||
# Fix for framebuffer drivers, which do not have a default mode
|
||||
set_framebuffer_mode
|
||||
setup_framebuffer
|
||||
|
||||
# Hooks
|
||||
for hook in /etc/postmarketos-mkinitfs/hooks/*.sh; do
|
||||
|
|
|
@ -42,7 +42,9 @@ mount_subpartitions() {
|
|||
# Do not create subpartition mappings if pmOS_boot
|
||||
# already exists (e.g. installed on an sdcard)
|
||||
blkid |grep -q "pmOS_boot" && return
|
||||
|
||||
attempt_count=0
|
||||
echo "Trying to mount subpartitions for 10 seconds..."
|
||||
while [ -z "$(find_boot_partition)" ]; do
|
||||
for i in /dev/mmcblk*; do
|
||||
case "$(kpartx -l "$i" 2>/dev/null | wc -l)" in
|
||||
2)
|
||||
|
@ -62,6 +64,13 @@ mount_subpartitions() {
|
|||
;;
|
||||
esac
|
||||
done
|
||||
attempt_count=$(( attempt_count + 1 ));
|
||||
if [ "$attempt_count" -gt "100" ]; then
|
||||
echo "ERROR: failed to mount subpartitions!"
|
||||
return;
|
||||
fi
|
||||
sleep 0.1;
|
||||
done
|
||||
}
|
||||
|
||||
find_root_partition() {
|
||||
|
@ -335,6 +344,30 @@ set_framebuffer_mode() {
|
|||
echo "$_mode" > /sys/class/graphics/fb0/mode
|
||||
}
|
||||
|
||||
setup_framebuffer() {
|
||||
# Skip for non-framebuffer devices
|
||||
# shellcheck disable=SC2154
|
||||
if [ "$deviceinfo_no_framebuffer" = "true" ]; then
|
||||
echo "NOTE: Skipping framebuffer setup (deviecinfo_no_framebuffer)"
|
||||
return
|
||||
fi
|
||||
|
||||
# Wait for /dev/fb0
|
||||
echo "NOTE: Waiting 10 seconds for the framebuffer /dev/fb0."
|
||||
echo "If your device does not have a framebuffer, disable this with:"
|
||||
echo "no_framebuffer=true in <https://postmarketos.org/deviceinfo>"
|
||||
for i in $(seq 1 100); do
|
||||
[ -e "/dev/fb0" ] && break
|
||||
sleep 0.1
|
||||
done
|
||||
if ! [ -e "/dev/fb0" ]; then
|
||||
echo "ERROR: /dev/fb0 did not appear!"
|
||||
return
|
||||
fi
|
||||
|
||||
set_framebuffer_mode
|
||||
}
|
||||
|
||||
loop_forever() {
|
||||
while true; do
|
||||
sleep 1
|
||||
|
|
Loading…
Reference in a new issue