Files
alkane-os/image/overlay/etc/init.d/S60alkane-web
T
noahandClaude Opus 4.8 18b5fac584 image: build the console into a zynq-7010 .afw + fix serve_only API bind
Produce a flashable zynq-7010 image carrying the current console, and make the
image serve it on boot.

- image/make-zynq-afw.sh: cross-compiles alkane-os for armv7 (static musl,
  matching the SDK rootfs; the ARM cross-gcc is the linker since the host cc
  cannot link ARM objects), drops the binary and the image overlay into the SDK's
  zynq rootfs, repacks the ramdisk under fakeroot (device nodes + root ownership
  preserved), and packages zImage + dtb + rootfs into a .afw via ci/make-afw.sh.
- image/overlay/etc/init.d/S60alkane-web: starts `alkane-os --serve` after the
  network, so the booted image serves the console (login + read-only API) on :80.
  The SDK init owns board-detect/network/ssh and leaves the console to this.
- main.rs: fix serve_only to default the cgminer API to loopback (127.0.0.1:4028)
  instead of 0.0.0.0, which bind_local (loopback-only) rejected - so plain
  `--serve` now starts instead of failing to bind.

Verified: the build produces dist/alkane-os-0.1.0-zynq-7010-armv7.afw (check-afw
OK: kernel 4.3MB, dtb 11KB, rootfs 3.26MB), the rootfs carries the new binary +
the web-init overlay, and the static armv7 binary runs under qemu-arm and serves
the console end to end (login page renders, admin/admin -> 303 session,
/api/hardware open). dist/ is gitignored, so the artifact is not committed.
clippy -D warnings clean, no emojis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
2026-11-10 21:26:53 -06:00

35 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# S60alkane-web: serve the Alkane console and HTTP API.
#
# Starts after the network (S40). `alkane-os --serve` brings up the web console
# (gated on a login) and the read-only JSON API on port 80, falling back to 8080
# without privilege. The board HAL/mining backend is started separately; this
# only needs the box to be reachable and observable, so every page renders and
# the console works before any hashboard is driven.
#
# This file is part of the alkane-os image overlay (image/overlay), dropped into
# the SDK rootfs at build time. It is intentionally not in the SDK's own init,
# which owns board-detect / network / ssh and leaves the console to alkane-os.
PIDFILE=/run/alkane-web.pid
BIN=/usr/bin/alkane-os
start() {
[ -x "$BIN" ] || { echo "alkane-web: $BIN missing"; exit 1; }
echo "alkane-web: starting console on :80 (falls back to :8080)"
start-stop-daemon -S -b -m -p "$PIDFILE" -x "$BIN" -- --serve
}
stop() {
echo "alkane-web: stopping console"
start-stop-daemon -K -q -p "$PIDFILE" 2>/dev/null
rm -f "$PIDFILE"
}
case "$1" in
start) start ;;
stop) stop ;;
restart) stop; start ;;
*) echo "usage: $0 {start|stop|restart}"; exit 1 ;;
esac