diff --git a/device/community/soc-qcom-msm8953/APKBUILD b/device/community/soc-qcom-msm8953/APKBUILD
index 5d7c0ca0e90bc520029e91cf8b1a3cc7277d031c..dc1b2f35eeefd29830edd71f328e68d9518e6a2c 100644
--- a/device/community/soc-qcom-msm8953/APKBUILD
+++ b/device/community/soc-qcom-msm8953/APKBUILD
@@ -1,8 +1,8 @@
 # Maintainer: Barnabas Czeman <trabarni@gmail.com>
 pkgname=soc-qcom-msm8953
 pkgdesc="Common package for Qualcomm MSM8953 devices"
-pkgver=11
-pkgrel=2
+pkgver=12
+pkgrel=0
 url="https://postmarketos.org"
 license="BSD-3-Clause"
 arch="aarch64"
@@ -21,6 +21,7 @@ source="
 	90-feedbackd-pm8xxx-vib.rules
 	q6voiced.conf
 	adreno-a506-quirks.sh
+	moto-modem-rfs-setup.openrc
 "
 
 package() {
@@ -57,8 +58,7 @@ modem_openrc() {
 		rmtfs-openrc
 		tqftpserv-openrc
 	"
-
-	mkdir -p "$subpkgdir"
+	install -Dm755 $srcdir/moto-modem-rfs-setup.openrc "$subpkgdir"/etc/init.d/moto-modem-rfs-setup
 }
 
 gpu() {
@@ -74,4 +74,5 @@ sha512sums="
 90fca4a3291a2c84c0b20e41308c4698374ba896e9365ca80dbfd0c0c4f7dc08317f3dd865a3c7f6707c81b02f5bb24136d1172253d2e4fdd50039bbbf02a178  90-feedbackd-pm8xxx-vib.rules
 3a4a9322839d4b3ef9d79668a37840a9f444954759ae3c512e694051d2f9a2573db42ad6c4c1a5c75eeb861232a27ba1a8cef9b503decd54ead25a96e3dd6f98  q6voiced.conf
 d546c99ca8d406b4e2e3901a417e4e461314a38f2f01c48525e44ca524ad57af7bfc280f416bda90573b0bfb1cca27d45cb0a0ed44e999ef8d406a380d1fdbb2  adreno-a506-quirks.sh
+d4fd0f3406c9f004e9cae7bc500c5713aab75f102f8e3ea1af820865f01eb03def01cd9ed3e8a184c7dfc22ab419628fad17957a3782885d96eb36e94461e842  moto-modem-rfs-setup.openrc
 "
diff --git a/device/community/soc-qcom-msm8953/moto-modem-rfs-setup.openrc b/device/community/soc-qcom-msm8953/moto-modem-rfs-setup.openrc
new file mode 100644
index 0000000000000000000000000000000000000000..9fcbeb5449a5a5ba9a93d74608ec815d6bdc7d42
--- /dev/null
+++ b/device/community/soc-qcom-msm8953/moto-modem-rfs-setup.openrc
@@ -0,0 +1,40 @@
+#!/sbin/openrc-run
+
+description="Setup modem firmware for tqftpserv"
+
+depend() {
+	before tqftpserv
+}
+
+start()
+{
+	MODEM_FIRMWARE_DIR="/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 $MODEM_FIRMWARE_DIR
+
+		cp -R "$PERSIST_PATH"/rfs/msm/mpss/ "$MODEM_FIRMWARE_DIR"/readwrite
+
+		umount $PERSIST_DEV
+		rmdir $PERSIST_PATH
+	fi
+
+	ln -s "$MODEM_FIRMWARE_DIR"/readwrite/ /tmp/tqftpserv
+}
diff --git a/device/community/soc-qcom-msm8953/soc-qcom-msm8953-modem-openrc.post-install b/device/community/soc-qcom-msm8953/soc-qcom-msm8953-modem-openrc.post-install
index e83d9b2021b920334fef200451cbd1c69a0a75d4..bfa0d1a0b765033ce29482dce2af4396bfe5ce48 100644
--- a/device/community/soc-qcom-msm8953/soc-qcom-msm8953-modem-openrc.post-install
+++ b/device/community/soc-qcom-msm8953/soc-qcom-msm8953-modem-openrc.post-install
@@ -1,2 +1,3 @@
 #!/bin/sh
 rc-update add -q q6voiced default
+rc-update add -q moto-modem-rfs-setup boot