Files
shater/BUILD.md
T
omar d3af5580fd
build / arm_cortex-a7_neon-vfpv4 (push) Has been cancelled
build / mipsel_24kc (push) Has been cancelled
build / x86_64 (push) Has been cancelled
build / aarch64_cortex-a53 (push) Has been cancelled
MVP core: xrayctl (parse+gen validated by real xray -test on OpenWrt), luci-app-shater, shater-core, CI/feed, examples, contract
- xrayctl Go daemon: share-link parser (vless/vmess/trojan/ss + reality/xhttp/ws/grpc), UCI->model, config generator, sub fetch+fingerprint+reconcile, apply/nft/routing, status/explain; go build/vet/test green
- fix: routing rule with no matcher -> inject tcp,udp catch-all (xray 'no effective fields'); regression test added; 'Configuration OK' on real xray 25.1.30
- luci-app-shater: JS views (overview/nodes/subs/rules/settings) + ucode ubus backend + acl (verified)
- shater-core: procd init + hotplug + sysctl + inert default config (sh -n clean)
- CI: gh-action-sdk matrix (x86_64/aarch64_cortex-a53/+2), signed feed; BUILD.md; dist/
- examples: full+minimal /etc/config/xray, share-link fixtures
- CONTRACT.md: UCI schema + xrayctl CLI/ubus interface
2026-07-09 00:40:53 +03:00

6.6 KiB

BUILD & INSTALL — shater packages

Three OpenWrt packages live under package/:

package kind PKGARCH build input
xrayctl Go control-plane daemon per-arch golang-package.mk
luci-app-shater LuCI web app (client-side JS) all luci.mk
shater-core system/init + fw4/routing all plain package.mk

Engine dependency xray-core is not ours — it comes from the router's own package feed (ImmortalWrt/BananaWRT/OpenWrt packages feed).

Two ways to build: CI (multi-arch, signed feed — .github/workflows/build.yml) or locally with the SDK in Docker (below). Feed publishing/install lives in dist/README.md.


1. Local build with the SDK (Docker)

The testbed already runs SDK builds via testbed/scripts/sdk-build.ps1, but that script builds a single, dependency-free hello package: it bind-mounts one package dir into /builder/package/<pkg> and runs make package/<pkg>/compile. Our three packages need (a) each other, (b) the golang host/target packages (for xrayctl) and (c) luci-base (for luci-app-shater), so they must be registered as a feed inside the SDK and built with the package feeds updated. Below is that generalization — run it as-is; it does not modify testbed/.

SDK images (match the CI pin — OpenWrt 24.10.4, opkg/.ipk):

matrix arch SDK Docker image (target) notes
x86_64 openwrt/sdk:x86_64-24.10.4 VM / testbed
aarch64_cortex-a53 openwrt/sdk:mediatek-filogic-24.10.4 the router (BananaWRT)

The testbed script currently hardcodes -24.10.3; bump it to -24.10.4 (or just use the docker run below) so local builds match CI. Build as an unprivileged user, from a path without spaces.

x86_64

# from repo root: C:\Users\Admin\Desktop\shater
New-Item -ItemType Directory -Force .\dist\out\x86_64 | Out-Null
docker run --rm `
  -v "${PWD}\package:/builder/shater-pkgs:ro" `
  -v "${PWD}\dist\out\x86_64:/builder/artifacts" `
  openwrt/sdk:x86_64-24.10.4 bash -eus -c @'
    set -e
    # register our repo package dir as an SDK feed (src-link needs an ABS path)
    echo "src-link shater /builder/shater-pkgs" >> feeds.conf.default
    ./scripts/feeds update -a
    ./scripts/feeds install -a -p shater        # -p = prefer our feed
    make defconfig
    for p in xrayctl shater-core luci-app-shater; do
      make package/$p/compile V=s -j"$(nproc)"
    done
    make package/index
    find bin -name "*.ipk" -exec cp -v {} /builder/artifacts/ \;
'@

aarch64_cortex-a53 (the router)

Identical, only the image and output dir change:

New-Item -ItemType Directory -Force .\dist\out\aarch64_cortex-a53 | Out-Null
docker run --rm `
  -v "${PWD}\package:/builder/shater-pkgs:ro" `
  -v "${PWD}\dist\out\aarch64_cortex-a53:/builder/artifacts" `
  openwrt/sdk:mediatek-filogic-24.10.4 bash -eus -c @'
    set -e
    echo "src-link shater /builder/shater-pkgs" >> feeds.conf.default
    ./scripts/feeds update -a
    ./scripts/feeds install -a -p shater
    make defconfig
    for p in xrayctl shater-core luci-app-shater; do
      make package/$p/compile V=s -j"$(nproc)"
    done
    make package/index
    find bin -name "*.ipk" -exec cp -v {} /builder/artifacts/ \;
