Build shipped tools from source
build-deps.sh builds mtdflash and dropbear (static musl) and the patched RTSP server (uClibc-ng 1.0.30, ABI-compatible with the camera's 1.0.31). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Build the tools this project ships, from source (run ./fetch-deps.sh first):
|
||||||
|
# blobs/fwupdate/mtdflash src/mtdflash.c static musl
|
||||||
|
# blobs/ssh/dropbearmulti dropbear 2026.94 (downloaded) static musl
|
||||||
|
# blobs/anyka-rtsp/bin/ak_rtsp_server_sample.auth
|
||||||
|
# SDK sample + patches/rtsp_sample.patch + src/rtsp_sample/ak_record.c
|
||||||
|
# dynamic, uClibc-ng 1.0.30 (<= camera's 1.0.31), links the SDK libs
|
||||||
|
# TC_DIR=... to use toolchains from elsewhere.
|
||||||
|
set -e
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"; cd "$HERE"
|
||||||
|
TC_DIR=${TC_DIR:-$HERE/toolchains}
|
||||||
|
MUSL=$TC_DIR/armv5-eabi--musl--stable-2026.08-1/bin/arm-buildroot-linux-musleabi-
|
||||||
|
UCLIBC=$TC_DIR/armv5-eabi--uclibc--stable-2018.11-1/bin/arm-linux-
|
||||||
|
[ -x "${MUSL}gcc" ] && [ -x "${UCLIBC}gcc" ] || { echo "toolchains missing: run ./fetch-deps.sh"; exit 1; }
|
||||||
|
WORK=$(mktemp -d); trap 'rm -rf "$WORK"' EXIT
|
||||||
|
|
||||||
|
echo "[build] mtdflash"
|
||||||
|
mkdir -p blobs/fwupdate
|
||||||
|
${MUSL}gcc -Os -static -Wall -s -o blobs/fwupdate/mtdflash src/mtdflash.c
|
||||||
|
|
||||||
|
echo "[build] RTSP server (SDK sample + auth + recorder)"
|
||||||
|
R=src/rtsp_sample; L=$HERE/blobs/anyka-rtsp/lib
|
||||||
|
mkdir -p "$WORK/rtsp"
|
||||||
|
cp $R/*.c $R/*.h "$WORK/rtsp/"; cp -r $R/include "$WORK/rtsp/"
|
||||||
|
( cd "$WORK/rtsp" && patch -s -p1 < "$HERE/patches/rtsp_sample.patch" )
|
||||||
|
LIBS=$(ls "$L" | sed -n 's/^lib\(.*\)\.so$/-l\1/p' | tr '\n' ' ')
|
||||||
|
( cd "$WORK/rtsp" && ${UCLIBC}gcc -O2 -w -D_GNU_SOURCE -D__CHIP_AK3918AV130_SERIES -I. -Iinclude \
|
||||||
|
-o ak_rtsp_server_sample ak_rtsp_server_sample.c ak_rtsp_stream.c ak_record.c aas_ini_parser.c \
|
||||||
|
-L"$L" -Wl,--start-group $LIBS -lpthread -Wl,--end-group -Wl,--allow-shlib-undefined && \
|
||||||
|
${UCLIBC}strip ak_rtsp_server_sample )
|
||||||
|
cp "$WORK/rtsp/ak_rtsp_server_sample" blobs/anyka-rtsp/bin/ak_rtsp_server_sample.auth
|
||||||
|
|
||||||
|
echo "[build] dropbear (static)"
|
||||||
|
DB=dropbear-2026.94
|
||||||
|
[ -f "toolchains/$DB.tar.bz2" ] || curl -fsSL -o "toolchains/$DB.tar.bz2" "https://matt.ucc.asn.au/dropbear/releases/$DB.tar.bz2"
|
||||||
|
tar -C "$WORK" -xjf "toolchains/$DB.tar.bz2"
|
||||||
|
( cd "$WORK/$DB" && PATH="$(dirname "$MUSL"):$PATH" ./configure --host=arm-buildroot-linux-musleabi \
|
||||||
|
--enable-static --disable-harden --disable-zlib --disable-lastlog --disable-wtmp --disable-utmp \
|
||||||
|
--disable-pututline >/dev/null && \
|
||||||
|
PATH="$(dirname "$MUSL"):$PATH" make -s PROGRAMS="dropbear dropbearkey scp" MULTI=1 dropbearmulti >/dev/null && \
|
||||||
|
${MUSL}strip dropbearmulti )
|
||||||
|
mkdir -p blobs/ssh; cp "$WORK/$DB/dropbearmulti" blobs/ssh/dropbearmulti
|
||||||
|
echo "[build] done:"; ls -la blobs/fwupdate/mtdflash blobs/ssh/dropbearmulti blobs/anyka-rtsp/bin/ak_rtsp_server_sample.auth
|
||||||
Reference in New Issue
Block a user