Add flasher credential provisioning, LUKS2 FDE, LED fixes, and docs
This commit is contained in:
1 parent
2706b9a901
commit
b7dca4f15f
49 files changed
+1524
-183
No files matched your search
+33
-13
@@ -60,41 +60,61 @@ Extracted blobs are placed in `firmware-cache/mt6797/` and automatically injecte
|
||||
Geminux claims the entire user-writable eMMC past the protected MediaTek region (`LBA 0x70000`, byte offset `0x0E000000`, `SYS0..SYS27`), removing Android `system`, `cache`, and `userdata` in favor of `boot`, `recovery`, `boot2`, and a single full-disk `linux` ext4 partition:
|
||||
|
||||
```sh
|
||||
# Interactive: prompts for desktop username, desktop password, root password,
|
||||
# and optional LUKS2 full-disk encryption before waiting for USB BROM/Preloader:
|
||||
./flash-mtk.sh --flash-full
|
||||
|
||||
# Non-interactive with explicit credentials and interactive LUKS2 passphrase:
|
||||
./flash-mtk.sh --flash-full --username alice --ask-user-password --ask-root-password --encrypt
|
||||
|
||||
# Non-interactive using image defaults (unencrypted):
|
||||
./flash-mtk.sh --flash-full --use-default-credentials
|
||||
```
|
||||
|
||||
What `--flash-full` does automatically (implemented in [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py) and [scripts/geminux_gpt.py](file:///home/lux/proj/geminux/scripts/geminux_gpt.py)):
|
||||
What `--flash-full` does automatically (implemented in [flash-mtk.py](file:///home/lux/proj/geminux/flash-mtk.py), [scripts/geminux_accounts.py](file:///home/lux/proj/geminux/scripts/geminux_accounts.py), [scripts/geminux_luks.py](file:///home/lux/proj/geminux/scripts/geminux_luks.py), and [scripts/geminux_gpt.py](file:///home/lux/proj/geminux/scripts/geminux_gpt.py)):
|
||||
|
||||
1. Takes an initial backup into `backup/<timestamp>/` (or pass `--skip-backup --backup-dir backup/<timestamp>` on subsequent reflashes to reuse an existing backup).
|
||||
2. Verifies the protected factory partition layout before `0x0E000000` (`pass --force-gpt` only if intentionally converting a non-standard partition table).
|
||||
3. Writes updated Primary GPT (`LBA 0..33`) and Backup GPT with a mandatory readback verification check.
|
||||
4. Writes `boot-geminux.img` to `boot` and `boot2`, `recovery-geminux.img` to `recovery` (with readback verification), and `geminux-rootfs.img` to `linux`, then sends the DA reboot handshake (`--reboot` default, `--poweroff` to stay powered off, or `--no-reboot` to remain in DA mode).
|
||||
1. Resolves desktop `username`, desktop `password`, `root` `password`, and optional `--encrypt` LUKS2 passphrase before waiting for USB BROM/Preloader. Flags available: `--username`, `--user-password`, `--ask-user-password`, `--root-password`, `--ask-root-password`, `--use-default-credentials`, `--encrypt`, `--luks-password`, and `--ask-luks-password`. The LUKS2 disk passphrase is independent of the desktop and `root` login passwords (though you may enter the same passphrase if desired).
|
||||
2. Takes an initial backup into `backup/<timestamp>/` (or pass `--skip-backup --backup-dir backup/<timestamp>` on subsequent reflashes to reuse an existing backup).
|
||||
3. Verifies the protected factory partition layout before `0x0E000000` (`pass --force-gpt` only if intentionally converting a non-standard partition table).
|
||||
4. Writes updated Primary GPT (`LBA 0..33`) and Backup GPT with a mandatory readback verification check.
|
||||
5. Stages a temporary copy of `geminux-rootfs.img` (leaving `images/geminux-rootfs.img` unmodified), provisions `/etc/passwd`, `/etc/group`, `/etc/shadow`, and `/home/<username>` via `debugfs`/`e2fsck`, optionally wraps it inside a LUKS2 container (`aes-xts-plain64`, Argon2id), writes `boot-geminux.img` to `boot` and `boot2`, `recovery-geminux.img` to `recovery` (with readback verification), and the staged rootfs to `linux`, then sends the DA reboot handshake (`--reboot` default, `--poweroff` to stay powered off, or `--no-reboot` to remain in DA mode).
|
||||
|
||||
To update only the kernel and initramfs later without touching GPT or the root filesystem:
|
||||
Additional flashing and offline image utilities:
|
||||
|
||||
```sh
|
||||
# Update only boot, boot2, and recovery without touching GPT or linux:
|
||||
./flash-mtk.sh --flash-kernel-only
|
||||
```
|
||||
|
||||
To restore a previous backup:
|
||||
# Update only the linux rootfs partition (with optional credentials and --encrypt):
|
||||
./flash-mtk.sh --flash-rootfs-only --username alice --ask-user-password --encrypt
|
||||
|
||||
```sh
|
||||
# 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 --restore-backup backup/<timestamp>
|
||||
```
|
||||
|
||||
## First boot and recovery notes
|
||||
|
||||
- Disconnect the USB-C cable and hold the **Esc** (power) button until the unit boots.
|
||||
- On first boot, the initramfs automatically expands the ext4 filesystem (`resize2fs`) to fill the entire `linux` partition before pivoting to OpenRC.
|
||||
- TinyDM automatically logs into XLibre + DWM as `user` (UID `10000`, default password `geminux`, SSH authorized key installed from `keys/geminux_id_ed25519.pub` if generated). Change the `user` and `root` passwords immediately with `passwd`.
|
||||
- Connecting a host PC over USB-C starts the `usb0` NCM Ethernet gadget on `172.16.42.1/24` for rescue SSH access.
|
||||
- If flashed with `--encrypt`, the initramfs loads the standalone binary Gemini US keyboard map (`/etc/gemini-us.kmap`) on `tty1` and prompts for the LUKS2 passphrase before mounting `PARTLABEL=linux` via `cryptsetup open --allow-discards` as `/dev/mapper/geminux_root` (off-mode battery charging still runs before the unlock prompt). Because LUKS2 data segment 0 uses dynamic whole-device length, unlocking immediately maps the full `linux` partition.
|
||||
- On first boot, the initramfs runs non-interactive `e2fsck -p` and `resize2fs -f` (`</dev/null`) to expand the ext4 filesystem across the full ~58 GiB `linux` partition, writes `/var/lib/geminux/.rootfs-resized` so future boots skip first-boot resizing, and pivots to OpenRC.
|
||||
- TinyDM automatically logs into XLibre + DWM as UID `10000` (either your provisioned `--username` or the default `user`; default password `geminux` unless set during flashing). SSH authorized key is installed from `keys/geminux_id_ed25519.pub` if generated. Change passwords at any time with `passwd`.
|
||||
- Connecting a host PC over USB-C starts the `usb0` NCM Ethernet gadget on `172.16.42.1/24` for rescue SSH access. In recovery mode, `unlock-root`, `check-fs`, and `mount-root` automatically handle LUKS2 unlock when needed.
|
||||
|
||||
## 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-side `cryptsetup reencrypt --encrypt --disable-locks` wraps the staged rootfs with a 32 MiB LUKS2 header pad (`16 MiB` payload offset, dynamic whole-device segment length, `aes-xts-plain64` 512-bit, Argon2id 128 MiB / 4 threads) so no plaintext rootfs touches eMMC; `cryptsetup open --allow-discards` maps the full partition upon unlock and first boot runs `resize2fs -f` to grow the inner ext4 filesystem to ~58 GiB.
|
||||
- **Security Scope**: Protects data at rest against device theft or physical eMMC extraction. Because MediaTek's stock `lk` bootloader does not enforce AVB verified boot on `boot`/`recovery`/`boot2`, FDE does not defend against offline tampering of the `boot` partition.
|
||||
|
||||
## Live Gemini PDA x27 hardware validation checklist
|
||||
|
||||
Perform these checks on physical hardware after the 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 touch input (`novatek-nt36xxx`) and physical keyboard mappings (`Fn+1..0 = F1..F10`, `Fn+Alt = Mod4`, Planet key).
|
||||
- [ ] Verify `ssd2092` touchscreen input, multi-touch gestures (`geminux-touchd`), and physical keyboard mappings (`Fn+1..0 = F1..F10`, `Fn+Alt = Mod4`, Planet key).
|
||||
- [ ] Confirm Glamor 3D acceleration via `glxinfo | grep -i renderer`.
|
||||
- [ ] Test Wi-Fi connectivity via `geminux-net` or `nmcli`, Bluetooth via `geminux-net`, and audio playback/recording (speaker, 3.5mm jack, internal mic).
|
||||
- [ ] With MD1 firmware extracted, verify `/dev/ccci_md_ctl`, `/dev/ttyC0`, and `ccmni*` registration for LTE data, voice calls (`geminux-dialer`), and SMS (`geminux-sms`).
|
||||
|
||||
Reference in new issue
Block a user