'@

(Bash/Git-Bash equivalent: same body, replace the PowerShell docker run ... @' ...'@ wrapper with docker run --rm -v "$PWD/package:/builder/shater-pkgs:ro" -v "$PWD/dist/out/<arch>:/builder/artifacts" <image> bash -eu -c '<body>'.)

Artifacts land in dist/out/<arch>/*.ipk (plus the Packages* index). To build just one package, keep only its line in the for loop — but the feed setup (feeds update/install) is required for xrayctl (golang) and luci-app-shater (luci-base) to resolve.

Signing the local feed

dist/make-feed.sh dist/out/aarch64_cortex-a53 /path/to/secret.key

2. Installing on the router

Two options. xray-core (the engine) must come from the router's OWN feed, not ours — see the kmod caveat below (same rule applies to the two kmods).

Full one-liner and key setup are in dist/README.md. Short form:

ARCH=$(. /etc/openwrt_release; echo "$DISTRIB_ARCH")
FEED=https://omar.git.qomar.pw/shater
wget -O /tmp/k "$FEED/public.key" && mv /tmp/k "/etc/opkg/keys/$(usign -F -p /tmp/k)"
echo "src/gz shater $FEED/$ARCH" >> /etc/opkg/customfeeds.conf
opkg update
opkg install xray-core xrayctl shater-core luci-app-shater

Option B — manual .ipk, in dependency order

Copy the built .ipk files to the router (e.g. /tmp) and install bottom-up so each package's depends are already present:

opkg update
# 1) engine + kernel bits from the ROUTER's feed (not ours):
opkg install xray-core kmod-nft-tproxy kmod-nft-socket dnsmasq-full
# 2) our packages, dependency order:
opkg install /tmp/xrayctl_*.ipk          # Go daemon (control plane)
opkg install /tmp/shater-core_*.ipk      # init + fw4/routing glue
opkg install /tmp/luci-app-shater_*.ipk  # LuCI UI (depends on the above)

Order rationale: luci-app-shater depends on xrayctl + shater-core + xray-core; shater-core wires fw4/routing and pulls the kmods; xrayctl is the leaf binary. Installing a .ipk whose deps are missing fails, hence bottom-up.


3. kmod caveat (READ THIS for the real router)

Kernel modules pin to an exact kernel version+hash. kmod-nft-tproxy and kmod-nft-socket (needed for the TPROXY/mark data path) built by our SDK will refuse to load on the router unless its kernel is byte-identical to the SDK's.

The router is ImmortalWrt/BananaWRT, not stock OpenWrt 24.10.4 — its kernel hash differs. Therefore:

  • Do NOT install our SDK's kmods on the router. Pull kmod-nft-tproxy and kmod-nft-socket from the router's own feed (opkg update && opkg install kmod-nft-tproxy kmod-nft-socket), which matches its running kernel.
  • Our packages only depend on those kmods; they don't (and must not) ship them.
  • Same principle for xray-core and dnsmasq-full: prefer the router's feed.
  • Our built .ipk set (xrayctl, luci-app-shater, shater-core) contains no kmods — xrayctl is a userspace Go binary and the other two are PKGARCH=all — so they install cleanly across the 24.10.x line regardless of kernel hash.