把 MSM8916 芯片的 4G 上网卡(常见形态是 USB 随身 Wi-Fi 棒)刷成能跑 Debian 的袖珍主机,靠的就是这套镜像构建脚本。内核直接取 postmarketOS 为 Qualcomm MSM8916 预编译的版本,省掉自己搭交叉工具链;脚本另外编译 hyp 与 lk2nd 两个定制 bootloader,补上这类设备的基础支持,最后打出可烧写的镜像。当前分支产出 Debian,要 Alpine 切到 alpine 分支即可。依赖装法与构建分成两步,方便单独重跑:递归克隆子模块、装好依赖、再 sudo ./build.sh。作者只在 Ubuntu 22.04 上实测过。MIT。手上有闲置 dongle、想拿它当廉价 ARM 小机器折腾的嵌入式玩家,可以照文档走一遍;记录 104 stars、205 forks,fork 反而多于 star。
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
debianimage, use the alpine branch for analpineimage.
This has been tested to work on Ubuntu 22.04
- clone
shell
git clone --recurse-submodules https://github.com/kinsamanka/OpenStick-Builder.git
cd OpenStick-Builder/
shell
cd OpenStick-Builder/
sudo ./build.shshell
sudo scripts/install_deps.shthese custom bootloader allows basic support for extlinux.conf file, similar to u-boot and depthcharge.
shell
sudo scripts/build_hyp_aboot.sh
- extract Qualcomm firmware
extracts the bootloader and creates a new partition table that utilizes the full emmc space
shell
sudo scripts/extract_fw.sh
- create rootfs using debootstrap
shell
sudo scripts/debootstrap.sh
shell
sudo scripts/build_gt.shshell
sudo scripts/build_images.shThe generated firmware files will be stored under the files directory
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 commandedl rf orig_fw.bin
sudo apt install fastbootThe 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
shell
for n in fsc fsg modem modemst1 modemst2 persist sec; do
edl r ${n} ${n}.bin
done
- Install aboot
shell
edl w aboot aboot.mbn
- Reboot to fastboot
shell
edl e boot
edl reset
- Flash firmware
shell
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
shell
for n in fsc fsg modem modemst1 modemst2 persist sec; do
fastboot flash ${n} ${n}.bin
done
- Reboot
shell
fastboot reboot
| wlan0 | |
|---|---|
| ssid | Openstick |
| password | openstick |
| ip addr | 192.168.4.1 |
| usb0 | |
|---|---|
| ip addr | 192.168.5.1 |
| username | user |
| password | 1 |
/boot/extlinux/extlinux.conf to use the correct devicetree
shell
sed -i 's/yiming-uz801v3/<BOARD>/' /boot/extlinux/extlinux.confwhere <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
shell
resize2fs /dev/disk/by-partlabel/rootfs
To update the kernel of the debian image
shell
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.
| 日期 | 榜单 | 排名 | 周期新增 | 总 STAR |
|---|