Skip to content

Instantly share code, notes, and snippets.

@kimocoder
Created July 28, 2025 19:09
Show Gist options
  • Save kimocoder/ffc8940964df1fd15f4be1beebb6eb3b to your computer and use it in GitHub Desktop.
Save kimocoder/ffc8940964df1fd15f4be1beebb6eb3b to your computer and use it in GitHub Desktop.
build.sh
#!/usr/bin/env bash
#
# If missing the "qcom,ipq5018-cmn-pll.h" after running build script, simply do these two steps below;
# ----------------------------------------------------------------------------------------------------
# $ wget -O build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/linux-6.12.40/include/dt-bindings/clock/qcom,ipq5018-cmn-pll.h "https://gist.githubusercontent.com/kimocoder/b8ebb67ae3250517d7dde1c36b5afcb7/raw/03b750c5646716c4bdae5deb7bb9db14adb83676/qcom,ipq5018-cmn-pll.h"
# $ make -j12 V=sc
#
set -euo pipefail
export FORCE_UNSAFE_CONFIGURE=1
# Color functions
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
info() { echo -e "${BLUE}[INFO]${NC} $*"; }
success() { echo -e "${GREEN}[OK]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*"; }
# Define directories
PATCH_DIR="target/linux/qualcommax/patches-6.12"
CLOCK_HEADER="build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/linux-6.12.40/include/dt-bindings/clock"
DTS_FILE="target/linux/qualcommax/files/arch/arm64/boot/dts/qcom"
info "Creating required directories..."
mkdir -p "$CLOCK_HEADER" "$DTS_FILE"
success "Directories ensured."
info "Removing outdated patch files..."
rm -f $PATCH_DIR/{0150,0306,0324,0337,0339,0340,0421,0713,0816,0036,0048,0049,0123,0704,0714,0715,0817}*.patch || warn "Some patch files were not present."
success "Patch cleanup complete."
info "Downloading CMN PLL header..."
wget -q -O "$CLOCK_HEADER/qcom,ipq5018-cmn-pll.h" \
"https://gist.githubusercontent.com/kimocoder/b8ebb67ae3250517d7dde1c36b5afcb7/raw/03b750c5646716c4bdae5deb7bb9db14adb83676/qcom,ipq5018-cmn-pll.h"
success "CMN PLL header downloaded."
info "Downloading ipq5018.dtsi..."
wget -q -O "$DTS_FILE/ipq5018.dtsi" \
"https://gist.githubusercontent.com/kimocoder/02a48c73f5669d2cfd641d350cdd1817/raw/b09130f0cdcadca543498954fe1ac086309d9201/ipq5018.dtsi"
success "DTS file downloaded."
info "Starting OpenWrt build..."
make -j$(nproc) V=sc
success "Build process initiated."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment