main/postmarketos-mkinitfs: refactor osk-sdl config/running (MR 1870)

- Simplified logic for setup/running osk-sdl in initfs
- include libGLESv2 when running osk-sdl w/ mesa
- depends on osk-sdl >=0.62
This commit is contained in:
Clayton Craft 2021-01-11 21:36:52 -08:00 committed by Alexey Min
parent 33a565156a
commit 4243b95bd0
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448
3 changed files with 40 additions and 35 deletions

View file

@ -1,6 +1,6 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=postmarketos-mkinitfs
pkgver=0.21
pkgver=0.22
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
@ -55,7 +55,7 @@ check() {
sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f3139d00897f69323a916d709ced4297fea8cbd3a13ebae575b873ec9e2cbfae 00-default.modules
bafd06286594102b8b3b126c3ae0a77a97f004ab804f03426154310c5107a1acaf3636bdba92626333adfe4fb0df32ff42c6d8d9e7adf35f6da620c6e14407a1 init.sh.in
7e44c39393587e73d69533eb58362245bcb6cdb28a91eadd7878af54831b0c0ab264e8e9984b138e68b207d1f7544adab2b64b6ec68b4f528ea1273819670210 init_functions.sh
9a18ccd14ab5a9e2decc3df35c9b489cbb94b57dc180f0919d0cdf003de5f0f4730beb96d5c3d19b13aebc6d6fe046aa9e81846b86a66f794ca1cb59b91eabfe init_functions.sh
dfc01ee0547ea88b7aa45a005e842b636e9e19bbf1705f3dad53a66d57af7c5c513c092b5469a06d9b00322e56a4d25f1b47e4c5324aafa99f5291679968d1f1 mkinitfs.sh
6a034e52e7e0d2eb4db632d1a08a47e58ccfc82780e3d1fbc08759ae0c7a1c7c6a222ad91fe346c45d82bec4487cc9c4b71adad96061865153c0e98e1e8e1c37 mkinitfs_functions.sh
d5df1872b40d7d5aaf2f0cd2169b8485df81899eb930c0772b821445bc1bcd244eac628b9cecb0d655c603e5dda06e0e7f2743773ed0ba9930b8e85e4f83afc9 mkinitfs_functions.sh
c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh"

View file

@ -443,46 +443,50 @@ start_udhcpd() {
udhcpd
}
setup_directfb_tslib() {
# Set up directfb and tslib
# Note: linux_input module is disabled since it will try to take over
# the touchscreen device from tslib (e.g. on the N900)
export DFBARGS="system=fbdev,no-cursor,disable-module=linux_input"
export SDL_VIDEODRIVER="directfb"
# shellcheck disable=SC2154
if [ -n "$deviceinfo_dev_touchscreen" ]; then
export TSLIB_TSDEVICE="$deviceinfo_dev_touchscreen"
fi
}
setup_kmsdrm() {
# Set up SDL and Mesa env to use kmsdrm backend
export SDL_VIDEODRIVER="kmsdrm"
# needed for librem 5
export ETNA_MESA_DEBUG="no_supertile"
}
# $1: SDL_VIDEODRIVER value (e.g. 'kmsdrm', 'directfb')
run_osk_sdl() {
osk-sdl -n root -d "$partition" -c /etc/osk.conf -v > /osk-sdl.log 2>&1
unset ETNA_MESA_DEBUG
unset SDL_VIDEODRIVER
unset DFBARGS
unset TSLIB_TSDEVICE
unset OSK_EXTRA_ARGS
case "$1" in
"kmsdrm")
# Set up SDL and Mesa env to use kmsdrm backend
export SDL_VIDEODRIVER="kmsdrm"
# needed for librem 5
export ETNA_MESA_DEBUG="no_supertile"
;;
"directfb")
# Set up directfb and tslib
# Note: linux_input module is disabled since it will try to take over
# the touchscreen device from tslib (e.g. on the N900)
export DFBARGS="system=fbdev,no-cursor,disable-module=linux_input"
export SDL_VIDEODRIVER="directfb"
# SDL/directfb tries to use gles even though it's not
# actually available, so disable it in osk-sdl
export OSK_EXTRA_ARGS="--no-gles"
# shellcheck disable=SC2154
if [ -n "$deviceinfo_dev_touchscreen" ]; then
export TSLIB_TSDEVICE="$deviceinfo_dev_touchscreen"
fi
;;
esac
osk-sdl $OSK_EXTRA_ARGS -n root -d "$partition" -c /etc/osk.conf -v > /osk-sdl.log 2>&1
}
start_onscreen_keyboard() {
# shellcheck disable=SC2154
if [ -n "$deviceinfo_mesa_driver" ]; then
setup_kmsdrm
# try to run osk-sdl with kmsdrm driver, then fallback to
# directfb if that fails
if ! run_osk_sdl "kmsdrm"; then
run_osk_sdl "directfb"
fi
else
setup_directfb_tslib
run_osk_sdl "directfb"
fi
if ! run_osk_sdl; then
setup_directfb_tslib
run_osk_sdl
fi
unset ETNA_MESA_DEBUG
unset SDL_VIDEODRIVER
unset DFBARGS
unset TSLIB_TSDEVICE
}
start_charging_mode() {

View file

@ -231,6 +231,7 @@ get_binaries_extra()
BINARIES_EXTRA="
$BINARIES_EXTRA
/usr/lib/libEGL.so.1
/usr/lib/libGLESv2.so.2
/usr/lib/libgbm.so.1
/usr/lib/libudev.so.1
/usr/lib/xorg/modules/dri/${deviceinfo_mesa_driver}_dri.so