Refactor first-boot rotation setup to use kernel command line for persistent display rotation. Update documentation to clarify the new method of setting screen orientation (90° clockwise) via cmdline.txt, eliminating the need for one-shot scripts. Enhance logging and user guidance for rotation and wallpaper configuration during first boot.
This commit is contained in:
@@ -182,12 +182,19 @@ fi
|
||||
log "Running update-initramfs to apply Plymouth theme ..."
|
||||
update-initramfs -u -k all 2>/dev/null || true
|
||||
|
||||
# --- 6b2. Kernel cmdline: swiotlb for vc4-drm (avoids "swiotlb buffer is full" / blank DSI on CM4) ---
|
||||
# --- 6b2. Kernel cmdline: swiotlb + DSI rotation (KMS, persistent across reboots) ---
|
||||
CMDLINE_PATH="/boot/firmware/cmdline.txt"
|
||||
[[ -f "$CMDLINE_PATH" ]] || CMDLINE_PATH="/boot/cmdline.txt"
|
||||
if [[ -f "$CMDLINE_PATH" ]] && ! grep -q 'swiotlb=' "$CMDLINE_PATH"; then
|
||||
sed -i 's/rootwait/rootwait swiotlb=65536/' "$CMDLINE_PATH"
|
||||
log "Added swiotlb=65536 to kernel cmdline (vc4-drm / DSI)"
|
||||
if [[ -f "$CMDLINE_PATH" ]]; then
|
||||
if ! grep -q 'swiotlb=' "$CMDLINE_PATH"; then
|
||||
sed -i 's/rootwait/rootwait swiotlb=65536/' "$CMDLINE_PATH"
|
||||
log "Added swiotlb=65536 to kernel cmdline (vc4-drm / DSI)"
|
||||
fi
|
||||
# Persistent rotation for DSI-1 (KMS): append at end of single line. 90 = 90° clockwise.
|
||||
if ! grep -q 'video=DSI-1:rotate=' "$CMDLINE_PATH"; then
|
||||
sed -i 's/$/ video=DSI-1:rotate=90/' "$CMDLINE_PATH"
|
||||
log "Added video=DSI-1:rotate=90 to kernel cmdline (DSI rotation)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- 6c. CM4: enable rpi-eeprom-update so boot order can be set ---
|
||||
@@ -274,10 +281,10 @@ SVCEOF
|
||||
systemctl enable set-cm4-boot-order-once.service 2>/dev/null && log "Enabled set-cm4-boot-order-once.service to set boot order after next boot"
|
||||
fi
|
||||
|
||||
# --- 7. One-shots (rotation at first login; wallpaper already set in pcmanfm config above) ---
|
||||
log "--- One-shot scripts (run at pi first login) ---"
|
||||
install_oneshot set-rotation-once || true
|
||||
log "One-shots will append to $LOGFILE when they run at first login"
|
||||
# --- 7. One-shots (wallpaper already set in pcmanfm config above; rotation is via cmdline.txt) ---
|
||||
log "--- One-shot scripts (if any) ---"
|
||||
# Rotation is set persistently in cmdline.txt (video=DSI-1:rotate=90), not via one-shot script.
|
||||
log "Rotation is set via kernel cmdline (video=DSI-1:rotate=90)"
|
||||
|
||||
# --- 8. Allow pi to append to first-boot.log (for one-shot scripts) ---
|
||||
chmod 666 "$LOGFILE"
|
||||
|
||||
Reference in New Issue
Block a user