Skip to content

Instantly share code, notes, and snippets.

@zhuowei
Created August 25, 2019 01:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zhuowei/69a9b8d1e1704f0600ecf91a36fd4b8c to your computer and use it in GitHub Desktop.
Save zhuowei/69a9b8d1e1704f0600ecf91a36fd4b8c to your computer and use it in GitHub Desktop.
Attempting to boot the modem on Pixel 3 XL - it just crashes the phone.
No time to get this packaged properly
see the Moto G wiki page for how to do this properly:
https://wiki.postmarketos.org/wiki/Moto_G4_Play_(motorola-harpia)
but here's how to do it in the ramdisk:
# Pack the modem firmware
Grab the radio firmware from the factory image:
dd bs=140 skip=1 if=radio-crosshatch-g845-00048-190722-b-5745561.img of=radio.img
mount -o loop radio.img tempmnt
cd tempmnt/images
tar czf /tmp/modem.tar.gz *
# Pack qcom_rmtfs
wget http://postmarketos.brixit.nl/aarch64/qrtr-1.0_git20180131-r1.apk
wget http://postmarketos.brixit.nl/aarch64/qcom_rmtfs-0.0_git20180131-r3.apk
wget http://dl-cdn.alpinelinux.org/alpine/v3.9/main/aarch64/eudev-libs-3.2.7-r0.apk
# on your host computer,
# copy the .apk files and the modem.tar.gz into your kernel's build directory
# then
python3 -m http.server 8000
# to serve the kernel modules + apks + modem.tar.gz over http
# now do this on the phone!
# Run this in the initramfs debug shell hook.
# --------
# Insert modules
# Note: manually loading modules is only necessary because I'm in the
# initramfs: in actual pmOS, eudev loads these for us.
# (I want to manually load these and watch the dmesg: that's why I'm not using eudev)
# (ok, and also because I don't want to flash my phone...)
wget 172.16.42.2:8000/drivers/remoteproc/remoteproc.ko
wget 172.16.42.2:8000/drivers/soc/qcom/qcom_aoss.ko
wget 172.16.42.2:8000/drivers/rpmsg/qcom_glink_smem.ko
wget 172.16.42.2:8000/drivers/soc/qcom/qmi_helpers.ko
wget 172.16.42.2:8000/drivers/remoteproc/qcom_sysmon.ko
wget 172.16.42.2:8000/drivers/remoteproc/qcom_q6v5.ko
wget 172.16.42.2:8000/drivers/soc/qcom/mdt_loader.ko
wget 172.16.42.2:8000/drivers/remoteproc/qcom_common.ko
wget 172.16.42.2:8000/drivers/soc/qcom/glink_ssr.ko
wget 172.16.42.2:8000/net/qrtr/qrtr.ko
wget 172.16.42.2:8000/net/qrtr/qrtr-smd.ko
wget 172.16.42.2:8000/net/qrtr/qrtr-tun.ko
wget 172.16.42.2:8000/drivers/remoteproc/qcom_q6v5_mss.ko
wget 172.16.42.2:8000/drivers/soc/qcom/rmtfs_mem.ko
insmod remoteproc.ko
insmod qcom_aoss.ko
insmod qcom_glink_smem.ko
insmod qmi_helpers.ko
insmod qcom_sysmon.ko
insmod qcom_q6v5.ko
insmod mdt_loader.ko
insmod qcom_common.ko
insmod glink_ssr.ko
insmod qrtr.ko
insmod qrtr-smd.ko
insmod qrtr-tun.ko
insmod qcom_q6v5_mss.ko
insmod rmtfs_mem.ko
# prep the firmware
wget 172.16.42.2:8000/modem.tar.gz
mkdir /lib/firmware
cd /lib/firmware
tar xf /modem.tar.gz
cd /
wget 172.16.42.2:8000/busybox
chmod 755 /busybox
/busybox uevent mdev &
# prep rmtfs
wget 172.16.42.2:8000/qrtr-1.0_git20180131-r1.apk
wget 172.16.42.2:8000/qcom_rmtfs-0.0_git20180131-r3.apk
wget 172.16.42.2:8000/eudev-libs-3.2.7-r0.apk
tar xf qrtr-1.0_git20180131-r1.apk
tar xf qcom_rmtfs-0.0_git20180131-r3.apk
tar xf eudev-libs-3.2.7-r0.apk
mount -t devtmpfs devtmpfs /dev
# Boot the modem!
echo start >/sys/devices/platform/soc/4080000.remoteproc/remoteproc/remoteproc0/state
# Try to start rmtfs to provide modem with startup info
/usr/sbin/qcom_rmtfs
# The modem will boot up (!), qcom_rmtfs will fail to find the modem,
# and a few seconds later the modem will crash and reboot the phone.
#
# E|qrtr: bind(14): Invalid argument
# failed to create qrtr socket
# E|qrtr: bind(14): Invalid argument
# failed to create qrtr socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment