From 8d50629b927ba37b354a9b272ef4b544c39c86ee Mon Sep 17 00:00:00 2001 From: nearxos Date: Fri, 20 Feb 2026 12:38:59 +0200 Subject: [PATCH] Update first-boot scripts and documentation to change display rotation from Right to Left for reTerminal DM. Enhance Plymouth theme configuration to ensure a single [Daemon] section is used. Update logging messages for clarity regarding boot order changes on Pi 5. Adjust README to reflect new rotation settings for one-shot scripts. --- .../cloud-init/files-from-guard/README.md | 2 +- .../emmc-provisioning/cloud-init/first-boot.md | 18 +++++++++--------- .../emmc-provisioning/cloud-init/first-boot.sh | 6 ++++-- .../cloud-init/fix-reterminal-display.sh | 5 +++-- .../cloud-init/set-rotation-once.sh | 9 +++++---- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/chromium-setup/emmc-provisioning/cloud-init/files-from-guard/README.md b/chromium-setup/emmc-provisioning/cloud-init/files-from-guard/README.md index f4284f5..801b2b2 100644 --- a/chromium-setup/emmc-provisioning/cloud-init/files-from-guard/README.md +++ b/chromium-setup/emmc-provisioning/cloud-init/files-from-guard/README.md @@ -14,7 +14,7 @@ first-boot.sh downloads from **`.../files/first-boot/`** (e.g. `http://10.130.60 | **99-wallpaper.conf** | LightDM greeter wallpaper (from `config-files/`). | | **99-default-session.conf** | LightDM default session rpd-labwc (from `config-files/`). | | **maliit-keyboard.desktop** | Maliit on-screen keyboard autostart (from `config-files/`). | -| **set-rotation-once.sh** + **.desktop** | One-shot: wlr-randr rotation (Right) at first login. | +| **set-rotation-once.sh** + **.desktop** | One-shot: wlr-randr rotation (Left) at first login. | | **set-wallpaper-once.sh** + **.desktop** | One-shot: swaybg wallpaper + labwc autostart at first login. | --- diff --git a/chromium-setup/emmc-provisioning/cloud-init/first-boot.md b/chromium-setup/emmc-provisioning/cloud-init/first-boot.md index 6df2c4b..647219d 100644 --- a/chromium-setup/emmc-provisioning/cloud-init/first-boot.md +++ b/chromium-setup/emmc-provisioning/cloud-init/first-boot.md @@ -50,7 +50,7 @@ Installs the software needed for the rest of the script and for the kiosk: | **wmctrl** | Window control; used to force Chromium into fullscreen. | | **openssh-server** | SSH access (often also enabled in user-data). | | **swaybg** | Wallpaper for labwc (Wayland); used by one-shot and labwc autostart. | -| **wlr-randr** | Display rotation for wlroots/labwc; one-shot sets “Right” (transform 90). | +| **wlr-randr** | Display rotation for wlroots/labwc; one-shot sets “Left” (transform 270). | | **maliit-keyboard** | On-screen keyboard for touch input. | | **xinput-calibrator** | Touchscreen calibration (optional; run manually if needed). | @@ -78,7 +78,7 @@ Ensure the `.desktop` file on the server has `Exec=/home/pi/start-chromium.sh` ( A **single image** (`splash.png`) is used for the boot splash, login screen, and desktop wallpaper. Host it at **`${FILE_SERVER}/splash.png`** (e.g. `http://10.130.60.141:5000/files/splash.png`). -- **Plymouth (boot splash):** Downloads `splash.png`, `custom.plymouth`, and `custom.script` from the file server → installs to `/usr/share/plymouth/themes/custom/` → sets `Theme=custom` in `/etc/plymouth/plymouthd.conf` → runs `update-initramfs -u`. If any download fails, logs a warning and continues. +- **Plymouth (boot splash):** Downloads `splash.png`, `custom.plymouth`, and `custom.script` from the file server → installs to `/usr/share/plymouth/themes/custom/` → sets `Theme=custom` in `/etc/plymouth/plymouthd.conf` (single `[Daemon]` section) → runs `update-initramfs -u`. If any download fails, logs a warning and continues. **Note:** On reTerminal DM the DSI panel initializes a few seconds into boot, so the Plymouth splash may appear briefly or after a short black screen; this is normal for DSI on Pi 5. - **LightDM (login screen):** Copies the same image to `/usr/share/rpd-wallpaper/splash.png` and writes `/etc/lightdm/lightdm.conf.d/99-wallpaper.conf` with `wallpaper=...` and `wallpaper_mode=crop`. - **Desktop wallpaper:** A one-shot autostart runs when **pi** first logs in: it adds `swaybg -i /usr/share/rpd-wallpaper/splash.png -m fill` to `~/.config/labwc/autostart` (so it persists across logins) and runs swaybg for the current session. The one-shot then deletes itself. @@ -114,24 +114,24 @@ These changes take effect after a reboot. --- -## Screen rotation (portrait → landscape, “Right”) +## Screen rotation (portrait → landscape, “Left”) The reTerminal DM default is portrait. Rotation is set using **wlr-randr** (labwc/Wayland), so nothing is written to `/boot/firmware/config.txt`. - **One-shot autostart** — A small script runs once when user `pi` first logs into the graphical session: - - **`/home/pi/set-rotation-once.sh`** — Waits 5 seconds, detects the output name with `wlr-randr`, then runs `wlr-randr --output --transform 90` (Right / 90° clockwise). Falls back to `DSI-1` if detection fails. - - **`/home/pi/.config/autostart/set-rotation-once.desktop`** — Autostart entry that runs the script. Both the script and this desktop file **delete themselves** after a successful run, so rotation is applied only once. -- **Effect** — Same as choosing “Right” in display settings. Rotation applies after the first login; no reboot needed for rotation (only for the Seeed drivers). + - **`/home/pi/set-rotation-once.sh`** — Waits 5 seconds, detects the output name with `wlr-randr`, then runs `wlr-randr --output --transform 270` (Left / 90° counter-clockwise). Falls back to `DSI-1` if detection fails. + - **`/home/pi/.config/autostart/set-rotation-once.desktop`** — Autostart entry that runs the script once at first login. Both the script and this desktop file **delete themselves** after a successful run, so rotation is applied only on first boot and never again. +- **Effect** — Same as choosing “Left” in display settings. Rotation applies after the first login; no reboot needed for rotation (only for the Seeed drivers). --- ## Boot order (network first, then eMMC/SD) -If **`rpi-eeprom-config`** and **`rpi-eeprom-update`** are present (Pi 4/CM4), the script sets the EEPROM **`BOOT_ORDER=0x21`**: try **network** first (0x2), then **SD/eMMC** (0x1). This allows future network boot or re-provisioning (e.g. PXE or USB gadget) before falling back to local storage. The EEPROM update is scheduled for the next reboot; no second reboot is required. If the tools are not available, the step is skipped. +If **`rpi-eeprom-config`** and **`rpi-eeprom-update`** are present (Pi 4/CM4), the script sets the EEPROM **`BOOT_ORDER=0x21`**: try **network** first (0x2), then **SD/eMMC** (0x1). This allows future network boot or re-provisioning (e.g. PXE or USB gadget) before falling back to local storage. The EEPROM update is scheduled for the next reboot; no second reboot is required. **On reTerminal DM (Pi 5)** the bootloader is different and `rpi-eeprom-update -l` typically does not provide a config file — the log message “Boot order unchanged (reTerminal DM / Pi 5 use a different bootloader…)” is normal and not an error. If the tools are not available, the step is skipped. ## Reboot -Runs **`reboot`** so the kernel and display stack load the new Seeed drivers. After reboot, the screen and touch work; on **pi**’s first login the one-shot sets rotation to “Right” (landscape), and the Chromium kiosk and Maliit start via autostart. +Runs **`reboot`** so the kernel and display stack load the new Seeed drivers. After reboot, the screen and touch work; on **pi**’s first login the one-shot sets rotation to “Left” (landscape), and the Chromium kiosk and Maliit start via autostart. --- @@ -140,4 +140,4 @@ Runs **`reboot`** so the kernel and display stack load the new Seeed drivers. Af - **File server** — Edit `FILE_SERVER` if your assets are served from another host/port. Host all files listed in **`files-from-guard/README.md`** and **`config-files/README.md`** (kiosk, splash, Plymouth, LightDM, Maliit, one-shots and their .desktop files). - **Kiosk URL** — The URL Chromium opens is defined in `start-chromium.sh` on your file server (e.g. `--app=http://127.0.0.1:8080`); change it there. - **User** — If you use a user other than `pi`, replace `pi` in this script and in the files on the file server (paths and ownership). -- **Screen rotation** — The one-shot runs `wlr-randr --output --transform 90`. To use another orientation, change `90` to `270` (left), `180` (inverted), or `normal`. +- **Screen rotation** — The one-shot runs `wlr-randr --output --transform 270` (Left). To use another orientation, change `270` to `90` (right), `180` (inverted), or `normal`. diff --git a/chromium-setup/emmc-provisioning/cloud-init/first-boot.sh b/chromium-setup/emmc-provisioning/cloud-init/first-boot.sh index 3ecc649..3a6ff6e 100644 --- a/chromium-setup/emmc-provisioning/cloud-init/first-boot.sh +++ b/chromium-setup/emmc-provisioning/cloud-init/first-boot.sh @@ -145,9 +145,10 @@ if [[ -f "$CFG_PATH" ]]; then log "Set disable_splash=0 so Plymouth splash is shown" fi fi -# Ensure Plymouth uses our custom theme only (remove Theme=pix, set Theme=custom) +# Ensure Plymouth uses our custom theme only (single [Daemon], Theme=custom) if [[ -f /etc/plymouth/plymouthd.conf ]]; then sed -i '/^Theme=/d' /etc/plymouth/plymouthd.conf + sed -i '/^\[Daemon\]$/d' /etc/plymouth/plymouthd.conf grep -q '^\[Daemon\]' /etc/plymouth/plymouthd.conf || echo '[Daemon]' >> /etc/plymouth/plymouthd.conf echo 'Theme=custom' >> /etc/plymouth/plymouthd.conf log "Plymouth theme set to custom only" @@ -157,6 +158,7 @@ update-initramfs -u -k all 2>/dev/null || true # --- 6c. Boot order: network first, then eMMC/SD (for future network boot / re-provisioning) --- # BOOT_ORDER: 0x2 = network, 0x1 = SD/eMMC. 0x21 = try network first, then local storage. +# On Pi 5 / reTerminal DM the EEPROM layout differs; rpi-eeprom-update -l may not return a path (skip is normal). log "--- Boot order (network first, then eMMC/SD) ---" if command -v rpi-eeprom-config >/dev/null 2>&1 && command -v rpi-eeprom-update >/dev/null 2>&1; then BOOTCONF="/tmp/first-boot-eeprom-conf.txt" @@ -172,7 +174,7 @@ if command -v rpi-eeprom-config >/dev/null 2>&1 && command -v rpi-eeprom-update log "WARNING: rpi-eeprom-config --apply failed; boot order unchanged" fi else - log "WARNING: Could not read current EEPROM config; skipping boot order change" + log "Boot order unchanged (reTerminal DM / Pi 5 use a different bootloader; rpi-eeprom-update did not provide a config file — this is normal)" fi rm -f "$BOOTCONF" else diff --git a/chromium-setup/emmc-provisioning/cloud-init/fix-reterminal-display.sh b/chromium-setup/emmc-provisioning/cloud-init/fix-reterminal-display.sh index e335729..1ecc838 100644 --- a/chromium-setup/emmc-provisioning/cloud-init/fix-reterminal-display.sh +++ b/chromium-setup/emmc-provisioning/cloud-init/fix-reterminal-display.sh @@ -16,9 +16,10 @@ if [[ -f "$CFG_PATH" ]]; then echo "Done. config: $(grep disable_splash "$CFG_PATH")" fi -echo "=== Fixing Plymouth theme (custom only) ===" +echo "=== Fixing Plymouth theme (custom only, no duplicate [Daemon]) ===" if [[ -f /etc/plymouth/plymouthd.conf ]]; then sed -i '/^Theme=/d' /etc/plymouth/plymouthd.conf + sed -i '/^\[Daemon\]$/d' /etc/plymouth/plymouthd.conf grep -q '^\[Daemon\]' /etc/plymouth/plymouthd.conf || echo '[Daemon]' >> /etc/plymouth/plymouthd.conf echo 'Theme=custom' >> /etc/plymouth/plymouthd.conf echo "Done. plymouthd.conf Theme: $(grep Theme= /etc/plymouth/plymouthd.conf)" @@ -27,7 +28,7 @@ update-initramfs -u -k all 2>/dev/null || true echo "=== Rotation and wallpaper (rpd-labwc / labwc Wayland) ===" echo "To set rotation and wallpaper now (in a labwc session), run as $PI_USER:" -echo " wlr-randr --output \$(wlr-randr | awk '/^[A-Za-z0-9_-]+ /{print \$1; exit}') --transform 90" +echo " wlr-randr --output \$(wlr-randr | awk '/^[A-Za-z0-9_-]+ /{print \$1; exit}') --transform 270" echo " swaybg -i /usr/share/rpd-wallpaper/splash.png -m fill &" echo "" echo "Or ensure one-shots run at next login (they are in autostart if still present)." diff --git a/chromium-setup/emmc-provisioning/cloud-init/set-rotation-once.sh b/chromium-setup/emmc-provisioning/cloud-init/set-rotation-once.sh index c8efc6a..2decf9d 100644 --- a/chromium-setup/emmc-provisioning/cloud-init/set-rotation-once.sh +++ b/chromium-setup/emmc-provisioning/cloud-init/set-rotation-once.sh @@ -1,6 +1,7 @@ #!/bin/bash -# One-shot: set reTerminal DM (labwc/Wayland) rotation to Right via wlr-randr, then remove self. -# Runs as user pi at first login. Logs to /var/log/first-boot.log. +# One-shot: set reTerminal DM (labwc/Wayland) rotation to Left via wlr-randr, then remove self. +# Runs once as user pi at first login; deletes its autostart and this script so it never runs again. +# Logs to /var/log/first-boot.log. FIRST_BOOT_LOG="/var/log/first-boot.log" log() { echo "[$(date -Iseconds)] [set-rotation-once] $*" >> "$FIRST_BOOT_LOG" 2>/dev/null || true; } @@ -18,8 +19,8 @@ if [[ -z "$OUTPUT" ]]; then fi if [[ -n "$OUTPUT" ]] && command -v wlr-randr &>/dev/null; then - log "applying rotation right (transform 90) on $OUTPUT" - wlr-randr --output "$OUTPUT" --transform 90 2>&1 | while read -r line; do log "$line"; done + log "applying rotation left (transform 270) on $OUTPUT" + wlr-randr --output "$OUTPUT" --transform 270 2>&1 | while read -r line; do log "$line"; done else log "WARNING: wlr-randr not found or no output" fi