main/{devicepkg-dev,postmarketos-mkinitfs}: statically generate splash screens (!899)
We need to generate the splash screens separately for each device, because they are specific to the device's display resolution. At the moment we do this dynamically during the installation process. This has the advantage that there is no need to re-build all device packages when one of the splash screen is changed (or a new one is added). In reality, however, the splash screens do not change very frequently. On the other hand, generating the splash screens dynamically has signficant disk usage overhead for a minimal ("none" UI) rootfs: The Python interpreter together with the necessary libraries requires about ~60 MB of disk space on aarch64. The splash screens itself require about ~100 KB for 720x1280. This is not necessary if we move the splash screen generation into devicepkg-dev, which is used to build the device package for all devices. Another advantage is that we no longer need the (rather complicated) caching mechanism for splash screens - so we actually end up with less lines than before. rootfs size for samsung-a5ulte ("none" UI): Before: 450M After: 388M (-62M) After this change, every(!) device package needs to be rebuilt once. No changes are necessary in device packages.
This commit is contained in:
parent
0c7bcb5431
commit
e3d07c832c
5 changed files with 51 additions and 81 deletions
|
@ -1,10 +1,11 @@
|
|||
pkgname="devicepkg-dev"
|
||||
pkgver=0.9.2
|
||||
pkgver=0.10.0
|
||||
pkgrel=0
|
||||
pkgdesc="Provides default device package functions"
|
||||
url="https://postmarketos.org"
|
||||
arch="all"
|
||||
license="MIT"
|
||||
depends="postmarketos-splash"
|
||||
source="
|
||||
compiler-gcc.h
|
||||
devicepkg_build.sh
|
||||
|
@ -57,8 +58,8 @@ package() {
|
|||
"$pkgdir/usr/share/devicepkg-dev/compiler-gcc.h"
|
||||
}
|
||||
sha512sums="d69930dd790b00fb39760a37d95a10899f0d167e10e2804feb05d9ce04f94185dc32d36edc90214aba2ea2aa09bf18f7dab93f1d2eff23f67beb2cc83be30e7c compiler-gcc.h
|
||||
5230b3d8a61fe0e83deef17072df732c1413abedefbda56a9d2d8f8148b82dc7437a62c3e45115ee21f5208f1e17308506b002c504058552d37e7b5053bb69fa devicepkg_build.sh
|
||||
cc567d1cc236b06240a9bf58d7aadabc44bbe8bb6c8e50c721531d00a1996bdf961ed0a1a9031489d419778e4d16afc6b7f7d176eec5e928b5b91ea2a91059d1 devicepkg_package.sh
|
||||
d57f61ccff6546c97b7c90a0c6018f2e603e018cc36268f2c54654029830c63a93661a6128262f574dd6799fa4a1fac13f51b84b9709f628542c5b741ac8edd5 devicepkg_build.sh
|
||||
5ac4a5087c598582cb12278a4ce0c2dccfe7f91c1620d3328d1d0944c89eff81f8afcc681506d73a80d69615401f96a99fb1fdaa755fea101e0d36ec6ef2d5d0 devicepkg_package.sh
|
||||
1b038d0bca1e130674497cf7aeb26fac2bcec510ce094fa6f6700fcdcabc778741541c1aa89d3588ed42908f60708a2d9b83ffd5e50e99db619d366458e82256 downstreamkernel_prepare.sh
|
||||
cf5ee240cd1c1e9d30cdec833b4a007fd2e00f9a32ba3f265f99aa2e3dd3601cf43c08d3f3e01bade1d5b2648a6754b2f236e5cb4a9945e18e5c4e97aa2ed7c8 devicepkg_subpackage_kernel.sh
|
||||
9bb7f2a0930f397a713e9f4b6d5b83a426d9a2a3f692dcc42ac30717bf26ead869d8823a38f3ad388af12b2b9a02e8ec4d4418e9c2062389ed06d2b891a49ff3 deviceinfo
|
||||
|
|
|
@ -20,6 +20,45 @@ fi
|
|||
# shellcheck disable=SC1090,SC1091
|
||||
. "$srcdir/deviceinfo"
|
||||
|
||||
# Create splash screens
|
||||
generate_splash_screens()
|
||||
{
|
||||
splash_config="/etc/postmarketos/splash.ini"
|
||||
splash_width=${deviceinfo_screen_width:-720}
|
||||
splash_height=${deviceinfo_screen_height:-1280}
|
||||
|
||||
# Overwrite $@ to easily iterate over the splash screens. Format:
|
||||
# $1: splash_name
|
||||
# $2: text
|
||||
# $3: arguments
|
||||
set -- "splash-loading" "Loading..." "--center" \
|
||||
"splash-noboot" "boot partition not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-noinitramfsextra" "initramfs-extra not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-norootfs" "rootfs not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-mounterror" "unable to mount root partition\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-debug-shell" "WARNING\\ndebug-shell is active\\nhttps://postmarketos.org/debug-shell" "--center" \
|
||||
"splash-charging-error" "CHARGING MODE\\nerror starting charging-sdl\\nhttps://postmarketos.org/troubleshooting" "--center"
|
||||
|
||||
# Loop through the splash screens definitions
|
||||
while [ $# -gt 2 ]
|
||||
do
|
||||
splash_name=$1
|
||||
splash_text=$2
|
||||
splash_args=$3
|
||||
|
||||
if [ "${deviceinfo_framebuffer_landscape}" == "true" ]; then
|
||||
splash_args="${splash_args} --landscape"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
pmos-make-splash --text="${splash_text}" $splash_args --config "${splash_config}" \
|
||||
"$splash_width" "$splash_height" "$srcdir/${splash_name}.ppm"
|
||||
gzip "$srcdir/${splash_name}.ppm"
|
||||
|
||||
shift 3 # move to the next 3 arguments
|
||||
done
|
||||
}
|
||||
|
||||
# Convert an input calibration matrix from pixel coordinates to 0-1 coordinates
|
||||
# and echo it for libinput.
|
||||
# Parameters:
|
||||
|
@ -64,6 +103,8 @@ echo_libinput_calibration()
|
|||
echo "ENV{LIBINPUT_CALIBRATION_MATRIX}=\"$1 $2 $x_offset $4 $5 $y_offset\", \\"
|
||||
}
|
||||
|
||||
generate_splash_screens
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [ -n "$deviceinfo_dev_touchscreen" ]; then
|
||||
# Create touchscreen udev rule
|
||||
|
|
|
@ -20,6 +20,7 @@ fi
|
|||
|
||||
install -Dm644 "$srcdir/deviceinfo" \
|
||||
"$pkgdir/etc/deviceinfo"
|
||||
install -Dm644 -t "$pkgdir/usr/share/postmarketos-splashes" "$srcdir"/*.ppm.gz
|
||||
|
||||
if [ -f "$srcdir/90-$pkgname.rules" ]; then
|
||||
install -Dm644 "$srcdir/90-$pkgname.rules" \
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
pkgname=postmarketos-mkinitfs
|
||||
pkgver=0.8.0
|
||||
pkgrel=2
|
||||
pkgver=0.9.0
|
||||
pkgrel=0
|
||||
pkgdesc="Tool to generate initramfs images for postmarketOS"
|
||||
url="https://postmarketos.org"
|
||||
# multipath-tools: kpartx
|
||||
depends="busybox-extras lddtree cryptsetup kmod multipath-tools postmarketos-splash
|
||||
depends="busybox-extras lddtree cryptsetup kmod multipath-tools
|
||||
device-mapper parted e2fsprogs e2fsprogs-extra osk-sdl charging-sdl triggerhappy xz bzip2 lz4"
|
||||
triggers="$pkgname.trigger=/etc/postmarketos-mkinitfs/hooks:/usr/share/kernel/*"
|
||||
source="init.sh.in init_functions.sh mkinitfs.sh"
|
||||
|
@ -25,4 +25,4 @@ package() {
|
|||
}
|
||||
sha512sums="1d49db8a48ad513cc548b8a0ea23cc64518e71c93863155b4e9d2271fb46090506331c03d6955d693c8568c248ecc76b218efe4a6f6bba57c41c5f6d775dc61b init.sh.in
|
||||
3bcec7b35ced7e87c301f71a892e54aa40983396e2ebaa3c8cbd84c91f711b3ca0e30fbc3104b1a1018ec1af51844ba90a63d380359b51db6242562d21776ed0 init_functions.sh
|
||||
3f918f8b5967b73e507c2ddf36dccc24fee98298f05ca23e22605400de95137f8877e09769616e7db388557c645fb45c03e1e6b5bab815ec9f853c318f0431f1 mkinitfs.sh"
|
||||
eaad43a846eea96abe1bb876369b0925ab52a141545b13099c634f9422017b5e57f809274ae89c0b53ade1db2c5cc4e96bb9841ad933d68f7664543992e8391b mkinitfs.sh"
|
||||
|
|
|
@ -314,79 +314,6 @@ create_bootimg()
|
|||
fi
|
||||
}
|
||||
|
||||
# Create splash screens
|
||||
# $1: "false" to skip clearing the cache if one image is missing
|
||||
generate_splash_screens()
|
||||
{
|
||||
[ "$1" != "false" ] && clean="true" || clean="false"
|
||||
|
||||
splash_version=$(apk info -v | grep postmarketos-splash)
|
||||
if [ -z "$splash_version" ]; then
|
||||
# If package is not installed yet, use latest version from repository
|
||||
splash_version=$(apk search -x postmarketos-splash)
|
||||
fi
|
||||
splash_config="/etc/postmarketos/splash.ini"
|
||||
splash_config_hash=$(md5sum "$splash_config")
|
||||
splash_width=${deviceinfo_screen_width:-720}
|
||||
splash_height=${deviceinfo_screen_height:-1280}
|
||||
splash_cache_dir="/var/cache/postmarketos-splashes"
|
||||
|
||||
# Overwrite $@ to easily iterate over the splash screens. Format:
|
||||
# $1: splash_name
|
||||
# $2: text
|
||||
# $3: arguments
|
||||
set -- "splash-loading" "Loading..." "--center" \
|
||||
"splash-noboot" "boot partition not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-noinitramfsextra" "initramfs-extra not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-norootfs" "rootfs not found\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-mounterror" "unable to mount root partition\\nhttps://postmarketos.org/troubleshooting" "--center" \
|
||||
"splash-debug-shell" "WARNING\\ndebug-shell is active\\nhttps://postmarketos.org/debug-shell" "--center" \
|
||||
"splash-charging-error" "CHARGING MODE\\nerror starting charging-sdl\\nhttps://postmarketos.org/troubleshooting" "--center"
|
||||
|
||||
# Ensure cache folder exists
|
||||
mkdir -p "${splash_cache_dir}"
|
||||
|
||||
# Loop through the splash screens definitions
|
||||
while [ $# -gt 2 ]
|
||||
do
|
||||
splash_name=$1
|
||||
splash_text=$2
|
||||
splash_args=$3
|
||||
|
||||
if [ "${deviceinfo_framebuffer_landscape}" == "true" ]; then
|
||||
splash_args="${splash_args} --landscape"
|
||||
fi
|
||||
|
||||
# Compute hash using the following values concatenated:
|
||||
# - postmarketos-splash package version
|
||||
# - splash config file
|
||||
# - device resolution
|
||||
# - text to be displayed
|
||||
# - extra arguments
|
||||
splash_hash_string="${splash_version}#${splash_config_hash}#${splash_width}#${splash_height}#${splash_text}#${splash_args}"
|
||||
splash_hash="$(echo "${splash_hash_string}" | md5sum | awk '{ print $1 }')"
|
||||
|
||||
if ! [ -e "${splash_cache_dir}/${splash_name}_${splash_hash}.ppm.gz" ]; then
|
||||
|
||||
# If a cached file is missing, clear the whole cache and start again skipping this step
|
||||
if [ "$clean" = "true" ]; then
|
||||
rm -f ${splash_cache_dir}/*
|
||||
generate_splash_screens false
|
||||
return
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
pmos-make-splash --text="${splash_text}" $splash_args --config "${splash_config}" \
|
||||
"$splash_width" "$splash_height" "${splash_cache_dir}/${splash_name}_${splash_hash}.ppm"
|
||||
gzip "${splash_cache_dir}/${splash_name}_${splash_hash}.ppm"
|
||||
fi
|
||||
|
||||
cp "${splash_cache_dir}/${splash_name}_${splash_hash}.ppm.gz" "${tmpdir}/${splash_name}.ppm.gz"
|
||||
|
||||
shift 3 # move to the next 3 arguments
|
||||
done
|
||||
}
|
||||
|
||||
# Append the correct device tree to the linux image file or copy the dtb to the boot partition
|
||||
append_or_copy_dtb()
|
||||
{
|
||||
|
@ -458,6 +385,7 @@ copy_files "$(get_modules)" "$tmpdir"
|
|||
copy_files "$(get_binaries)" "$tmpdir"
|
||||
copy_files "/etc/deviceinfo" "$tmpdir"
|
||||
copy_files "/etc/postmarketos-mkinitfs/hooks/*.sh" "$tmpdir"
|
||||
cp /usr/share/postmarketos-splashes/*.ppm.gz "$tmpdir"
|
||||
create_device_nodes
|
||||
ln -s "/bin/busybox" "$tmpdir/bin/sh"
|
||||
install -Dm755 "/usr/share/postmarketos-mkinitfs/init.sh.in" \
|
||||
|
@ -466,7 +394,6 @@ install -Dm755 "/usr/share/postmarketos-mkinitfs/init_functions.sh" \
|
|||
"$tmpdir/init_functions.sh"
|
||||
|
||||
# finish up
|
||||
generate_splash_screens
|
||||
replace_init_variables
|
||||
create_cpio_image "$tmpdir" "$outfile"
|
||||
append_or_copy_dtb
|
||||
|
|
Loading…
Reference in a new issue