#!/usr/bin/env bash set -euo pipefail SDK_ROOT="${SDK_ROOT:-/work/OK3568_Linux_fs}" if [ ! -d "$SDK_ROOT" ]; then echo "SDK root not mounted: $SDK_ROOT" >&2 exit 2 fi if [ ! -r "$SDK_ROOT/device/rockchip/common/Makefile" ]; then echo "Vendor SDK common Makefile is missing under $SDK_ROOT." >&2 exit 2 fi if [ ! -s "$SDK_ROOT/Makefile" ] && [ ! -L "$SDK_ROOT/Makefile" ]; then echo "SDK root Makefile is not readable as a file or symlink." >&2 echo "Expected it to resolve to device/rockchip/common/Makefile." >&2 exit 2 fi if [ ! -x "$SDK_ROOT/build.sh" ]; then chmod +x "$SDK_ROOT/build.sh" 2>/dev/null || true fi mkdir -p /home/forlinx/.ccache "$SDK_ROOT/output" export USE_CCACHE=1 export CCACHE_DIR=/home/forlinx/.ccache cd "$SDK_ROOT" exec "$@"