Files

103 lines
7.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Installation guide
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.
## Option A: Flash a prebuilt release ZIP
### Host prerequisites (no Docker required)
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).
### Steps
```sh
unzip geminux-<version>-<codename>-gemini-x27.zip
cd geminux-<version>-<codename>-gemini-x27
sha256sum -c SHA256SUMS.txt
cat FLASH-INSTRUCTIONS.txt # bundled plain-text flashing guide
```
Continue to [Flashing to the Gemini PDA](#flashing-to-the-gemini-pda) below.
## Option B: Build from source and package a release
### Build host prerequisites
In addition to `python3`, `libusb-1.0`, `e2fsprogs`, and optional `img2simg`/`simg2img`, building images requires **Docker** (`docker`).
```sh
./rebuild-image.sh # or ./rebuild-image.sh --rebuild-all --force-bootstrap
./scripts/check-rebuild.sh # offline APK, ELF, DTB, image & Python unit checks
```
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).
## Flashing to the Gemini PDA
> [!WARNING]
> Never wipe or overwrite MediaTek factory calibration, baseband, or bootloader partitions (`proinfo`, `nvram`, `nvdata`, `protect1`, `protect2`, `seccfg`, `lk`, `tee1`, `md1img`, `scp1`, `preloader`).
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:
```sh
./flash-mtk.sh --extract-firmware --system-img /path/to/system.img
```
### Flasher commands
```sh
# 1. Optional standalone backup -> backup/<timestamp>/ + pgpt.bin + sgpt.bin:
./flash-mtk.sh --only-backup
# 2. Full interactive install (prompts for user/root credentials & optional LUKS2):
./flash-mtk.sh --flash-full
# 3. Non-interactive example with explicit username, prompted passwords & LUKS2:
./flash-mtk.sh --flash-full --username alice --ask-user-password --ask-root-password --encrypt
# 4. Keep image defaults (unencrypted, login: user / geminux):
./flash-mtk.sh --flash-full --use-default-credentials
```
**What `--flash-full` runs**: Resolves credentials/LUKS2 passphrase upfront, backs up protected partitions into `backup/<timestamp>/` (reuse via `--skip-backup --backup-dir ...`), verifies protected GPT boundaries (`--force-gpt` overrides), writes & readback-checks updated Primary/Backup GPT, stages `geminux-rootfs.img` cleanly with firmware injection, `/etc/{passwd,group,shadow}` provisioning, and optional LUKS2 (`aes-xts-plain64`, Argon2id), writes & readback-verifies `boot`, `recovery`, and `boot2`, flashes `linux`, and reboots (`--no-reboot` / `--poweroff` overrides).
### Partial updates and restore
```sh
./flash-mtk.sh --flash-kernel-only
./flash-mtk.sh --flash-rootfs-only --username alice --ask-user-password --encrypt
./flash-mtk.sh --customize-rootfs /tmp/custom.img --username alice --encrypt
./flash-mtk.sh --restore-backup backup/<timestamp>
```
## First boot and recovery notes
- **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`.
## Live Gemini PDA x27 hardware validation checklist
- [ ] `uname -r` shows `7.3.5-geminux`; `lsmod` shows `mediatek_drm`, `panfrost`, `mt6797_ccci_cldma`, `mt6797_wlan_core`, and `btmt6797`.
- [ ] `ssd2092` touchscreen, `geminux-touchd` gestures, and XKB keys (`Fn+1..0`, `Fn+Z/X`, `Fn+Alt = Mod4`, Planet key) work; `glxinfo | grep -i renderer` reports Panfrost.
- [ ] **Anodized** default theme, `geminux-dark.png` default wallpaper, interactive theme editor, and `geminux-apply-wallpaper` restore cleanly.
- [ ] Wi-Fi (`geminux-net`), Bluetooth, and PipeWire audio (speaker, 3.5 mm jack, internal mic) function normally.
- [ ] With MD1 firmware present, `/dev/ccci_md_ctl`, `/dev/ttyC0`, `doas geminux-cellctl status` (`MD_STATE=READY` + SIM/ST33 eUICC), `geminux-imsd`, `ccmni*` data, voice calls (`geminux-dialer`), and SMS (`geminux-sms`) work.
- [ ] Front camera capture (`geminux-camera`), external `SiI9024` HDMI, `/media/sdcard` automount, `Fn+F` Airplane Mode, lid-close & overnight battery deep sleep recovery (`0013`–`0014`), and `geminux-power-audit` (`pmic_modes=Y`, `allow_md1=Y`, `gpu_rail_suspends`, standby draw in Airplane Mode ON and OFF) succeed.