Use target hostnames and restore lk2nd bootloader reboot

This commit is contained in:
Luxferre committed 2026-11-09 23:44:44 +02:00
1 parent 1c011b360a
commit 3b96b8f242
22 files changed
+203 -70

No files matched your search

+72 -7
View File
@@ -17,6 +17,41 @@ for script in "$BASE_DIR"/*.sh "$BASE_DIR"/scripts/*.sh; do
fi
done
echo "[check] Target-specific hostname..."
HOSTNAME_HELPER="$BASE_DIR/scripts/set-bananarchy-hostname.sh"
if [ ! -x "$HOSTNAME_HELPER" ]; then
fail "missing or non-executable scripts/set-bananarchy-hostname.sh"
fi
if ! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh" || \
! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
grep -qF '"nokia-argon" > "$ROOTFS/etc/hostname"' \
"$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then
fail "target rootfs bootstrap no longer uses the target-specific hostname helper"
fi
if [ -x "$HOSTNAME_HELPER" ]; then
HOSTNAME_TMP="$(mktemp -d)"
for dev in nokia-argon nokia-beatles nokia-tough nokia-sparkler nokia-leo; do
if ! "$HOSTNAME_HELPER" "$HOSTNAME_TMP" "$dev"; then
fail "hostname helper failed for $dev"
continue
fi
if [ "$(cat "$HOSTNAME_TMP/etc/hostname" 2>/dev/null)" != "$dev" ] || \
! grep -qF "127.0.0.1 $dev localhost.localdomain localhost" \
"$HOSTNAME_TMP/etc/hosts" 2>/dev/null || \
[ "$(readlink "$HOSTNAME_TMP/etc/runlevels/boot/hostname" 2>/dev/null)" != \
"/etc/init.d/hostname" ]; then
fail "hostname helper produced the wrong identity for $dev"
fi
done
rm -rf "$HOSTNAME_TMP"
fi
if ! grep -qF 'BANANARCHY_USER_PASSWORD="${BANANARCHY_USER_PASSWORD:-147147}"' \
"$BASE_DIR/scripts/bootstrap-rootfs.sh" || \
! grep -qF 'openssl passwd -6 -salt bananarchy "$PASSWORD"' \
"$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then
fail "the default 147147 unlock passcode is no longer provisioned"
fi
echo "[check] Python syntax..."
python3 - "$BASE_DIR" <<'PYEOF' || exit 1
import ast
@@ -207,8 +242,8 @@ for variant in normal diagnostic display; do
;;
display)
image="$BASE_DIR/images/boot-lk2nd-nokia-beatles-display.img"
opts="--expect-fastboot 0 --expect-display 1 --allow-missing-cookie"
label="nokia-beatles known-good display lk2nd image"
opts="--expect-fastboot 0 --expect-display 1"
label="nokia-beatles display lk2nd image with Fastboot reboot cookie"
;;
esac
if [ ! -f "$image" ]; then
@@ -317,10 +352,10 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"b4d0555f17dd1e224069641603ff3d120fd3ea5c219a34de227caf240a077558 images/bananarchy-nokia-argon.img" \
"e2267187c58920b5c5b822d940b81e0df8f59e7788fed00e3d31dfbdb290c7fc images/bananarchy-nokia-beatles.img" \
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \
"f4e9b8b2b36d4ffa9ba4f74de293b14f16b5ed45bbd5ab1d62bc2023242b73b2 images/bananarchy-nokia-beatles.img" \
"6715abd414fd02fd21ca8c2cd621a8a21e78f46d079b2d185b38a1f7a4a3e659 images/boot-bananarchy-nokia-beatles.img" \
"e1fdd8551b6393184a465638881b63ca58c04e1e8f655f092260a18379e1cbe6 images/boot-lk2nd-nokia-beatles-display.img"; do
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
set -- $pair
want=$1
path="$BASE_DIR/$2"
@@ -649,8 +684,38 @@ for mod in mux-core mux-gpio spi-mux; do
fail "modules-load.d is missing $mod"
fi
done
if ! grep -q 'PON_SOFT_RB_SPARE.*0x02U' "$BASE_DIR/src/leds-msm8905-torch/leds-msm8905-torch.c"; then
fail "the torch reboot cookie no longer selects the lk2nd Fastboot menu"
echo "[check] Reboot-to-bootloader Fastboot cookie..."
TORCH_SRC="$BASE_DIR/src/leds-msm8905-torch/leds-msm8905-torch.c"
for token in '#define FASTBOOT_COOKIE_LOW 0x02U' \
'#define FASTBOOT_COOKIE_DUAL 0x0aU' \
'of_machine_is_compatible("nokia,beatles")' \
'regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, cookie)'; do
if ! grep -qF "$token" "$TORCH_SRC"; then
fail "the torch reboot cookie lost the target-aware lk2nd Fastboot path ($token)"
fi
done
for f in scripts/check-lk2nd-beatles.py scripts/build-lk2nd-beatles.sh \
scripts/test-lk2nd-beatles-port.py; do
if grep -qF -- '--allow-missing-cookie' "$BASE_DIR/$f" || \
grep -qF 'allow_missing_cookie' "$BASE_DIR/$f"; then
fail "$f still permits a display lk2nd image without the reboot cookie"
fi
done
if ! grep -qF 'opts="--expect-fastboot 0 --expect-display 1"' "$BASE_DIR/scripts/check-rebuild.sh"; then
fail "check-rebuild.sh no longer requires the display lk2nd reboot cookie"
fi
for f in src/sxmo-dmenu/dmenu.c \
overlay/rootfs/usr/bin/sxmo_appmenu.sh \
overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh; do
if ! grep -qF 'Reboot to bootloader' "$BASE_DIR/$f"; then
fail "$f lost the Reboot to bootloader menu item"
fi
done
if ! grep -qF 'set_kernel_reboot_mode "bootloader"' \
"$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh" || \
! grep -qF 'force_reboot_cmd "bootloader"' \
"$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh"; then
fail "sxmo_power.sh no longer reboots through the canonical bootloader mode"
fi
for stale in images/boot-bananarchy-nokia-beatles-debug.img \
images/boot-bananarchy-nokia-beatles-ramoops.img; do