diff --git a/setup-2drive-build.sh b/setup-2drive-build.sh new file mode 100644 index 0000000..5d67474 --- /dev/null +++ b/setup-2drive-build.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Move AOSP source to a second drive so the OS drive doesn't fill up. +# $1 = NVMe path to create as AOSP source root (e.g. /mnt/ssd/AOSP-Source) +# $2 = local path environ.py expects (e.g. /home/oxmc/PawletOS-Build/AOSP-Source) +# +# Out dir is handled separately via OUT_DIR in ~/.bashrc — no out/ symlink needed. + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Usage: ./setup-2drive-build.sh " + echo " e.g.: ./setup-2drive-build.sh /mnt/ssd/AOSP-Source /home/oxmc/PawletOS-Build/AOSP-Source" + exit 1 +fi + +NVME_SOURCE="$1" +LOCAL_SOURCE="$2" + +mkdir -p "$NVME_SOURCE" + +if [ -L "$LOCAL_SOURCE" ]; then + echo "Existing symlink found, relinking..." + unlink "$LOCAL_SOURCE" +elif [ -d "$LOCAL_SOURCE" ]; then + echo "ERROR: $LOCAL_SOURCE is a real directory (has data on the OS drive)." + echo "Remove it first: rm -rf '$LOCAL_SOURCE'" + exit 1 +fi + +ln -s "$NVME_SOURCE" "$LOCAL_SOURCE" + +echo "Done." +echo " AOSP source : $LOCAL_SOURCE -> $NVME_SOURCE" +echo " Build output: set OUT_DIR in ~/.bashrc (currently: ${OUT_DIR:-not set})" diff --git a/setup-ccache.sh b/setup-ccache.sh new file mode 100644 index 0000000..c6a95fb --- /dev/null +++ b/setup-ccache.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Configure ccache for AOSP builds and persist settings to ~/.bashrc. +# $1 = cache size limit (default: 30G) + +CCACHE_PATH=/mnt/ssd/ccache +CACHE_SIZE="${1:-30G}" +BASHRC="$HOME/.bashrc" + +mkdir -p "$CCACHE_PATH" + +CCACHE_DIR="$CCACHE_PATH" ccache -M "$CACHE_SIZE" +CCACHE_DIR="$CCACHE_PATH" ccache --set-config=compression=true +CCACHE_DIR="$CCACHE_PATH" ccache --set-config=compression_level=1 + +export CCACHE_DIR="$CCACHE_PATH" +export CCACHE_EXEC=/usr/bin/ccache +export USE_CCACHE=1 +export CC_WRAPPER=ccache +export CXX_WRAPPER=ccache + +if ! grep -q 'CCACHE_DIR' "$BASHRC"; then + cat >> "$BASHRC" << 'EOF' + +# ccache (PawletOS build) +export CCACHE_DIR=/mnt/ssd/ccache +export CCACHE_EXEC=/usr/bin/ccache +export USE_CCACHE=1 +export CC_WRAPPER=ccache +export CXX_WRAPPER=ccache +EOF + echo "ccache vars written to $BASHRC" +else + echo "~/.bashrc already has CCACHE_DIR — not duplicating" +fi + +echo "" +CCACHE_DIR="$CCACHE_PATH" ccache -s