Files
pmaports-rtwo/device/community/soc-qcom-msm8953/moto-modem-rfs-setup.openrc
T
Aster Boese ab7a887f16 treewide: finish moving community firmware under /usr/
Modifies mkinitfs *.files files to expect firmware under `/usr/lib/` and
cleans up firmware installs missed by the initial migration.

https://gitlab.postmarketos.org/postmarketOS/pmaports/-/work_items/4354

Signed-off-by: Aster Boese <asterboese@mailbox.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8450>
2026-05-18 12:40:26 +00:00

41 lines
1.1 KiB
Plaintext

#!/sbin/openrc-run
description="Setup modem firmware for tqftpserv"
depend() {
before tqftpserv
}
start()
{
MODEM_FIRMWARE_DIR="/usr/lib/firmware/postmarketos/persist"
# The firmware present here is unique to each device
# Using the firmware of one device on another can will simply fail
# This is needed because motorola devices derive IMEI and other unique
# IDs from these files
# See also: https://forum.xda-developers.com/g5-plus/how-to/fix-persist-resolve-imei0-explanation-t3825147
if [ ! -d $MODEM_FIRMWARE_DIR ]; then
# Make a copy of the firmware if its not already made
# Use the copy instead of the original, because if due to some error
# somehow the firmware gets corrupted, the original firmware will
# still be available on the 'persist' partition
PERSIST_PATH="/tmp/persist"
PERSIST_DEV="/dev/disk/by-partlabel/persist"
mkdir -p $PERSIST_PATH
mount $PERSIST_DEV -o ro,noatime $PERSIST_PATH
mkdir -p $MODEM_FIRMWARE_DIR
cp -R "$PERSIST_PATH"/rfs/msm/mpss/ "$MODEM_FIRMWARE_DIR"/readwrite
umount $PERSIST_PATH
rmdir $PERSIST_PATH
fi
ln -s "$MODEM_FIRMWARE_DIR"/readwrite/ /tmp/tqftpserv
}