Files
bananarchy/scripts/bootstrap-rootfs.sh
T
Luxferre ab53423e33 Port Nokia 800 Tough (nokia-coconut), fix microSD detection, and stage upcoming a1120 (cocojamboo) build
- Migrate nokia-tough to canonical nokia-coconut while keeping CLI aliases, add layered bootloader/lk2nd/nokia-coconut.patch, bootfs/bootimg validators, and offline scripts/inspect-stock-msm8905-dump.py

- Complete nokia-coconut Stage 2 hardware bring-up: wire 6-column 22-key keypad (gpio0, gpio3, gpio7, gpio99, gpio6, gpio1), gpio98 KEY_POWER, and pon@800:resin KEY_DOWN (0x6c); split leds-msm8905-torch into GPIO_13 white:torch (dedicated top-edge flashlight) and GPIO_32 camera:flash (rear camera flash for camera.so and bananarchy-photo)

- Restore sdhci@7864000 non-removable across all six DTS/DTB targets, remove unwired gpio38 cd-gpios/sdc2-cd-* states, and harden sxmo_sdcard.sh under flock

- Register upcoming build a1120 (cocojamboo) in scripts/version.sh, scripts/check-rebuild.sh, CHANGELOG.md, AGENTS.md, README.md, and MANUAL.md with verified hashes across nokia-argon, nokia-beatles, and nokia-coconut
2026-11-15 18:00:10 +02:00

89 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
# Autonomously create a complete armv7 Bananarchy rootfs from the repository.
# Safe to run repeatedly: an up-to-date rootfs is left untouched.
set -eu
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PKGS_FILE="$BASE_DIR/scripts/rootfs-packages.txt"
CONTAINER_SCRIPT="$BASE_DIR/scripts/bootstrap-rootfs-container.sh"
BOOTSTRAP_VERSION="1"
MARKER_REL="etc/bananarchy/rootfs-bootstrap.done"
ROOTFS_DIR="${ROOTFS_DIR:-$BASE_DIR/rootfs}"
TARGET_DEVICE="nokia-argon"
FORCE=0
CHECK_ONLY=0
for arg in "$@"; do
case "$arg" in
--force|-f)
FORCE=1
;;
--check|-c)
CHECK_ONLY=1
;;
nokia-argon|argon)
TARGET_DEVICE="nokia-argon"
;;
nokia-beatles|beatles)
TARGET_DEVICE="nokia-beatles"
;;
nokia-coconut|nokia-tough|coconut|tough)
TARGET_DEVICE="nokia-coconut"
;;
nokia-sparkler|sparkler)
TARGET_DEVICE="nokia-sparkler"
;;
nokia-leo|leo)
TARGET_DEVICE="nokia-leo"
;;
*)
if [ -z "${ROOTFS_DIR_SET:-}" ]; then
ROOTFS_DIR="$arg"
ROOTFS_DIR_SET=1
else
echo "Usage: $0 [rootfs-dir] [device] [--force|--check]" >&2
exit 1
fi
;;
esac
done
if [ ! -f "$PKGS_FILE" ] || [ ! -f "$CONTAINER_SCRIPT" ]; then
echo "Error: bootstrap inputs are missing from $BASE_DIR/scripts." >&2
exit 1
fi
mkdir -p "$ROOTFS_DIR"
ROOTFS_HOST="$(realpath "$ROOTFS_DIR")"
PKG_HASH="$(sha256sum "$PKGS_FILE" | awk '{print $1}')"
EXPECTED="$BOOTSTRAP_VERSION:$PKG_HASH"
MARKER="$ROOTFS_HOST/$MARKER_REL"
if [ "$FORCE" -eq 0 ] && [ -f "$MARKER" ] && [ "$(cat "$MARKER")" = "$EXPECTED" ]; then
echo "[bootstrap] Rootfs is already complete: $ROOTFS_HOST"
exit 0
fi
if [ "$CHECK_ONLY" -eq 1 ]; then
echo "[bootstrap] Rootfs needs bootstrapping: $ROOTFS_HOST"
exit 1
fi
if ! command -v docker >/dev/null 2>&1; then
echo "Error: Docker is required to bootstrap the armv7 rootfs." >&2
exit 1
fi
echo "[bootstrap] Building a complete rootfs at $ROOTFS_HOST for $TARGET_DEVICE..."
exec docker run --rm --network=host \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
-e TARGET_DEVICE="$TARGET_DEVICE" \
-e BANANARCHY_USER_PASSWORD="${BANANARCHY_USER_PASSWORD:-147147}" \
-e BOOTSTRAP_VERSION="$BOOTSTRAP_VERSION" \
-e PKG_HASH="$PKG_HASH" \
-v "$ROOTFS_HOST:/rootfs" \
-v "$BASE_DIR:/bananarchy:ro" \
alpine:3.24 sh -eu /bananarchy/scripts/bootstrap-rootfs-container.sh