Files
pmaports-rtwo/device/testing/device-pine64-pinenote/pinenote-init-waveform.initd
T
Antoine Martin b6954d59e8 device-pine64-pinenote: add waveform management initd
Previously, waveform information was provided by maintainer. Since every
device panel is slightly different, waveform information is actually
available on the device in a specific partition (partlabel=waveform).

We thus use the device waveform information instead of the less
appropriate generic binary. We do this by having an initd script extract
and prepare the binary from the partition using hrdl's scripts. The
rockchip_ebc module expects both ebc.wbf and custom_wf.bin under
/lib/firmware/rockchip. Thus, if those files are not detected, the initd
runs the necessary operations, regenerates with mkinitfs, and reloads
rockchip_ebc.

gpio_rockchip is also added to modules-initfs as the kernel now compiles
it as a module

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6667
[ci:skip-build]: already built successfully in CI
2025-06-18 08:26:14 -04:00

35 lines
1.1 KiB
Plaintext

#!/sbin/openrc-run
name=$RC_SVCNAME
description="Sets up rockchip_ebc ebc.wbf waveform from waveform partition"
error_log=/var/log/pinenote/$RC_SVCNAME.log
start() {
# Check for the file existence
if [ -s "/lib/firmware/rockchip/ebc.wbf" ] && [ -s "/lib/firmware/rockchip/custom_wf.bin" ]; then
einfo "No need to init waveform"
unset -f start
return 0
fi
ebegin "Extracting waveform"
cd /tmp
/usr/libexec/pinenote/waveform_extract.sh 2>&1 | tee -a "$error_log"
/usr/libexec/pinenote/wbf_to_custom.py /lib/firmware/rockchip/ebc.wbf 2>&1 | tee -a "$error_log"
mv custom_wf.bin /lib/firmware/rockchip/.
einfo "Regenerating initramfs"
/usr/sbin/mkinitfs 2>&1 | tee -a "$error_log"
einfo "Reloading rockchip_ebc"
modprobe -r rockchip_ebc
modprobe rockchip_ebc
eend $?
}
start_pre() {
checkpath --directory --owner root:root --mode 0775 \
/lib/firmware/rockchip \
/var/log/pinenote
}