Skip to content

kinsamanka/OpenStick-Builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenStick Image Builder

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.

Build Instructions

Build locally

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/

Quick

  • build
    cd OpenStick-Builder/
    sudo ./build.sh

Detailed

  • 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

On the cloud using Github Actions

  1. Fork this repo
  2. 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

Customizations

Edit scripts/setup.sh to add/remove packages. Note that this script is running inside the chroot environment.

Firmware Installation

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

Prerequisites

  • EDL
  • Android fastboot tool
    sudo apt install fastboot
    

Steps

  • 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

Post-Install

  • 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 devicetree

    sed -i 's/yiming-uz801v3/<BOARD>/' /boot/extlinux/extlinux.conf

    where <BOARD> is

    • thwc-uf896 for UF896 boards
    • thwc-ufi001c for UFIxxx boards
    • jz01-45-v33 for JZxxx boards
    • fy-mf800 for MF800 boards
  • To maximize the rootfs partition

    resize2fs /dev/disk/by-partlabel/rootfs
  • To update the kernel of the debian image

    wget -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.

About

Debian image builder for MSM8916 based 4G modem dongles

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages