2222 apply_kernelsu :
2323 description : " Apply KernelSU patch (true/false)"
2424 required : true
25- default : false
25+ default : " false"
2626 kernelsu_patch_url :
27- description : " KernelSU patch/ setup script URL (leave empty to skip )"
27+ description : " KernelSU setup.sh URL (ignored if apply_kernelsu=false )"
2828 required : false
29- default : " "
29+ default : " https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh "
3030
3131jobs :
3232 build :
3636 CCACHE_NOHASHDIR : " true"
3737 CCACHE_MAXSIZE : " 2G"
3838 KERNEL_CMDLINE : " ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out CROSS_COMPILE=aarch64-linux-gnu- CLANG_TRIPLE=aarch64-linux-gnu-"
39- KERNEL_DEFCONFIG : ${{ github.event.inputs.kernel_defconfig || 'vendor/sm8150_defconfig' }}
40- KERNEL_SOURCE_URL : ${{ github.event.inputs.kernel_source_url || 'https://github.com/LineageOS/android_kernel_oneplus_sm8150' }}
41- KERNEL_BRANCH : ${{ github.event.inputs.kernel_branch || 'lineage-23.0' }}
4239 OUTPUT_ZIP_NAME : ${{ github.event.inputs.output_name || 'OP7_KSN_wifi-LOS-noVendor.zip' }}
4340
4441 steps :
@@ -48,20 +45,22 @@ jobs:
4845 fetch-depth : 0
4946
5047 - name : Checkout Kernel Source
48+ env :
49+ KERNEL_SOURCE_URL : ${{ github.event.inputs.kernel_source_url || 'https://github.com/LineageOS/android_kernel_oneplus_sm8150' }}
50+ KERNEL_BRANCH : ${{ github.event.inputs.kernel_branch || 'lineage-23.0' }}
5151 run : |
5252 set -euo pipefail
5353 git clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_SOURCE_URL}" kernel
5454 cd kernel
5555 git submodule update --init --recursive
56- cd ..
5756
5857 - name : Set up ccache
5958 uses : hendrikmuhs/ccache-action@v1.2
6059
6160 - name : Cleanup space
6261 run : |
6362 set -euo pipefail
64- sudo rm -rf /opt/ghc /usr/local/share/boost /usr/share/dotnet "$AGENT_TOOLSDIRECTORY" || true
63+ sudo rm -rf /opt/ghc /usr/local/share/boost /usr/share/dotnet "${ AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache} " || true
6564
6665 - name : Install dependencies
6766 run : |
@@ -70,24 +69,27 @@ jobs:
7069 sudo apt-get install -y \
7170 clang-18 llvm-18 lld-18 gcc-aarch64-linux-gnu \
7271 binutils-aarch64-linux-gnu binutils make python3 libssl-dev \
73- build-essential bc bison flex unzip git git-lfs libelf-dev pahole
72+ build-essential bc bison flex unzip git git-lfs libelf-dev pahole \
73+ zip
7474 git clone https://github.com/khalidaboelmagd/AnyKernel3
7575 rm -rf AnyKernel3/.git
76+ mkdir -p modules/vendor/lib/modules
7677
77- - name : KernelSU-Next setup
78- if : ${{ inputs.apply_kernelsu == 'true' && inputs.kernelsu_patch_url != '' }}
78+ - name : Optional KernelSU-Next setup
79+ if : ${{ inputs.apply_kernelsu == 'true' }}
7980 working-directory : kernel
81+ env :
82+ KSU_URL : ${{ github.event.inputs.kernelsu_patch_url }}
8083 run : |
8184 set -euo pipefail
8285 export PATH="/usr/lib/llvm-18/bin:$PATH"
83- curl -LSs "${{ inputs.kernelsu_patch_url } }" | bash -
86+ curl -LSs "${KSU_URL }" | bash -
8487
85- - name : Write novendor.defaults and kernel config disables
88+ - name : Write novendor.defaults
8689 working-directory : kernel
8790 run : |
8891 set -euo pipefail
8992 cat > ../novendor.defaults <<'EOF'
90- # Force localversion predictable
9193 CONFIG_LOCALVERSION_AUTO=y
9294
9395 # Vendor / proprietary modules
@@ -105,12 +107,12 @@ jobs:
105107 CONFIG_TOUCHSCREEN_OPLUS=n
106108 CONFIG_SOUND_OPLUS=n
107109
108- # Wireless stacks that usually need blobs
110+ # Wireless stacks (likely require blobs)
109111 CONFIG_MAC80211=n
110112 CONFIG_CFG80211=n
111113 CONFIG_WLAN=n
112114
113- # Netfilter / iptables / conntrack disables
115+ # Netfilter / xt / nf_conntrack (disable entirely)
114116 CONFIG_NETFILTER=n
115117 CONFIG_NETFILTER_XTABLES=n
116118 CONFIG_NF_CONNTRACK=n
@@ -127,59 +129,65 @@ jobs:
127129 CONFIG_NF_TABLES_IPV4=n
128130 CONFIG_NF_TABLES_IPV6=n
129131
130- # Reduce debug for smaller kernel (optional)
132+ # Optional: reduce debug
131133 CONFIG_DEBUG_INFO=n
132134 CONFIG_DEBUG_KERNEL=n
133135 EOF
134136
135- - name : Prepare kernel output directory ( defconfig)
137+ - name : Prepare defconfig
136138 working-directory : kernel
139+ env :
140+ KERNEL_DEFCONFIG : ${{ github.event.inputs.kernel_defconfig || 'vendor/sm8150_defconfig' }}
137141 run : |
138142 set -euo pipefail
139143 export PATH="/usr/lib/llvm-18/bin:$PATH"
140144 mkdir -p out
141- make O=out ARCH=arm64 ${KERNEL_DEFCONFIG}
145+ make O=out ARCH=arm64 " ${KERNEL_DEFCONFIG}"
142146
143- - name : Apply vendor disables and blackhole problematic dirs
147+ - name : Apply novendor defaults and blackhole dirs
144148 working-directory : kernel
145149 run : |
146150 set -euo pipefail
151+ export PATH="/usr/lib/llvm-18/bin:$PATH"
152+
147153 make O=out ARCH=arm64 olddefconfig KCONFIG_ALLCONFIG=../novendor.defaults
148154
149- cp out/.config arch/arm64/configs/oneplus_novendor_defconfig
150-
151- # Blackhole all problematic dirs (Makefiles are wiped)
152- for d in \
153- drivers/gpu/drm/msm/oplus \
154- drivers/misc/oplus* \
155- drivers/soc/oplus \
156- drivers/input/oplus* \
157- drivers/oneplus* \
158- drivers/staging/qcacld-3.0 \
159- drivers/media/platform/msm/camera \
160- drivers/thermal/qcom \
161- sound/soc/oplus* \
162- net/netfilter \
163- net/ipv6/netfilter \
164- net/bridge/netfilter; do
155+ # Save resulting config as reference
156+ cp out/.config arch/arm64/configs/oneplus_novendor_defconfig || true
157+
158+ # Blackhole problematic dirs (Makefiles to empty obj lists)
159+ blackhole() {
160+ d="$1"
165161 if [ -d "$d" ]; then
166- echo -e "# blackholed for no-vendor build
167- obj-y :=
168- obj-m :=" > "$d/Makefile"
169- chmod 644 "$d/Makefile"
162+ printf '%s
163+ ' ' # blackholed for no-vendor build' 'obj-y :=' 'obj-m :=' > "$d/Makefile"
164+ chmod 0644 "$d/Makefile"
170165 echo "Blackholed : $d"
171166 fi
172- done
173-
174- # Remove lines that bring vendor fragments from configs
167+ }
168+
169+ blackhole drivers/gpu/drm/msm/oplus
170+ blackhole drivers/misc/oplus
171+ for d in drivers/misc/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
172+ blackhole drivers/soc/oplus
173+ for d in drivers/input/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
174+ for d in drivers/oneplus*; do [ -d "$d" ] && blackhole "$d" || true; done
175+ blackhole drivers/staging/qcacld-3.0
176+ blackhole drivers/media/platform/msm/camera
177+ blackhole drivers/thermal/qcom
178+ for d in sound/soc/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
179+ blackhole net/netfilter
180+ blackhole net/ipv6/netfilter
181+ blackhole net/bridge/netfilter
182+
183+ # Remove vendor fragments from Kconfig includes (best effort)
175184 sed -i '/^source.*vendor/d' arch/arm64/configs/* || true
176185 sed -i '/^# Kconfig: vendor/d' arch/arm64/configs/* || true
177186
178- # Extra: wipe any leftover Makefiles under netfilter families
179- find net/netfilter net/ipv6/netfilter net/bridge/netfilter -type f -name Makefile -exec \
180- sh -c 'echo -e "# disabled (no vendor blobs/netfilter)
181- obj-y :=
182- obj-m :=" > "$1"' _ {} ;
187+ # Extra guard: wipe any leftover Makefiles in netfilter families
188+ find net/netfilter net/ipv6/netfilter net/bridge/netfilter -type f -name Makefile -print0 | \
189+ xargs -0 -I{} bash -c "printf '%s
190+ ' ' # disabled (no vendor blobs/netfilter)' 'obj-y :=' 'obj-m :=' > '{}'"
183191
184192 - name : Build kernel
185193 working-directory : kernel
@@ -219,14 +227,20 @@ obj-m :=" > "$1"' _ {} ;
219227 run : |
220228 set -euo pipefail
221229 cd AnyKernel3
222- zip -r ../${OUTPUT_ZIP_NAME}.zip *
230+ zip -r " ../${OUTPUT_ZIP_NAME}.zip" *
223231 cd ../modules
224- zip -r ../${OUTPUT_ZIP_NAME}-modules.zip *
232+ if ls vendor/lib/modules/*.ko >/dev/null 2>&1; then
233+ zip -r "../${OUTPUT_ZIP_NAME}-modules.zip" *
234+ else
235+ echo "No Wi-Fi modules found; skipping modules zip"
236+ fi
225237 cd ..
226238
227- - name : Upload zips
239+ - name : Upload outputs
228240 uses : actions/upload-artifact@v4
229241 with :
230242 name : outputs
231- path : ${{ env.OUTPUT_ZIP_NAME }}.zip,${{ env.OUTPUT_ZIP_NAME }}-modules.zip
232- if-no-files-found : error
243+ path : |
244+ ${{ env.OUTPUT_ZIP_NAME }}.zip
245+ ${{ env.OUTPUT_ZIP_NAME }}-modules.zip
246+ if-no-files-found : warn
0 commit comments