Flash a **Planet Computers Gemini PDA** (Wi-Fi + 4G, MT6797X) directly from Linux using Geminux's bundled pure-Python MediaTek BROM/DA flasher—either from a prebuilt release ZIP or from a local source build.
1. Linux x86_64/arm64 PC with `python3`, `python3-pip`, `libusb-1.0`, `e2fsprogs` (`debugfs`, `e2fsck`), and `sudo` (raw USB access).
2. Optional: `cryptsetup` (only for `--encrypt` LUKS2 full-disk encryption) and `simg2img` (only if extracting firmware from a sparse stock Android `system.img`).
3. Gemini PDA (x27) connected directly to a host USB port via USB-C data cable (avoid unpowered hubs).
Outputs `images/boot-geminux.img`, `images/recovery-geminux.img`, `images/geminux-rootfs.img` (plus `.simg` if `img2simg` is installed), and `images/SHA256SUMS`.
### Package a redistributable release ZIP
Create a self-contained ZIP archive under `releases/` containing the images, `SHA256SUMS.txt`, plain-text `FLASH-INSTRUCTIONS.txt`, `flash-mtk.sh`, helper scripts, and `vendor/mtkclient/`:
```sh
./package-image.sh # or ./rebuild-image.sh --package
By default, [scripts/package-release-zip.py](scripts/package-release-zip.py) versions the archive from the latest git commit (`<YYYYMMDD>-<shortsha>`, overridable with `--version` or `GEMINUX_VERSION`), stages a copy of `geminux-rootfs.img`, strips SSH host/authorized keys while keeping `/lib/firmware/mediatek/mt6797/` blobs (`--include-firmware` default), verifies `e2fsck -fn` and ZIP CRCs, and writes `<archive>.zip.sha256` (`--strip-firmware` omits proprietary blobs for clean redistribution; `--keep-ssh-keys` keeps SSH keys).
Geminux claims user-writable eMMC past `LBA 0x70000` (`0x0E000000`), replacing Android `system`, `cache`, and `userdata` with `boot`, `recovery`, `boot2`, and a single full-disk `linux` ext4 partition.
- **Connecting BROM/Preloader mode**: Keep the Gemini powered off and unplugged, start the flash command on your host, then plug the USB-C cable into the **left** USB-C port (closest to `Esc`). [flash-mtk.sh](flash-mtk.sh) pauses host `ModemManager` temporarily so `/dev/ttyACM*` is not grabbed mid-handshake.
- **Turnkey firmware handling**: Clean release archives do not ship proprietary MediaTek blobs. During `--flash-full`, [flash-mtk.py](flash-mtk.py) automatically reads your device's stock Android `system` partition before repartitioning, saves Wi-Fi/BT/SPM blobs into `firmware-cache/mt6797/`, and injects them offline into the staged `linux` rootfs via `debugfs` (`--skip-firmware-inject` disables). If Android was already replaced earlier, extract blobs once from a stock `system.img` first:
- **eSIM persistence**: Profiles on the hardware ST33 eUICC survive `linux` reflashes (whereas flashing `linux` replaces `/` and `/home`).
- **Power on & USB fuel gauge**: Unplug USB-C and hold **Esc** to boot. If booted on USB power, `bq25890` pauses charging (~15 s while `VSYS` stays USB-powered) so `mt6351-fuel-gauge` calibrates true open-circuit battery voltage.
- **LUKS2 unlock & ext4 expand**: Encrypted installs prompt on `tty1` using `/etc/gemini-us.kmap` and unlock the full dynamic `linux` partition (`--allow-discards`). First boot automatically runs `e2fsck -p` and `resize2fs -f` (~58 GiB) and creates `/var/lib/geminux/.rootfs-resized`. For LUKS2 cipher/kernel details, see [ARCHITECTURE.md](ARCHITECTURE.md).
- **Desktop defaults**: Auto-logs into XLibre + DWM as UID `10000` (provisioned username or `user`, default password `geminux`, default **Anodized** theme, and default `geminux-dark.png` wallpaper).
- **USB NCM rescue**: Connecting USB-C brings up `usb0` (`172.16.42.1/24`); recovery initramfs provides LUKS2-aware `unlock-root`, `check-fs`, and `mount-root`.