Image builder for MSM8916 based 4G modem dongles
This builder uses the precompiled kernel provided by postmarketOS for Qualcomm MSM8916 devices.
Note
This branch generates a debian
image, use the alpine branch for an alpine
image.
This has been tested to work on Ubuntu 22.04
- clone
git clone --recurse-submodules https://github.com/kinsamanka/OpenStick-Builder.git cd OpenStick-Builder/
- build
cd OpenStick-Builder/ sudo ./build.sh
-
install dependencies
sudo scripts/install_deps.sh
-
build hyp and lk2nd
these custom bootloader allows basic support for
extlinux.conf
file, similar to u-boot and depthcharge.sudo scripts/build_hyp_aboot.sh
-
extract Qualcomm firmware
extracts the bootloader and creates a new partition table that utilizes the full emmc space
sudo scripts/extract_fw.sh
-
create rootfs using debootstrap
sudo scripts/debootstrap.sh
-
build gadget-tools
sudo scripts/build_gt.sh
-
create images
sudo scripts/build_images.sh
The generated firmware files will be stored under the files
directory
- Fork this repo
- Run the Build workflow
- click and run Run workflow
- once the workflow is done, click on the workflow summary and then download the resulting artifact
Edit scripts/setup.sh
to add/remove packages. Note that this script is running inside the chroot
environment.
Warning
The following commands can potentially brick your device, making it unbootable. Proceed with caution and at your own risk!
Important
Make sure to perform a backup of the original firmware using the command edl rf orig_fw.bin
- EDL
- Android fastboot tool
sudo apt install fastboot
-
Enter Qualcom EDL mode using this guide
-
Backup required partitions
The following files are required from the original firmware:
fsc.bin
fsg.bin
modem.bin
modemst1.bin
modemst2.bin
persist.bin
sec.bin
Skip this step if these files are already present
for n in fsc fsg modem modemst1 modemst2 persist sec; do edl r ${n} ${n}.bin done
-
Install
aboot
edl w aboot aboot.mbn
-
Reboot to fastboot
edl e boot edl reset
-
Flash firmware
fastboot flash partition gpt_both0.bin fastboot flash aboot aboot.mbn fastboot flash hyp hyp.mbn fastboot flash rpm rpm.mbn fastboot flash sbl1 sbl1.mbn fastboot flash tz tz.mbn fastboot flash boot boot.bin fastboot flash rootfs rootfs.bin
-
Restore original partitions
for n in fsc fsg modem modemst1 modemst2 persist sec; do fastboot flash ${n} ${n}.bin done
-
Reboot
fastboot reboot
-
Network configuration
wlan0 ssid Openstick password openstick ip addr 192.168.4.1 usb0 ip addr 192.168.5.1 -
Default user
username user password 1 -
If your device is not based on UZ801, modify
/boot/extlinux/extlinux.conf
to use the correct devicetreesed -i 's/yiming-uz801v3/<BOARD>/' /boot/extlinux/extlinux.conf
where
<BOARD>
isthwc-uf896
for UF896 boardsthwc-ufi001c
for UFIxxx boardsjz01-45-v33
for JZxxx boardsfy-mf800
for MF800 boards
-
To maximize the
rootfs
partitionresize2fs /dev/disk/by-partlabel/rootfs
-
To update the kernel of the
debian
imagewget -O - http://mirror.postmarketos.org/postmarketos/<branch>/aarch64/linux-postmarketos-qcom-msm8916-<version>.apk \ | tar xkzf - -C / --exclude=.PKGINFO --exclude=.SIGN* 2>/dev/null
Specify the correct
<branch>
and<version>
values.