BuildChain v1.0.0 — on-device Android build toolchain

KernelSU module that turns any rooted phone into a native Android
compiler. Includes aapt2/aapt/aidl/zipalign/dexdump (API 35 static
arm64), BusyBox, platform-tools. Hooks into Termux for Java/Kotlin/
Python/Gradle. bc-build compiles Java/Kotlin to APK or runs Gradle
projects. bc-sign handles debug/release signing. WebUI dashboard
on port 8089. Auto-links tools into system PATH and Termux PATH.
This commit is contained in:
sssnake
2026-03-31 21:23:57 -07:00
parent 6a7c85dc26
commit c3f931d075
4 changed files with 125 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.zip

19
build.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
ZIP="BuildChain-v1.0.0.zip"
rm -f "$ZIP"
zip -r9 "$ZIP" \
module.prop \
customize.sh \
post-fs-data.sh \
service.sh \
uninstall.sh \
tools/ \
scripts/ \
webroot/ \
-x "*.git*" "build.sh" "sepolicy/*"
echo "Built: $ZIP ($(du -h "$ZIP" | cut -f1))"

79
customize.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/system/bin/sh
# BuildChain — KernelSU installation script
SKIPUNZIP=0
ui_print "================================================"
ui_print " BuildChain v1.0.0"
ui_print " On-device Android build toolchain"
ui_print "================================================"
ui_print ""
DEVICE=$(getprop ro.product.model)
ARCH=$(uname -m)
API=$(getprop ro.build.version.sdk)
ui_print "- Device: $DEVICE ($ARCH)"
ui_print "- Android API: $API"
ui_print ""
# Verify arch
case "$ARCH" in
aarch64|arm64)
ui_print "- Architecture: arm64 (supported)"
;;
*)
ui_print "! WARNING: Untested architecture: $ARCH"
ui_print "! Build tools are compiled for arm64"
;;
esac
ui_print ""
ui_print "- Setting up config directory..."
CONFIG_DIR="/data/adb/buildchain"
mkdir -p "$CONFIG_DIR"
echo "$MODPATH" > "$CONFIG_DIR/moddir"
ui_print "- Setting permissions..."
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm_recursive $MODPATH/tools 0 2000 0755 0755
set_perm_recursive $MODPATH/scripts 0 2000 0755 0755
set_perm $MODPATH/service.sh 0 0 0755
set_perm $MODPATH/post-fs-data.sh 0 0 0755
set_perm $MODPATH/uninstall.sh 0 0 0755
# Verify tools work
ui_print ""
ui_print "- Testing build tools..."
for tool in aapt2 aidl zipalign; do
if [ -f "$MODPATH/tools/build-tools/$tool" ]; then
ui_print " [OK] $tool"
else
ui_print " [!!] $tool missing"
fi
done
if [ -f "$MODPATH/tools/busybox" ]; then
APPLETS=$("$MODPATH/tools/busybox" --list 2>/dev/null | wc -l)
ui_print " [OK] busybox ($APPLETS applets)"
else
ui_print " [!!] busybox missing"
fi
# Check Termux
ui_print ""
if pm list packages 2>/dev/null | grep -q "com.termux"; then
ui_print "- Termux: installed"
ui_print "- After reboot, open Termux and run:"
ui_print " buildchain setup"
else
ui_print "! Termux not installed"
ui_print "! Install Termux from F-Droid, then run: buildchain setup"
fi
ui_print ""
ui_print "- Installation complete!"
ui_print "- Reboot to activate"
ui_print "- CLI: buildchain status"
ui_print "- WebUI: http://localhost:8089"
ui_print ""

View File

@@ -150,8 +150,31 @@ handle_request() {
}
log "Starting on port $PORT"
# Find a working netcat
NC=""
if command -v busybox >/dev/null 2>&1 && busybox nc --help 2>&1 | grep -q "\-ll"; then
NC="busybox nc"
elif [ -f "$MODDIR/tools/busybox" ]; then
NC="$MODDIR/tools/busybox nc"
elif command -v toybox >/dev/null 2>&1; then
NC="toybox nc"
fi
if [ -z "$NC" ]; then
log "ERROR: No working netcat found"
exit 1
fi
log "Using: $NC"
while true; do
handle_request | busybox nc -ll -p "$PORT" -s 127.0.0.1 2>/dev/null \
|| handle_request | toybox nc -L -p "$PORT" -s 127.0.0.1 2>/dev/null \
|| { log "ERROR: No listener"; exit 1; }
# Create a FIFO for bidirectional communication
FIFO="/data/adb/buildchain/webui.fifo"
rm -f "$FIFO"
mkfifo "$FIFO"
# nc reads from client, pipes to handle_request, response goes back via FIFO
handle_request < "$FIFO" | $NC -l -p "$PORT" -s 127.0.0.1 > "$FIFO" 2>/dev/null
rm -f "$FIFO"
done