Update Novendor.yml #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build OnePlus 7 Kernel (No Vendor Blobs) | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| kernel_source_url: | ||
| description: "URL of the kernel source repository" | ||
| required: true | ||
| default: "https://github.com/LineageOS/android_kernel_oneplus_sm8150" | ||
| kernel_branch: | ||
| description: "Branch of the kernel source" | ||
| required: true | ||
| default: "lineage-23.0" | ||
| kernel_defconfig: | ||
| description: "defconfig file to use" | ||
| required: true | ||
| default: "vendor/sm8150_defconfig" | ||
| output_name: | ||
| description: "Name of the output.zip" | ||
| required: false | ||
| default: "OP7_KSN_wifi-LOS-noVendor.zip" | ||
| apply_kernelsu: | ||
| description: "Apply KernelSU patch (true/false)" | ||
| required: true | ||
| default: "false" | ||
| kernelsu_patch_url: | ||
| description: "KernelSU patch/setup script URL (leave empty to skip)" | ||
| required: false | ||
| default: "" | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
| env: | ||
| # keep the toolchain path set later | ||
| OUTDIR: out | ||
| CLANG_DIR: clang | ||
| steps: | ||
| - name: Checkout this workflow repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Install system dependencies (tar early so checkout won't fail) | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y \ | ||
| git wget curl tar gzip xz-utils unzip zip \ | ||
| build-essential bc bison flex libssl-dev libncurses-dev \ | ||
| clang-18 lld-18 llvm-18 gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \ | ||
| ccache | ||
| - name: Set inputs into environment (no YAML expressions later) | ||
| run: | | ||
| # Write inputs directly to GITHUB_ENV; we'll apply shell defaults later | ||
| echo "KERNEL_SOURCE_URL=${{ github.event.inputs.kernel_source_url }}" >> $GITHUB_ENV | ||
| echo "KERNEL_BRANCH=${{ github.event.inputs.kernel_branch }}" >> $GITHUB_ENV | ||
| echo "KERNEL_DEFCONFIG=${{ github.event.inputs.kernel_defconfig }}" >> $GITHUB_ENV | ||
| echo "OUTPUT_ZIP_NAME=${{ github.event.inputs.output_name }}" >> $GITHUB_ENV | ||
| echo "APPLY_KERNELSU=${{ github.event.inputs.apply_kernelsu }}" >> $GITHUB_ENV | ||
| echo "KERNELSU_PATCH_URL=${{ github.event.inputs.kernelsu_patch_url }}" >> $GITHUB_ENV | ||
| - name: Download Clang toolchain (if system clang-18 missing) | ||
| run: | | ||
| if ! command -v clang-18 >/dev/null 2>&1; then | ||
| mkdir -p ${CLANG_DIR} | ||
| CLANG_TGZ="clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-22.04.tar.xz" | ||
| wget -q "https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/${CLANG_TGZ}" | ||
| tar -xf ${CLANG_TGZ} -C ${CLANG_DIR} --strip-components=1 | ||
| fi | ||
| echo "${PWD}/${CLANG_DIR}/bin" >> $GITHUB_PATH | ||
| - name: Clone kernel source | ||
| run: | | ||
| # apply shell-level defaults (if user left inputs empty) | ||
| : "${KERNEL_SOURCE_URL:=https://github.com/LineageOS/android_kernel_oneplus_sm8150}" | ||
| : "${KERNEL_BRANCH:=lineage-23.0}" | ||
| echo "Cloning kernel from $KERNEL_SOURCE_URL (branch $KERNEL_BRANCH)" | ||
| git clone --depth=1 --branch "$KERNEL_BRANCH" "$KERNEL_SOURCE_URL" kernel | ||
| cd kernel | ||
| git submodule update --init --recursive || true | ||
| - name: Create novendor.defaults (safe heredoc) | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| cat > ../novendor.defaults <<'EOF' | ||
| # Force localversion predictable | ||
| CONFIG_LOCALVERSION_AUTO=y | ||
| # Vendor / proprietary modules | ||
| CONFIG_VENDOR_EDIT=n | ||
| CONFIG_OPLUS_DEVICE_INFO=n | ||
| CONFIG_OPLUS_PROJECT_INFO=n | ||
| CONFIG_OPLUS_ARCH_EXTENDS=n | ||
| CONFIG_OPLUS_FEATURE_CHG_BASIC=n | ||
| CONFIG_OPLUS_FEATURE_SENSOR=n | ||
| CONFIG_MSM_CAMERA=n | ||
| CONFIG_QCOM_CAMERA=n | ||
| CONFIG_SPECTRA_CAMERA=n | ||
| CONFIG_SPECTRA_EEPROM=n | ||
| CONFIG_DRM_MSM_OPLUS=n | ||
| CONFIG_TOUCHSCREEN_OPLUS=n | ||
| CONFIG_SOUND_OPLUS=n | ||
| # Wireless stacks that usually need blobs | ||
| CONFIG_MAC80211=n | ||
| CONFIG_CFG80211=n | ||
| CONFIG_WLAN=n | ||
| # Netfilter / iptables / conntrack disables | ||
| CONFIG_NETFILTER=n | ||
| CONFIG_NETFILTER_XTABLES=n | ||
| CONFIG_NF_CONNTRACK=n | ||
| CONFIG_NF_CONNTRACK_IPV4=n | ||
| CONFIG_NF_CONNTRACK_IPV6=n | ||
| CONFIG_IP_NF_IPTABLES=n | ||
| CONFIG_IP_NF_FILTER=n | ||
| CONFIG_IP_NF_NAT=n | ||
| CONFIG_IP_NF_TARGET_MASQUERADE=n | ||
| CONFIG_IP6_NF_IPTABLES=n | ||
| CONFIG_IP6_NF_FILTER=n | ||
| CONFIG_BRIDGE_NETFILTER=n | ||
| CONFIG_NF_TABLES=n | ||
| CONFIG_NF_TABLES_IPV4=n | ||
| CONFIG_NF_TABLES_IPV6=n | ||
| # Reduce debug for smaller kernel (optional) | ||
| CONFIG_DEBUG_INFO=n | ||
| CONFIG_DEBUG_KERNEL=n | ||
| EOF | ||
| - name: Prepare kernel output directory and seed defconfig | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| export PATH="${PWD}/../${CLANG_DIR}/bin:$PATH" | ||
| mkdir -p ../${OUTDIR} | ||
| # Use provided defconfig, or fallback to vendor/sm8150_defconfig if empty | ||
| if [ -z "${KERNEL_DEFCONFIG}" ]; then | ||
| KCONF="vendor/sm8150_defconfig" | ||
| else | ||
| KCONF="${KERNEL_DEFCONFIG}" | ||
| fi | ||
| echo "Using defconfig: $KCONF" | ||
| make O=../${OUTDIR} ARCH=arm64 "$KCONF" | ||
| - name: Merge novendor.defaults and save cleaned defconfig | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| make O=../${OUTDIR} ARCH=arm64 olddefconfig KCONFIG_ALLCONFIG=../novendor.defaults | ||
| cp ../${OUTDIR}/.config arch/arm64/configs/oneplus_novendor_defconfig || true | ||
| - name: Blackhole vendor-heavy directories | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| for d in \ | ||
| drivers/gpu/drm/msm/oplus \ | ||
| drivers/misc/oplus* \ | ||
| drivers/soc/oplus \ | ||
| drivers/input/oplus* \ | ||
| drivers/oneplus* \ | ||
| drivers/staging/qcacld-3.0 \ | ||
| drivers/media/platform/msm/camera \ | ||
| drivers/thermal/qcom \ | ||
| sound/soc/oplus* \ | ||
| net/netfilter \ | ||
| net/ipv6/netfilter \ | ||
| net/bridge/netfilter; do | ||
| if [ -d "$d" ]; then | ||
| echo -e "# blackholed for no-vendor build\nobj-y :=\nobj-m :=" > "$d/Makefile" | ||
| chmod 644 "$d/Makefile" | ||
| echo "Blackholed: $d" | ||
| fi | ||
| done | ||
| - name: (optional) Apply KernelSU patch | ||
| if: env.APPLY_KERNELSU == 'true' | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -n "${KERNELSU_PATCH_URL}" ]; then | ||
| echo "Applying KernelSU from ${KERNELSU_PATCH_URL}" | ||
| curl -LSs "${KERNELSU_PATCH_URL}" | bash - | ||
| else | ||
| echo "APPLY_KERNELSU was true but no KERNELSU_PATCH_URL provided - skipping" | ||
| fi | ||
| - name: Build kernel (no-vendor) | ||
| working-directory: kernel | ||
| env: | ||
| KBUILD_OUTPUT: ../${OUTDIR} | ||
| run: | | ||
| set -euo pipefail | ||
| export PATH="${PWD}/../${CLANG_DIR}/bin:$PATH" | ||
| export CC="clang-18" | ||
| export LD="ld.lld-18" | ||
| make O=../${OUTDIR} ARCH=arm64 oneplus_novendor_defconfig || true | ||
| # fallback: if that custom defconfig isn't present, just use the earlier .config | ||
| make O=../${OUTDIR} ARCH=arm64 -j$(nproc) CC="ccache clang-18" LD="ld.lld-18" | ||
| - name: Verify and copy kernel image to AnyKernel3 | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -f ../${OUTDIR}/arch/arm64/boot/Image.gz-dtb ]; then | ||
| echo "Found Image.gz-dtb" | ||
| cp ../${OUTDIR}/arch/arm64/boot/Image.gz-dtb ../AnyKernel3/zImage | ||
| elif [ -f ../${OUTDIR}/arch/arm64/boot/Image ]; then | ||
| echo "Found Image" | ||
| cp ../${OUTDIR}/arch/arm64/boot/Image ../AnyKernel3/zImage | ||
| else | ||
| echo "Kernel image not found in ../${OUTDIR}/arch/arm64/boot" | ||
| ls -la ../${OUTDIR}/arch/arm64/boot || true | ||
| exit 1 | ||
| fi | ||
| - name: Prepare AnyKernel3 and package zip | ||
| run: | | ||
| git clone --depth=1 https://github.com/khalidaboelmagd/AnyKernel3 || true | ||
| rm -rf AnyKernel3/.git || true | ||
| cd AnyKernel3 || exit 1 | ||
| sed -i 's|device.name1=.*|device.name1=guacamole|' anykernel.sh || true | ||
| sed -i 's|device.name2=.*|device.name2=guacamoleb|' anykernel.sh || true | ||
| sed -i 's|do.devicecheck=1|do.devicecheck=0|' anykernel.sh || true | ||
| zip -r9 ../${OUTPUT_ZIP_NAME}.zip ./* | ||
| - name: Package modules (if built) | ||
| working-directory: kernel | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p ../modules/vendor/lib/modules || true | ||
| if [ -d ../${OUTDIR}/drivers/staging/qcacld-3.0 ]; then | ||
| find ../${OUTDIR}/drivers/staging/qcacld-3.0 -name "*.ko" -exec cp -v {} ../modules/vendor/lib/modules/ \; || true | ||
| fi | ||
| cd ../modules || exit 0 | ||
| zip -r ../${OUTPUT_ZIP_NAME}-modules.zip . || true | ||
| - name: Upload zips | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: outputs | ||
| path: | | ||
| ${OUTPUT_ZIP_NAME}.zip | ||
| ${OUTPUT_ZIP_NAME}-modules.zip | ||
| if-no-files-found: error | ||