Package release ZIPs, streamline docs, and backport X11 DPMS/lock fixes
- Streamline README, INSTALL, MANUAL, ARCHITECTURE, and POWER-OPTIMIZATION docs - Add release ZIP packager (package-image.sh, scripts/package-release-zip.py, rebuild-image.sh --package) with sanitized rootfs, SHA256SUMS, and FLASH-INSTRUCTIONS.txt - Add automatic offline MT6797 firmware ext4 injection in flash-mtk.py and scripts/extract-vendor-fw.py - Backport X11 DPMS wake + XResetScreenSaver in geminux-powerd and _GEMINUX_LOCK_READY + grab-first sync in geminux-lock, rebuild aarch64 prebuilts, and expand tests
This commit is contained in:
1 parent
5472d4273a
commit
180d0a91e6
18 files changed
+1242
-480
No files matched your search
+62
-88
@@ -1,128 +1,102 @@
|
||||
# Installation guide
|
||||
|
||||
This guide walks through building Geminux images and flashing a **Planet Computers Gemini PDA** (Wi-Fi + 4G, MT6797X) directly from Linux without MediaTek's proprietary FlashTool GUI.
|
||||
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.
|
||||
|
||||
## Prerequisites on the Linux host
|
||||
## Option A: Flash a prebuilt release ZIP
|
||||
|
||||
1. **Docker** (`docker`) installed and running for `aarch64` cross-compilation and Alpine rootfs assembly.
|
||||
2. **Host tools**: `python3`, `libusb-1.0`, and `udev` or `sudo` privileges for MediaTek USB BROM/DA access.
|
||||
3. **Optional sparse tools**: `img2simg` and `simg2img` (`android-tools` or `ext4` sparse utilities) if you want Android sparse image output.
|
||||
4. **Hardware**: A Planet Computers Gemini PDA (x27 Wi-Fi + 4G) and a USB-C data cable connected directly to a host USB port (avoid unpowered hubs).
|
||||
### Host prerequisites (no Docker required)
|
||||
|
||||
On hosts running `ModemManager`, [flash-mtk.sh](flash-mtk.sh) automatically pauses `ModemManager` during flashing and restarts it on exit so `/dev/ttyACM*` is not claimed away from the BROM/Preloader handshake.
|
||||
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).
|
||||
|
||||
## Step 1: Build the Geminux images
|
||||
|
||||
From the repository root:
|
||||
### Steps
|
||||
|
||||
```sh
|
||||
./rebuild-image.sh
|
||||
./scripts/check-rebuild.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
|
||||
```
|
||||
|
||||
This writes:
|
||||
Continue to [Flashing to the Gemini PDA](#flashing-to-the-gemini-pda) below.
|
||||
|
||||
- `images/boot-geminux.img` — `<= 16 MiB` LK boot image containing `Image.gz`, `mt6797-gemini-pda-geminux.dtb`, and initramfs
|
||||
- `images/recovery-geminux.img` — initramfs recovery image with USB NCM rescue shell
|
||||
- `images/geminux-rootfs.img` — ext4 root filesystem labeled `geminux-root`
|
||||
- `images/geminux-rootfs.simg` — Android sparse copy (generated when `img2simg` is installed)
|
||||
- `images/SHA256SUMS`
|
||||
## Option B: Build from source and package a release
|
||||
|
||||
## Step 2: Backup factory partitions and extract MediaTek firmware
|
||||
### 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) stages a copy of `geminux-rootfs.img`, strips SSH host/authorized keys and proprietary `/lib/firmware/mediatek/mt6797/` blobs so the archive can be shared safely, verifies `e2fsck -fn` and ZIP CRCs, and writes `<archive>.zip.sha256` (`--include-firmware` / `--keep-ssh-keys` keep them for single-device personal archives).
|
||||
|
||||
## 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`).
|
||||
|
||||
Power off the Gemini PDA completely and leave it unplugged. Run the backup command, then plug the USB-C cable into the **left** USB-C port (closest to the Esc side) while powered off to enter MediaTek BROM/Preloader mode:
|
||||
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
|
||||
```
|
||||
|
||||
Backups are stored under `backup/<timestamp>/` alongside `pgpt.bin` and `sgpt.bin`.
|
||||
|
||||
Next, extract the device-owned proprietary MediaTek firmware blobs (`MT6797` Wi-Fi, Bluetooth, SPM, and MD1 radio images, never redistributed in git) either from the Gemini's existing Android `system` partition or from a local `system.img`:
|
||||
|
||||
```sh
|
||||
# From a connected Gemini in BROM mode:
|
||||
./flash-mtk.sh --extract-firmware
|
||||
|
||||
# Or from a local stock Android system image:
|
||||
./flash-mtk.sh --extract-firmware --system-img /path/to/system.img
|
||||
```
|
||||
|
||||
Extracted blobs go into `firmware-cache/mt6797/` and are injected into `/lib/firmware/mediatek/mt6797/` on build. Re-run `./rebuild-image.sh` so `geminux-rootfs.img` bundles them:
|
||||
|
||||
```sh
|
||||
./rebuild-image.sh
|
||||
```
|
||||
|
||||
## Step 3: Flash full eMMC with Geminux
|
||||
|
||||
Geminux claims all user-writable eMMC past the protected MediaTek boundary (`LBA 0x70000`, byte offset `0x0E000000`, `SYS0..SYS27`), replacing Android `system`, `cache`, and `userdata` with `boot`, `recovery`, `boot2`, and a single full-disk `linux` ext4 partition:
|
||||
|
||||
```sh
|
||||
# Interactive: prompts for desktop username, desktop password, root password,
|
||||
# and optional LUKS2 encryption before waiting for USB BROM/Preloader:
|
||||
# 2. Full interactive install (prompts for user/root credentials & optional LUKS2):
|
||||
./flash-mtk.sh --flash-full
|
||||
|
||||
# Non-interactive with explicit username, prompted passwords, and LUKS2 encryption:
|
||||
# 3. Non-interactive example with explicit username, prompted passwords & LUKS2:
|
||||
./flash-mtk.sh --flash-full --username alice --ask-user-password --ask-root-password --encrypt
|
||||
|
||||
# Non-interactive using image defaults (unencrypted):
|
||||
# 4. Keep image defaults (unencrypted, login: user / geminux):
|
||||
./flash-mtk.sh --flash-full --use-default-credentials
|
||||
```
|
||||
|
||||
### What `--flash-full` performs
|
||||
**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).
|
||||
|
||||
Implemented across [flash-mtk.py](flash-mtk.py), [scripts/geminux_accounts.py](scripts/geminux_accounts.py), [scripts/geminux_luks.py](scripts/geminux_luks.py), and [scripts/geminux_gpt.py](scripts/geminux_gpt.py):
|
||||
|
||||
1. **Pre-flash credential resolution**: Prompts/validates desktop `username`, desktop `password`, `root` `password`, and optional `--encrypt` LUKS2 passphrase before waiting for USB (`--username`, `--user-password`, `--ask-user-password`, `--root-password`, `--ask-root-password`, `--use-default-credentials`, `--encrypt`, `--luks-password`, `--ask-luks-password`). The LUKS2 passphrase is independent of login passwords.
|
||||
2. **Safety backup**: Saves an initial backup in `backup/<timestamp>/` (pass `--skip-backup --backup-dir backup/<timestamp>` on subsequent flashes to reuse one).
|
||||
3. **Protected layout verification**: Verifies protected partitions before `0x0E000000` (pass `--force-gpt` only when intentionally converting a non-standard table).
|
||||
4. **GPT write + readback**: Writes updated Primary (`LBA 0..33`) and Backup GPT with mandatory readback check.
|
||||
5. **Staged provisioning & write**: Copies `geminux-rootfs.img` to a temporary file (leaving `images/` untouched), provisions `/etc/passwd`, `/etc/group`, `/etc/shadow`, and `/home/<username>` via `debugfs`/`e2fsck`, optionally encrypts with LUKS2 (`aes-xts-plain64`, Argon2id), flashes `boot-geminux.img` (`boot` & `boot2`), `recovery-geminux.img` (`recovery`), and `linux` with readback verification, then sends the DA reboot handshake (`--reboot` default, `--poweroff`, or `--no-reboot`).
|
||||
|
||||
### Partial flash and offline utilities
|
||||
### Partial updates and restore
|
||||
|
||||
```sh
|
||||
# Update only boot, boot2, and recovery without touching GPT or linux:
|
||||
./flash-mtk.sh --flash-kernel-only
|
||||
|
||||
# Update only the linux rootfs partition (with optional credentials and --encrypt):
|
||||
./flash-mtk.sh --flash-rootfs-only --username alice --ask-user-password --encrypt
|
||||
|
||||
# Create an offline customized (and optionally LUKS2-encrypted) ext4 rootfs image:
|
||||
./flash-mtk.sh --customize-rootfs /tmp/custom-rootfs.img --username alice --ask-user-password --ask-root-password --encrypt
|
||||
|
||||
# Restore a previous backup:
|
||||
./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 provisioned on the hardware ST33 eUICC survive full `linux` rootfs reflashes (whereas flashing `linux` replaces `/` and `/home`).
|
||||
- **Power on**: Unplug the USB-C cable and hold the **Esc** (power) button until the device boots.
|
||||
- **USB-attached boot fuel-gauge calibration**: When booting directly on USB power (for instance right after `--flash-full`), `bq25890` briefly holds charging disabled (`F_CHG_CFG=0`, ~15 s while `VSYS` stays powered via USB) so `mt6351-fuel-gauge` calibrates to true zero-current battery OCV rather than ~4.336 V charging voltage.
|
||||
- **LUKS2 unlock**: When flashed with `--encrypt`, initramfs loads `/etc/gemini-us.kmap` on `tty1` and prompts for the LUKS2 passphrase (`cryptsetup open --allow-discards` -> `/dev/mapper/geminux_root`, mapping the full dynamic partition after any off-mode charging check).
|
||||
- **First-boot resize**: Initramfs runs `e2fsck -p </dev/null` and `resize2fs -f </dev/null` to expand ext4 across the ~58 GiB `linux` partition, records `/var/lib/geminux/.rootfs-resized`, and pivots to OpenRC.
|
||||
- **Desktop login & default theme**: TinyDM auto-logs into XLibre + DWM as UID `10000` (your provisioned username or `user`, default password `geminux` unless set; authorized key from `keys/geminux_id_ed25519.pub` if generated). The desktop opens in the default **Anodized** theme; customize themes with `Mod4 + t` (`geminux-themes`) and desktop wallpapers via `geminux-themes --wallpaper` or `geminux-apply-wallpaper`.
|
||||
- **Rescue shell**: Plugging USB-C into a host starts USB NCM Ethernet (`usb0`) at `172.16.42.1/24`. In recovery mode, `unlock-root`, `check-fs`, and `mount-root` handle LUKS2 unlock automatically.
|
||||
|
||||
## Full-disk encryption (LUKS2) details
|
||||
|
||||
- **Kernel & Hardware**: Built-in `BLK_DEV_DM=y`, `DM_CRYPT=y`, `CRYPTO_ESSIV=y`, ARMv8 AES-CE (`CRYPTO_AES_ARM64_CE_BLK=y`, `CRYPTO_XTS=y`, `CRYPTO_SHA256=y`), `DRM_SIMPLEDRM=y` + rotated `TER16x32` console, and `KEYBOARD_MATRIX=y` + `PINCTRL_AW9523=y`.
|
||||
- **Format & Expansion**: Host `cryptsetup reencrypt --encrypt --disable-locks` wraps the staged rootfs with a 32 MiB LUKS2 header pad (`16 MiB` payload offset, whole-device segment, `aes-xts-plain64` 512-bit, Argon2id 128 MiB / 4 threads) so no plaintext rootfs touches eMMC; unlocking maps the whole device and first boot expands ext4 to ~58 GiB.
|
||||
- **Security Scope**: Protects data at rest against theft or physical eMMC extraction. Because stock MediaTek `lk` does not enforce AVB verified boot on `boot`/`recovery`/`boot2`, FDE does not protect against offline tampering of the `boot` partition.
|
||||
- **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
|
||||
|
||||
Perform these checks on physical hardware after first boot:
|
||||
|
||||
- [ ] Confirm `uname -r` reports `7.3.5-geminux` and `lsmod` shows `mediatek_drm`, `panfrost`, `mt6797_ccci_cldma`, `mt6797_wlan_core`, and `btmt6797`.
|
||||
- [ ] Verify `ssd2092` touchscreen input, `geminux-touchd` gestures (2-finger tap/scroll, 3-finger middle-click), and keyboard mappings (`Fn+1..0 = F1..F10`, `Fn+Z/X = F11/F12`, `Fn+Alt = Mod4`, Planet key).
|
||||
- [ ] Confirm Glamor 3D acceleration via `glxinfo | grep -i renderer`.
|
||||
- [ ] Verify **Anodized** default theme, interactive theme switching & Theme Editor (`geminux-themes`), and desktop wallpaper apply/restore (`geminux-themes --wallpaper` / `geminux-apply-wallpaper`).
|
||||
- [ ] Test Wi-Fi and Bluetooth via `geminux-net` / `nmcli`, plus audio playback/recording (speaker, 3.5mm jack, internal mic).
|
||||
- [ ] With MD1 firmware extracted, verify `/dev/ccci_md_ctl`, `/dev/ttyC0`, `doas geminux-cellctl status` (`MD_STATE=READY` + SIM/ST33 eUICC), `rc-service geminux-imsd status`, `ccmni*` data, voice calls (`geminux-dialer`), and SMS (`geminux-sms`).
|
||||
- [ ] Test front camera preview/JPEG/AVI capture (`geminux-camera`), external HDMI (`SiI9024`), microSD automount at `/media/sdcard` (`geminux-sdcard-mount status`), `Fn+F` Airplane Mode, lid-close & overnight battery deep sleep recovery (`0013` PMIC/SPM safety and quiet open-lid timer re-suspend), and `geminux-power-audit`.
|
||||
- [ ] `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`), and `geminux-power-audit` succeed.
|
||||
Reference in new issue
Block a user